1147 - Initial auto mappings pass
This commit is contained in:
parent
48198dbcb3
commit
4e03ac893c
291 changed files with 3335 additions and 3504 deletions
|
@ -24,14 +24,14 @@
|
|||
|
||||
package techreborn.tiles;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.ChatFormat;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.common.util.ChatUtils;
|
||||
import reborncore.common.util.StringUtils;
|
||||
|
@ -41,7 +41,7 @@ import techreborn.init.TRContent;
|
|||
import techreborn.init.TRTileEntities;
|
||||
import techreborn.utils.MessageIDs;
|
||||
|
||||
public class TileAlarm extends TileEntity
|
||||
public class TileAlarm extends BlockEntity
|
||||
implements ITickable, IToolDrop {
|
||||
private int selectedSound = 1;
|
||||
|
||||
|
@ -50,33 +50,33 @@ public class TileAlarm extends TileEntity
|
|||
}
|
||||
|
||||
public void rightClick() {
|
||||
if (!world.isRemote) {
|
||||
if (!world.isClient) {
|
||||
if (selectedSound < 3) {
|
||||
selectedSound++;
|
||||
} else {
|
||||
selectedSound = 1;
|
||||
}
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.alarmID, new TextComponentString(
|
||||
TextFormatting.GRAY + StringUtils.t("techreborn.message.alarm") + " " + "Alarm " + selectedSound));
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.alarmID, new TextComponent(
|
||||
ChatFormat.GRAY + StringUtils.t("techreborn.message.alarm") + " " + "Alarm " + selectedSound));
|
||||
}
|
||||
}
|
||||
|
||||
// TileEntity
|
||||
@Override
|
||||
public NBTTagCompound write(NBTTagCompound compound) {
|
||||
public CompoundTag toTag(CompoundTag compound) {
|
||||
if (compound == null) {
|
||||
compound = new NBTTagCompound();
|
||||
compound = new CompoundTag();
|
||||
}
|
||||
compound.putInt("selectedSound", this.selectedSound);
|
||||
return super.write(compound);
|
||||
return super.toTag(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NBTTagCompound compound) {
|
||||
if (compound != null && compound.contains("selectedSound")) {
|
||||
public void fromTag(CompoundTag compound) {
|
||||
if (compound != null && compound.containsKey("selectedSound")) {
|
||||
selectedSound = compound.getInt("selectedSound");
|
||||
}
|
||||
super.read(compound);
|
||||
super.fromTag(compound);
|
||||
}
|
||||
|
||||
//TODO 1.13 seems to be gone?
|
||||
|
@ -88,7 +88,7 @@ public class TileAlarm extends TileEntity
|
|||
// ITickable
|
||||
@Override
|
||||
public void tick() {
|
||||
if (!world.isRemote && world.getGameTime() % 25 == 0 && world.isBlockPowered(getPos())) {
|
||||
if (!world.isClient && world.getTime() % 25 == 0 && world.isReceivingRedstonePower(getPos())) {
|
||||
BlockAlarm.setActive(true, world, pos);
|
||||
switch (selectedSound) {
|
||||
case 1:
|
||||
|
@ -102,14 +102,14 @@ public class TileAlarm extends TileEntity
|
|||
break;
|
||||
}
|
||||
|
||||
} else if (!world.isRemote && world.getGameTime() % 25 == 0) {
|
||||
} else if (!world.isClient && world.getTime() % 25 == 0) {
|
||||
BlockAlarm.setActive(false, world, pos);
|
||||
}
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
public ItemStack getToolDrop(final PlayerEntity entityPlayer) {
|
||||
return TRContent.Machine.ALARM.getStack();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
|
||||
package techreborn.tiles;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
|
@ -63,11 +63,11 @@ public class TileChargeOMat extends TilePowerAcceptor
|
|||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
if(world.isRemote){
|
||||
if(world.isClient){
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < 6; i++) {
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
ItemStack stack = inventory.getInvStack(i);
|
||||
|
||||
if (!stack.isEmpty()) {
|
||||
ExternalPowerSystems.chargeItem(this, stack);
|
||||
|
@ -81,12 +81,12 @@ public class TileChargeOMat extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(final Direction direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
public boolean canProvideEnergy(final Direction direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ public class TileChargeOMat extends TilePowerAcceptor
|
|||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
public ItemStack getToolDrop(final PlayerEntity entityPlayer) {
|
||||
return TRContent.Machine.CHARGE_O_MAT.getStack();
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ public class TileChargeOMat extends TilePowerAcceptor
|
|||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("chargebench").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).energySlot(0, 62, 25).energySlot(1, 98, 25).energySlot(2, 62, 45).energySlot(3, 98, 45)
|
||||
.energySlot(4, 62, 65).energySlot(5, 98, 65).syncEnergyValue().addInventory().create(this);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.tiles;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
|
@ -44,7 +44,7 @@ public class TileDigitalChest extends TileTechStorageBase implements IContainerP
|
|||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("digitalchest").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 80, 24).outputSlot(1, 80, 64).addInventory().create(this);
|
||||
}
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
package techreborn.tiles;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
|
@ -58,7 +58,7 @@ public abstract class TileGenericMachine extends TilePowerAcceptor
|
|||
* @param toolDrop Block Block to drop with wrench
|
||||
* @param energySlot int Energy slot to use to charge machine from battery
|
||||
*/
|
||||
public TileGenericMachine(TileEntityType<?> tileEntityType, String name, int maxInput, int maxEnergy, Block toolDrop, int energySlot) {
|
||||
public TileGenericMachine(BlockEntityType<?> tileEntityType, String name, int maxInput, int maxEnergy, Block toolDrop, int energySlot) {
|
||||
super(tileEntityType);
|
||||
this.name = "Tile" + name;
|
||||
this.maxInput = maxInput;
|
||||
|
@ -79,7 +79,7 @@ public abstract class TileGenericMachine extends TilePowerAcceptor
|
|||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (!world.isRemote) {
|
||||
if (!world.isClient) {
|
||||
charge(energySlot);
|
||||
}
|
||||
}
|
||||
|
@ -90,12 +90,12 @@ public abstract class TileGenericMachine extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(final Direction direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
public boolean canProvideEnergy(final Direction direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ public abstract class TileGenericMachine extends TilePowerAcceptor
|
|||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer p0) {
|
||||
public ItemStack getToolDrop(PlayerEntity p0) {
|
||||
return new ItemStack(toolDrop, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,9 +24,6 @@
|
|||
|
||||
package techreborn.tiles;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
|
@ -43,6 +40,9 @@ import techreborn.init.TRTileEntities;
|
|||
import techreborn.items.DynamicCell;
|
||||
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
|
||||
@RebornRegister(TechReborn.MOD_ID)
|
||||
public class TileIndustrialCentrifuge extends TileGenericMachine implements IContainerProvider, IListInfoProvider {
|
||||
|
@ -62,7 +62,7 @@ public class TileIndustrialCentrifuge extends TileGenericMachine implements ICon
|
|||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("centrifuge").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this)
|
||||
.filterSlot(1, 40, 54, stack -> ItemUtils.isItemEqual(stack, DynamicCell.getEmptyCell(1), true, true))
|
||||
|
@ -74,8 +74,8 @@ public class TileIndustrialCentrifuge extends TileGenericMachine implements ICon
|
|||
|
||||
// IListInfoProvider
|
||||
@Override
|
||||
public void addInfo(final List<ITextComponent> info, final boolean isRealTile, boolean hasData) {
|
||||
public void addInfo(final List<Component> info, final boolean isRealTile, boolean hasData) {
|
||||
super.addInfo(info, isRealTile, hasData);
|
||||
info.add(new TextComponentString("Round and round it goes"));
|
||||
info.add(new TextComponent("Round and round it goes"));
|
||||
}
|
||||
}
|
|
@ -24,18 +24,18 @@
|
|||
|
||||
package techreborn.tiles;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.client.network.packet.BlockEntityUpdateS2CPacket;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.common.util.NonNullSupplier;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
|
||||
|
||||
|
||||
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
|
@ -54,36 +54,36 @@ public class TileTechStorageBase extends TileMachineBase
|
|||
public final Inventory<TileTechStorageBase> inventory;
|
||||
public ItemStack storedItem;
|
||||
|
||||
public TileTechStorageBase(TileEntityType<?> tileEntityTypeIn, String name, int maxCapacity) {
|
||||
public TileTechStorageBase(BlockEntityType<?> tileEntityTypeIn, String name, int maxCapacity) {
|
||||
super(tileEntityTypeIn);
|
||||
this.maxCapacity = maxCapacity;
|
||||
storedItem = ItemStack.EMPTY;
|
||||
inventory = new Inventory<>(3, name, maxCapacity, this).withConfiguredAccess();
|
||||
}
|
||||
|
||||
public void readWithoutCoords(NBTTagCompound tagCompound) {
|
||||
public void readWithoutCoords(CompoundTag tagCompound) {
|
||||
|
||||
storedItem = ItemStack.EMPTY;
|
||||
|
||||
if (tagCompound.contains("storedStack")) {
|
||||
storedItem = ItemStack.read(tagCompound.getCompound("storedStack"));
|
||||
if (tagCompound.containsKey("storedStack")) {
|
||||
storedItem = ItemStack.fromTag(tagCompound.getCompound("storedStack"));
|
||||
}
|
||||
|
||||
if (!storedItem.isEmpty()) {
|
||||
storedItem.setCount(Math.min(tagCompound.getInt("storedQuantity"), this.maxCapacity));
|
||||
storedItem.setAmount(Math.min(tagCompound.getInt("storedQuantity"), this.maxCapacity));
|
||||
}
|
||||
|
||||
inventory.read(tagCompound);
|
||||
}
|
||||
|
||||
public NBTTagCompound writeWithoutCoords(NBTTagCompound tagCompound) {
|
||||
public CompoundTag writeWithoutCoords(CompoundTag tagCompound) {
|
||||
if (!storedItem.isEmpty()) {
|
||||
ItemStack temp = storedItem.copy();
|
||||
if (storedItem.getCount() > storedItem.getMaxStackSize()) {
|
||||
temp.setCount(storedItem.getMaxStackSize());
|
||||
if (storedItem.getAmount() > storedItem.getMaxAmount()) {
|
||||
temp.setAmount(storedItem.getMaxAmount());
|
||||
}
|
||||
tagCompound.put("storedStack", temp.write(new NBTTagCompound()));
|
||||
tagCompound.putInt("storedQuantity", Math.min(storedItem.getCount(), maxCapacity));
|
||||
tagCompound.put("storedStack", temp.toTag(new CompoundTag()));
|
||||
tagCompound.putInt("storedQuantity", Math.min(storedItem.getAmount(), maxCapacity));
|
||||
} else {
|
||||
tagCompound.putInt("storedQuantity", 0);
|
||||
}
|
||||
|
@ -92,12 +92,12 @@ public class TileTechStorageBase extends TileMachineBase
|
|||
}
|
||||
|
||||
public ItemStack getDropWithNBT() {
|
||||
NBTTagCompound tileEntity = new NBTTagCompound();
|
||||
CompoundTag tileEntity = new CompoundTag();
|
||||
ItemStack dropStack = new ItemStack(getBlockType(), 1);
|
||||
writeWithoutCoords(tileEntity);
|
||||
dropStack.setTag(new NBTTagCompound());
|
||||
dropStack.setTag(new CompoundTag());
|
||||
dropStack.getTag().put("tileEntity", tileEntity);
|
||||
storedItem.setCount(0);
|
||||
storedItem.setAmount(0);
|
||||
inventory.setStackInSlot(1, ItemStack.EMPTY);
|
||||
syncWithAll();
|
||||
|
||||
|
@ -105,25 +105,25 @@ public class TileTechStorageBase extends TileMachineBase
|
|||
}
|
||||
|
||||
public int getStoredCount() {
|
||||
return storedItem.getCount();
|
||||
return storedItem.getAmount();
|
||||
}
|
||||
|
||||
public List<ItemStack> getContentDrops() {
|
||||
ArrayList<ItemStack> stacks = new ArrayList<>();
|
||||
|
||||
if (!getStoredItemType().isEmpty()) {
|
||||
if (!inventory.getStackInSlot(1).isEmpty()) {
|
||||
stacks.add(inventory.getStackInSlot(1));
|
||||
if (!inventory.getInvStack(1).isEmpty()) {
|
||||
stacks.add(inventory.getInvStack(1));
|
||||
}
|
||||
int size = storedItem.getMaxStackSize();
|
||||
int size = storedItem.getMaxAmount();
|
||||
for (int i = 0; i < getStoredCount() / size; i++) {
|
||||
ItemStack droped = storedItem.copy();
|
||||
droped.setCount(size);
|
||||
droped.setAmount(size);
|
||||
stacks.add(droped);
|
||||
}
|
||||
if (getStoredCount() % size != 0) {
|
||||
ItemStack droped = storedItem.copy();
|
||||
droped.setCount(getStoredCount() % size);
|
||||
droped.setAmount(getStoredCount() % size);
|
||||
stacks.add(droped);
|
||||
}
|
||||
}
|
||||
|
@ -135,27 +135,27 @@ public class TileTechStorageBase extends TileMachineBase
|
|||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (!world.isRemote) {
|
||||
if (!world.isClient) {
|
||||
ItemStack outputStack = ItemStack.EMPTY;
|
||||
if (!inventory.getStackInSlot(1).isEmpty()) {
|
||||
outputStack = inventory.getStackInSlot(1);
|
||||
if (!inventory.getInvStack(1).isEmpty()) {
|
||||
outputStack = inventory.getInvStack(1);
|
||||
}
|
||||
if (!inventory.getStackInSlot(0).isEmpty()
|
||||
&& (storedItem.getCount() + outputStack.getCount()) < maxCapacity) {
|
||||
ItemStack inputStack = inventory.getStackInSlot(0);
|
||||
if (!inventory.getInvStack(0).isEmpty()
|
||||
&& (storedItem.getAmount() + outputStack.getAmount()) < maxCapacity) {
|
||||
ItemStack inputStack = inventory.getInvStack(0);
|
||||
if (getStoredItemType().isEmpty()
|
||||
|| (storedItem.isEmpty() && ItemUtils.isItemEqual(inputStack, outputStack, true, true))) {
|
||||
|
||||
storedItem = inputStack;
|
||||
inventory.setStackInSlot(0, ItemStack.EMPTY);
|
||||
} else if (ItemUtils.isItemEqual(getStoredItemType(), inputStack, true, true)) {
|
||||
int reminder = maxCapacity - storedItem.getCount() - outputStack.getCount();
|
||||
if (inputStack.getCount() <= reminder) {
|
||||
setStoredItemCount(inputStack.getCount());
|
||||
int reminder = maxCapacity - storedItem.getAmount() - outputStack.getAmount();
|
||||
if (inputStack.getAmount() <= reminder) {
|
||||
setStoredItemCount(inputStack.getAmount());
|
||||
inventory.setStackInSlot(0, ItemStack.EMPTY);
|
||||
} else {
|
||||
setStoredItemCount(maxCapacity - outputStack.getCount());
|
||||
inventory.getStackInSlot(0).shrink(reminder);
|
||||
setStoredItemCount(maxCapacity - outputStack.getAmount());
|
||||
inventory.getInvStack(0).subtractAmount(reminder);
|
||||
}
|
||||
}
|
||||
markDirty();
|
||||
|
@ -166,8 +166,8 @@ public class TileTechStorageBase extends TileMachineBase
|
|||
if (outputStack.isEmpty()) {
|
||||
|
||||
ItemStack delivered = storedItem.copy();
|
||||
delivered.setCount(Math.min(storedItem.getCount(), delivered.getMaxStackSize()));
|
||||
storedItem.shrink(delivered.getCount());
|
||||
delivered.setAmount(Math.min(storedItem.getAmount(), delivered.getMaxAmount()));
|
||||
storedItem.subtractAmount(delivered.getAmount());
|
||||
|
||||
if (storedItem.isEmpty()) {
|
||||
storedItem = ItemStack.EMPTY;
|
||||
|
@ -177,12 +177,12 @@ public class TileTechStorageBase extends TileMachineBase
|
|||
markDirty();
|
||||
syncWithAll();
|
||||
} else if (ItemUtils.isItemEqual(storedItem, outputStack, true, true)
|
||||
&& outputStack.getCount() < outputStack.getMaxStackSize()) {
|
||||
&& outputStack.getAmount() < outputStack.getMaxAmount()) {
|
||||
|
||||
int wanted = Math.min(storedItem.getCount(),
|
||||
outputStack.getMaxStackSize() - outputStack.getCount());
|
||||
outputStack.setCount(outputStack.getCount() + wanted);
|
||||
storedItem.shrink(wanted);
|
||||
int wanted = Math.min(storedItem.getAmount(),
|
||||
outputStack.getMaxAmount() - outputStack.getAmount());
|
||||
outputStack.setAmount(outputStack.getAmount() + wanted);
|
||||
storedItem.subtractAmount(wanted);
|
||||
|
||||
if (storedItem.isEmpty()) {
|
||||
storedItem = ItemStack.EMPTY;
|
||||
|
@ -200,20 +200,20 @@ public class TileTechStorageBase extends TileMachineBase
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
|
||||
public void onDataPacket(ClientConnection net, BlockEntityUpdateS2CPacket packet) {
|
||||
world.markBlockRangeForRenderUpdate(pos.getX(), pos.getY(), pos.getZ(), pos.getX(), pos.getY(), pos.getZ());
|
||||
read(packet.getNbtCompound());
|
||||
fromTag(packet.getCompoundTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NBTTagCompound tagCompound) {
|
||||
super.read(tagCompound);
|
||||
public void fromTag(CompoundTag tagCompound) {
|
||||
super.fromTag(tagCompound);
|
||||
readWithoutCoords(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound write(NBTTagCompound tagCompound) {
|
||||
super.write(tagCompound);
|
||||
public CompoundTag toTag(CompoundTag tagCompound) {
|
||||
super.toTag(tagCompound);
|
||||
writeWithoutCoords(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
@ -242,41 +242,41 @@ public class TileTechStorageBase extends TileMachineBase
|
|||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getToolDrop(PlayerEntity entityPlayer) {
|
||||
return getDropWithNBT();
|
||||
}
|
||||
|
||||
// IListInfoProvider
|
||||
@Override
|
||||
public void addInfo(List<ITextComponent> info, boolean isRealTile, boolean hasData) {
|
||||
public void addInfo(List<Component> info, boolean isRealTile, boolean hasData) {
|
||||
if (isRealTile || hasData) {
|
||||
int size = 0;
|
||||
String name = "of nothing";
|
||||
if (!storedItem.isEmpty()) {
|
||||
name = storedItem.getDisplayName().getString();
|
||||
size += storedItem.getCount();
|
||||
size += storedItem.getAmount();
|
||||
}
|
||||
if (!inventory.getStackInSlot(1).isEmpty()) {
|
||||
name = inventory.getStackInSlot(1).getDisplayName().getString();
|
||||
size += inventory.getStackInSlot(1).getCount();
|
||||
if (!inventory.getInvStack(1).isEmpty()) {
|
||||
name = inventory.getInvStack(1).getDisplayName().getString();
|
||||
size += inventory.getInvStack(1).getAmount();
|
||||
}
|
||||
info.add(new TextComponentString(size + " " + name));
|
||||
info.add(new TextComponent(size + " " + name));
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getStoredItemType() {
|
||||
return storedItem.isEmpty() ? inventory.getStackInSlot(1) : storedItem;
|
||||
return storedItem.isEmpty() ? inventory.getInvStack(1) : storedItem;
|
||||
}
|
||||
|
||||
|
||||
public void setStoredItemCount(int amount) {
|
||||
storedItem.grow(amount);
|
||||
storedItem.addAmount(amount);
|
||||
markDirty();
|
||||
}
|
||||
|
||||
public void setStoredItemType(ItemStack type, int amount) {
|
||||
storedItem = type;
|
||||
storedItem.setCount(amount);
|
||||
storedItem.setAmount(amount);
|
||||
markDirty();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,22 +24,22 @@
|
|||
|
||||
package techreborn.tiles.cable;
|
||||
|
||||
import net.minecraft.ChatFormat;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.client.network.packet.BlockEntityUpdateS2CPacket;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
|
||||
|
||||
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.common.RebornCoreConfig;
|
||||
|
@ -56,13 +56,13 @@ import java.util.List;
|
|||
* Created by modmuss50 on 19/05/2017.
|
||||
*/
|
||||
|
||||
public class TileCable extends TileEntity
|
||||
public class TileCable extends BlockEntity
|
||||
implements ITickable, IEnergyStorage, IListInfoProvider, IToolDrop {
|
||||
|
||||
public int power = 0;
|
||||
private int transferRate = 0;
|
||||
private TRContent.Cables cableType = null;
|
||||
private ArrayList<EnumFacing> sendingFace = new ArrayList<EnumFacing>();
|
||||
private ArrayList<Direction> sendingFace = new ArrayList<Direction>();
|
||||
int ticksSinceLastChange = 0;
|
||||
|
||||
public TileCable() {
|
||||
|
@ -78,7 +78,7 @@ public class TileCable extends TileEntity
|
|||
return TRContent.Cables.COPPER;
|
||||
}
|
||||
|
||||
public boolean canReceiveFromFace(EnumFacing face) {
|
||||
public boolean canReceiveFromFace(Direction face) {
|
||||
if (sendingFace.contains(face)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -94,35 +94,35 @@ public class TileCable extends TileEntity
|
|||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getUpdateTag() {
|
||||
return write(new NBTTagCompound());
|
||||
public CompoundTag toInitialChunkDataTag() {
|
||||
return toTag(new CompoundTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SPacketUpdateTileEntity getUpdatePacket() {
|
||||
NBTTagCompound nbtTag = new NBTTagCompound();
|
||||
write(nbtTag);
|
||||
return new SPacketUpdateTileEntity(getPos(), 1, nbtTag);
|
||||
public BlockEntityUpdateS2CPacket toUpdatePacket() {
|
||||
CompoundTag nbtTag = new CompoundTag();
|
||||
toTag(nbtTag);
|
||||
return new BlockEntityUpdateS2CPacket(getPos(), 1, nbtTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
|
||||
read(packet.getNbtCompound());
|
||||
public void onDataPacket(ClientConnection net, BlockEntityUpdateS2CPacket packet) {
|
||||
fromTag(packet.getCompoundTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NBTTagCompound compound) {
|
||||
super.read(compound);
|
||||
if (compound.contains("TileCable")) {
|
||||
public void fromTag(CompoundTag compound) {
|
||||
super.fromTag(compound);
|
||||
if (compound.containsKey("TileCable")) {
|
||||
power = compound.getCompound("TileCable").getInt("power");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound write(NBTTagCompound compound) {
|
||||
super.write(compound);
|
||||
public CompoundTag toTag(CompoundTag compound) {
|
||||
super.toTag(compound);
|
||||
if (power > 0) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
CompoundTag data = new CompoundTag();
|
||||
data.putInt("power", getEnergyStored());
|
||||
compound.put("TileCable", data);
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ public class TileCable extends TileEntity
|
|||
// ITickable
|
||||
@Override
|
||||
public void tick() {
|
||||
if (world.isRemote) {
|
||||
if (world.isClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -152,8 +152,8 @@ public class TileCable extends TileEntity
|
|||
}
|
||||
|
||||
ArrayList<IEnergyStorage> acceptors = new ArrayList<IEnergyStorage>();
|
||||
for (EnumFacing face : EnumFacing.values()) {
|
||||
TileEntity tile = world.getTileEntity(pos.offset(face));
|
||||
for (Direction face : Direction.values()) {
|
||||
BlockEntity tile = world.getBlockEntity(pos.offset(face));
|
||||
|
||||
if (tile == null) {
|
||||
continue;
|
||||
|
@ -239,19 +239,19 @@ public class TileCable extends TileEntity
|
|||
|
||||
// IListInfoProvider
|
||||
@Override
|
||||
public void addInfo(List<ITextComponent> info, boolean isRealTile, boolean hasData) {
|
||||
public void addInfo(List<Component> info, boolean isRealTile, boolean hasData) {
|
||||
if (isRealTile) {
|
||||
info.add(new TextComponentString(TextFormatting.GRAY + StringUtils.t("techreborn.tooltip.transferRate") + ": "
|
||||
+ TextFormatting.GOLD
|
||||
info.add(new TextComponent(ChatFormat.GRAY + StringUtils.t("techreborn.tooltip.transferRate") + ": "
|
||||
+ ChatFormat.GOLD
|
||||
+ PowerSystem.getLocaliszedPowerFormatted(transferRate / RebornCoreConfig.euPerFU) + "/t"));
|
||||
info.add(new TextComponentString(TextFormatting.GRAY + StringUtils.t("techreborn.tooltip.tier") + ": "
|
||||
+ TextFormatting.GOLD + StringUtils.toFirstCapitalAllLowercase(cableType.tier.toString())));
|
||||
info.add(new TextComponent(ChatFormat.GRAY + StringUtils.t("techreborn.tooltip.tier") + ": "
|
||||
+ ChatFormat.GOLD + StringUtils.toFirstCapitalAllLowercase(cableType.tier.toString())));
|
||||
}
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer playerIn) {
|
||||
public ItemStack getToolDrop(PlayerEntity playerIn) {
|
||||
return new ItemStack(getCableType().block);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
|
||||
package techreborn.tiles.fusionReactor;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
|
@ -135,11 +135,11 @@ public class TileFusionControlComputer extends TilePowerAcceptor
|
|||
if (stack.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
if (inventory.getStackInSlot(slot).isEmpty()) {
|
||||
if (inventory.getInvStack(slot).isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
if (ItemUtils.isItemEqual(inventory.getStackInSlot(slot), stack, true, tags)) {
|
||||
if (stack.getCount() + inventory.getStackInSlot(slot).getCount() <= stack.getMaxStackSize()) {
|
||||
if (ItemUtils.isItemEqual(inventory.getInvStack(slot), stack, true, tags)) {
|
||||
if (stack.getAmount() + inventory.getInvStack(slot).getAmount() <= stack.getMaxAmount()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ public class TileFusionControlComputer extends TilePowerAcceptor
|
|||
* @return boolean True if reactor can execute recipe provided
|
||||
*/
|
||||
private boolean validateReactorRecipe(FusionReactorRecipe recipe) {
|
||||
boolean validRecipe = validateReactorRecipeInputs(recipe, inventory.getStackInSlot(topStackSlot), inventory.getStackInSlot(bottomStackSlot)) || validateReactorRecipeInputs(recipe, inventory.getStackInSlot(bottomStackSlot), inventory.getStackInSlot(topStackSlot));
|
||||
boolean validRecipe = validateReactorRecipeInputs(recipe, inventory.getInvStack(topStackSlot), inventory.getInvStack(bottomStackSlot)) || validateReactorRecipeInputs(recipe, inventory.getInvStack(bottomStackSlot), inventory.getInvStack(topStackSlot));
|
||||
return validRecipe && getSize() >= recipe.getMinSize();
|
||||
}
|
||||
|
||||
|
@ -205,18 +205,18 @@ public class TileFusionControlComputer extends TilePowerAcceptor
|
|||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
if (world.isRemote) {
|
||||
if (world.isClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(lastTick == world.getGameTime()){
|
||||
if(lastTick == world.getTime()){
|
||||
//Prevent tick accerators, blame obstinate for this.
|
||||
return;
|
||||
}
|
||||
lastTick = world.getGameTime();
|
||||
lastTick = world.getTime();
|
||||
|
||||
// Force check every second
|
||||
if (world.getGameTime() % 20 == 0) {
|
||||
if (world.getTime() % 20 == 0) {
|
||||
checkCoils();
|
||||
inventory.setChanged();
|
||||
}
|
||||
|
@ -241,9 +241,9 @@ public class TileFusionControlComputer extends TilePowerAcceptor
|
|||
if (canUseEnergy(currentRecipe.getStartEU())) {
|
||||
useEnergy(currentRecipe.getStartEU());
|
||||
hasStartedCrafting = true;
|
||||
inventory.shrinkSlot(topStackSlot, currentRecipe.getTopInput().getCount());
|
||||
inventory.shrinkSlot(topStackSlot, currentRecipe.getTopInput().getAmount());
|
||||
if (!currentRecipe.getBottomInput().isEmpty()) {
|
||||
inventory.shrinkSlot(bottomStackSlot, currentRecipe.getBottomInput().getCount());
|
||||
inventory.shrinkSlot(bottomStackSlot, currentRecipe.getBottomInput().getAmount());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -261,16 +261,16 @@ public class TileFusionControlComputer extends TilePowerAcceptor
|
|||
}
|
||||
} else if (crafingTickTime >= finalTickTime) {
|
||||
if (canFitStack(currentRecipe.getOutput(), outputStackSlot, true)) {
|
||||
if (inventory.getStackInSlot(outputStackSlot).isEmpty()) {
|
||||
if (inventory.getInvStack(outputStackSlot).isEmpty()) {
|
||||
inventory.setStackInSlot(outputStackSlot, currentRecipe.getOutput().copy());
|
||||
} else {
|
||||
inventory.shrinkSlot(outputStackSlot, -currentRecipe.getOutput().getCount());
|
||||
inventory.shrinkSlot(outputStackSlot, -currentRecipe.getOutput().getAmount());
|
||||
}
|
||||
if (validateReactorRecipe(this.currentRecipe)) {
|
||||
crafingTickTime = 0;
|
||||
inventory.shrinkSlot(topStackSlot, currentRecipe.getTopInput().getCount());
|
||||
inventory.shrinkSlot(topStackSlot, currentRecipe.getTopInput().getAmount());
|
||||
if (!currentRecipe.getBottomInput().isEmpty()) {
|
||||
inventory.shrinkSlot(bottomStackSlot, currentRecipe.getBottomInput().getCount());
|
||||
inventory.shrinkSlot(bottomStackSlot, currentRecipe.getBottomInput().getAmount());
|
||||
}
|
||||
} else {
|
||||
resetCrafter();
|
||||
|
@ -296,13 +296,13 @@ public class TileFusionControlComputer extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return !(direction == EnumFacing.DOWN || direction == EnumFacing.UP);
|
||||
public boolean canAcceptEnergy(Direction direction) {
|
||||
return !(direction == Direction.DOWN || direction == Direction.UP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return direction == EnumFacing.DOWN || direction == EnumFacing.UP;
|
||||
public boolean canProvideEnergy(Direction direction) {
|
||||
return direction == Direction.DOWN || direction == Direction.UP;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -322,28 +322,28 @@ public class TileFusionControlComputer extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public void read(final NBTTagCompound tagCompound) {
|
||||
super.read(tagCompound);
|
||||
public void fromTag(final CompoundTag tagCompound) {
|
||||
super.fromTag(tagCompound);
|
||||
this.crafingTickTime = tagCompound.getInt("crafingTickTime");
|
||||
this.finalTickTime = tagCompound.getInt("finalTickTime");
|
||||
this.neededPower = tagCompound.getInt("neededPower");
|
||||
this.hasStartedCrafting = tagCompound.getBoolean("hasStartedCrafting");
|
||||
if(tagCompound.contains("hasActiveRecipe") && tagCompound.getBoolean("hasActiveRecipe") && this.currentRecipe == null){
|
||||
if(tagCompound.containsKey("hasActiveRecipe") && tagCompound.getBoolean("hasActiveRecipe") && this.currentRecipe == null){
|
||||
for (final FusionReactorRecipe reactorRecipe : FusionReactorRecipeHelper.reactorRecipes) {
|
||||
if (validateReactorRecipe(reactorRecipe)) {
|
||||
this.currentRecipe = reactorRecipe;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(tagCompound.contains("size")){
|
||||
if(tagCompound.containsKey("size")){
|
||||
this.size = tagCompound.getInt("size");
|
||||
}
|
||||
this.size = Math.min(size, maxCoilSize);//Done here to force the samller size, will be useful if people lag out on a large one.
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound write(final NBTTagCompound tagCompound) {
|
||||
super.write(tagCompound);
|
||||
public CompoundTag toTag(final CompoundTag tagCompound) {
|
||||
super.toTag(tagCompound);
|
||||
tagCompound.putInt("crafingTickTime", this.crafingTickTime);
|
||||
tagCompound.putInt("finalTickTime", this.finalTickTime);
|
||||
tagCompound.putInt("neededPower", this.neededPower);
|
||||
|
@ -367,7 +367,7 @@ public class TileFusionControlComputer extends TilePowerAcceptor
|
|||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer playerIn) {
|
||||
public ItemStack getToolDrop(PlayerEntity playerIn) {
|
||||
return TRContent.Machine.FUSION_CONTROL_COMPUTER.getStack();
|
||||
}
|
||||
|
||||
|
@ -379,7 +379,7 @@ public class TileFusionControlComputer extends TilePowerAcceptor
|
|||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("fusionreactor").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this).slot(0, 34, 47).slot(1, 126, 47).outputSlot(2, 80, 47).syncEnergyValue()
|
||||
.syncIntegerValue(this::getCoilStatus, this::setCoilStatus)
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
|
||||
package techreborn.tiles.generator;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
|
@ -59,7 +59,7 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
|
|||
*/
|
||||
double pendingWithdraw = 0.0;
|
||||
|
||||
public TileBaseFluidGenerator(TileEntityType<?> tileEntityType, EFluidGenerator type, String tileName, int tankCapacity, int euTick) {
|
||||
public TileBaseFluidGenerator(BlockEntityType<?> tileEntityType, EFluidGenerator type, String tileName, int tankCapacity, int euTick) {
|
||||
super(tileEntityType);
|
||||
recipes = GeneratorRecipeHelper.getFluidRecipesForGenerator(type);
|
||||
tank = new Tank(tileName, tankCapacity, this);
|
||||
|
@ -73,14 +73,14 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
|
|||
super.tick();
|
||||
ticksSinceLastChange++;
|
||||
|
||||
if(world.isRemote){
|
||||
if(world.isClient){
|
||||
return;
|
||||
}
|
||||
|
||||
// Check cells input slot 2 time per second
|
||||
// Please, keep ticks counting on client also to report progress to GUI
|
||||
if (ticksSinceLastChange >= 10) {
|
||||
if (!inventory.getStackInSlot(0).isEmpty()) {
|
||||
if (!inventory.getInvStack(0).isEmpty()) {
|
||||
FluidUtils.drainContainers(tank, inventory, 0, 1);
|
||||
FluidUtils.fillContainers(tank, inventory, 0, 1, tank.getFluidType());
|
||||
}
|
||||
|
@ -103,15 +103,15 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
|
|||
final int currentWithdraw = (int) pendingWithdraw;
|
||||
pendingWithdraw -= currentWithdraw;
|
||||
tank.drain(currentWithdraw, true);
|
||||
lastOutput = world.getGameTime();
|
||||
lastOutput = world.getTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (world.getGameTime() - lastOutput < 30 && !isActive()) {
|
||||
if (world.getTime() - lastOutput < 30 && !isActive()) {
|
||||
world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, true));
|
||||
}
|
||||
else if (world.getGameTime() - lastOutput > 30 && isActive()) {
|
||||
else if (world.getTime() - lastOutput > 30 && isActive()) {
|
||||
world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, false));
|
||||
}
|
||||
}
|
||||
|
@ -136,8 +136,8 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
|
|||
}
|
||||
|
||||
protected boolean acceptFluid() {
|
||||
if (!inventory.getStackInSlot(0).isEmpty()) {
|
||||
FluidStack stack = FluidUtils.getFluidStackInContainer(inventory.getStackInSlot(0));
|
||||
if (!inventory.getInvStack(0).isEmpty()) {
|
||||
FluidStack stack = FluidUtils.getFluidStackInContainer(inventory.getInvStack(0));
|
||||
if (stack != null)
|
||||
return recipes.getRecipeForFluid(stack.getFluid()).isPresent();
|
||||
}
|
||||
|
@ -159,12 +159,12 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(Direction direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
public boolean canProvideEnergy(Direction direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -174,14 +174,14 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
|
|||
}
|
||||
|
||||
@Override
|
||||
public void read(NBTTagCompound tagCompound) {
|
||||
super.read(tagCompound);
|
||||
public void fromTag(CompoundTag tagCompound) {
|
||||
super.fromTag(tagCompound);
|
||||
tank.read(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound write(NBTTagCompound tagCompound) {
|
||||
super.write(tagCompound);
|
||||
public CompoundTag toTag(CompoundTag tagCompound) {
|
||||
super.toTag(tagCompound);
|
||||
tank.write(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
package techreborn.tiles.generator;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.LightningEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
|
@ -67,24 +67,24 @@ public class TileLightningRod extends TilePowerAcceptor implements IToolDrop {
|
|||
--onStatusHoldTicks;
|
||||
|
||||
if (onStatusHoldTicks == 0 || getEnergy() <= 0) {
|
||||
if (getBlockState().getBlock() instanceof BlockMachineBase)
|
||||
((BlockMachineBase) getBlockState().getBlock()).setActive(false, world, pos);
|
||||
if (getCachedState().getBlock() instanceof BlockMachineBase)
|
||||
((BlockMachineBase) getCachedState().getBlock()).setActive(false, world, pos);
|
||||
onStatusHoldTicks = -1;
|
||||
}
|
||||
|
||||
final float weatherStrength = world.getThunderStrength(1.0F);
|
||||
final float weatherStrength = world.getThunderGradient(1.0F);
|
||||
if (weatherStrength > 0.2F) {
|
||||
//lightStrikeChance = (MAX - (CHANCE * WEATHER_STRENGTH)
|
||||
final float lightStrikeChance = (100F - chanceOfStrike) * 20F;
|
||||
final float totalChance = lightStrikeChance * getLightningStrikeMultiplier() * (1.1F - weatherStrength);
|
||||
if (world.rand.nextInt((int) Math.floor(totalChance)) == 0) {
|
||||
if (world.random.nextInt((int) Math.floor(totalChance)) == 0) {
|
||||
if (!isValidIronFence(pos.up().getY())) {
|
||||
onStatusHoldTicks = 400;
|
||||
return;
|
||||
}
|
||||
final EntityLightningBolt lightningBolt = new EntityLightningBolt(world,
|
||||
final LightningEntity lightningBolt = new LightningEntity(world,
|
||||
pos.getX() + 0.5F,
|
||||
world.getHeight(),
|
||||
world.getTopPosition(),
|
||||
pos.getZ() + 0.5F, false);
|
||||
world.addWeatherEffect(lightningBolt);
|
||||
world.spawnEntity(lightningBolt);
|
||||
|
@ -98,7 +98,7 @@ public class TileLightningRod extends TilePowerAcceptor implements IToolDrop {
|
|||
|
||||
public float getLightningStrikeMultiplier() {
|
||||
final float actualHeight = world.getDimension().getActualHeight();
|
||||
final float groundLevel = world.getHeight();
|
||||
final float groundLevel = world.getTopPosition();
|
||||
for (int i = pos.getY() + 1; i < actualHeight; i++) {
|
||||
if (!isValidIronFence(i)) {
|
||||
if (groundLevel >= i)
|
||||
|
@ -125,12 +125,12 @@ public class TileLightningRod extends TilePowerAcceptor implements IToolDrop {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(final Direction direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
public boolean canProvideEnergy(final Direction direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ public class TileLightningRod extends TilePowerAcceptor implements IToolDrop {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer playerIn) {
|
||||
public ItemStack getToolDrop(PlayerEntity playerIn) {
|
||||
return TRContent.Machine.LIGHTNING_ROD.getStack();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.tiles.generator;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
|
@ -53,7 +53,7 @@ public class TilePlasmaGenerator extends TileBaseFluidGenerator implements ICont
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer playerIn) {
|
||||
public ItemStack getToolDrop(PlayerEntity playerIn) {
|
||||
return TRContent.Machine.PLASMA_GENERATOR.getStack();
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ public class TilePlasmaGenerator extends TileBaseFluidGenerator implements ICont
|
|||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("plasmagenerator").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 25, 35).outputSlot(1, 25, 55).syncEnergyValue()
|
||||
.syncIntegerValue(this::getTicksSinceLastChange, this::setTicksSinceLastChange)
|
||||
|
|
|
@ -24,14 +24,14 @@
|
|||
|
||||
package techreborn.tiles.generator;
|
||||
|
||||
import net.minecraft.ChatFormat;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
|
@ -55,22 +55,22 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
|
|||
}
|
||||
|
||||
public boolean isSunOut() {
|
||||
return canSeeSky && !world.isRaining() && !world.isThundering() && world.isDaytime();
|
||||
return canSeeSky && !world.isRaining() && !world.isThundering() && world.isDaylight();
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (world.isRemote) {
|
||||
if (world.isClient) {
|
||||
return;
|
||||
}
|
||||
if (panel == TRContent.SolarPanels.CREATIVE) {
|
||||
setEnergy(Integer.MAX_VALUE);
|
||||
return;
|
||||
}
|
||||
if (world.getGameTime() % 20 == 0) {
|
||||
canSeeSky = world.canBlockSeeSky(pos.up());
|
||||
if (world.getTime() % 20 == 0) {
|
||||
canSeeSky = world.method_8626(pos.up());
|
||||
if (lastState != isSunOut()) {
|
||||
world.setBlockState(pos, world.getBlockState(pos).with(BlockSolarPanel.ACTIVE, isSunOut()));
|
||||
lastState = isSunOut();
|
||||
|
@ -94,12 +94,12 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(final Direction direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
public boolean canProvideEnergy(final Direction direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -130,27 +130,27 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
|
|||
|
||||
// TODO: Translate
|
||||
@Override
|
||||
public void addInfo(List<ITextComponent> info, boolean isRealTile, boolean hasData) {
|
||||
info.add(new TextComponentString(TextFormatting.GRAY + "Internal Energy Storage: " + TextFormatting.GOLD
|
||||
public void addInfo(List<Component> info, boolean isRealTile, boolean hasData) {
|
||||
info.add(new TextComponent(ChatFormat.GRAY + "Internal Energy Storage: " + ChatFormat.GOLD
|
||||
+ PowerSystem.getLocaliszedPowerFormatted((int) getMaxPower())));
|
||||
|
||||
info.add(new TextComponentString(TextFormatting.GRAY + "Generation Rate Day: " + TextFormatting.GOLD
|
||||
info.add(new TextComponent(ChatFormat.GRAY + "Generation Rate Day: " + ChatFormat.GOLD
|
||||
+ PowerSystem.getLocaliszedPowerFormatted(panel.generationRateD)));
|
||||
|
||||
info.add(new TextComponentString(TextFormatting.GRAY + "Generation Rate Night: " + TextFormatting.GOLD
|
||||
info.add(new TextComponent(ChatFormat.GRAY + "Generation Rate Night: " + ChatFormat.GOLD
|
||||
+ PowerSystem.getLocaliszedPowerFormatted(panel.generationRateN)));
|
||||
|
||||
info.add(new TextComponentString(TextFormatting.GRAY + "Tier: " + TextFormatting.GOLD
|
||||
info.add(new TextComponent(ChatFormat.GRAY + "Tier: " + ChatFormat.GOLD
|
||||
+ StringUtils.toFirstCapitalAllLowercase(getTier().toString())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NBTTagCompound tag) {
|
||||
public void fromTag(CompoundTag tag) {
|
||||
if (world == null) {
|
||||
// We are in TileEntity.create method during chunk load.
|
||||
this.checkOverfill = false;
|
||||
}
|
||||
super.read(tag);
|
||||
super.fromTag(tag);
|
||||
}
|
||||
|
||||
// TileMachineBase
|
||||
|
@ -166,7 +166,7 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
|
|||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer playerIn) {
|
||||
public ItemStack getToolDrop(final PlayerEntity playerIn) {
|
||||
return new ItemStack(getBlockType());
|
||||
}
|
||||
}
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.tiles.generator.advanced;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
|
@ -54,7 +54,7 @@ public class TileDieselGenerator extends TileBaseFluidGenerator implements ICont
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
public ItemStack getToolDrop(final PlayerEntity entityPlayer) {
|
||||
return TRContent.Machine.DIESEL_GENERATOR.getStack();
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class TileDieselGenerator extends TileBaseFluidGenerator implements ICont
|
|||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("dieselgenerator").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this).slot(0, 25, 35).outputSlot(1, 25, 55).syncEnergyValue()
|
||||
.syncIntegerValue(this::getTicksSinceLastChange, this::setTicksSinceLastChange)
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
|
||||
package techreborn.tiles.generator.advanced;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
|
@ -74,16 +74,16 @@ public class TileDragonEggSyphon extends TilePowerAcceptor
|
|||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
if (!world.isRemote) {
|
||||
if (!world.isClient) {
|
||||
if (world.getBlockState(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ()))
|
||||
.getBlock() == Blocks.DRAGON_EGG) {
|
||||
if (tryAddingEnergy(energyPerTick))
|
||||
lastOutput = world.getGameTime();
|
||||
lastOutput = world.getTime();
|
||||
}
|
||||
|
||||
if (world.getGameTime() - lastOutput < 30 && !isActive()) {
|
||||
if (world.getTime() - lastOutput < 30 && !isActive()) {
|
||||
world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, true));
|
||||
} else if (world.getGameTime() - lastOutput > 30 && isActive()) {
|
||||
} else if (world.getTime() - lastOutput > 30 && isActive()) {
|
||||
world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, false));
|
||||
}
|
||||
}
|
||||
|
@ -95,12 +95,12 @@ public class TileDragonEggSyphon extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(Direction direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
public boolean canProvideEnergy(Direction direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ public class TileDragonEggSyphon extends TilePowerAcceptor
|
|||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getToolDrop(PlayerEntity entityPlayer) {
|
||||
return TRContent.Machine.DRAGON_EGG_SYPHON.getStack();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.tiles.generator.advanced;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
|
@ -54,7 +54,7 @@ public class TileGasTurbine extends TileBaseFluidGenerator implements IContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getToolDrop(PlayerEntity entityPlayer) {
|
||||
return TRContent.Machine.GAS_TURBINE.getStack();
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class TileGasTurbine extends TileBaseFluidGenerator implements IContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("gasturbine").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this).slot(0, 25, 35).outputSlot(1, 25, 55).syncEnergyValue()
|
||||
.syncIntegerValue(this::getTicksSinceLastChange, this::setTicksSinceLastChange)
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.tiles.generator.advanced;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
|
@ -54,7 +54,7 @@ public class TileSemiFluidGenerator extends TileBaseFluidGenerator implements IC
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer playerIn) {
|
||||
public ItemStack getToolDrop(PlayerEntity playerIn) {
|
||||
return TRContent.Machine.SEMI_FLUID_GENERATOR.getStack();
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class TileSemiFluidGenerator extends TileBaseFluidGenerator implements IC
|
|||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("semifluidgenerator").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this).slot(0, 25, 35).outputSlot(1, 25, 55).syncEnergyValue()
|
||||
.syncIntegerValue(this::getTicksSinceLastChange, this::setTicksSinceLastChange)
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.tiles.generator.advanced;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
|
@ -54,7 +54,7 @@ public class TileThermalGenerator extends TileBaseFluidGenerator implements ICon
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getToolDrop(PlayerEntity entityPlayer) {
|
||||
return TRContent.Machine.THERMAL_GENERATOR.getStack();
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class TileThermalGenerator extends TileBaseFluidGenerator implements ICon
|
|||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("thermalgenerator").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this).slot(0, 25, 35).outputSlot(1, 25, 55).syncEnergyValue()
|
||||
.syncIntegerValue(this::getTicksSinceLastChange, this::setTicksSinceLastChange)
|
||||
|
|
|
@ -24,13 +24,13 @@
|
|||
|
||||
package techreborn.tiles.generator.basic;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.FurnaceBlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
|
@ -70,13 +70,13 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr
|
|||
}
|
||||
|
||||
public static int getItemBurnTime(ItemStack stack) {
|
||||
return TileEntityFurnace.getBurnTimes().get(stack) / 4;
|
||||
return FurnaceBlockEntity.getBurnTimes().get(stack) / 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (world.isRemote) {
|
||||
if (world.isClient) {
|
||||
return;
|
||||
}
|
||||
if (getEnergy() < getMaxPower()) {
|
||||
|
@ -91,12 +91,12 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr
|
|||
|
||||
if (burnTime == 0) {
|
||||
updateState();
|
||||
burnTime = totalBurnTime = TileSolidFuelGenerator.getItemBurnTime(inventory.getStackInSlot(fuelSlot));
|
||||
burnTime = totalBurnTime = TileSolidFuelGenerator.getItemBurnTime(inventory.getInvStack(fuelSlot));
|
||||
if (burnTime > 0) {
|
||||
updateState();
|
||||
burnItem = inventory.getStackInSlot(fuelSlot);
|
||||
if (inventory.getStackInSlot(fuelSlot).getCount() == 1) {
|
||||
if (inventory.getStackInSlot(fuelSlot).getItem() == Items.LAVA_BUCKET || inventory.getStackInSlot(fuelSlot).getItem() == ForgeMod.getInstance().universalBucket) {
|
||||
burnItem = inventory.getInvStack(fuelSlot);
|
||||
if (inventory.getInvStack(fuelSlot).getAmount() == 1) {
|
||||
if (inventory.getInvStack(fuelSlot).getItem() == Items.LAVA_BUCKET || inventory.getInvStack(fuelSlot).getItem() == ForgeMod.getInstance().universalBucket) {
|
||||
inventory.setStackInSlot(fuelSlot, new ItemStack(Items.BUCKET));
|
||||
} else {
|
||||
inventory.setStackInSlot(fuelSlot, ItemStack.EMPTY);
|
||||
|
@ -112,7 +112,7 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr
|
|||
}
|
||||
|
||||
public void updateState() {
|
||||
final IBlockState BlockStateContainer = world.getBlockState(pos);
|
||||
final BlockState BlockStateContainer = world.getBlockState(pos);
|
||||
if (BlockStateContainer.getBlock() instanceof BlockMachineBase) {
|
||||
final BlockMachineBase blockMachineBase = (BlockMachineBase) BlockStateContainer.getBlock();
|
||||
if (BlockStateContainer.get(BlockMachineBase.ACTIVE) != burnTime > 0) {
|
||||
|
@ -127,12 +127,12 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(Direction direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
public boolean canProvideEnergy(Direction direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer playerIn) {
|
||||
public ItemStack getToolDrop(PlayerEntity playerIn) {
|
||||
return TRContent.Machine.SOLID_FUEL_GENERATOR.getStack();
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr
|
|||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("generator").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).fuelSlot(0, 80, 54).energySlot(1, 8, 72).syncEnergyValue()
|
||||
.syncIntegerValue(this::getBurnTime, this::setBurnTime)
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
|
||||
package techreborn.tiles.generator.basic;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.registration.RebornRegister;
|
||||
|
@ -60,7 +60,7 @@ public class TileWaterMill extends TilePowerAcceptor implements IToolDrop {
|
|||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (world.getGameTime() % 20 == 0) {
|
||||
if (world.getTime() % 20 == 0) {
|
||||
checkForWater();
|
||||
}
|
||||
if (waterblocks > 0) {
|
||||
|
@ -74,7 +74,7 @@ public class TileWaterMill extends TilePowerAcceptor implements IToolDrop {
|
|||
|
||||
public void checkForWater() {
|
||||
waterblocks = 0;
|
||||
for (EnumFacing facing : EnumFacing.values()) {
|
||||
for (Direction facing : Direction.values()) {
|
||||
if (facing.getAxis().isHorizontal() && world.getBlockState(pos.offset(facing)).getBlock() == Blocks.WATER) {
|
||||
waterblocks++;
|
||||
}
|
||||
|
@ -87,12 +87,12 @@ public class TileWaterMill extends TilePowerAcceptor implements IToolDrop {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(Direction direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
public boolean canProvideEnergy(Direction direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ public class TileWaterMill extends TilePowerAcceptor implements IToolDrop {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer playerIn) {
|
||||
public ItemStack getToolDrop(PlayerEntity playerIn) {
|
||||
return TRContent.Machine.WATER_MILL.getStack();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
|
||||
package techreborn.tiles.generator.basic;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.registration.RebornRegister;
|
||||
|
@ -75,12 +75,12 @@ public class TileWindMill extends TilePowerAcceptor implements IToolDrop {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(Direction direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
public boolean canProvideEnergy(Direction direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class TileWindMill extends TilePowerAcceptor implements IToolDrop {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer playerIn) {
|
||||
public ItemStack getToolDrop(PlayerEntity playerIn) {
|
||||
return TRContent.Machine.WIND_MILL.getStack();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
package techreborn.tiles.lighting;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import techreborn.blocks.lighting.BlockLamp;
|
||||
|
@ -47,10 +47,10 @@ public class TileLamp extends TilePowerAcceptor
|
|||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (world == null || world.isRemote) {
|
||||
if (world == null || world.isClient) {
|
||||
return;
|
||||
}
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
BlockState state = world.getBlockState(pos);
|
||||
Block b = state.getBlock();
|
||||
if (b instanceof BlockLamp) {
|
||||
double cost = getEuPerTick(((BlockLamp) b).getCost());
|
||||
|
@ -70,13 +70,13 @@ public class TileLamp extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
EnumFacing me = BlockLamp.getFacing(world.getBlockState(pos)).getOpposite();
|
||||
public boolean canAcceptEnergy(final Direction direction) {
|
||||
Direction me = BlockLamp.getFacing(world.getBlockState(pos)).getOpposite();
|
||||
return direction == me;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
public boolean canProvideEnergy(final Direction direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ public class TileLamp extends TilePowerAcceptor
|
|||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
public ItemStack getToolDrop(final PlayerEntity entityPlayer) {
|
||||
return new ItemStack(world.getBlockState(pos).getBlock());
|
||||
}
|
||||
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
|
||||
package techreborn.tiles.machine.iron;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.entity.FurnaceBlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
|
@ -71,7 +71,7 @@ public class TileIronAlloyFurnace extends TileMachineBase
|
|||
if (stack.isEmpty()) {
|
||||
return 0;
|
||||
} else {
|
||||
return TileEntityFurnace.getBurnTimes().getOrDefault(stack.getItem(), 0);
|
||||
return FurnaceBlockEntity.getBurnTimes().getOrDefault(stack.getItem(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,13 +83,13 @@ public class TileIronAlloyFurnace extends TileMachineBase
|
|||
if (this.burnTime > 0) {
|
||||
--this.burnTime;
|
||||
}
|
||||
if (!this.world.isRemote) {
|
||||
if (this.burnTime != 0 || !inventory.getStackInSlot(this.input1).isEmpty()&& !inventory.getStackInSlot(this.fuel).isEmpty()) {
|
||||
if (!this.world.isClient) {
|
||||
if (this.burnTime != 0 || !inventory.getInvStack(this.input1).isEmpty()&& !inventory.getInvStack(this.fuel).isEmpty()) {
|
||||
if (this.burnTime == 0 && this.canSmelt()) {
|
||||
this.currentItemBurnTime = this.burnTime = TileIronAlloyFurnace.getItemBurnTime(inventory.getStackInSlot(this.fuel));
|
||||
this.currentItemBurnTime = this.burnTime = TileIronAlloyFurnace.getItemBurnTime(inventory.getInvStack(this.fuel));
|
||||
if (this.burnTime > 0) {
|
||||
flag1 = true;
|
||||
if (!inventory.getStackInSlot(this.fuel).isEmpty()) {
|
||||
if (!inventory.getInvStack(this.fuel).isEmpty()) {
|
||||
inventory.shrinkSlot(this.fuel, 1);
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ public class TileIronAlloyFurnace extends TileMachineBase
|
|||
for (RebornIngredient ingredient : recipeType.getRebornIngredients()) {
|
||||
boolean hasItem = false;
|
||||
for (int inputslot = 0; inputslot < 2; inputslot++) {
|
||||
if (ingredient.test(inventory.getStackInSlot(inputslot))) {
|
||||
if (ingredient.test(inventory.getInvStack(inputslot))) {
|
||||
hasItem = true;
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ public class TileIronAlloyFurnace extends TileMachineBase
|
|||
}
|
||||
|
||||
private boolean canSmelt() {
|
||||
if (inventory.getStackInSlot(this.input1).isEmpty() || inventory.getStackInSlot(this.input2).isEmpty()) {
|
||||
if (inventory.getInvStack(this.input1).isEmpty() || inventory.getInvStack(this.input2).isEmpty()) {
|
||||
return false;
|
||||
} else {
|
||||
ItemStack itemstack = null;
|
||||
|
@ -146,12 +146,12 @@ public class TileIronAlloyFurnace extends TileMachineBase
|
|||
|
||||
if (itemstack == null)
|
||||
return false;
|
||||
if (inventory.getStackInSlot(this.output).isEmpty())
|
||||
if (inventory.getInvStack(this.output).isEmpty())
|
||||
return true;
|
||||
if (!inventory.getStackInSlot(this.output).isItemEqual(itemstack))
|
||||
if (!inventory.getInvStack(this.output).isEqualIgnoreTags(itemstack))
|
||||
return false;
|
||||
final int result = inventory.getStackInSlot(this.output).getCount() + itemstack.getCount();
|
||||
return result <= inventory.getStackLimit() && result <= inventory.getStackInSlot(this.output).getMaxStackSize(); // Forge
|
||||
final int result = inventory.getInvStack(this.output).getAmount() + itemstack.getAmount();
|
||||
return result <= inventory.getStackLimit() && result <= inventory.getInvStack(this.output).getMaxAmount(); // Forge
|
||||
// BugFix:
|
||||
// Make
|
||||
// it
|
||||
|
@ -179,10 +179,10 @@ public class TileIronAlloyFurnace extends TileMachineBase
|
|||
}
|
||||
}
|
||||
|
||||
if (inventory.getStackInSlot(this.output).isEmpty()) {
|
||||
if (inventory.getInvStack(this.output).isEmpty()) {
|
||||
inventory.setStackInSlot(this.output, itemstack.copy());
|
||||
} else if (inventory.getStackInSlot(this.output).getItem() == itemstack.getItem()) {
|
||||
inventory.shrinkSlot(this.output, -itemstack.getCount());
|
||||
} else if (inventory.getInvStack(this.output).getItem() == itemstack.getItem()) {
|
||||
inventory.shrinkSlot(this.output, -itemstack.getAmount());
|
||||
}
|
||||
|
||||
for (final Recipe recipeType : ModRecipes.ALLOY_SMELTER.getRecipes(world)) {
|
||||
|
@ -195,7 +195,7 @@ public class TileIronAlloyFurnace extends TileMachineBase
|
|||
if (hasAllRecipes) {
|
||||
for (RebornIngredient ingredient : recipeType.getRebornIngredients()) {
|
||||
for (int inputSlot = 0; inputSlot < 2; inputSlot++) {
|
||||
if (ingredient.test(this.inventory.getStackInSlot(inputSlot))) {
|
||||
if (ingredient.test(this.inventory.getInvStack(inputSlot))) {
|
||||
inventory.shrinkSlot(inputSlot, ingredient.getSize());
|
||||
break;
|
||||
}
|
||||
|
@ -228,12 +228,12 @@ public class TileIronAlloyFurnace extends TileMachineBase
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing() {
|
||||
public Direction getFacing() {
|
||||
return this.getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
public ItemStack getToolDrop(final PlayerEntity entityPlayer) {
|
||||
return TRContent.Machine.IRON_ALLOY_FURNACE.getStack();
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ public class TileIronAlloyFurnace extends TileMachineBase
|
|||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("alloyfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this)
|
||||
.filterSlot(0, 47, 17,
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
|
||||
package techreborn.tiles.machine.iron;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.FurnaceBlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraftforge.common.crafting.VanillaRecipeTypes;
|
||||
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
|
@ -76,7 +76,7 @@ public class TileIronFurnace extends TileMachineBase
|
|||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if(world.isRemote){
|
||||
if(world.isClient){
|
||||
return;
|
||||
}
|
||||
final boolean burning = this.isBurning();
|
||||
|
@ -86,15 +86,15 @@ public class TileIronFurnace extends TileMachineBase
|
|||
this.updateState();
|
||||
}
|
||||
if (this.fuel <= 0 && this.canSmelt()) {
|
||||
this.fuel = this.fuelGague = (int) (TileEntityFurnace.getBurnTimes().getOrDefault(inventory.getStackInSlot(this.fuelslot).getItem(), 0) * 1.25);
|
||||
this.fuel = this.fuelGague = (int) (FurnaceBlockEntity.getBurnTimes().getOrDefault(inventory.getInvStack(this.fuelslot).getItem(), 0) * 1.25);
|
||||
if (this.fuel > 0) {
|
||||
// Fuel slot
|
||||
ItemStack fuelStack = inventory.getStackInSlot(this.fuelslot);
|
||||
if (fuelStack.getItem().hasContainerItem(fuelStack)) {
|
||||
inventory.setStackInSlot(this.fuelslot, new ItemStack(fuelStack.getItem().getContainerItem()));
|
||||
} else if (fuelStack.getCount() > 1) {
|
||||
ItemStack fuelStack = inventory.getInvStack(this.fuelslot);
|
||||
if (fuelStack.getItem().hasRecipeRemainder(fuelStack)) {
|
||||
inventory.setStackInSlot(this.fuelslot, new ItemStack(fuelStack.getItem().getRecipeRemainder()));
|
||||
} else if (fuelStack.getAmount() > 1) {
|
||||
inventory.shrinkSlot(this.fuelslot, 1);
|
||||
} else if (fuelStack.getCount() == 1) {
|
||||
} else if (fuelStack.getAmount() == 1) {
|
||||
inventory.setStackInSlot(this.fuelslot, ItemStack.EMPTY);
|
||||
}
|
||||
updateInventory = true;
|
||||
|
@ -120,14 +120,14 @@ public class TileIronFurnace extends TileMachineBase
|
|||
|
||||
public void cookItems() {
|
||||
if (this.canSmelt()) {
|
||||
final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, VanillaRecipeTypes.SMELTING, inventory.getStackInSlot(this.input1));
|
||||
final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, VanillaRecipeTypes.SMELTING, inventory.getInvStack(this.input1));
|
||||
|
||||
if (inventory.getStackInSlot(this.output).isEmpty()) {
|
||||
if (inventory.getInvStack(this.output).isEmpty()) {
|
||||
inventory.setStackInSlot(this.output, itemstack.copy());
|
||||
} else if (inventory.getStackInSlot(this.output).isItemEqual(itemstack)) {
|
||||
inventory.getStackInSlot(this.output).grow(itemstack.getCount());
|
||||
} else if (inventory.getInvStack(this.output).isEqualIgnoreTags(itemstack)) {
|
||||
inventory.getInvStack(this.output).addAmount(itemstack.getAmount());
|
||||
}
|
||||
if (inventory.getStackInSlot(this.input1).getCount() > 1) {
|
||||
if (inventory.getInvStack(this.input1).getAmount() > 1) {
|
||||
inventory.shrinkSlot(this.input1, 1);
|
||||
} else {
|
||||
inventory.setStackInSlot(this.input1, ItemStack.EMPTY);
|
||||
|
@ -136,17 +136,17 @@ public class TileIronFurnace extends TileMachineBase
|
|||
}
|
||||
|
||||
public boolean canSmelt() {
|
||||
if (inventory.getStackInSlot(this.input1).isEmpty())
|
||||
if (inventory.getInvStack(this.input1).isEmpty())
|
||||
return false;
|
||||
final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, VanillaRecipeTypes.SMELTING, inventory.getStackInSlot(this.input1));
|
||||
final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, VanillaRecipeTypes.SMELTING, inventory.getInvStack(this.input1));
|
||||
if (itemstack.isEmpty())
|
||||
return false;
|
||||
if (inventory.getStackInSlot(this.output).isEmpty())
|
||||
if (inventory.getInvStack(this.output).isEmpty())
|
||||
return true;
|
||||
if (!inventory.getStackInSlot(this.output).isItemEqual(itemstack))
|
||||
if (!inventory.getInvStack(this.output).isEqualIgnoreTags(itemstack))
|
||||
return false;
|
||||
final int result = inventory.getStackInSlot(this.output).getCount() + itemstack.getCount();
|
||||
return result <= inventory.getStackLimit() && result <= itemstack.getMaxStackSize();
|
||||
final int result = inventory.getInvStack(this.output).getAmount() + itemstack.getAmount();
|
||||
return result <= inventory.getStackLimit() && result <= itemstack.getMaxAmount();
|
||||
}
|
||||
|
||||
public boolean isBurning() {
|
||||
|
@ -162,7 +162,7 @@ public class TileIronFurnace extends TileMachineBase
|
|||
}
|
||||
|
||||
public void updateState() {
|
||||
final IBlockState BlockStateContainer = this.world.getBlockState(this.pos);
|
||||
final BlockState BlockStateContainer = this.world.getBlockState(this.pos);
|
||||
if (BlockStateContainer.getBlock() instanceof BlockMachineBase) {
|
||||
final BlockMachineBase blockMachineBase = (BlockMachineBase) BlockStateContainer.getBlock();
|
||||
if (BlockStateContainer.get(BlockMachineBase.ACTIVE) != this.fuel > 0)
|
||||
|
@ -178,10 +178,10 @@ public class TileIronFurnace extends TileMachineBase
|
|||
public static IInventoryAccess<TileIronFurnace> getInvetoryAccess(){
|
||||
return (slotID, stack, face, direction, tile) -> {
|
||||
if(direction == IInventoryAccess.AccessDirection.INSERT){
|
||||
boolean isFuel = TileEntityFurnace.isItemFuel(stack);
|
||||
boolean isFuel = FurnaceBlockEntity.isItemFuel(stack);
|
||||
if(isFuel){
|
||||
ItemStack fuelSlotStack = tile.inventory.getStackInSlot(tile.fuelslot);
|
||||
if(fuelSlotStack.isEmpty() || ItemUtils.isItemEqual(stack, fuelSlotStack, true, true) && fuelSlotStack.getMaxStackSize() != fuelSlotStack.getCount()){
|
||||
ItemStack fuelSlotStack = tile.inventory.getInvStack(tile.fuelslot);
|
||||
if(fuelSlotStack.isEmpty() || ItemUtils.isItemEqual(stack, fuelSlotStack, true, true) && fuelSlotStack.getMaxAmount() != fuelSlotStack.getAmount()){
|
||||
return slotID == tile.fuelslot;
|
||||
}
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ public class TileIronFurnace extends TileMachineBase
|
|||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("ironfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).fuelSlot(2, 56, 53).slot(0, 56, 17).outputSlot(1, 116, 35)
|
||||
.syncIntegerValue(this::getBurnTime, this::setBurnTime)
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
package techreborn.tiles.machine.multiblock;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.init.TRContent;
|
||||
|
@ -68,10 +68,10 @@ public class MultiblockChecker {
|
|||
|
||||
public boolean checkAir(int offX, int offY, int offZ) {
|
||||
BlockPos pos = downCenter.add(offX, offY, offZ);
|
||||
return world.isAirBlock(pos);
|
||||
return world.isAir(pos);
|
||||
}
|
||||
|
||||
public IBlockState getBlock(int offX, int offY, int offZ) {
|
||||
public BlockState getBlock(int offX, int offY, int offZ) {
|
||||
BlockPos pos = downCenter.add(offX, offY, offZ);
|
||||
return world.getBlockState(pos);
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
package techreborn.tiles.machine.multiblock;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
|
@ -41,21 +41,21 @@ import techreborn.init.TRTileEntities;
|
|||
import techreborn.tiles.TileGenericMachine;
|
||||
|
||||
@RebornRegister(TechReborn.MOD_ID)
|
||||
public class TileDistillationTower extends TileGenericMachine implements IContainerProvider {
|
||||
public class TileEnvTypeillationTower extends TileGenericMachine implements IContainerProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "distillation_tower", key = "DistillationTowerMaxInput", comment = "Distillation Tower Max Input (Value in EU)")
|
||||
@ConfigRegistry(config = "machines", category = "EnvTypeillation_tower", key = "EnvTypeillationTowerMaxInput", comment = "EnvTypeillation Tower Max Input (Value in EU)")
|
||||
public static int maxInput = 128;
|
||||
@ConfigRegistry(config = "machines", category = "distillation_tower", key = "DistillationTowerMaxEnergy", comment = "Distillation Tower Max Energy (Value in EU)")
|
||||
@ConfigRegistry(config = "machines", category = "EnvTypeillation_tower", key = "EnvTypeillationTowerMaxEnergy", comment = "EnvTypeillation Tower Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 10_000;
|
||||
|
||||
public MultiblockChecker multiblockChecker;
|
||||
|
||||
public TileDistillationTower() {
|
||||
super(TRTileEntities.DISTILLATION_TOWER,"DistillationTower", maxInput, maxEnergy, TRContent.Machine.DISTILLATION_TOWER.block, 6);
|
||||
public TileEnvTypeillationTower() {
|
||||
super(TRTileEntities.EnvTypeILLATION_TOWER,"EnvTypeillationTower", maxInput, maxEnergy, TRContent.Machine.EnvTypeILLATION_TOWER.block, 6);
|
||||
final int[] inputs = new int[] { 0, 1 };
|
||||
final int[] outputs = new int[] { 2, 3, 4, 5 };
|
||||
this.inventory = new Inventory<>(7, "TileDistillationTower", 64, this).withConfiguredAccess();
|
||||
this.crafter = new RecipeCrafter(ModRecipes.DISTILLATION_TOWER, this, 2, 4, this.inventory, inputs, outputs);
|
||||
this.inventory = new Inventory<>(7, "TileEnvTypeillationTower", 64, this).withConfiguredAccess();
|
||||
this.crafter = new RecipeCrafter(ModRecipes.EnvTypeILLATION_TOWER, this, 2, 4, this.inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
public boolean getMutliBlock() {
|
||||
|
@ -81,15 +81,15 @@ public class TileDistillationTower extends TileGenericMachine implements IContai
|
|||
multiblockChecker = new MultiblockChecker(world, downCenter);
|
||||
}
|
||||
|
||||
if (!world.isRemote && getMutliBlock()){
|
||||
if (!world.isClient && getMutliBlock()){
|
||||
super.tick();
|
||||
}
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("distillationtower").player(player.inventory).inventory().hotbar().addInventory()
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("EnvTypeillationtower").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 35, 27).slot(1, 35, 47).outputSlot(2, 79, 37).outputSlot(3, 99, 37)
|
||||
.outputSlot(4, 119, 37).outputSlot(5, 139, 37).energySlot(6, 8, 72).syncEnergyValue().syncCrafterValue()
|
||||
.addInventory().create(this);
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
package techreborn.tiles.machine.multiblock;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
|
@ -90,8 +90,8 @@ public class TileFluidReplicator extends TileGenericMachine implements IContaine
|
|||
|
||||
ticksSinceLastChange++;
|
||||
// Check cells input slot 2 time per second
|
||||
if (!world.isRemote && ticksSinceLastChange >= 10) {
|
||||
if (!inventory.getStackInSlot(1).isEmpty()) {
|
||||
if (!world.isClient && ticksSinceLastChange >= 10) {
|
||||
if (!inventory.getInvStack(1).isEmpty()) {
|
||||
FluidUtils.fillContainers(tank, inventory, 1, 2, tank.getFluidType());
|
||||
}
|
||||
ticksSinceLastChange = 0;
|
||||
|
@ -111,14 +111,14 @@ public class TileFluidReplicator extends TileGenericMachine implements IContaine
|
|||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void read(final NBTTagCompound tagCompound) {
|
||||
super.read(tagCompound);
|
||||
public void fromTag(final CompoundTag tagCompound) {
|
||||
super.fromTag(tagCompound);
|
||||
tank.read(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound write(final NBTTagCompound tagCompound) {
|
||||
super.write(tagCompound);
|
||||
public CompoundTag toTag(final CompoundTag tagCompound) {
|
||||
super.toTag(tagCompound);
|
||||
tank.write(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ public class TileFluidReplicator extends TileGenericMachine implements IContaine
|
|||
private static IInventoryAccess<TileFluidReplicator> getInventoryAccess(){
|
||||
return (slotID, stack, face, direction, tile) -> {
|
||||
if(slotID == 0){
|
||||
return stack.isItemEqual(TRContent.Parts.UU_MATTER.getStack());
|
||||
return stack.isEqualIgnoreTags(TRContent.Parts.UU_MATTER.getStack());
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
@ -141,9 +141,9 @@ public class TileFluidReplicator extends TileGenericMachine implements IContaine
|
|||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(EntityPlayer player) {
|
||||
public BuiltContainer createContainer(PlayerEntity player) {
|
||||
return new ContainerBuilder("fluidreplicator").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).fluidSlot(1, 124, 35).filterSlot(0, 55, 45, stack -> stack.isItemEqual(TRContent.Parts.UU_MATTER.getStack()))
|
||||
.tile(this).fluidSlot(1, 124, 35).filterSlot(0, 55, 45, stack -> stack.isEqualIgnoreTags(TRContent.Parts.UU_MATTER.getStack()))
|
||||
.outputSlot(2, 124, 55).energySlot(3, 8, 72).syncEnergyValue().syncCrafterValue().addInventory()
|
||||
.create(this);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.tiles.machine.multiblock;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
|
@ -74,14 +74,14 @@ public class TileImplosionCompressor extends TileGenericMachine implements ICont
|
|||
multiblockChecker = new MultiblockChecker(world, pos.down(3));
|
||||
}
|
||||
|
||||
if (!world.isRemote && getMutliBlock()){
|
||||
if (!world.isClient && getMutliBlock()){
|
||||
super.tick();
|
||||
}
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("implosioncompressor").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 50, 27).slot(1, 50, 47).outputSlot(2, 92, 36).outputSlot(3, 110, 36)
|
||||
.energySlot(4, 8, 72).syncEnergyValue().syncCrafterValue().addInventory().create(this);
|
||||
|
|
|
@ -24,13 +24,13 @@
|
|||
|
||||
package techreborn.tiles.machine.multiblock;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.client.network.packet.BlockEntityUpdateS2CPacket;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
|
@ -74,7 +74,7 @@ public class TileIndustrialBlastFurnace extends TileGenericMachine implements IC
|
|||
|
||||
// Bottom center of multiblock
|
||||
final BlockPos location = pos.offset(getFacing().getOpposite(), 2);
|
||||
final TileEntity tileEntity = world.getTileEntity(location);
|
||||
final BlockEntity tileEntity = world.getBlockEntity(location);
|
||||
|
||||
if (tileEntity instanceof TileMachineCasing) {
|
||||
if (((TileMachineCasing) tileEntity).isConnected()
|
||||
|
@ -90,11 +90,11 @@ public class TileIndustrialBlastFurnace extends TileGenericMachine implements IC
|
|||
}
|
||||
|
||||
for (final IMultiblockPart part : casing.connectedParts) {
|
||||
heat += BlockMachineCasing.getHeatFromState(part.getBlockState());
|
||||
heat += BlockMachineCasing.getHeatFromState(part.getCachedState());
|
||||
}
|
||||
|
||||
if (world.getBlockState(location.offset(EnumFacing.UP, 1)).getBlock().getTranslationKey().equals("tile.lava")
|
||||
&& world.getBlockState(location.offset(EnumFacing.UP, 2)).getBlock().getTranslationKey().equals("tile.lava")) {
|
||||
if (world.getBlockState(location.offset(Direction.UP, 1)).getBlock().getTranslationKey().equals("tile.lava")
|
||||
&& world.getBlockState(location.offset(Direction.UP, 2)).getBlock().getTranslationKey().equals("tile.lava")) {
|
||||
heat += 500;
|
||||
}
|
||||
return heat;
|
||||
|
@ -142,14 +142,14 @@ public class TileIndustrialBlastFurnace extends TileGenericMachine implements IC
|
|||
|
||||
// TileMachineBase
|
||||
@Override
|
||||
public void onDataPacket(final NetworkManager net, final SPacketUpdateTileEntity packet) {
|
||||
public void onDataPacket(final ClientConnection net, final BlockEntityUpdateS2CPacket packet) {
|
||||
world.markBlockRangeForRenderUpdate(pos.getX(), pos.getY(), pos.getZ(), pos.getX(), pos.getY(), pos.getZ());
|
||||
read(packet.getNbtCompound());
|
||||
fromTag(packet.getCompoundTag());
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("blastfurnace").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 50, 27).slot(1, 50, 47).outputSlot(2, 93, 37).outputSlot(3, 113, 37)
|
||||
.energySlot(4, 8, 72).syncEnergyValue().syncCrafterValue()
|
||||
|
|
|
@ -24,14 +24,14 @@
|
|||
|
||||
package techreborn.tiles.machine.multiblock;
|
||||
|
||||
import net.minecraft.block.BlockFlowingFluid;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.FluidBlock;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
|
||||
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
|
@ -80,8 +80,8 @@ public class TileIndustrialGrinder extends TileGenericMachine implements IContai
|
|||
final boolean down = multiblockChecker.checkRectY(1, 1, MultiblockChecker.STANDARD_CASING, MultiblockChecker.ZERO_OFFSET);
|
||||
final boolean up = multiblockChecker.checkRectY(1, 1, MultiblockChecker.STANDARD_CASING, new BlockPos(0, 2, 0));
|
||||
final boolean blade = multiblockChecker.checkRingY(1, 1, MultiblockChecker.REINFORCED_CASING, new BlockPos(0, 1, 0));
|
||||
final IBlockState centerBlock = multiblockChecker.getBlock(0, 1, 0);
|
||||
final boolean center = ((centerBlock.getBlock() instanceof BlockFlowingFluid
|
||||
final BlockState centerBlock = multiblockChecker.getBlock(0, 1, 0);
|
||||
final boolean center = ((centerBlock.getBlock() instanceof FluidBlock
|
||||
|| centerBlock.getBlock() instanceof IFluidBlock)
|
||||
&& centerBlock.getMaterial() == Material.WATER);
|
||||
return down && center && blade && up;
|
||||
|
@ -106,15 +106,15 @@ public class TileIndustrialGrinder extends TileGenericMachine implements IContai
|
|||
|
||||
ticksSinceLastChange++;
|
||||
// Check cells input slot 2 time per second
|
||||
if (!world.isRemote && ticksSinceLastChange >= 10) {
|
||||
if (!inventory.getStackInSlot(1).isEmpty()) {
|
||||
if (!world.isClient && ticksSinceLastChange >= 10) {
|
||||
if (!inventory.getInvStack(1).isEmpty()) {
|
||||
FluidUtils.drainContainers(tank, inventory, 1, 6);
|
||||
FluidUtils.fillContainers(tank, inventory, 1, 6, tank.getFluidType());
|
||||
}
|
||||
ticksSinceLastChange = 0;
|
||||
}
|
||||
|
||||
if (!world.isRemote && getMultiBlock()) {
|
||||
if (!world.isClient && getMultiBlock()) {
|
||||
super.tick();
|
||||
}
|
||||
|
||||
|
@ -122,14 +122,14 @@ public class TileIndustrialGrinder extends TileGenericMachine implements IContai
|
|||
}
|
||||
|
||||
@Override
|
||||
public void read(final NBTTagCompound tagCompound) {
|
||||
super.read(tagCompound);
|
||||
public void fromTag(final CompoundTag tagCompound) {
|
||||
super.fromTag(tagCompound);
|
||||
tank.read(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound write(final NBTTagCompound tagCompound) {
|
||||
super.write(tagCompound);
|
||||
public CompoundTag toTag(final CompoundTag tagCompound) {
|
||||
super.toTag(tagCompound);
|
||||
tank.write(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ public class TileIndustrialGrinder extends TileGenericMachine implements IContai
|
|||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
// fluidSlot first to support automation and shift-click
|
||||
return new ContainerBuilder("industrialgrinder").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).fluidSlot(1, 34, 35).slot(0, 84, 43).outputSlot(2, 126, 18).outputSlot(3, 126, 36)
|
||||
|
|
|
@ -24,14 +24,14 @@
|
|||
|
||||
package techreborn.tiles.machine.multiblock;
|
||||
|
||||
import net.minecraft.block.BlockFlowingFluid;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.FluidBlock;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
|
||||
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
|
@ -81,8 +81,8 @@ public class TileIndustrialSawmill extends TileGenericMachine implements IContai
|
|||
final boolean down = multiblockChecker.checkRectY(1, 1, MultiblockChecker.STANDARD_CASING, MultiblockChecker.ZERO_OFFSET);
|
||||
final boolean up = multiblockChecker.checkRectY(1, 1, MultiblockChecker.STANDARD_CASING, new BlockPos(0, 2, 0));
|
||||
final boolean blade = multiblockChecker.checkRingY(1, 1, MultiblockChecker.REINFORCED_CASING, new BlockPos(0, 1, 0));
|
||||
final IBlockState centerBlock = multiblockChecker.getBlock(0, 1, 0);
|
||||
final boolean center = ((centerBlock.getBlock() instanceof BlockFlowingFluid
|
||||
final BlockState centerBlock = multiblockChecker.getBlock(0, 1, 0);
|
||||
final boolean center = ((centerBlock.getBlock() instanceof FluidBlock
|
||||
|| centerBlock.getBlock() instanceof IFluidBlock)
|
||||
&& centerBlock.getMaterial() == Material.WATER);
|
||||
return down && center && blade && up;
|
||||
|
@ -98,15 +98,15 @@ public class TileIndustrialSawmill extends TileGenericMachine implements IContai
|
|||
|
||||
ticksSinceLastChange++;
|
||||
// Check cells input slot 2 time per second
|
||||
if (!world.isRemote && ticksSinceLastChange >= 10) {
|
||||
if (!inventory.getStackInSlot(1).isEmpty()) {
|
||||
if (!world.isClient && ticksSinceLastChange >= 10) {
|
||||
if (!inventory.getInvStack(1).isEmpty()) {
|
||||
FluidUtils.drainContainers(tank, inventory, 1, 5);
|
||||
FluidUtils.fillContainers(tank, inventory, 1, 5, tank.getFluidType());
|
||||
}
|
||||
ticksSinceLastChange = 0;
|
||||
}
|
||||
|
||||
if (!world.isRemote && getMutliBlock()) {
|
||||
if (!world.isClient && getMutliBlock()) {
|
||||
super.tick();
|
||||
}
|
||||
|
||||
|
@ -115,14 +115,14 @@ public class TileIndustrialSawmill extends TileGenericMachine implements IContai
|
|||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void read(final NBTTagCompound tagCompound) {
|
||||
super.read(tagCompound);
|
||||
public void fromTag(final CompoundTag tagCompound) {
|
||||
super.fromTag(tagCompound);
|
||||
tank.read(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound write(final NBTTagCompound tagCompound) {
|
||||
super.write(tagCompound);
|
||||
public CompoundTag toTag(final CompoundTag tagCompound) {
|
||||
super.toTag(tagCompound);
|
||||
tank.write(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ public class TileIndustrialSawmill extends TileGenericMachine implements IContai
|
|||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("industrialsawmill").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).fluidSlot(1, 34, 35).slot(0, 84, 43).outputSlot(2, 126, 25).outputSlot(3, 126, 43)
|
||||
.outputSlot(4, 126, 61).outputSlot(5, 34, 55).energySlot(6, 8, 72).syncEnergyValue().syncCrafterValue()
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.tiles.machine.multiblock;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
|
@ -70,7 +70,7 @@ public class TileVacuumFreezer extends TileGenericMachine implements IContainerP
|
|||
// TileGenericMachine
|
||||
@Override
|
||||
public void tick() {
|
||||
if (!world.isRemote && getMultiBlock()) {
|
||||
if (!world.isClient && getMultiBlock()) {
|
||||
super.tick();
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public class TileVacuumFreezer extends TileGenericMachine implements IContainerP
|
|||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("vacuumfreezer").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue()
|
||||
.syncCrafterValue().addInventory().create(this);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.tiles.machine.tier1;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
|
@ -56,7 +56,7 @@ public class TileAlloySmelter extends TileGenericMachine implements IContainerPr
|
|||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("alloysmelter").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this)
|
||||
.filterSlot(0, 34, 47,
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.tiles.machine.tier1;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
|
@ -56,7 +56,7 @@ public class TileAssemblingMachine extends TileGenericMachine implements IContai
|
|||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("assemblingmachine").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this).slot(0, 55, 35).slot(1, 55, 55).outputSlot(2, 101, 45).energySlot(3, 8, 72)
|
||||
.syncEnergyValue().syncCrafterValue().addInventory().create(this);
|
||||
|
|
|
@ -24,17 +24,17 @@
|
|||
|
||||
package techreborn.tiles.machine.tier1;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.container.Container;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraftforge.common.crafting.VanillaRecipeTypes;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.recipe.Recipe;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
|
@ -74,9 +74,9 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
public int maxProgress = 120;
|
||||
public int euTick = 10;
|
||||
|
||||
InventoryCrafting inventoryCrafting = null;
|
||||
IRecipe lastCustomRecipe = null;
|
||||
IRecipe lastRecipe = null;
|
||||
CraftingInventory inventoryCrafting = null;
|
||||
Recipe lastCustomRecipe = null;
|
||||
Recipe lastRecipe = null;
|
||||
|
||||
public boolean locked = true;
|
||||
|
||||
|
@ -85,15 +85,15 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Nullable
|
||||
public IRecipe getIRecipe() {
|
||||
InventoryCrafting crafting = getCraftingInventory();
|
||||
if (!crafting.isEmpty()) {
|
||||
public Recipe getIRecipe() {
|
||||
CraftingInventory crafting = getCraftingInventory();
|
||||
if (!crafting.isInvEmpty()) {
|
||||
if (lastRecipe != null) {
|
||||
if (lastRecipe.matches(crafting, world)) {
|
||||
return lastRecipe;
|
||||
}
|
||||
}
|
||||
for (IRecipe testRecipe : TRRecipeHandler.getRecipes(world, VanillaRecipeTypes.CRAFTING)) {
|
||||
for (Recipe testRecipe : TRRecipeHandler.getRecipes(world, VanillaRecipeTypes.CRAFTING)) {
|
||||
if (testRecipe.matches(crafting, world)) {
|
||||
lastRecipe = testRecipe;
|
||||
return testRecipe;
|
||||
|
@ -103,41 +103,41 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
return null;
|
||||
}
|
||||
|
||||
public InventoryCrafting getCraftingInventory() {
|
||||
public CraftingInventory getCraftingInventory() {
|
||||
if (inventoryCrafting == null) {
|
||||
inventoryCrafting = new InventoryCrafting(new Container() {
|
||||
inventoryCrafting = new CraftingInventory(new Container() {
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer playerIn) {
|
||||
public boolean canUse(PlayerEntity playerIn) {
|
||||
return false;
|
||||
}
|
||||
}, 3, 3);
|
||||
}
|
||||
for (int i = 0; i < 9; i++) {
|
||||
inventoryCrafting.setInventorySlotContents(i, inventory.getStackInSlot(i));
|
||||
inventoryCrafting.setInvStack(i, inventory.getInvStack(i));
|
||||
}
|
||||
return inventoryCrafting;
|
||||
}
|
||||
|
||||
public boolean canMake(IRecipe recipe) {
|
||||
if (recipe != null && recipe.canFit(3, 3)) {
|
||||
public boolean canMake(Recipe recipe) {
|
||||
if (recipe != null && recipe.fits(3, 3)) {
|
||||
boolean missingOutput = false;
|
||||
int[] stacksInSlots = new int[9];
|
||||
for (int i = 0; i < 9; i++) {
|
||||
stacksInSlots[i] = inventory.getStackInSlot(i).getCount();
|
||||
stacksInSlots[i] = inventory.getInvStack(i).getAmount();
|
||||
}
|
||||
for (Ingredient ingredient : recipe.getIngredients()) {
|
||||
for (Ingredient ingredient : recipe.getPreviewInputs()) {
|
||||
if (ingredient != Ingredient.EMPTY) {
|
||||
boolean foundIngredient = false;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
ItemStack stack = inventory.getInvStack(i);
|
||||
int requiredSize = locked ? 1 : 0;
|
||||
if (stack.getMaxStackSize() == 1) {
|
||||
if (stack.getMaxAmount() == 1) {
|
||||
requiredSize = 0;
|
||||
}
|
||||
if (stacksInSlots[i] > requiredSize) {
|
||||
if (ingredient.test(stack)) {
|
||||
if (stack.getItem().getContainerItem() != null) {
|
||||
if (!hasRoomForExtraItem(stack.getItem().getContainerItem(stack))) {
|
||||
if (ingredient.method_8093(stack)) {
|
||||
if (stack.getItem().getRecipeRemainder() != null) {
|
||||
if (!hasRoomForExtraItem(stack.getItem().getRecipeRemainder(stack))) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
}
|
||||
}
|
||||
if (!missingOutput) {
|
||||
if (hasOutputSpace(recipe.getRecipeOutput(), 9)) {
|
||||
if (hasOutputSpace(recipe.getOutput(), 9)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
boolean hasRoomForExtraItem(ItemStack stack) {
|
||||
ItemStack extraOutputSlot = inventory.getStackInSlot(10);
|
||||
ItemStack extraOutputSlot = inventory.getInvStack(10);
|
||||
if (extraOutputSlot.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -171,35 +171,35 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
public boolean hasOutputSpace(ItemStack output, int slot) {
|
||||
ItemStack stack = inventory.getStackInSlot(slot);
|
||||
ItemStack stack = inventory.getInvStack(slot);
|
||||
if (stack.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
if (ItemUtils.isItemEqual(stack, output, true, true)) {
|
||||
if (stack.getMaxStackSize() > stack.getCount() + output.getCount()) {
|
||||
if (stack.getMaxAmount() > stack.getAmount() + output.getAmount()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean make(IRecipe recipe) {
|
||||
public boolean make(Recipe recipe) {
|
||||
if (recipe == null || !canMake(recipe)) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < recipe.getIngredients().size(); i++) {
|
||||
Ingredient ingredient = recipe.getIngredients().get(i);
|
||||
for (int i = 0; i < recipe.getPreviewInputs().size(); i++) {
|
||||
Ingredient ingredient = recipe.getPreviewInputs().get(i);
|
||||
// Looks for the best slot to take it from
|
||||
ItemStack bestSlot = inventory.getStackInSlot(i);
|
||||
if (ingredient.test(bestSlot)) {
|
||||
ItemStack bestSlot = inventory.getInvStack(i);
|
||||
if (ingredient.method_8093(bestSlot)) {
|
||||
handleContainerItem(bestSlot);
|
||||
bestSlot.shrink(1);
|
||||
bestSlot.subtractAmount(1);
|
||||
} else {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
ItemStack stack = inventory.getStackInSlot(j);
|
||||
if (ingredient.test(stack)) {
|
||||
ItemStack stack = inventory.getInvStack(j);
|
||||
if (ingredient.method_8093(stack)) {
|
||||
handleContainerItem(stack);
|
||||
stack.shrink(1); // TODO is this right? or do I need
|
||||
stack.subtractAmount(1); // TODO is this right? or do I need
|
||||
// to use it as an actull
|
||||
// crafting grid
|
||||
break;
|
||||
|
@ -207,28 +207,28 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
}
|
||||
}
|
||||
}
|
||||
ItemStack output = inventory.getStackInSlot(9);
|
||||
ItemStack output = inventory.getInvStack(9);
|
||||
// TODO fire forge recipe event
|
||||
ItemStack ouputStack = recipe.getCraftingResult(getCraftingInventory());
|
||||
ItemStack ouputStack = recipe.craft(getCraftingInventory());
|
||||
if (output.isEmpty()) {
|
||||
inventory.setStackInSlot(9, ouputStack.copy());
|
||||
} else {
|
||||
// TODO use ouputStack in someway?
|
||||
output.grow(recipe.getRecipeOutput().getCount());
|
||||
output.addAmount(recipe.getOutput().getAmount());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void handleContainerItem(ItemStack stack) {
|
||||
if (stack.getItem().hasContainerItem(stack)) {
|
||||
ItemStack containerItem = stack.getItem().getContainerItem(stack);
|
||||
ItemStack extraOutputSlot = inventory.getStackInSlot(10);
|
||||
if (stack.getItem().hasRecipeRemainder(stack)) {
|
||||
ItemStack containerItem = stack.getItem().getRecipeRemainder(stack);
|
||||
ItemStack extraOutputSlot = inventory.getInvStack(10);
|
||||
if (hasOutputSpace(containerItem, 10)) {
|
||||
if (extraOutputSlot.isEmpty()) {
|
||||
inventory.setStackInSlot(10, containerItem.copy());
|
||||
} else if (ItemUtils.isItemEqual(extraOutputSlot, containerItem, true, true)
|
||||
&& extraOutputSlot.getMaxStackSize() < extraOutputSlot.getCount() + containerItem.getCount()) {
|
||||
extraOutputSlot.grow(1);
|
||||
&& extraOutputSlot.getMaxAmount() < extraOutputSlot.getAmount() + containerItem.getAmount()) {
|
||||
extraOutputSlot.addAmount(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -236,15 +236,15 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
|
||||
public boolean hasIngredient(Ingredient ingredient) {
|
||||
for (int i = 0; i < 9; i++) {
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
if (ingredient.test(stack)) {
|
||||
ItemStack stack = inventory.getInvStack(i);
|
||||
if (ingredient.method_8093(stack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isItemValidForRecipeSlot(IRecipe recipe, ItemStack stack, int slotID) {
|
||||
public boolean isItemValidForRecipeSlot(Recipe recipe, ItemStack stack, int slotID) {
|
||||
if (recipe == null) {
|
||||
return true;
|
||||
}
|
||||
|
@ -255,19 +255,19 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
return true;
|
||||
}
|
||||
|
||||
public int findBestSlotForStack(IRecipe recipe, ItemStack stack) {
|
||||
public int findBestSlotForStack(Recipe recipe, ItemStack stack) {
|
||||
if (recipe == null) {
|
||||
return -1;
|
||||
}
|
||||
List<Integer> possibleSlots = new ArrayList<>();
|
||||
for (int i = 0; i < recipe.getIngredients().size(); i++) {
|
||||
ItemStack stackInSlot = inventory.getStackInSlot(i);
|
||||
Ingredient ingredient = recipe.getIngredients().get(i);
|
||||
if (ingredient != Ingredient.EMPTY && ingredient.test(stack)) {
|
||||
for (int i = 0; i < recipe.getPreviewInputs().size(); i++) {
|
||||
ItemStack stackInSlot = inventory.getInvStack(i);
|
||||
Ingredient ingredient = recipe.getPreviewInputs().get(i);
|
||||
if (ingredient != Ingredient.EMPTY && ingredient.method_8093(stack)) {
|
||||
if (stackInSlot.isEmpty()) {
|
||||
possibleSlots.add(i);
|
||||
} else if (stackInSlot.getItem() == stack.getItem()) {
|
||||
if (stackInSlot.getMaxStackSize() >= stackInSlot.getCount() + stack.getCount()) {
|
||||
if (stackInSlot.getMaxAmount() >= stackInSlot.getAmount() + stack.getAmount()) {
|
||||
possibleSlots.add(i);
|
||||
}
|
||||
}
|
||||
|
@ -276,14 +276,14 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
// Slot, count
|
||||
Pair<Integer, Integer> smallestCount = null;
|
||||
for (Integer slot : possibleSlots) {
|
||||
ItemStack slotStack = inventory.getStackInSlot(slot);
|
||||
ItemStack slotStack = inventory.getInvStack(slot);
|
||||
if (slotStack.isEmpty()) {
|
||||
return slot;
|
||||
}
|
||||
if (smallestCount == null) {
|
||||
smallestCount = Pair.of(slot, slotStack.getCount());
|
||||
} else if (smallestCount.getRight() >= slotStack.getCount()) {
|
||||
smallestCount = Pair.of(slot, slotStack.getCount());
|
||||
smallestCount = Pair.of(slot, slotStack.getAmount());
|
||||
} else if (smallestCount.getRight() >= slotStack.getAmount()) {
|
||||
smallestCount = Pair.of(slot, slotStack.getAmount());
|
||||
}
|
||||
}
|
||||
if (smallestCount != null) {
|
||||
|
@ -315,10 +315,10 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (world.isRemote) {
|
||||
if (world.isClient) {
|
||||
return;
|
||||
}
|
||||
IRecipe recipe = getIRecipe();
|
||||
Recipe recipe = getIRecipe();
|
||||
if (recipe != null) {
|
||||
if (progress >= maxProgress) {
|
||||
if (make(recipe)) {
|
||||
|
@ -369,27 +369,27 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing enumFacing) {
|
||||
public boolean canAcceptEnergy(Direction enumFacing) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing enumFacing) {
|
||||
public boolean canProvideEnergy(Direction enumFacing) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound write(NBTTagCompound tag) {
|
||||
public CompoundTag toTag(CompoundTag tag) {
|
||||
tag.putBoolean("locked", locked);
|
||||
return super.write(tag);
|
||||
return super.toTag(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NBTTagCompound tag) {
|
||||
if (tag.contains("locked")) {
|
||||
public void fromTag(CompoundTag tag) {
|
||||
if (tag.containsKey("locked")) {
|
||||
locked = tag.getBoolean("locked");
|
||||
}
|
||||
super.read(tag);
|
||||
super.fromTag(tag);
|
||||
}
|
||||
|
||||
// TileMachineBase
|
||||
|
@ -419,13 +419,13 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
|
||||
// This machine doesnt have a facing
|
||||
@Override
|
||||
public EnumFacing getFacingEnum() {
|
||||
return EnumFacing.NORTH;
|
||||
public Direction getFacingEnum() {
|
||||
return Direction.NORTH;
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer playerIn) {
|
||||
public ItemStack getToolDrop(PlayerEntity playerIn) {
|
||||
return TRContent.Machine.AUTO_CRAFTING_TABLE.getStack();
|
||||
}
|
||||
|
||||
|
@ -437,7 +437,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(EntityPlayer player) {
|
||||
public BuiltContainer createContainer(PlayerEntity player) {
|
||||
return new ContainerBuilder("autocraftingtable").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 28, 25).slot(1, 46, 25).slot(2, 64, 25).slot(3, 28, 43).slot(4, 46, 43)
|
||||
.slot(5, 64, 43).slot(6, 28, 61).slot(7, 46, 61).slot(8, 64, 61).outputSlot(9, 145, 42)
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.tiles.machine.tier1;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
|
@ -56,7 +56,7 @@ public class TileChemicalReactor extends TileGenericMachine implements IContaine
|
|||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("chemicalreactor").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this).slot(0, 34, 47).slot(1, 126, 47).outputSlot(2, 80, 47).energySlot(3, 8, 72)
|
||||
.syncEnergyValue().syncCrafterValue().addInventory().create(this);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.tiles.machine.tier1;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
|
@ -56,7 +56,7 @@ public class TileCompressor extends TileGenericMachine implements IContainerProv
|
|||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("compressor").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue()
|
||||
.syncCrafterValue().addInventory().create(this);
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
|
||||
package techreborn.tiles.machine.tier1;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.crafting.VanillaRecipeTypes;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
|
@ -71,14 +71,14 @@ public class TileElectricFurnace extends TilePowerAcceptor
|
|||
|
||||
public void cookItems() {
|
||||
if (canSmelt()) {
|
||||
final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, VanillaRecipeTypes.SMELTING, inventory.getStackInSlot(input1));
|
||||
final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, VanillaRecipeTypes.SMELTING, inventory.getInvStack(input1));
|
||||
|
||||
if (inventory.getStackInSlot(output).isEmpty()) {
|
||||
if (inventory.getInvStack(output).isEmpty()) {
|
||||
inventory.setStackInSlot(output, itemstack.copy());
|
||||
} else if (inventory.getStackInSlot(output).isItemEqual(itemstack)) {
|
||||
inventory.getStackInSlot(output).grow(itemstack.getCount());
|
||||
} else if (inventory.getInvStack(output).isEqualIgnoreTags(itemstack)) {
|
||||
inventory.getInvStack(output).addAmount(itemstack.getAmount());
|
||||
}
|
||||
if (inventory.getStackInSlot(input1).getCount() > 1) {
|
||||
if (inventory.getInvStack(input1).getAmount() > 1) {
|
||||
inventory.shrinkSlot(input1, 1);
|
||||
} else {
|
||||
inventory.setStackInSlot(input1, ItemStack.EMPTY);
|
||||
|
@ -87,21 +87,21 @@ public class TileElectricFurnace extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
public boolean canSmelt() {
|
||||
if (inventory.getStackInSlot(input1).isEmpty()) {
|
||||
if (inventory.getInvStack(input1).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, VanillaRecipeTypes.SMELTING, inventory.getStackInSlot(input1));
|
||||
final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, VanillaRecipeTypes.SMELTING, inventory.getInvStack(input1));
|
||||
if (itemstack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
if (inventory.getStackInSlot(output).isEmpty()) {
|
||||
if (inventory.getInvStack(output).isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
if (!inventory.getStackInSlot(output).isItemEqual(itemstack)) {
|
||||
if (!inventory.getInvStack(output).isEqualIgnoreTags(itemstack)) {
|
||||
return false;
|
||||
}
|
||||
final int result = inventory.getStackInSlot(output).getCount() + itemstack.getCount();
|
||||
return result <= this.inventory.getStackLimit() && result <= itemstack.getMaxStackSize();
|
||||
final int result = inventory.getInvStack(output).getAmount() + itemstack.getAmount();
|
||||
return result <= this.inventory.getStackLimit() && result <= itemstack.getMaxAmount();
|
||||
}
|
||||
|
||||
public boolean isBurning() {
|
||||
|
@ -124,7 +124,7 @@ public class TileElectricFurnace extends TilePowerAcceptor
|
|||
wasBurning = true;
|
||||
return;
|
||||
}
|
||||
final IBlockState BlockStateContainer = world.getBlockState(pos);
|
||||
final BlockState BlockStateContainer = world.getBlockState(pos);
|
||||
if (BlockStateContainer.getBlock() instanceof BlockMachineBase) {
|
||||
final BlockMachineBase blockMachineBase = (BlockMachineBase) BlockStateContainer.getBlock();
|
||||
if (BlockStateContainer.get(BlockMachineBase.ACTIVE) != progress > 0)
|
||||
|
@ -146,7 +146,7 @@ public class TileElectricFurnace extends TilePowerAcceptor
|
|||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void tick() {
|
||||
if (world.isRemote) {
|
||||
if (world.isClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -183,12 +183,12 @@ public class TileElectricFurnace extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(final Direction direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
public boolean canProvideEnergy(final Direction direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ public class TileElectricFurnace extends TilePowerAcceptor
|
|||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
public ItemStack getToolDrop(final PlayerEntity entityPlayer) {
|
||||
return TRContent.Machine.ELECTRIC_FURNACE.getStack();
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ public class TileElectricFurnace extends TilePowerAcceptor
|
|||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("electricfurnace").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue()
|
||||
.syncIntegerValue(this::getBurnTime, this::setBurnTime).addInventory().create(this);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.tiles.machine.tier1;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
|
@ -56,7 +56,7 @@ public class TileExtractor extends TileGenericMachine implements IContainerProvi
|
|||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("extractor").player(player.inventory).inventory().hotbar().addInventory().tile(this)
|
||||
.slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue().syncCrafterValue()
|
||||
.addInventory().create(this);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.tiles.machine.tier1;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
|
@ -56,7 +56,7 @@ public class TileGrinder extends TileGenericMachine implements IContainerProvide
|
|||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("grinder").player(player.inventory).inventory().hotbar().addInventory().tile(this)
|
||||
.slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue().syncCrafterValue()
|
||||
.addInventory().create(this);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.tiles.machine.tier1;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
|
@ -58,7 +58,7 @@ public class TileIndustrialElectrolyzer extends TileGenericMachine implements IC
|
|||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("industrialelectrolyzer").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this)
|
||||
.filterSlot(1, 47, 72, stack -> ItemUtils.isItemEqual(stack, DynamicCell.getEmptyCell(1), true, true))
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
|
||||
package techreborn.tiles.machine.tier1;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.registration.RebornRegister;
|
||||
|
@ -65,24 +65,24 @@ public class TilePlayerDectector extends TilePowerAcceptor implements IToolDrop
|
|||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (!world.isRemote && world.getGameTime() % 20 == 0) {
|
||||
if (!world.isClient && world.getTime() % 20 == 0) {
|
||||
boolean lastRedstone = redstone;
|
||||
redstone = false;
|
||||
if (canUseEnergy(euPerTick)) {
|
||||
Iterator<EntityPlayer> tIterator = super.world.playerEntities.iterator();
|
||||
Iterator<PlayerEntity> tIterator = super.world.playerEntities.iterator();
|
||||
while (tIterator.hasNext()) {
|
||||
EntityPlayer player = tIterator.next();
|
||||
if (player.getDistanceSq((double) super.getPos().getX() + 0.5D,
|
||||
PlayerEntity player = tIterator.next();
|
||||
if (player.squaredEnvTypeanceTo((double) super.getPos().getX() + 0.5D,
|
||||
(double) super.getPos().getY() + 0.5D, (double) super.getPos().getZ() + 0.5D) <= 256.0D) {
|
||||
String type = world.getBlockState(pos).get(BlockPlayerDetector.TYPE);
|
||||
if (type.equals("all")) {// ALL
|
||||
redstone = true;
|
||||
} else if (type.equals("others")) {// Others
|
||||
if (!owenerUdid.isEmpty() && !owenerUdid.equals(player.getUniqueID().toString())) {
|
||||
if (!owenerUdid.isEmpty() && !owenerUdid.equals(player.getUuid().toString())) {
|
||||
redstone = true;
|
||||
}
|
||||
} else {// You
|
||||
if (!owenerUdid.isEmpty() && owenerUdid.equals(player.getUniqueID().toString())) {
|
||||
if (!owenerUdid.isEmpty() && owenerUdid.equals(player.getUuid().toString())) {
|
||||
redstone = true;
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class TilePlayerDectector extends TilePowerAcceptor implements IToolDrop
|
|||
}
|
||||
if (lastRedstone != redstone) {
|
||||
WorldUtils.updateBlock(world, pos);
|
||||
world.notifyNeighborsOfStateChange(pos, world.getBlockState(pos).getBlock());
|
||||
world.updateNeighborsAlways(pos, world.getBlockState(pos).getBlock());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,12 +103,12 @@ public class TilePlayerDectector extends TilePowerAcceptor implements IToolDrop
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(Direction direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
public boolean canProvideEnergy(Direction direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -123,21 +123,21 @@ public class TilePlayerDectector extends TilePowerAcceptor implements IToolDrop
|
|||
}
|
||||
|
||||
@Override
|
||||
public void read(NBTTagCompound tag) {
|
||||
super.read(tag);
|
||||
public void fromTag(CompoundTag tag) {
|
||||
super.fromTag(tag);
|
||||
owenerUdid = tag.getString("ownerID");
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound write(NBTTagCompound tag) {
|
||||
super.write(tag);
|
||||
public CompoundTag toTag(CompoundTag tag) {
|
||||
super.toTag(tag);
|
||||
tag.putString("ownerID", owenerUdid);
|
||||
return tag;
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer p0) {
|
||||
public ItemStack getToolDrop(PlayerEntity p0) {
|
||||
return TRContent.Machine.PLAYER_DETECTOR.getStack();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
|
||||
package techreborn.tiles.machine.tier1;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.IUpgrade;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
|
@ -79,27 +79,27 @@ public class TileRecycler extends TilePowerAcceptor
|
|||
|
||||
public void recycleItems() {
|
||||
ItemStack itemstack = TRContent.Parts.SCRAP.getStack();
|
||||
final int randomchance = this.world.rand.nextInt(chance);
|
||||
final int randomchance = this.world.random.nextInt(chance);
|
||||
|
||||
if (randomchance == 1) {
|
||||
if (inventory.getStackInSlot(1).isEmpty()) {
|
||||
if (inventory.getInvStack(1).isEmpty()) {
|
||||
inventory.setStackInSlot(1, itemstack.copy());
|
||||
}
|
||||
else {
|
||||
inventory.getStackInSlot(1).grow(itemstack.getCount());
|
||||
inventory.getInvStack(1).addAmount(itemstack.getAmount());
|
||||
}
|
||||
}
|
||||
inventory.shrinkSlot(0, 1);
|
||||
}
|
||||
|
||||
public boolean canRecycle() {
|
||||
return !inventory.getStackInSlot(0) .isEmpty() && hasSlotGotSpace(1);
|
||||
return !inventory.getInvStack(0) .isEmpty() && hasSlotGotSpace(1);
|
||||
}
|
||||
|
||||
public boolean hasSlotGotSpace(int slot) {
|
||||
if (inventory.getStackInSlot(slot).isEmpty()) {
|
||||
if (inventory.getInvStack(slot).isEmpty()) {
|
||||
return true;
|
||||
} else if (inventory.getStackInSlot(slot).getCount() < inventory.getStackInSlot(slot).getMaxStackSize()) {
|
||||
} else if (inventory.getInvStack(slot).getAmount() < inventory.getInvStack(slot).getMaxAmount()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -114,7 +114,7 @@ public class TileRecycler extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
public void updateState() {
|
||||
final IBlockState BlockStateContainer = world.getBlockState(pos);
|
||||
final BlockState BlockStateContainer = world.getBlockState(pos);
|
||||
if (BlockStateContainer.getBlock() instanceof BlockMachineBase) {
|
||||
final BlockMachineBase blockMachineBase = (BlockMachineBase) BlockStateContainer.getBlock();
|
||||
boolean shouldBurn = isBurning || (canRecycle() && canUseEnergy(getEuPerTick(cost)));
|
||||
|
@ -128,7 +128,7 @@ public class TileRecycler extends TilePowerAcceptor
|
|||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (world.isRemote) {
|
||||
if (world.isClient) {
|
||||
return;
|
||||
}
|
||||
charge(2);
|
||||
|
@ -163,12 +163,12 @@ public class TileRecycler extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(Direction direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
public boolean canProvideEnergy(Direction direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@ public class TileRecycler extends TilePowerAcceptor
|
|||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getToolDrop(PlayerEntity entityPlayer) {
|
||||
return TRContent.Machine.RECYCLER.getStack();
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ public class TileRecycler extends TilePowerAcceptor
|
|||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(EntityPlayer player) {
|
||||
public BuiltContainer createContainer(PlayerEntity player) {
|
||||
return new ContainerBuilder("recycler").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 55, 45, itemStack -> itemStack.getItem() instanceof IUpgrade).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue()
|
||||
.syncIntegerValue(this::getProgress, this::setProgress).addInventory().create(this);
|
||||
|
|
|
@ -24,14 +24,14 @@
|
|||
|
||||
package techreborn.tiles.machine.tier1;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.container.Container;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.recipe.Recipe;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
|
@ -72,13 +72,13 @@ public class TileRollingMachine extends TilePowerAcceptor
|
|||
public static int maxEnergy = 10000;
|
||||
|
||||
public int[] craftingSlots = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||
private InventoryCrafting craftCache;
|
||||
private CraftingInventory craftCache;
|
||||
public Inventory<TileRollingMachine> inventory = new Inventory<>(12, "TileRollingMachine", 64, this).withConfiguredAccess();
|
||||
public boolean isRunning;
|
||||
public int tickTime;
|
||||
@Nonnull
|
||||
public ItemStack currentRecipeOutput;
|
||||
public IRecipe currentRecipe;
|
||||
public Recipe currentRecipe;
|
||||
private int outputSlot;
|
||||
public boolean locked = false;
|
||||
public int balanceSlot = 0;
|
||||
|
@ -94,12 +94,12 @@ public class TileRollingMachine extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(final Direction direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
public boolean canProvideEnergy(final Direction direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -116,22 +116,22 @@ public class TileRollingMachine extends TilePowerAcceptor
|
|||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (world.isRemote) {
|
||||
if (world.isClient) {
|
||||
return;
|
||||
}
|
||||
charge(10);
|
||||
|
||||
InventoryCrafting craftMatrix = getCraftingMatrix();
|
||||
CraftingInventory craftMatrix = getCraftingMatrix();
|
||||
currentRecipe = RollingMachineRecipe.instance.findMatchingRecipe(craftMatrix, world);
|
||||
if (currentRecipe != null) {
|
||||
setIsActive(true);
|
||||
if (world.getGameTime() % 2 == 0) {
|
||||
Optional<InventoryCrafting> balanceResult = balanceRecipe(craftMatrix);
|
||||
if (world.getTime() % 2 == 0) {
|
||||
Optional<CraftingInventory> balanceResult = balanceRecipe(craftMatrix);
|
||||
if (balanceResult.isPresent()) {
|
||||
craftMatrix = balanceResult.get();
|
||||
}
|
||||
}
|
||||
currentRecipeOutput = currentRecipe.getCraftingResult(craftMatrix);
|
||||
currentRecipeOutput = currentRecipe.craft(craftMatrix);
|
||||
} else {
|
||||
currentRecipeOutput = ItemStack.EMPTY;
|
||||
}
|
||||
|
@ -141,15 +141,15 @@ public class TileRollingMachine extends TilePowerAcceptor
|
|||
currentRecipeOutput = RollingMachineRecipe.instance.findMatchingRecipeOutput(craftMatrix, world);
|
||||
if (!currentRecipeOutput.isEmpty()) {
|
||||
boolean hasCrafted = false;
|
||||
if (inventory.getStackInSlot(outputSlot).isEmpty()) {
|
||||
if (inventory.getInvStack(outputSlot).isEmpty()) {
|
||||
inventory.setStackInSlot(outputSlot, currentRecipeOutput);
|
||||
tickTime = 0;
|
||||
hasCrafted = true;
|
||||
} else {
|
||||
if (inventory.getStackInSlot(outputSlot).getCount()
|
||||
+ currentRecipeOutput.getCount() <= currentRecipeOutput.getMaxStackSize()) {
|
||||
final ItemStack stack = inventory.getStackInSlot(outputSlot);
|
||||
stack.setCount(stack.getCount() + currentRecipeOutput.getCount());
|
||||
if (inventory.getInvStack(outputSlot).getAmount()
|
||||
+ currentRecipeOutput.getAmount() <= currentRecipeOutput.getMaxAmount()) {
|
||||
final ItemStack stack = inventory.getInvStack(outputSlot);
|
||||
stack.setAmount(stack.getAmount() + currentRecipeOutput.getAmount());
|
||||
inventory.setStackInSlot(outputSlot, stack);
|
||||
tickTime = 0;
|
||||
hasCrafted = true;
|
||||
|
@ -158,7 +158,7 @@ public class TileRollingMachine extends TilePowerAcceptor
|
|||
}
|
||||
}
|
||||
if (hasCrafted) {
|
||||
for (int i = 0; i < craftMatrix.getSizeInventory(); i++) {
|
||||
for (int i = 0; i < craftMatrix.getInvSize(); i++) {
|
||||
inventory.shrinkSlot(i, 1);
|
||||
}
|
||||
currentRecipeOutput = ItemStack.EMPTY;
|
||||
|
@ -195,36 +195,36 @@ public class TileRollingMachine extends TilePowerAcceptor
|
|||
BlockMachineBase blockMachineBase = (BlockMachineBase)this.getWorld().getBlockState(this.getPos()).getBlock();
|
||||
blockMachineBase.setActive(active, this.getWorld(), this.getPos());
|
||||
}
|
||||
this.getWorld().notifyBlockUpdate(this.getPos(), this.getWorld().getBlockState(this.getPos()), this.getWorld().getBlockState(this.getPos()), 3);
|
||||
this.getWorld().updateListeners(this.getPos(), this.getWorld().getBlockState(this.getPos()), this.getWorld().getBlockState(this.getPos()), 3);
|
||||
}
|
||||
|
||||
public Optional<InventoryCrafting> balanceRecipe(InventoryCrafting craftCache) {
|
||||
public Optional<CraftingInventory> balanceRecipe(CraftingInventory craftCache) {
|
||||
if (currentRecipe == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
if (world.isRemote) {
|
||||
if (world.isClient) {
|
||||
return Optional.empty();
|
||||
}
|
||||
if (!locked) {
|
||||
return Optional.empty();
|
||||
}
|
||||
if (craftCache.isEmpty()) {
|
||||
if (craftCache.isInvEmpty()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
balanceSlot++;
|
||||
if (balanceSlot > craftCache.getSizeInventory()) {
|
||||
if (balanceSlot > craftCache.getInvSize()) {
|
||||
balanceSlot = 0;
|
||||
}
|
||||
//Find the best slot for each item in a recipe, and move it if needed
|
||||
ItemStack sourceStack = inventory.getStackInSlot(balanceSlot);
|
||||
ItemStack sourceStack = inventory.getInvStack(balanceSlot);
|
||||
if (sourceStack.isEmpty()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
List<Integer> possibleSlots = new ArrayList<>();
|
||||
for (int s = 0; s < currentRecipe.getIngredients().size(); s++) {
|
||||
ItemStack stackInSlot = inventory.getStackInSlot(s);
|
||||
Ingredient ingredient = currentRecipe.getIngredients().get(s);
|
||||
if (ingredient != Ingredient.EMPTY && ingredient.test(sourceStack)) {
|
||||
for (int s = 0; s < currentRecipe.getPreviewInputs().size(); s++) {
|
||||
ItemStack stackInSlot = inventory.getInvStack(s);
|
||||
Ingredient ingredient = currentRecipe.getPreviewInputs().get(s);
|
||||
if (ingredient != Ingredient.EMPTY && ingredient.method_8093(sourceStack)) {
|
||||
if (stackInSlot.isEmpty()) {
|
||||
possibleSlots.add(s);
|
||||
} else if (stackInSlot.getItem() == sourceStack.getItem()) {
|
||||
|
@ -235,10 +235,10 @@ public class TileRollingMachine extends TilePowerAcceptor
|
|||
|
||||
if(!possibleSlots.isEmpty()){
|
||||
int totalItems = possibleSlots.stream()
|
||||
.mapToInt(value -> inventory.getStackInSlot(value).getCount()).sum();
|
||||
.mapToInt(value -> inventory.getInvStack(value).getAmount()).sum();
|
||||
int slots = possibleSlots.size();
|
||||
|
||||
//This makes an array of ints with the best possible slot distribution
|
||||
//This makes an array of ints with the best possible slot EnvTyperibution
|
||||
int[] split = new int[slots];
|
||||
int remainder = totalItems % slots;
|
||||
Arrays.fill(split, totalItems / slots);
|
||||
|
@ -251,16 +251,16 @@ public class TileRollingMachine extends TilePowerAcceptor
|
|||
}
|
||||
}
|
||||
|
||||
List<Integer> slotDistrubution = possibleSlots.stream()
|
||||
.mapToInt(value -> inventory.getStackInSlot(value).getCount())
|
||||
List<Integer> slotEnvTyperubution = possibleSlots.stream()
|
||||
.mapToInt(value -> inventory.getInvStack(value).getAmount())
|
||||
.boxed().collect(Collectors.toList());
|
||||
|
||||
boolean needsBalance = false;
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
int required = split[i];
|
||||
if(slotDistrubution.contains(required)){
|
||||
if(slotEnvTyperubution.contains(required)){
|
||||
//We need to remove the int, not at the int, this seems to work around that
|
||||
slotDistrubution.remove(new Integer(required));
|
||||
slotEnvTyperubution.remove(new Integer(required));
|
||||
} else {
|
||||
needsBalance = true;
|
||||
}
|
||||
|
@ -275,49 +275,49 @@ public class TileRollingMachine extends TilePowerAcceptor
|
|||
//Slot, count
|
||||
Pair<Integer, Integer> bestSlot = null;
|
||||
for (Integer slot : possibleSlots) {
|
||||
ItemStack slotStack = inventory.getStackInSlot(slot);
|
||||
ItemStack slotStack = inventory.getInvStack(slot);
|
||||
if (slotStack.isEmpty()) {
|
||||
bestSlot = Pair.of(slot, 0);
|
||||
}
|
||||
if (bestSlot == null) {
|
||||
bestSlot = Pair.of(slot, slotStack.getCount());
|
||||
} else if (bestSlot.getRight() >= slotStack.getCount()) {
|
||||
bestSlot = Pair.of(slot, slotStack.getCount());
|
||||
bestSlot = Pair.of(slot, slotStack.getAmount());
|
||||
} else if (bestSlot.getRight() >= slotStack.getAmount()) {
|
||||
bestSlot = Pair.of(slot, slotStack.getAmount());
|
||||
}
|
||||
}
|
||||
if (bestSlot == null
|
||||
|| bestSlot.getLeft() == balanceSlot
|
||||
|| bestSlot.getRight() == sourceStack.getCount()
|
||||
|| inventory.getStackInSlot(bestSlot.getLeft()).isEmpty()
|
||||
|| !ItemUtils.isItemEqual(sourceStack, inventory.getStackInSlot(bestSlot.getLeft()), true, true)) {
|
||||
|| bestSlot.getRight() == sourceStack.getAmount()
|
||||
|| inventory.getInvStack(bestSlot.getLeft()).isEmpty()
|
||||
|| !ItemUtils.isItemEqual(sourceStack, inventory.getInvStack(bestSlot.getLeft()), true, true)) {
|
||||
return Optional.empty();
|
||||
}
|
||||
sourceStack.shrink(1);
|
||||
inventory.getStackInSlot(bestSlot.getLeft()).grow(1);
|
||||
sourceStack.subtractAmount(1);
|
||||
inventory.getInvStack(bestSlot.getLeft()).addAmount(1);
|
||||
inventory.setChanged();
|
||||
|
||||
return Optional.of(getCraftingMatrix());
|
||||
}
|
||||
|
||||
private InventoryCrafting getCraftingMatrix() {
|
||||
private CraftingInventory getCraftingMatrix() {
|
||||
if (craftCache == null) {
|
||||
craftCache = new InventoryCrafting(new RollingTileContainer(), 3, 3);
|
||||
craftCache = new CraftingInventory(new RollingTileContainer(), 3, 3);
|
||||
}
|
||||
if (inventory.hasChanged()) {
|
||||
for (int i = 0; i < 9; i++) {
|
||||
craftCache.setInventorySlotContents(i, inventory.getStackInSlot(i).copy());
|
||||
craftCache.setInvStack(i, inventory.getInvStack(i).copy());
|
||||
}
|
||||
inventory.resetChanged();
|
||||
}
|
||||
return craftCache;
|
||||
}
|
||||
|
||||
public boolean canMake(InventoryCrafting craftMatrix) {
|
||||
public boolean canMake(CraftingInventory craftMatrix) {
|
||||
ItemStack stack = RollingMachineRecipe.instance.findMatchingRecipeOutput(craftMatrix, this.world);
|
||||
if (locked) {
|
||||
for (int i = 0; i < craftMatrix.getSizeInventory(); i++) {
|
||||
ItemStack stack1 = craftMatrix.getStackInSlot(i);
|
||||
if (!stack1.isEmpty() && stack1.getCount() < 2) {
|
||||
for (int i = 0; i < craftMatrix.getInvSize(); i++) {
|
||||
ItemStack stack1 = craftMatrix.getInvStack(i);
|
||||
if (!stack1.isEmpty() && stack1.getAmount() < 2) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ public class TileRollingMachine extends TilePowerAcceptor
|
|||
if (stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
ItemStack output = inventory.getStackInSlot(outputSlot);
|
||||
ItemStack output = inventory.getInvStack(outputSlot);
|
||||
if (output.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -333,21 +333,21 @@ public class TileRollingMachine extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
public ItemStack getToolDrop(final PlayerEntity entityPlayer) {
|
||||
return TRContent.Machine.ROLLING_MACHINE.getStack();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(final NBTTagCompound tagCompound) {
|
||||
super.read(tagCompound);
|
||||
public void fromTag(final CompoundTag tagCompound) {
|
||||
super.fromTag(tagCompound);
|
||||
this.isRunning = tagCompound.getBoolean("isRunning");
|
||||
this.tickTime = tagCompound.getInt("tickTime");
|
||||
this.locked = tagCompound.getBoolean("locked");
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound write(final NBTTagCompound tagCompound) {
|
||||
super.write(tagCompound);
|
||||
public CompoundTag toTag(final CompoundTag tagCompound) {
|
||||
super.toTag(tagCompound);
|
||||
tagCompound.putBoolean("isRunning", this.isRunning);
|
||||
tagCompound.putInt("tickTime", this.tickTime);
|
||||
tagCompound.putBoolean("locked", locked);
|
||||
|
@ -375,7 +375,7 @@ public class TileRollingMachine extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("rollingmachine").player(player.inventory)
|
||||
.inventory().hotbar()
|
||||
.addInventory().tile(this)
|
||||
|
@ -407,7 +407,7 @@ public class TileRollingMachine extends TilePowerAcceptor
|
|||
private static class RollingTileContainer extends Container {
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(final EntityPlayer entityplayer) {
|
||||
public boolean canUse(final PlayerEntity entityplayer) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.tiles.machine.tier1;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
|
@ -61,7 +61,7 @@ public class TileScrapboxinator extends TileGenericMachine implements IContainer
|
|||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("scrapboxinator").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).filterSlot(0, 55, 45, stack -> stack.getItem() == TRContent.SCRAP_BOX).outputSlot(1, 101, 45)
|
||||
.energySlot(2, 8, 72).syncEnergyValue().syncCrafterValue().addInventory().create(this);
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
|
||||
package techreborn.tiles.machine.tier3;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
|
@ -60,7 +60,7 @@ public class TileChunkLoader extends TilePowerAcceptor implements IToolDrop, Ite
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
public ItemStack getToolDrop(final PlayerEntity entityPlayer) {
|
||||
return TRContent.Machine.CHUNK_LOADER.getStack();
|
||||
}
|
||||
|
||||
|
@ -74,12 +74,12 @@ public class TileChunkLoader extends TilePowerAcceptor implements IToolDrop, Ite
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(final Direction direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
public boolean canProvideEnergy(final Direction direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ public class TileChunkLoader extends TilePowerAcceptor implements IToolDrop, Ite
|
|||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("chunkloader").player(player.inventory).inventory(8,84).hotbar(8,142).addInventory()
|
||||
.create(this);
|
||||
}
|
||||
|
|
|
@ -36,13 +36,13 @@ public class TileCreativeQuantumChest extends TileQuantumChest {
|
|||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
ItemStack stack = inventory.getStackInSlot(1);
|
||||
ItemStack stack = inventory.getInvStack(1);
|
||||
if (!stack.isEmpty() && storedItem.isEmpty()) {
|
||||
stack.setCount(stack.getMaxStackSize());
|
||||
stack.setAmount(stack.getMaxAmount());
|
||||
storedItem = stack.copy();
|
||||
}
|
||||
|
||||
storedItem.setCount(maxCapacity - storedItem.getMaxStackSize());
|
||||
storedItem.setAmount(maxCapacity - storedItem.getMaxAmount());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
|
||||
package techreborn.tiles.machine.tier3;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
|
@ -71,9 +71,9 @@ public class TileMatterFabricator extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
private boolean spaceForOutput(int slot) {
|
||||
return inventory.getStackInSlot(slot).isEmpty()
|
||||
|| ItemUtils.isItemEqual(inventory.getStackInSlot(slot), TRContent.Parts.UU_MATTER.getStack(), true, true)
|
||||
&& inventory.getStackInSlot(slot).getCount() < 64;
|
||||
return inventory.getInvStack(slot).isEmpty()
|
||||
|| ItemUtils.isItemEqual(inventory.getInvStack(slot), TRContent.Parts.UU_MATTER.getStack(), true, true)
|
||||
&& inventory.getInvStack(slot).getAmount() < 64;
|
||||
}
|
||||
|
||||
private void addOutputProducts() {
|
||||
|
@ -86,11 +86,11 @@ public class TileMatterFabricator extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
private void addOutputProducts(int slot) {
|
||||
if (inventory.getStackInSlot(slot).isEmpty()) {
|
||||
if (inventory.getInvStack(slot).isEmpty()) {
|
||||
inventory.setStackInSlot(slot, TRContent.Parts.UU_MATTER.getStack());
|
||||
}
|
||||
else if (ItemUtils.isItemEqual(this.inventory.getStackInSlot(slot), TRContent.Parts.UU_MATTER.getStack(), true, true)) {
|
||||
inventory.getStackInSlot(slot).setCount((Math.min(64, 1 + inventory.getStackInSlot(slot).getCount())));
|
||||
else if (ItemUtils.isItemEqual(this.inventory.getInvStack(slot), TRContent.Parts.UU_MATTER.getStack(), true, true)) {
|
||||
inventory.getInvStack(slot).setAmount((Math.min(64, 1 + inventory.getInvStack(slot).getAmount())));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ public class TileMatterFabricator extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
public int getValue(ItemStack itemStack) {
|
||||
if (itemStack.isItemEqual(TRContent.Parts.SCRAP.getStack())) {
|
||||
if (itemStack.isEqualIgnoreTags(TRContent.Parts.SCRAP.getStack())) {
|
||||
return 200;
|
||||
} else if (itemStack.getItem() == TRContent.SCRAP_BOX) {
|
||||
return 2000;
|
||||
|
@ -135,7 +135,7 @@ public class TileMatterFabricator extends TilePowerAcceptor
|
|||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void tick() {
|
||||
if (world.isRemote) {
|
||||
if (world.isClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ public class TileMatterFabricator extends TilePowerAcceptor
|
|||
this.charge(11);
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
final ItemStack stack = inventory.getStackInSlot(i);
|
||||
final ItemStack stack = inventory.getInvStack(i);
|
||||
if (!stack.isEmpty() && spaceForOutput()) {
|
||||
final int amp = getValue(stack);
|
||||
final int euNeeded = amp * energyPerAmp;
|
||||
|
@ -169,12 +169,12 @@ public class TileMatterFabricator extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(Direction direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
public boolean canProvideEnergy(Direction direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ public class TileMatterFabricator extends TilePowerAcceptor
|
|||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getToolDrop(PlayerEntity entityPlayer) {
|
||||
return TRContent.Machine.MATTER_FABRICATOR.getStack();
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ public class TileMatterFabricator extends TilePowerAcceptor
|
|||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(EntityPlayer player) {
|
||||
public BuiltContainer createContainer(PlayerEntity player) {
|
||||
return new ContainerBuilder("matterfabricator").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 30, 20).slot(1, 50, 20).slot(2, 70, 20).slot(3, 90, 20).slot(4, 110, 20)
|
||||
.slot(5, 130, 20).outputSlot(6, 40, 66).outputSlot(7, 60, 66).outputSlot(8, 80, 66)
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
package techreborn.tiles.machine.tier3;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
|
@ -45,12 +45,12 @@ public class TileQuantumChest extends TileTechStorageBase implements IContainerP
|
|||
this(TRTileEntities.QUANTUM_CHEST);
|
||||
}
|
||||
|
||||
public TileQuantumChest(TileEntityType<?> tileEntityType) {
|
||||
public TileQuantumChest(BlockEntityType<?> tileEntityType) {
|
||||
super(tileEntityType, "TileQuantumChest", maxStorage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("quantumchest").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 80, 24).outputSlot(1, 80, 64).addInventory().create(this);
|
||||
}
|
||||
|
|
|
@ -24,14 +24,14 @@
|
|||
|
||||
package techreborn.tiles.machine.tier3;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.client.network.packet.BlockEntityUpdateS2CPacket;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
|
@ -64,24 +64,24 @@ public class TileQuantumTank extends TileMachineBase
|
|||
this(TRTileEntities.QUANTUM_TANK);
|
||||
}
|
||||
|
||||
public TileQuantumTank(TileEntityType<?> tileEntityTypeIn) {
|
||||
public TileQuantumTank(BlockEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
}
|
||||
|
||||
public void readWithoutCoords(final NBTTagCompound tagCompound) {
|
||||
public void readWithoutCoords(final CompoundTag tagCompound) {
|
||||
tank.read(tagCompound);
|
||||
}
|
||||
|
||||
public NBTTagCompound writeWithoutCoords(final NBTTagCompound tagCompound) {
|
||||
public CompoundTag writeWithoutCoords(final CompoundTag tagCompound) {
|
||||
tank.write(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
public ItemStack getDropWithNBT() {
|
||||
final NBTTagCompound tileEntity = new NBTTagCompound();
|
||||
final CompoundTag tileEntity = new CompoundTag();
|
||||
final ItemStack dropStack = TRContent.Machine.QUANTUM_TANK.getStack();
|
||||
this.writeWithoutCoords(tileEntity);
|
||||
dropStack.setTag(new NBTTagCompound());
|
||||
dropStack.setTag(new CompoundTag());
|
||||
dropStack.getTag().put("tileEntity", tileEntity);
|
||||
return dropStack;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public class TileQuantumTank extends TileMachineBase
|
|||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (!world.isRemote) {
|
||||
if (!world.isClient) {
|
||||
// TODO: Fix in 1.13
|
||||
// if (FluidUtils.drainContainers(tank, inventory, 0, 1)
|
||||
// || FluidUtils.fillContainers(tank, inventory, 0, 1, tank.getFluidType())) {
|
||||
|
@ -107,22 +107,22 @@ public class TileQuantumTank extends TileMachineBase
|
|||
}
|
||||
|
||||
@Override
|
||||
public void read(final NBTTagCompound tagCompound) {
|
||||
super.read(tagCompound);
|
||||
public void fromTag(final CompoundTag tagCompound) {
|
||||
super.fromTag(tagCompound);
|
||||
readWithoutCoords(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound write(final NBTTagCompound tagCompound) {
|
||||
super.write(tagCompound);
|
||||
public CompoundTag toTag(final CompoundTag tagCompound) {
|
||||
super.toTag(tagCompound);
|
||||
writeWithoutCoords(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(final NetworkManager net, final SPacketUpdateTileEntity packet) {
|
||||
public void onDataPacket(final ClientConnection net, final BlockEntityUpdateS2CPacket packet) {
|
||||
world.markBlockRangeForRenderUpdate(pos.getX(), pos.getY(), pos.getZ(), pos.getX(), pos.getY(), pos.getZ());
|
||||
read(packet.getNbtCompound());
|
||||
fromTag(packet.getCompoundTag());
|
||||
}
|
||||
|
||||
// ItemHandlerProvider
|
||||
|
@ -133,26 +133,26 @@ public class TileQuantumTank extends TileMachineBase
|
|||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
public ItemStack getToolDrop(final PlayerEntity entityPlayer) {
|
||||
return this.getDropWithNBT();
|
||||
}
|
||||
|
||||
// IListInfoProvider
|
||||
@Override
|
||||
public void addInfo(final List<ITextComponent> info, final boolean isRealTile, boolean hasData) {
|
||||
public void addInfo(final List<Component> info, final boolean isRealTile, boolean hasData) {
|
||||
if (isRealTile | hasData) {
|
||||
if (this.tank.getFluid() != null) {
|
||||
info.add(new TextComponentString(this.tank.getFluidAmount() + " of " + this.tank.getFluidType().getName()));
|
||||
info.add(new TextComponent(this.tank.getFluidAmount() + " of " + this.tank.getFluidType().getName()));
|
||||
} else {
|
||||
info.add(new TextComponentString("Empty"));
|
||||
info.add(new TextComponent("Empty"));
|
||||
}
|
||||
}
|
||||
info.add(new TextComponentString("Capacity " + this.tank.getCapacity() + " mb"));
|
||||
info.add(new TextComponent("Capacity " + this.tank.getCapacity() + " mb"));
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("quantumtank").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this).fluidSlot(0, 80, 17).outputSlot(1, 80, 53).addInventory()
|
||||
.create(this);
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
|
||||
package techreborn.tiles.storage;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.tile.IUpgrade;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
|
@ -64,7 +64,7 @@ public class TileAdjustableSU extends TileEnergyStorage implements IContainerPro
|
|||
|
||||
superconductors = 0;
|
||||
for (int i = 0; i < getUpgradeSlotCount(); i++) {
|
||||
ItemStack stack = getUpgradeInvetory().getStackInSlot(i);
|
||||
ItemStack stack = getUpgradeInvetory().getInvStack(i);
|
||||
if(false){ //TODO 1.13
|
||||
superconductors++;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class TileAdjustableSU extends TileEnergyStorage implements IContainerPro
|
|||
if (OUTPUT > getMaxConfigOutput()) {
|
||||
OUTPUT = getMaxConfigOutput();
|
||||
}
|
||||
if(world.getGameTime() % 20 == 0){
|
||||
if(world.getTime() % 20 == 0){
|
||||
checkTier();
|
||||
}
|
||||
}
|
||||
|
@ -114,10 +114,10 @@ public class TileAdjustableSU extends TileEnergyStorage implements IContainerPro
|
|||
}
|
||||
|
||||
public ItemStack getDropWithNBT() {
|
||||
NBTTagCompound tileEntity = new NBTTagCompound();
|
||||
CompoundTag tileEntity = new CompoundTag();
|
||||
ItemStack dropStack = TRContent.Machine.ADJUSTABLE_SU.getStack();
|
||||
writeWithoutCoords(tileEntity);
|
||||
dropStack.setTag(new NBTTagCompound());
|
||||
dropStack.setTag(new CompoundTag());
|
||||
dropStack.getTag().put("tileEntity", tileEntity);
|
||||
return dropStack;
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ public class TileAdjustableSU extends TileEnergyStorage implements IContainerPro
|
|||
|
||||
// TileEnergyStorage
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getToolDrop(PlayerEntity entityPlayer) {
|
||||
return getDropWithNBT();
|
||||
}
|
||||
|
||||
|
@ -162,23 +162,23 @@ public class TileAdjustableSU extends TileEnergyStorage implements IContainerPro
|
|||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public NBTTagCompound write(NBTTagCompound tagCompound) {
|
||||
super.write(tagCompound);
|
||||
public CompoundTag toTag(CompoundTag tagCompound) {
|
||||
super.toTag(tagCompound);
|
||||
tagCompound.putInt("output", OUTPUT);
|
||||
inventory.write(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NBTTagCompound nbttagcompound) {
|
||||
super.read(nbttagcompound);
|
||||
public void fromTag(CompoundTag nbttagcompound) {
|
||||
super.fromTag(nbttagcompound);
|
||||
this.OUTPUT = nbttagcompound.getInt("output");
|
||||
inventory.read(nbttagcompound);
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(EntityPlayer player) {
|
||||
public BuiltContainer createContainer(PlayerEntity player) {
|
||||
return new ContainerBuilder("aesu").player(player.inventory).inventory().hotbar().armor()
|
||||
.complete(8, 18).addArmor().addInventory().tile(this).energySlot(0, 62, 45).energySlot(1, 98, 45)
|
||||
.syncEnergyValue().syncIntegerValue(this::getCurrentOutput, this::setCurentOutput).addInventory().create(this);
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
package techreborn.tiles.storage;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
|
@ -51,7 +51,7 @@ public class TileEnergyStorage extends TilePowerAcceptor
|
|||
public int maxOutput;
|
||||
public int maxStorage;
|
||||
|
||||
public TileEnergyStorage(TileEntityType<?> tileEntityType, String name, int invSize, Block wrenchDrop, EnumPowerTier tier, int maxInput, int maxOuput, int maxStorage) {
|
||||
public TileEnergyStorage(BlockEntityType<?> tileEntityType, String name, int invSize, Block wrenchDrop, EnumPowerTier tier, int maxInput, int maxOuput, int maxStorage) {
|
||||
super(tileEntityType);
|
||||
inventory = new Inventory<>(invSize, "Tile" + name, 64, this).withConfiguredAccess();
|
||||
this.wrenchDrop = wrenchDrop;
|
||||
|
@ -66,14 +66,14 @@ public class TileEnergyStorage extends TilePowerAcceptor
|
|||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (!inventory.getStackInSlot(0).isEmpty()) {
|
||||
ItemStack stack = inventory.getStackInSlot(0);
|
||||
if (!inventory.getInvStack(0).isEmpty()) {
|
||||
ItemStack stack = inventory.getInvStack(0);
|
||||
|
||||
if (ExternalPowerSystems.isPoweredItem(stack)) {
|
||||
ExternalPowerSystems.chargeItem(this, stack);
|
||||
}
|
||||
}
|
||||
if (!inventory.getStackInSlot(1).isEmpty()) {
|
||||
if (!inventory.getInvStack(1).isEmpty()) {
|
||||
charge(1);
|
||||
}
|
||||
}
|
||||
|
@ -84,12 +84,12 @@ public class TileEnergyStorage extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(Direction direction) {
|
||||
return getFacing() != direction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
public boolean canProvideEnergy(Direction direction) {
|
||||
return getFacing() == direction;
|
||||
}
|
||||
|
||||
|
@ -110,12 +110,12 @@ public class TileEnergyStorage extends TilePowerAcceptor
|
|||
|
||||
// TileMachineBase
|
||||
@Override
|
||||
public void setFacing(EnumFacing enumFacing) {
|
||||
public void setFacing(Direction enumFacing) {
|
||||
world.setBlockState(pos, world.getBlockState(pos).with(BlockEnergyStorage.FACING, enumFacing));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacingEnum() {
|
||||
public Direction getFacingEnum() {
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
if (block instanceof BlockEnergyStorage) {
|
||||
return ((BlockEnergyStorage) block).getFacing(world.getBlockState(pos));
|
||||
|
@ -130,7 +130,7 @@ public class TileEnergyStorage extends TilePowerAcceptor
|
|||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getToolDrop(PlayerEntity entityPlayer) {
|
||||
return new ItemStack(wrenchDrop);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.tiles.storage;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
|
@ -46,7 +46,7 @@ public class TileHighVoltageSU extends TileEnergyStorage implements IContainerPr
|
|||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("mfsu").player(player.inventory).inventory().hotbar().armor()
|
||||
.complete(8, 18).addArmor().addInventory().tile(this).energySlot(0, 62, 45).energySlot(1, 98, 45)
|
||||
.syncEnergyValue().addInventory().create(this);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.tiles.storage;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
|
@ -42,7 +42,7 @@ public class TileLowVoltageSU extends TileEnergyStorage implements IContainerPro
|
|||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("batbox").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).energySlot(0, 62, 45).energySlot(1, 98, 45).syncEnergyValue().addInventory().create(this);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.tiles.storage;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
|
@ -46,7 +46,7 @@ public class TileMediumVoltageSU extends TileEnergyStorage implements IContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("mfe").player(player.inventory).inventory().hotbar().armor()
|
||||
.complete(8, 18).addArmor().addInventory().tile(this).energySlot(0, 62, 45).energySlot(1, 98, 45)
|
||||
.syncEnergyValue().addInventory().create(this);
|
||||
|
|
|
@ -24,25 +24,25 @@
|
|||
|
||||
package techreborn.tiles.storage.idsu;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.storage.WorldSavedData;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.PersistentState;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 13/06/2017.
|
||||
*/
|
||||
public class IDSUSaveManger extends WorldSavedData implements IDataIDSU {
|
||||
public class IDSUSaveManger extends PersistentState implements IDataIDSU {
|
||||
public IDSUSaveManger(String name) {
|
||||
super(TechReborn.MOD_ID + "_IDSU");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NBTTagCompound nbt) {
|
||||
public void fromTag(CompoundTag nbt) {
|
||||
power = nbt.getDouble("power");
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound write(NBTTagCompound compound) {
|
||||
public CompoundTag toTag(CompoundTag compound) {
|
||||
compound.putDouble("power", power);
|
||||
return compound;
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
package techreborn.tiles.storage.idsu;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
|
@ -94,14 +94,14 @@ public class TileInterdimensionalSU extends TileEnergyStorage implements IContai
|
|||
}
|
||||
|
||||
@Override
|
||||
public void read(NBTTagCompound nbttagcompound) {
|
||||
super.read(nbttagcompound);
|
||||
public void fromTag(CompoundTag nbttagcompound) {
|
||||
super.fromTag(nbttagcompound);
|
||||
this.ownerUdid = nbttagcompound.getString("ownerUdid");
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound write(NBTTagCompound nbttagcompound) {
|
||||
super.write(nbttagcompound);
|
||||
public CompoundTag toTag(CompoundTag nbttagcompound) {
|
||||
super.toTag(nbttagcompound);
|
||||
if (ownerUdid == null && StringUtils.isBlank(ownerUdid) || StringUtils.isEmpty(ownerUdid)) {
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ public class TileInterdimensionalSU extends TileEnergyStorage implements IContai
|
|||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("idsu").player(player.inventory).inventory().hotbar().armor()
|
||||
.complete(8, 18).addArmor().addInventory().tile(this).energySlot(0, 62, 45).energySlot(1, 98, 45)
|
||||
.syncEnergyValue().addInventory().create(this);
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
|
||||
package techreborn.tiles.storage.lesu;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.common.tile.TileMachineBase;
|
||||
|
@ -46,11 +46,11 @@ public class TileLSUStorage extends TileMachineBase
|
|||
public final void findAndJoinNetwork(World world, int x, int y, int z) {
|
||||
network = new LesuNetwork();
|
||||
network.addElement(this);
|
||||
for (EnumFacing direction : EnumFacing.values()) {
|
||||
if (world.getTileEntity(new BlockPos(x + direction.getXOffset(), y + direction.getYOffset(),
|
||||
z + direction.getZOffset())) instanceof TileLSUStorage) {
|
||||
TileLSUStorage lesu = (TileLSUStorage) world.getTileEntity(new BlockPos(x + direction.getXOffset(),
|
||||
y + direction.getYOffset(), z + direction.getZOffset()));
|
||||
for (Direction direction : Direction.values()) {
|
||||
if (world.getBlockEntity(new BlockPos(x + direction.getOffsetX(), y + direction.getOffsetY(),
|
||||
z + direction.getOffsetZ())) instanceof TileLSUStorage) {
|
||||
TileLSUStorage lesu = (TileLSUStorage) world.getBlockEntity(new BlockPos(x + direction.getOffsetX(),
|
||||
y + direction.getOffsetY(), z + direction.getOffsetZ()));
|
||||
if (lesu.network != null) {
|
||||
lesu.network.merge(network);
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public class TileLSUStorage extends TileMachineBase
|
|||
findAndJoinNetwork(world, pos.getX(), pos.getY(), pos.getZ());
|
||||
} else {
|
||||
if (network.master != null
|
||||
&& network.master.getWorld().getTileEntity(new BlockPos(network.master.getPos().getX(),
|
||||
&& network.master.getWorld().getBlockEntity(new BlockPos(network.master.getPos().getX(),
|
||||
network.master.getPos().getY(), network.master.getPos().getZ())) != network.master) {
|
||||
network.master = null;
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ public class TileLSUStorage extends TileMachineBase
|
|||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getToolDrop(PlayerEntity entityPlayer) {
|
||||
return TRContent.Machine.LSU_STORAGE.getStack();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
package techreborn.tiles.storage.lesu;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
|
@ -67,15 +67,15 @@ public class TileLapotronicSU extends TileEnergyStorage implements IContainerPro
|
|||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (world.isRemote) {
|
||||
if (world.isClient) {
|
||||
return;
|
||||
}
|
||||
countedNetworks.clear();
|
||||
connectedBlocks = 0;
|
||||
for (EnumFacing dir : EnumFacing.values()) {
|
||||
BlockPos adjucentBlockPos = new BlockPos(pos.getX() + dir.getXOffset(),
|
||||
pos.getY() + dir.getXOffset(), pos.getZ() + dir.getXOffset());
|
||||
TileEntity adjucentTile = world.getTileEntity(adjucentBlockPos);
|
||||
for (Direction dir : Direction.values()) {
|
||||
BlockPos adjucentBlockPos = new BlockPos(pos.getX() + dir.getOffsetX(),
|
||||
pos.getY() + dir.getOffsetX(), pos.getZ() + dir.getOffsetX());
|
||||
BlockEntity adjucentTile = world.getBlockEntity(adjucentBlockPos);
|
||||
if (adjucentTile == null || !(adjucentTile instanceof TileLSUStorage)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public class TileLapotronicSU extends TileEnergyStorage implements IContainerPro
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacingEnum() {
|
||||
public Direction getFacingEnum() {
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
if (block instanceof BlockLapotronicSU) {
|
||||
return ((BlockLapotronicSU) block).getFacing(world.getBlockState(pos));
|
||||
|
@ -120,7 +120,7 @@ public class TileLapotronicSU extends TileEnergyStorage implements IContainerPro
|
|||
|
||||
public void setConnectedBlocksNum(int value) {
|
||||
this.connectedBlocks = value;
|
||||
if (world.isRemote) {
|
||||
if (world.isClient) {
|
||||
setMaxStorage();
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ public class TileLapotronicSU extends TileEnergyStorage implements IContainerPro
|
|||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
public BuiltContainer createContainer(final PlayerEntity player) {
|
||||
return new ContainerBuilder("lesu").player(player.inventory).inventory().hotbar().armor().complete(8, 18)
|
||||
.addArmor().addInventory().tile(this).energySlot(0, 62, 45).energySlot(1, 98, 45).syncEnergyValue()
|
||||
.syncIntegerValue(this::getOutputRate, this::setOutputRate)
|
||||
|
|
|
@ -24,14 +24,14 @@
|
|||
|
||||
package techreborn.tiles.transformers;
|
||||
|
||||
import net.minecraft.ChatFormat;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
|
@ -63,7 +63,7 @@ public class TileTransformer extends TilePowerAcceptor
|
|||
public int maxOutput;
|
||||
public int maxStorage;
|
||||
|
||||
public TileTransformer(TileEntityType<?> tileEntityType, String name, Block wrenchDrop, EnumPowerTier tier) {
|
||||
public TileTransformer(BlockEntityType<?> tileEntityType, String name, Block wrenchDrop, EnumPowerTier tier) {
|
||||
super(tileEntityType);
|
||||
this.wrenchDrop = wrenchDrop;
|
||||
this.inputTier = tier;
|
||||
|
@ -88,7 +88,7 @@ public class TileTransformer extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(Direction direction) {
|
||||
if (IC2TransformersStyle == true){
|
||||
return getFacingEnum() == direction;
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public class TileTransformer extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
public boolean canProvideEnergy(Direction direction) {
|
||||
if (IC2TransformersStyle == true){
|
||||
return getFacingEnum() != direction;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ public class TileTransformer extends TilePowerAcceptor
|
|||
|
||||
// TileMachineBase
|
||||
@Override
|
||||
public EnumFacing getFacingEnum() {
|
||||
public Direction getFacingEnum() {
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
if (block instanceof BlockTransformer) {
|
||||
return ((BlockTransformer) block).getFacing(world.getBlockState(pos));
|
||||
|
@ -140,17 +140,17 @@ public class TileTransformer extends TilePowerAcceptor
|
|||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer playerIn) {
|
||||
public ItemStack getToolDrop(PlayerEntity playerIn) {
|
||||
return new ItemStack(wrenchDrop);
|
||||
}
|
||||
|
||||
// IListInfoProvider
|
||||
@Override
|
||||
public void addInfo(List<ITextComponent> info, boolean isRealTile, boolean hasData) {
|
||||
info.add(new TextComponentString(TextFormatting.GRAY + "Input Rate: " + TextFormatting.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxInput())));
|
||||
info.add(new TextComponentString(TextFormatting.GRAY + "Input Tier: " + TextFormatting.GOLD + StringUtils.toFirstCapitalAllLowercase(inputTier.toString())));
|
||||
info.add(new TextComponentString(TextFormatting.GRAY + "Output Rate: " + TextFormatting.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxOutput())));
|
||||
info.add(new TextComponentString(TextFormatting.GRAY + "Output Tier: " + TextFormatting.GOLD + StringUtils.toFirstCapitalAllLowercase(ouputTier.toString())));
|
||||
public void addInfo(List<Component> info, boolean isRealTile, boolean hasData) {
|
||||
info.add(new TextComponent(ChatFormat.GRAY + "Input Rate: " + ChatFormat.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxInput())));
|
||||
info.add(new TextComponent(ChatFormat.GRAY + "Input Tier: " + ChatFormat.GOLD + StringUtils.toFirstCapitalAllLowercase(inputTier.toString())));
|
||||
info.add(new TextComponent(ChatFormat.GRAY + "Output Rate: " + ChatFormat.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxOutput())));
|
||||
info.add(new TextComponent(ChatFormat.GRAY + "Output Tier: " + ChatFormat.GOLD + StringUtils.toFirstCapitalAllLowercase(ouputTier.toString())));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue