mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-18 19:29:17 +00:00
Intial stages of an cleanup of the inventory code, this commit is very broken.
This commit is contained in:
1 parent
3d765067cf
commit
034cdf2860
73 files changed
+606
-759
No files matched your search
@@ -23,9 +23,6 @@ import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.gadgets.TileForestry;
|
||||
import forestry.core.network.PacketPayload;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.TileInventoryAdapter;
|
||||
import forestry.core.utils.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -40,8 +37,6 @@ public abstract class TileAlveary extends TileForestry implements IAlvearyCompon
|
||||
private boolean isMaster;
|
||||
protected int masterX, masterZ;
|
||||
protected int masterY = -99;
|
||||
|
||||
protected TileInventoryAdapter inventory;
|
||||
protected final int componentBlockMeta;
|
||||
|
||||
public TileAlveary(int componentBlockMeta) {
|
||||
@@ -147,7 +142,7 @@ public abstract class TileAlveary extends TileForestry implements IAlvearyCompon
|
||||
setCentralTE(null);
|
||||
isMaster = true;
|
||||
|
||||
if (inventory == null)
|
||||
if (getInternalInventory() == null)
|
||||
createInventory();
|
||||
}
|
||||
|
||||
@@ -215,7 +210,7 @@ public abstract class TileAlveary extends TileForestry implements IAlvearyCompon
|
||||
|
||||
@Override
|
||||
public IInventory getInventory() {
|
||||
return inventory;
|
||||
return getInternalInventory();
|
||||
}
|
||||
|
||||
/* IALVEARY COMPONENT */
|
||||
@@ -258,9 +253,4 @@ public abstract class TileAlveary extends TileForestry implements IAlvearyCompon
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return Utils.isUseableByPlayer(player, this, worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,9 +32,10 @@ import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.utils.Utils;
|
||||
|
||||
public class TileAlvearyHygroregulator extends TileAlveary implements IInventory, ILiquidTankContainer {
|
||||
|
||||
@@ -43,6 +44,7 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
|
||||
/* RECIPE MANAGMENT */
|
||||
private static class HygroregulatorRecipe {
|
||||
|
||||
public final FluidStack liquid;
|
||||
public final int transferTime;
|
||||
public final float humidChange;
|
||||
@@ -59,7 +61,6 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
private final HygroregulatorRecipe[] recipes;
|
||||
|
||||
/* MEMBERS */
|
||||
private final InventoryAdapter canInventory = new InventoryAdapter(1, "CanInv");
|
||||
private final TankManager tankManager;
|
||||
private final FilteredTank liquidTank;
|
||||
|
||||
@@ -69,6 +70,8 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
public TileAlvearyHygroregulator() {
|
||||
super(BLOCK_META);
|
||||
|
||||
setInternalInventory(new TileInventoryAdapter(this, 1, "CanInv"));
|
||||
|
||||
Fluid water = LiquidHelper.getFluid(Defaults.LIQUID_WATER);
|
||||
Fluid lava = LiquidHelper.getFluid(Defaults.LIQUID_LAVA);
|
||||
Fluid liquidIce = LiquidHelper.getFluid(Defaults.LIQUID_ICE);
|
||||
@@ -76,9 +79,9 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
liquidTank = new FilteredTank(Defaults.PROCESSOR_TANK_CAPACITY, water, lava, liquidIce);
|
||||
tankManager = new TankManager(liquidTank);
|
||||
|
||||
recipes = new HygroregulatorRecipe[] { new HygroregulatorRecipe(new FluidStack(water, 1), 1, 0.01f, -0.005f),
|
||||
new HygroregulatorRecipe(new FluidStack(lava, 1), 10, -0.01f, +0.005f),
|
||||
new HygroregulatorRecipe(new FluidStack(liquidIce, 1), 10, 0.02f, -0.01f) };
|
||||
recipes = new HygroregulatorRecipe[]{new HygroregulatorRecipe(new FluidStack(water, 1), 1, 0.01f, -0.005f),
|
||||
new HygroregulatorRecipe(new FluidStack(lava, 1), 10, -0.01f, +0.005f),
|
||||
new HygroregulatorRecipe(new FluidStack(liquidIce, 1), 10, 0.02f, -0.01f)};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -94,11 +97,12 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
/* UPDATING */
|
||||
private HygroregulatorRecipe getRecipe(FluidStack liquid) {
|
||||
HygroregulatorRecipe recipe = null;
|
||||
for (HygroregulatorRecipe rec : recipes)
|
||||
for (HygroregulatorRecipe rec : recipes) {
|
||||
if (rec.liquid.isFluidEqual(liquid)) {
|
||||
recipe = rec;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@@ -131,11 +135,13 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
if (worldObj.getTotalWorldTime() % 20 * 10 != 0)
|
||||
return;
|
||||
|
||||
TileInventoryAdapter canInventory = getInternalInventory();
|
||||
|
||||
// Check if we have suitable items waiting in the item slot
|
||||
if (canInventory.getStackInSlot(0) != null) {
|
||||
FluidContainerData container = LiquidHelper.getLiquidContainer(canInventory.getStackInSlot(0));
|
||||
if (container != null &&
|
||||
(container.fluid.getFluid() == FluidRegistry.WATER || container.fluid.getFluid() == FluidRegistry.LAVA)) {
|
||||
if (container != null
|
||||
&& (container.fluid.getFluid() == FluidRegistry.WATER || container.fluid.getFluid() == FluidRegistry.LAVA)) {
|
||||
|
||||
canInventory.setInventorySlotContents(0, StackUtils.replenishByContainer(this, canInventory.getStackInSlot(0), container, liquidTank));
|
||||
if (canInventory.getStackInSlot(0).stackSize <= 0)
|
||||
@@ -154,9 +160,6 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
|
||||
canInventory.readFromNBT(nbttagcompound);
|
||||
|
||||
tankManager.readTanksFromNBT(nbttagcompound);
|
||||
|
||||
transferTime = nbttagcompound.getInteger("TransferTime");
|
||||
@@ -170,9 +173,6 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
|
||||
canInventory.writeToNBT(nbttagcompound);
|
||||
|
||||
tankManager.writeTanksToNBT(nbttagcompound);
|
||||
|
||||
nbttagcompound.setInteger("TransferTime", transferTime);
|
||||
@@ -192,38 +192,38 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
|
||||
@Override
|
||||
public IInventory getInventory() {
|
||||
return canInventory;
|
||||
return getInternalInventory();
|
||||
}
|
||||
|
||||
/* IINVENTORY */
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
if (canInventory != null)
|
||||
return canInventory.getSizeInventory();
|
||||
if (getInternalInventory() != null)
|
||||
return getInternalInventory().getSizeInventory();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slotIndex) {
|
||||
if (canInventory != null)
|
||||
return canInventory.getStackInSlot(slotIndex);
|
||||
if (getInternalInventory() != null)
|
||||
return getInternalInventory().getStackInSlot(slotIndex);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slotIndex, int amount) {
|
||||
if (canInventory != null)
|
||||
return canInventory.decrStackSize(slotIndex, amount);
|
||||
if (getInternalInventory() != null)
|
||||
return getInternalInventory().decrStackSize(slotIndex, amount);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slotIndex) {
|
||||
if (canInventory != null)
|
||||
return canInventory.getStackInSlotOnClosing(slotIndex);
|
||||
if (getInternalInventory() != null)
|
||||
return getInternalInventory().getStackInSlotOnClosing(slotIndex);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
@@ -231,21 +231,26 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
@Override
|
||||
public void setInventorySlotContents(int slotIndex, ItemStack itemstack) {
|
||||
// Client side handling for container synch
|
||||
if (canInventory == null && !Proxies.common.isSimulating(worldObj))
|
||||
if (getInternalInventory() == null && !Proxies.common.isSimulating(worldObj))
|
||||
createInventory();
|
||||
|
||||
if (canInventory != null)
|
||||
canInventory.setInventorySlotContents(slotIndex, itemstack);
|
||||
if (getInternalInventory() != null)
|
||||
getInternalInventory().setInventorySlotContents(slotIndex, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
if (canInventory != null)
|
||||
return canInventory.getInventoryStackLimit();
|
||||
if (getInternalInventory() != null)
|
||||
return getInternalInventory().getInventoryStackLimit();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return Utils.isUseableByPlayer(player, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
}
|
||||
@@ -254,27 +259,16 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
public void closeInventory() {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return super.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return super.hasCustomInventoryName();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemstack) {
|
||||
if (!getInternalInventory().isItemValidForSlot(slotIndex, itemstack))
|
||||
return false;
|
||||
|
||||
if (slotIndex == 0) {
|
||||
FluidStack fluid = LiquidHelper.getFluidStackInContainer(itemstack);
|
||||
if (fluid == null || fluid.amount <= 0)
|
||||
@@ -282,7 +276,7 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
return liquidTank.accepts(fluid.getFluid());
|
||||
}
|
||||
|
||||
return super.isItemValidForSlot(slotIndex, itemstack);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* ILIQUIDTANKCONTAINER */
|
||||
@@ -296,6 +290,7 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
return tankManager.fill(from, resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
return tankManager.drain(from, resource, doDrain);
|
||||
}
|
||||
@@ -321,8 +316,10 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGUINetworkData(int messageId, int data) {}
|
||||
public void getGUINetworkData(int messageId, int data) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendGUINetworkData(Container container, ICrafting iCrafting) {}
|
||||
public void sendGUINetworkData(Container container, ICrafting iCrafting) {
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import forestry.api.core.ITileStructure;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.apiculture.gui.ContainerAlveary;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.interfaces.IClimatised;
|
||||
import forestry.core.interfaces.IErrorSource;
|
||||
@@ -35,8 +36,8 @@ import forestry.core.network.GuiId;
|
||||
import forestry.core.network.PacketIds;
|
||||
import forestry.core.network.PacketInventoryStack;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.utils.TileInventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -47,11 +48,11 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import scala.collection.SortedMap;
|
||||
|
||||
public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, ISpecialInventory, IBeeHousing, IClimatised, IHintSource {
|
||||
|
||||
@@ -90,8 +91,6 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
this.tempChange = nbttagcompound.getFloat("TempChange");
|
||||
this.humidChange = nbttagcompound.getFloat("HumidChange");
|
||||
|
||||
if (inventory != null)
|
||||
inventory.readFromNBT(nbttagcompound);
|
||||
if (beekeepingLogic != null)
|
||||
beekeepingLogic.readFromNBT(nbttagcompound);
|
||||
|
||||
@@ -104,8 +103,6 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
nbttagcompound.setFloat("TempChange", tempChange);
|
||||
nbttagcompound.setFloat("HumidChange", humidChange);
|
||||
|
||||
if (inventory != null)
|
||||
inventory.writeToNBT(nbttagcompound);
|
||||
if (beekeepingLogic != null)
|
||||
beekeepingLogic.writeToNBT(nbttagcompound);
|
||||
|
||||
@@ -139,7 +136,7 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
|
||||
// Add swarm effects
|
||||
if (worldObj.getTotalWorldTime() % 200 * 10 == 0)
|
||||
onQueenChange(inventory.getStackInSlot(SLOT_QUEEN));
|
||||
onQueenChange(getInternalInventory().getStackInSlot(SLOT_QUEEN));
|
||||
if (getErrorState() == EnumErrorCode.OK)
|
||||
queen.doFX(beekeepingLogic.getEffectData(), this);
|
||||
|
||||
@@ -164,16 +161,15 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
if (!isMaster())
|
||||
return;
|
||||
|
||||
if (inventory == null)
|
||||
if (getInternalInventory() == null)
|
||||
return;
|
||||
|
||||
// / Multiplayer FX
|
||||
if (PluginApiculture.beeInterface.isMated(inventory.getStackInSlot(SLOT_QUEEN))) {
|
||||
if (PluginApiculture.beeInterface.isMated(getInternalInventory().getStackInSlot(SLOT_QUEEN)))
|
||||
if (getErrorState() == EnumErrorCode.OK && worldObj.getTotalWorldTime() % 2 == 0) {
|
||||
IBee displayQueen = PluginApiculture.beeInterface.getMember(inventory.getStackInSlot(SLOT_QUEEN));
|
||||
IBee displayQueen = PluginApiculture.beeInterface.getMember(getInternalInventory().getStackInSlot(SLOT_QUEEN));
|
||||
displayQueen.doFX(beekeepingLogic.getEffectData(), this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void equalizeTemperature() {
|
||||
@@ -196,6 +192,7 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
|
||||
/* STATE INFORMATION */
|
||||
private int getHealthDisplay() {
|
||||
IInventory inventory = getInternalInventory();
|
||||
if (inventory == null || inventory.getStackInSlot(SLOT_QUEEN) == null)
|
||||
return 0;
|
||||
|
||||
@@ -208,6 +205,7 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
}
|
||||
|
||||
private int getMaxHealthDisplay() {
|
||||
IInventory inventory = getInternalInventory();
|
||||
if (inventory == null || inventory.getStackInSlot(SLOT_QUEEN) == null)
|
||||
return 0;
|
||||
|
||||
@@ -237,7 +235,7 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
/* STRUCTURE MANAGMENT */
|
||||
@Override
|
||||
protected void createInventory() {
|
||||
this.inventory = new TileInventoryAdapter(this, 9, "Items");
|
||||
setInternalInventory(new TileInventoryAdapter(this, 9, "Items"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -425,6 +423,7 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
|
||||
@Override
|
||||
public boolean addProduct(ItemStack product, boolean all) {
|
||||
TileInventoryAdapter inventory = getInternalInventory();
|
||||
if (inventory == null)
|
||||
return false;
|
||||
|
||||
@@ -523,13 +522,8 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
}
|
||||
|
||||
/* IINVENTORY */
|
||||
@Override
|
||||
public InventoryAdapter getInternalInventory() {
|
||||
return (InventoryAdapter) getStructureInventory();
|
||||
}
|
||||
|
||||
private IInventory getStructureInventory() {
|
||||
|
||||
TileInventoryAdapter inventory = getInternalInventory();
|
||||
if (inventory != null) {
|
||||
if (isMaster() || !Proxies.common.isSimulating(worldObj))
|
||||
return inventory;
|
||||
@@ -580,6 +574,7 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slotIndex, ItemStack itemstack) {
|
||||
TileInventoryAdapter inventory = getInternalInventory();
|
||||
// Client side handling for container synch
|
||||
if (inventory == null && !Proxies.common.isSimulating(worldObj))
|
||||
createInventory();
|
||||
@@ -603,33 +598,6 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canTakeStackFromSide(int slotIndex, ItemStack itemstack, int side) {
|
||||
|
||||
if (!super.canTakeStackFromSide(slotIndex, itemstack, side))
|
||||
return false;
|
||||
|
||||
if (slotIndex != SLOT_QUEEN && slotIndex != SLOT_DRONE)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canPutStackFromSide(int slotIndex, ItemStack itemstack, int side) {
|
||||
|
||||
if (!super.canPutStackFromSide(slotIndex, itemstack, side))
|
||||
return false;
|
||||
|
||||
if (slotIndex == SLOT_QUEEN && PluginApiculture.beeInterface.isMember(itemstack)
|
||||
&& !PluginApiculture.beeInterface.isDrone(itemstack))
|
||||
return true;
|
||||
if (slotIndex == SLOT_DRONE && PluginApiculture.beeInterface.isDrone(itemstack))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
}
|
||||
@@ -638,52 +606,53 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
public void closeInventory() {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return super.isUseableByPlayer(player);
|
||||
return Utils.isUseableByPlayer(player, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return super.hasCustomInventoryName();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemstack) {
|
||||
return super.isItemValidForSlot(slotIndex, itemstack);
|
||||
TileInventoryAdapter inventory = getInternalInventory();
|
||||
if (inventory == null)
|
||||
return false;
|
||||
|
||||
if (!inventory.isItemValidForSlot(slotIndex, itemstack))
|
||||
return false;
|
||||
|
||||
if (slotIndex == SLOT_QUEEN && PluginApiculture.beeInterface.isMember(itemstack)
|
||||
&& !PluginApiculture.beeInterface.isDrone(itemstack))
|
||||
return true;
|
||||
return slotIndex == SLOT_DRONE && PluginApiculture.beeInterface.isDrone(itemstack);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemstack, int j) {
|
||||
return super.canInsertItem(i, itemstack, j);
|
||||
public boolean canInsertItem(int slotIndex, ItemStack itemstack, int side) {
|
||||
return isItemValidForSlot(slotIndex, itemstack);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
|
||||
return super.canExtractItem(i, itemstack, j);
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, int side) {
|
||||
TileInventoryAdapter inventory = getInternalInventory();
|
||||
if (inventory == null)
|
||||
return false;
|
||||
if (!inventory.canExtractItem(slotIndex, itemstack, side))
|
||||
return false;
|
||||
|
||||
return slotIndex != SLOT_QUEEN && slotIndex != SLOT_DRONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return super.getAccessibleSlotsFromSide(side);
|
||||
TileInventoryAdapter inventory = getInternalInventory();
|
||||
if (inventory == null)
|
||||
return Defaults.FACINGS_NONE;
|
||||
return inventory.getAccessibleSlotsFromSide(side);
|
||||
}
|
||||
|
||||
/* ISPECIALINVENTORY */
|
||||
@@ -755,28 +724,28 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
break;
|
||||
}
|
||||
|
||||
return new ItemStack[] { product };
|
||||
return new ItemStack[]{product};
|
||||
}
|
||||
|
||||
/* SMP GUI */
|
||||
public void getGUINetworkData(int i, int j) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
displayHealth = j;
|
||||
break;
|
||||
case 1:
|
||||
displayHealthMax = j;
|
||||
break;
|
||||
case 4:
|
||||
this.tempChange = (float) j / 100;
|
||||
break;
|
||||
case 5:
|
||||
this.humidChange = (float) j / 100;
|
||||
break;
|
||||
case 6: {
|
||||
this.biome = BiomeGenBase.getBiome(j);
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
displayHealth = j;
|
||||
break;
|
||||
case 1:
|
||||
displayHealthMax = j;
|
||||
break;
|
||||
case 4:
|
||||
this.tempChange = (float) j / 100;
|
||||
break;
|
||||
case 5:
|
||||
this.humidChange = (float) j / 100;
|
||||
break;
|
||||
case 6: {
|
||||
this.biome = BiomeGenBase.getBiome(j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -836,7 +805,7 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
public boolean isOwnable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* IHousing */
|
||||
@Override
|
||||
public GameProfile getOwnerName() {
|
||||
|
||||
@@ -23,7 +23,7 @@ import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.interfaces.ICrafter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
|
||||
public class TileAlvearySieve extends TileAlveary implements ICrafter, IBeeListener {
|
||||
|
||||
@@ -125,11 +125,6 @@ public class TileAlvearySieve extends TileAlveary implements ICrafter, IBeeListe
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* INVENTORY */
|
||||
public InventoryAdapter getInternalInventory() {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
/* ICRAFTER */
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
@@ -27,20 +26,25 @@ import forestry.api.apiculture.IAlvearyComponent;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.ISpecialInventory;
|
||||
import forestry.apiculture.worldgen.WorldGenHive;
|
||||
import forestry.apiculture.worldgen.WorldGenHiveSwamer;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.inventory.wrappers.IInvSlot;
|
||||
import forestry.core.inventory.wrappers.InventoryIterator;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.TileInventoryAdapter;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
|
||||
public class TileAlvearySwarmer extends TileAlveary implements ISpecialInventory {
|
||||
public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory {
|
||||
|
||||
/* CONSTANTS */
|
||||
public static final int BLOCK_META = 2;
|
||||
|
||||
TileInventoryAdapter swarmerInventory;
|
||||
private final Stack<ItemStack> pendingSpawns = new Stack<ItemStack>();
|
||||
|
||||
public TileAlvearySwarmer() {
|
||||
@@ -50,7 +54,7 @@ public class TileAlvearySwarmer extends TileAlveary implements ISpecialInventory
|
||||
@Override
|
||||
public void initialize() {
|
||||
super.initialize();
|
||||
if (swarmerInventory == null)
|
||||
if (getInternalInventory() == null)
|
||||
createInventory();
|
||||
}
|
||||
|
||||
@@ -89,10 +93,10 @@ public class TileAlvearySwarmer extends TileAlveary implements ISpecialInventory
|
||||
int slot = getInducerSlot();
|
||||
if (slot < 0)
|
||||
return;
|
||||
int chance = getChanceFor(swarmerInventory.getStackInSlot(slot));
|
||||
int chance = getChanceFor(getInternalInventory().getStackInSlot(slot));
|
||||
|
||||
// Remove resource
|
||||
swarmerInventory.decrStackSize(slot, 1);
|
||||
getInternalInventory().decrStackSize(slot, 1);
|
||||
|
||||
// Try to spawn princess
|
||||
if (worldObj.rand.nextInt(1000) >= chance)
|
||||
@@ -115,12 +119,13 @@ public class TileAlvearySwarmer extends TileAlveary implements ISpecialInventory
|
||||
}
|
||||
|
||||
private int getInducerSlot() {
|
||||
for (int i = 0; i < swarmerInventory.getSizeInventory(); i++) {
|
||||
if (swarmerInventory.getStackInSlot(i) == null)
|
||||
for (IInvSlot slot : InventoryIterator.getIterable(getInternalInventory())) {
|
||||
ItemStack stack = slot.getStackInSlot();
|
||||
if (stack == null)
|
||||
continue;
|
||||
for (Entry<ItemStack, Integer> entry : BeeManager.inducers.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(swarmerInventory.getStackInSlot(i)))
|
||||
return i;
|
||||
if (entry.getKey().isItemEqual(stack))
|
||||
return slot.getIndex();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +135,7 @@ public class TileAlvearySwarmer extends TileAlveary implements ISpecialInventory
|
||||
private void trySpawnSwarm() {
|
||||
|
||||
ItemStack toSpawn = pendingSpawns.peek();
|
||||
WorldGenHive generator = new WorldGenHiveSwamer(new ItemStack[] { toSpawn });
|
||||
WorldGenHive generator = new WorldGenHiveSwamer(new ItemStack[]{toSpawn});
|
||||
|
||||
int i = 0;
|
||||
while (i < 10) {
|
||||
@@ -154,7 +159,7 @@ public class TileAlvearySwarmer extends TileAlveary implements ISpecialInventory
|
||||
/* TEXTURES */
|
||||
@Override
|
||||
public int getIcon(int side, int metadata) {
|
||||
if(side == 0 || side == 1)
|
||||
if (side == 0 || side == 1)
|
||||
return BlockAlveary.BOTTOM;
|
||||
|
||||
if (pendingSpawns.size() > 0)
|
||||
@@ -166,10 +171,9 @@ public class TileAlvearySwarmer extends TileAlveary implements ISpecialInventory
|
||||
/* SAVING & LOADING */
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
if (swarmerInventory == null)
|
||||
if (getInternalInventory() == null)
|
||||
createInventory();
|
||||
swarmerInventory.readFromNBT(nbttagcompound);
|
||||
super.readFromNBT(nbttagcompound);
|
||||
|
||||
NBTTagList nbttaglist = nbttagcompound.getTagList("PendingSpawns", 10);
|
||||
for (int i = 0; i < nbttaglist.tagCount(); i++) {
|
||||
@@ -182,75 +186,60 @@ public class TileAlvearySwarmer extends TileAlveary implements ISpecialInventory
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
if (swarmerInventory != null)
|
||||
swarmerInventory.writeToNBT(nbttagcompound);
|
||||
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
ItemStack[] offspring = pendingSpawns.toArray(new ItemStack[pendingSpawns.size()]);
|
||||
for (int i = 0; i < offspring.length; i++)
|
||||
for (int i = 0; i < offspring.length; i++) {
|
||||
if (offspring[i] != null) {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
nbttagcompound1.setByte("Slot", (byte) i);
|
||||
offspring[i].writeToNBT(nbttagcompound1);
|
||||
nbttaglist.appendTag(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
nbttagcompound.setTag("PendingSpawns", nbttaglist);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createInventory() {
|
||||
swarmerInventory = new TileInventoryAdapter(this, 4, "SwarmInv");
|
||||
setInternalInventory(new TileInventoryAdapter(this, 4, "SwarmInv"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventory() {
|
||||
return swarmerInventory;
|
||||
}
|
||||
|
||||
/* ISPECIALINVENTORY */
|
||||
@Override
|
||||
public int addItem(ItemStack stack, boolean doAdd, ForgeDirection from) {
|
||||
if (swarmerInventory != null)
|
||||
return swarmerInventory.addStack(stack, false, doAdd);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] extractItem(boolean doRemove, ForgeDirection from, int maxItemCount) {
|
||||
return null;
|
||||
return getInternalInventory();
|
||||
}
|
||||
|
||||
/* IINVENTORY */
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
if (swarmerInventory != null)
|
||||
return swarmerInventory.getSizeInventory();
|
||||
if (getInternalInventory() != null)
|
||||
return getInternalInventory().getSizeInventory();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slotIndex) {
|
||||
if (swarmerInventory != null)
|
||||
return swarmerInventory.getStackInSlot(slotIndex);
|
||||
if (getInternalInventory() != null)
|
||||
return getInternalInventory().getStackInSlot(slotIndex);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slotIndex, int amount) {
|
||||
if (swarmerInventory != null)
|
||||
return swarmerInventory.decrStackSize(slotIndex, amount);
|
||||
if (getInternalInventory() != null)
|
||||
return getInternalInventory().decrStackSize(slotIndex, amount);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slotIndex) {
|
||||
if (swarmerInventory != null)
|
||||
return swarmerInventory.getStackInSlotOnClosing(slotIndex);
|
||||
if (getInternalInventory() != null)
|
||||
return getInternalInventory().getStackInSlotOnClosing(slotIndex);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
@@ -258,11 +247,11 @@ public class TileAlvearySwarmer extends TileAlveary implements ISpecialInventory
|
||||
@Override
|
||||
public void setInventorySlotContents(int slotIndex, ItemStack itemstack) {
|
||||
// Client side handling for container synch
|
||||
if (swarmerInventory == null && !Proxies.common.isSimulating(worldObj))
|
||||
if (getInternalInventory() == null && !Proxies.common.isSimulating(worldObj))
|
||||
createInventory();
|
||||
|
||||
if (swarmerInventory != null)
|
||||
swarmerInventory.setInventorySlotContents(slotIndex, itemstack);
|
||||
if (getInternalInventory() != null)
|
||||
getInternalInventory().setInventorySlotContents(slotIndex, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -272,36 +261,56 @@ public class TileAlvearySwarmer extends TileAlveary implements ISpecialInventory
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
if (swarmerInventory != null)
|
||||
return swarmerInventory.getInventoryStackLimit();
|
||||
if (getInternalInventory() != null)
|
||||
return getInternalInventory().getInventoryStackLimit();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override public void openInventory() {}
|
||||
@Override public void closeInventory() {}
|
||||
@Override
|
||||
public void openInventory() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return super.isUseableByPlayer(player);
|
||||
return Utils.isUseableByPlayer(player, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return super.hasCustomInventoryName();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemstack) {
|
||||
return super.isItemValidForSlot(slotIndex, itemstack);
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack stack) {
|
||||
if (getInternalInventory() != null) {
|
||||
if (!getInternalInventory().isItemValidForSlot(slotIndex, stack))
|
||||
return false;
|
||||
return StackUtils.isIdenticalItem(stack, ForestryItem.royalJelly.getItemStack());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
if (getInternalInventory() != null)
|
||||
return getInternalInventory().getAccessibleSlotsFromSide(side);
|
||||
return Defaults.FACINGS_NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side) {
|
||||
if (getInternalInventory() != null)
|
||||
return getInternalInventory().isItemValidForSlot(slot, stack);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ import forestry.core.network.PacketIds;
|
||||
import forestry.core.network.PacketInventoryStack;
|
||||
import forestry.core.network.PacketTileUpdate;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@@ -14,7 +14,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
|
||||
public class TileSwarm extends TileEntity {
|
||||
|
||||
|
||||
@@ -50,8 +50,4 @@ public class ContainerAlvearySieve extends ContainerForestry {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
return tile.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -22,7 +21,6 @@ import forestry.core.config.ForestryItem;
|
||||
import forestry.core.gui.ContainerForestry;
|
||||
import forestry.core.gui.slots.SlotClosed;
|
||||
import forestry.core.gui.slots.SlotCustom;
|
||||
import forestry.core.utils.Utils;
|
||||
|
||||
public class ContainerApiary extends ContainerForestry {
|
||||
|
||||
@@ -33,29 +31,29 @@ public class ContainerApiary extends ContainerForestry {
|
||||
|
||||
this.tile = tile;
|
||||
tile.sendNetworkUpdate();
|
||||
IInventory inventory = tile.getInternalInventory();
|
||||
IInventory inv = tile.getInternalInventory();
|
||||
|
||||
// Queen/Princess
|
||||
this.addSlot(new SlotCustom(inventory, TileBeehouse.SLOT_QUEEN, 29, 39, ForestryItem.beePrincessGE, ForestryItem.beeQueenGE));
|
||||
this.addSlot(new SlotCustom(inv, TileBeehouse.SLOT_QUEEN, 29, 39, ForestryItem.beePrincessGE, ForestryItem.beeQueenGE));
|
||||
|
||||
// Drone
|
||||
this.addSlot(new SlotCustom(inventory, TileBeehouse.SLOT_DRONE, 29, 65, ForestryItem.beeDroneGE));
|
||||
this.addSlot(new SlotCustom(inv, TileBeehouse.SLOT_DRONE, 29, 65, ForestryItem.beeDroneGE));
|
||||
|
||||
// Frames
|
||||
if (hasFrames) {
|
||||
this.addSlot(new SlotCustom(inventory, TileBeehouse.SLOT_FRAMES_1, 66, 23, IHiveFrame.class));
|
||||
this.addSlot(new SlotCustom(inventory, TileBeehouse.SLOT_FRAMES_1 + 1, 66, 52, IHiveFrame.class));
|
||||
this.addSlot(new SlotCustom(inventory, TileBeehouse.SLOT_FRAMES_1 + 2, 66, 81, IHiveFrame.class));
|
||||
this.addSlot(new SlotCustom(inv, TileBeehouse.SLOT_FRAMES_1, 66, 23, IHiveFrame.class));
|
||||
this.addSlot(new SlotCustom(inv, TileBeehouse.SLOT_FRAMES_1 + 1, 66, 52, IHiveFrame.class));
|
||||
this.addSlot(new SlotCustom(inv, TileBeehouse.SLOT_FRAMES_1 + 2, 66, 81, IHiveFrame.class));
|
||||
}
|
||||
|
||||
// Product Inventory
|
||||
this.addSlot(new SlotClosed(inventory, 2, 116, 52));
|
||||
this.addSlot(new SlotClosed(inventory, 3, 137, 39));
|
||||
this.addSlot(new SlotClosed(inventory, 4, 137, 65));
|
||||
this.addSlot(new SlotClosed(inventory, 5, 116, 78));
|
||||
this.addSlot(new SlotClosed(inventory, 6, 95, 65));
|
||||
this.addSlot(new SlotClosed(inventory, 7, 95, 39));
|
||||
this.addSlot(new SlotClosed(inventory, 8, 116, 26));
|
||||
this.addSlot(new SlotClosed(inv, 2, 116, 52));
|
||||
this.addSlot(new SlotClosed(inv, 3, 137, 39));
|
||||
this.addSlot(new SlotClosed(inv, 4, 137, 65));
|
||||
this.addSlot(new SlotClosed(inv, 5, 116, 78));
|
||||
this.addSlot(new SlotClosed(inv, 6, 95, 65));
|
||||
this.addSlot(new SlotClosed(inv, 7, 95, 39));
|
||||
this.addSlot(new SlotClosed(inv, 8, 116, 26));
|
||||
|
||||
// Player inventory
|
||||
for (int i1 = 0; i1 < 3; i1++) {
|
||||
@@ -82,8 +80,4 @@ public class ContainerApiary extends ContainerForestry {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
return Utils.isUseableByPlayer(entityplayer, tile, tile.getWorld(), tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.items;
|
||||
|
||||
import forestry.core.utils.AlyzerInventory;
|
||||
import forestry.core.inventory.AlyzerInventory;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -38,7 +38,7 @@ import forestry.core.interfaces.IHintSource;
|
||||
import forestry.core.items.ItemInventoried;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.ItemInventory;
|
||||
import forestry.core.inventory.ItemInventory;
|
||||
import forestry.core.utils.Vect;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.core.utils.AlyzerInventory;
|
||||
import forestry.core.inventory.AlyzerInventory;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.Tabs;
|
||||
|
||||
@@ -30,7 +30,7 @@ import forestry.core.interfaces.IErrorSource;
|
||||
import forestry.core.items.ItemForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.ItemInventory;
|
||||
import forestry.core.inventory.ItemInventory;
|
||||
|
||||
public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ import forestry.core.items.ItemNBTTile;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.core.utils.Utils;
|
||||
|
||||
public class BlockBase extends BlockForestry {
|
||||
|
||||
@@ -161,7 +162,7 @@ public class BlockBase extends BlockForestry {
|
||||
return false;
|
||||
|
||||
TileBase tile = (TileBase) world.getTileEntity(x, y, z);
|
||||
if (!tile.isUseableByPlayer(player))
|
||||
if (!Utils.isUseableByPlayer(player, tile))
|
||||
return false;
|
||||
|
||||
ItemStack current = player.getCurrentEquippedItem();
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.gadgets;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.world.World;
|
||||
import forestry.api.core.ITileStructure;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.core.utils.Utils;
|
||||
|
||||
public abstract class BlockStructure extends BlockForestry {
|
||||
|
||||
@@ -60,7 +61,7 @@ public abstract class BlockStructure extends BlockForestry {
|
||||
return false;
|
||||
|
||||
TileForestry tile = (TileForestry) world.getTileEntity(x, y, z);
|
||||
if (!tile.isUseableByPlayer(player))
|
||||
if (!Utils.isUseableByPlayer(player, tile))
|
||||
return false;
|
||||
|
||||
if (!Proxies.common.isSimulating(world))
|
||||
|
||||
@@ -42,7 +42,7 @@ import forestry.core.inventory.InvTools;
|
||||
import forestry.core.inventory.wrappers.IInvSlot;
|
||||
import forestry.core.inventory.wrappers.InventoryIterator;
|
||||
import forestry.core.inventory.wrappers.InventoryMapper;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiquidTankContainer {
|
||||
@@ -57,8 +57,6 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui
|
||||
public static final short SLOT_OUTPUT_1 = 8;
|
||||
|
||||
/* MEMBER */
|
||||
private final InventoryAdapter inventory = new InventoryAdapter(12, "Items");
|
||||
|
||||
private int analyzeTime;
|
||||
|
||||
@EntityNetData
|
||||
@@ -68,13 +66,15 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui
|
||||
|
||||
private final Stack<ItemStack> pendingProducts = new Stack<ItemStack>();
|
||||
|
||||
private final IInventory invInput = new InventoryMapper(inventory, SLOT_INPUT_1, 6);
|
||||
private final IInventory invInput;
|
||||
|
||||
/* CONSTRUCTOR */
|
||||
public TileAnalyzer() {
|
||||
super(800, 40, Defaults.MACHINE_MAX_ENERGY);
|
||||
setInternalInventory(new TileInventoryAdapter(this, 12, "Items"));
|
||||
resourceTank = new FilteredTank(Defaults.PROCESSOR_TANK_CAPACITY, Fluids.HONEY.get());
|
||||
tankManager = new TankManager(resourceTank);
|
||||
invInput = new InventoryMapper(getInternalInventory(), SLOT_INPUT_1, 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,17 +100,15 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui
|
||||
// / Pending Products
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
ItemStack[] pending = pendingProducts.toArray(new ItemStack[pendingProducts.size()]);
|
||||
for (int i = 0; i < pending.length; i++)
|
||||
for (int i = 0; i < pending.length; i++) {
|
||||
if (pending[i] != null) {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
nbttagcompound1.setByte("Slot", (byte) i);
|
||||
pending[i].writeToNBT(nbttagcompound1);
|
||||
nbttaglist.appendTag(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
nbttagcompound.setTag("PendingProducts", nbttaglist);
|
||||
|
||||
// / Inventory
|
||||
inventory.writeToNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -127,9 +125,6 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui
|
||||
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
|
||||
pendingProducts.add(ItemStack.loadItemStackFromNBT(nbttagcompound1));
|
||||
}
|
||||
|
||||
// / Inventory
|
||||
inventory.readFromNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -249,7 +244,7 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui
|
||||
return false;
|
||||
|
||||
ItemStack next = pendingProducts.peek();
|
||||
if (inventory.tryAddStack(next, SLOT_OUTPUT_1, inventory.getSizeInventory() - SLOT_OUTPUT_1, true)) {
|
||||
if (getInternalInventory().tryAddStack(next, SLOT_OUTPUT_1, getInternalInventory().getSizeInventory() - SLOT_OUTPUT_1, true)) {
|
||||
pendingProducts.pop();
|
||||
return true;
|
||||
}
|
||||
@@ -270,7 +265,7 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui
|
||||
if (analyzeTime > 0)
|
||||
return true;
|
||||
|
||||
return getErrorState() == EnumErrorCode.OK ||getErrorState() == EnumErrorCode.NOPOWER;
|
||||
return getErrorState() == EnumErrorCode.OK || getErrorState() == EnumErrorCode.NOPOWER;
|
||||
}
|
||||
|
||||
public int getProgressScaled(int i) {
|
||||
@@ -304,62 +299,34 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui
|
||||
}
|
||||
|
||||
/* ISIDEDINVENTORY */
|
||||
@Override
|
||||
public InventoryAdapter getInternalInventory() {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canTakeStackFromSide(int slotIndex, ItemStack itemstack, int side) {
|
||||
if (!super.canTakeStackFromSide(slotIndex, itemstack, side))
|
||||
return false;
|
||||
|
||||
return slotIndex >= SLOT_OUTPUT_1 && slotIndex < SLOT_OUTPUT_1 + 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canPutStackFromSide(int slotIndex, ItemStack stack, int side) {
|
||||
|
||||
if (!super.canPutStackFromSide(slotIndex, stack, side))
|
||||
return false;
|
||||
|
||||
if (slotIndex >= SLOT_INPUT_1 && slotIndex < SLOT_INPUT_1 + 6)
|
||||
return AlleleManager.alleleRegistry.isIndividual(stack);
|
||||
|
||||
if (slotIndex == SLOT_CAN)
|
||||
return Fluids.HONEY.isContained(stack);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventory.getSizeInventory();
|
||||
return getInternalInventory().getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return inventory.getStackInSlot(i);
|
||||
return getInternalInventory().getStackInSlot(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
return inventory.decrStackSize(i, j);
|
||||
return getInternalInventory().decrStackSize(i, j);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
inventory.setInventorySlotContents(i, itemstack);
|
||||
getInternalInventory().setInventorySlotContents(i, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return inventory.getInventoryStackLimit();
|
||||
return getInternalInventory().getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return inventory.getStackInSlotOnClosing(slot);
|
||||
return getInternalInventory().getStackInSlotOnClosing(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -370,52 +337,46 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui
|
||||
public void closeInventory() {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return super.isUseableByPlayer(player);
|
||||
return getInternalInventory().isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return super.hasCustomInventoryName();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemstack) {
|
||||
return super.isItemValidForSlot(slotIndex, itemstack);
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
if (!getInternalInventory().isItemValidForSlot(slot, stack))
|
||||
return false;
|
||||
|
||||
if (slot >= SLOT_INPUT_1 && slot < SLOT_INPUT_1 + 6)
|
||||
return AlleleManager.alleleRegistry.isIndividual(stack);
|
||||
|
||||
if (slot == SLOT_CAN)
|
||||
return Fluids.HONEY.isContained(stack);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemstack, int j) {
|
||||
return super.canInsertItem(i, itemstack, j);
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side) {
|
||||
return isItemValidForSlot(side, stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
|
||||
return super.canExtractItem(i, itemstack, j);
|
||||
public boolean canExtractItem(int slotIndex, ItemStack stack, int side) {
|
||||
if (!getInternalInventory().canExtractItem(slotIndex, stack, side))
|
||||
return false;
|
||||
|
||||
return slotIndex >= SLOT_OUTPUT_1 && slotIndex < SLOT_OUTPUT_1 + 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return super.getAccessibleSlotsFromSide(side);
|
||||
return getInternalInventory().getAccessibleSlotsFromSide(side);
|
||||
}
|
||||
|
||||
/* ILIQUIDCONTAINER */
|
||||
|
||||
@@ -89,16 +89,6 @@ public abstract class TileBase extends TileForestry implements IHintSource {
|
||||
public void openGui(EntityPlayer player, TileBase tile) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
if (!Utils.isUseableByPlayer(player, this, worldObj, xCoord, yCoord, zCoord))
|
||||
return false;
|
||||
if (getAccess() == EnumAccess.PRIVATE)
|
||||
return PlayerUtil.isSameGameProfile(owner, player.getGameProfile());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canDrainWithBucket() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -29,9 +29,9 @@ import forestry.core.network.PacketTileNBT;
|
||||
import forestry.core.network.PacketTileUpdate;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.core.utils.TileInventoryAdapter;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.utils.Utils;
|
||||
|
||||
public class TileEscritoire extends TileBase implements ISidedInventory, IRenderableMachine, ICrafter {
|
||||
|
||||
@@ -18,7 +18,6 @@ import com.mojang.authlib.GameProfile;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.interfaces.IErrorSource;
|
||||
import forestry.core.interfaces.IOwnable;
|
||||
import forestry.core.network.ForestryPacket;
|
||||
@@ -27,7 +26,7 @@ import forestry.core.network.PacketPayload;
|
||||
import forestry.core.network.PacketTileUpdate;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.EnumAccess;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.utils.Vect;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -46,6 +45,7 @@ import java.util.Collection;
|
||||
public abstract class TileForestry extends TileEntity implements INetworkedEntity, IOwnable, IErrorSource, ITriggerProvider {
|
||||
|
||||
protected boolean isInited = false;
|
||||
private TileInventoryAdapter inventory;
|
||||
|
||||
public Vect Coords() {
|
||||
return new Vect(xCoord, yCoord, zCoord);
|
||||
@@ -79,44 +79,43 @@ public abstract class TileForestry extends TileEntity implements INetworkedEntit
|
||||
initialize();
|
||||
isInited = true;
|
||||
}
|
||||
|
||||
if (!Proxies.common.isSimulating(worldObj))
|
||||
return;
|
||||
}
|
||||
|
||||
public abstract void initialize();
|
||||
|
||||
// / SAVING & LOADING
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
public void readFromNBT(NBTTagCompound data) {
|
||||
super.readFromNBT(data);
|
||||
|
||||
if(inventory != null) inventory.readFromNBT(data);
|
||||
|
||||
if (nbttagcompound.hasKey("Access"))
|
||||
access = EnumAccess.values()[nbttagcompound.getInteger("Access")];
|
||||
if (data.hasKey("Access"))
|
||||
access = EnumAccess.values()[data.getInteger("Access")];
|
||||
else
|
||||
access = EnumAccess.SHARED;
|
||||
if (nbttagcompound.hasKey("owner")) {
|
||||
owner = NBTUtil.func_152459_a(nbttagcompound.getCompoundTag("owner"));
|
||||
}
|
||||
if (data.hasKey("owner"))
|
||||
owner = NBTUtil.func_152459_a(data.getCompoundTag("owner"));
|
||||
|
||||
if (nbttagcompound.hasKey("Orientation"))
|
||||
orientation = ForgeDirection.values()[nbttagcompound.getInteger("Orientation")];
|
||||
if (data.hasKey("Orientation"))
|
||||
orientation = ForgeDirection.values()[data.getInteger("Orientation")];
|
||||
else
|
||||
orientation = ForgeDirection.WEST;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
nbttagcompound.setInteger("Access", access.ordinal());
|
||||
public void writeToNBT(NBTTagCompound data) {
|
||||
super.writeToNBT(data);
|
||||
if(inventory != null) inventory.writeToNBT(data);
|
||||
data.setInteger("Access", access.ordinal());
|
||||
if (this.owner != null) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
NBTUtil.func_152460_a(nbt, owner);
|
||||
nbttagcompound.setTag("owner", nbt);
|
||||
data.setTag("owner", nbt);
|
||||
}
|
||||
if (orientation != null)
|
||||
nbttagcompound.setInteger("Orientation", orientation.ordinal());
|
||||
data.setInteger("Orientation", orientation.ordinal());
|
||||
}
|
||||
|
||||
// / SMP
|
||||
@@ -205,7 +204,7 @@ public abstract class TileForestry extends TileEntity implements INetworkedEntit
|
||||
return errorState;
|
||||
}
|
||||
// / OWNERSHIP
|
||||
public GameProfile owner = null;
|
||||
private GameProfile owner = null;
|
||||
private EnumAccess access = EnumAccess.SHARED;
|
||||
|
||||
@Override
|
||||
@@ -285,52 +284,21 @@ public abstract class TileForestry extends TileEntity implements INetworkedEntit
|
||||
}
|
||||
|
||||
/* NAME */
|
||||
|
||||
/**
|
||||
* Gets the tile's unlocalized name, based on the block at the location of this entity (client-only).
|
||||
* @return
|
||||
*/
|
||||
public String getUnlocalizedName() {
|
||||
String blockUnlocalizedName = getBlockType().getUnlocalizedName().replace("tile.for.","");
|
||||
String blockUnlocalizedName = getBlockType().getUnlocalizedName().replace("tile.for.", "");
|
||||
return blockUnlocalizedName + "." + getBlockMetadata() + ".name";
|
||||
}
|
||||
|
||||
public boolean hasCustomInventoryName() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ACCESS */
|
||||
public abstract boolean isUseableByPlayer(EntityPlayer player);
|
||||
|
||||
/* INVENTORY BASICS */
|
||||
public InventoryAdapter getInternalInventory() {
|
||||
return null;
|
||||
public final TileInventoryAdapter getInternalInventory() {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canInsertItem(int i, ItemStack itemstack, int j) {
|
||||
return canPutStackFromSide(i, itemstack, j);
|
||||
}
|
||||
|
||||
protected boolean canTakeStackFromSide(int slotIndex, ItemStack itemstack, int side) {
|
||||
return getAccess() == EnumAccess.SHARED;
|
||||
}
|
||||
|
||||
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
|
||||
return canTakeStackFromSide(i, itemstack, j);
|
||||
}
|
||||
|
||||
protected boolean canPutStackFromSide(int slotIndex, ItemStack itemstack, int side) {
|
||||
return getAccess() == EnumAccess.SHARED;
|
||||
}
|
||||
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
if (getInternalInventory() == null)
|
||||
return Defaults.FACINGS_NONE;
|
||||
else
|
||||
return getInternalInventory().getSizeInventorySide(side);
|
||||
|
||||
public final void setInternalInventory(TileInventoryAdapter inv) {
|
||||
this.inventory = inv;
|
||||
}
|
||||
}
|
||||
@@ -12,32 +12,26 @@ package forestry.core.gadgets;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ISpecialInventory;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.interfaces.IClimatised;
|
||||
import forestry.core.interfaces.IHintSource;
|
||||
import forestry.core.network.PacketPayload;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.EnumAccess;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import forestry.plugins.PluginEnergy;
|
||||
import forestry.plugins.PluginFactory;
|
||||
import forestry.plugins.PluginIC2;
|
||||
import forestry.plugins.PluginMail;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public abstract class TileMachine extends TileForestry implements ISpecialInventory, IClimatised, IHintSource {
|
||||
public abstract class TileMachine extends TileForestry implements IClimatised, IHintSource {
|
||||
|
||||
public TileMachine() {
|
||||
}
|
||||
@@ -275,86 +269,6 @@ public abstract class TileMachine extends TileForestry implements ISpecialInvent
|
||||
return false;
|
||||
}
|
||||
|
||||
// IINVENTORY IMPLEMENTATION
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return Utils.isUseableByPlayer(player, this, worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return super.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemstack) {
|
||||
return super.isItemValidForSlot(slotIndex, itemstack);
|
||||
}
|
||||
|
||||
// IPARTICULARINVENTORY IMPLEMENTATION
|
||||
@Override
|
||||
public int addItem(ItemStack stack, boolean doAdd, ForgeDirection from) {
|
||||
if (getAccess() == EnumAccess.PRIVATE)
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] extractItem(boolean doRemove, ForgeDirection from, int maxItemCount) {
|
||||
if (getAccess() == EnumAccess.PRIVATE)
|
||||
return new ItemStack[0];
|
||||
|
||||
return new ItemStack[0];
|
||||
}
|
||||
|
||||
// INETWORKEDTILE IMPLEMENTATION
|
||||
@Override
|
||||
|
||||
@@ -2,7 +2,7 @@ package forestry.core.gui;
|
||||
|
||||
import forestry.core.gui.slots.SlotCustom;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.AlyzerInventory;
|
||||
import forestry.core.inventory.AlyzerInventory;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
@@ -213,7 +213,7 @@ public class ContainerForestry extends Container {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
public final boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
return inventory.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ import net.minecraft.item.ItemStack;
|
||||
import forestry.core.gui.slots.SlotItemInventory;
|
||||
import forestry.core.gui.slots.SlotLocked;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.ItemInventory;
|
||||
import forestry.core.inventory.ItemInventory;
|
||||
|
||||
public abstract class ContainerItemInventory extends ContainerForestry {
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package forestry.core.utils;
|
||||
package forestry.core.inventory;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
+19
-6
@@ -8,7 +8,7 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.utils;
|
||||
package forestry.core.inventory;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -18,13 +18,16 @@ import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import forestry.api.core.INBTTagable;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.utils.PlainInventory;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
|
||||
/**
|
||||
* With permission from Krapht.
|
||||
*/
|
||||
public class InventoryAdapter implements IInventory, INBTTagable {
|
||||
public class InventoryAdapter implements IInventory, ISidedInventory, INBTTagable {
|
||||
|
||||
private IInventory inventory = null;
|
||||
private final IInventory inventory;
|
||||
//private boolean debug = false;
|
||||
|
||||
public InventoryAdapter(int size, String name) {
|
||||
@@ -44,7 +47,6 @@ public class InventoryAdapter implements IInventory, INBTTagable {
|
||||
// this.debug = true;
|
||||
// return this;
|
||||
// }
|
||||
|
||||
/**
|
||||
* @return Copy of this inventory. Stacks are copies.
|
||||
*/
|
||||
@@ -333,7 +335,7 @@ public class InventoryAdapter implements IInventory, INBTTagable {
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -357,7 +359,8 @@ public class InventoryAdapter implements IInventory, INBTTagable {
|
||||
/* ISIDEDINVENTORY */
|
||||
private int[][] slotMap;
|
||||
|
||||
public int[] getSizeInventorySide(int side) {
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return slotMap[side];
|
||||
}
|
||||
|
||||
@@ -407,6 +410,16 @@ public class InventoryAdapter implements IInventory, INBTTagable {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side) {
|
||||
return isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* SAVING & LOADING */
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
+2
-1
@@ -8,7 +8,7 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.utils;
|
||||
package forestry.core.inventory;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -18,6 +18,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import forestry.api.core.INBTTagable;
|
||||
import forestry.core.utils.Utils;
|
||||
|
||||
public class ItemInventory implements IInventory, INBTTagable {
|
||||
|
||||
+22
-5
@@ -8,19 +8,22 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.utils;
|
||||
package forestry.core.inventory;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import forestry.core.gadgets.TileForestry;
|
||||
import forestry.core.utils.EnumAccess;
|
||||
import forestry.core.utils.PlayerUtil;
|
||||
import forestry.core.utils.Utils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class TileInventoryAdapter extends InventoryAdapter {
|
||||
|
||||
private final TileForestry tile;
|
||||
|
||||
public TileInventoryAdapter(TileForestry tile, int size, String name) {
|
||||
super(size, name);
|
||||
this.tile = tile;
|
||||
this(tile, size, name, 64);
|
||||
}
|
||||
|
||||
public TileInventoryAdapter(TileForestry tile, int size, String name, int stackLimit) {
|
||||
@@ -29,8 +32,12 @@ public class TileInventoryAdapter extends InventoryAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return tile.isUseableByPlayer(entityplayer);
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
if (!Utils.isUseableByPlayer(player, tile))
|
||||
return false;
|
||||
if (tile.getAccess() == EnumAccess.PRIVATE)
|
||||
return PlayerUtil.isSameGameProfile(tile.getOwnerProfile(), player.getGameProfile());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -38,4 +45,14 @@ public class TileInventoryAdapter extends InventoryAdapter {
|
||||
super.markDirty();
|
||||
tile.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return tile.getAccess() == EnumAccess.SHARED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side) {
|
||||
return tile.getAccess() == EnumAccess.SHARED;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.utils;
|
||||
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
@@ -229,7 +229,15 @@ public class Utils {
|
||||
return block == Blocks.water || block == Blocks.flowing_water || block == Blocks.lava || block == Blocks.flowing_lava;
|
||||
}
|
||||
|
||||
public static boolean isUseableByPlayer(EntityPlayer player, TileEntity tile, World world, int x, int y, int z) {
|
||||
public static boolean isUseableByPlayer(EntityPlayer player, TileEntity tile) {
|
||||
int x = tile.xCoord;
|
||||
int y = tile.yCoord;
|
||||
int z = tile.zCoord;
|
||||
World world = tile.getWorldObj();
|
||||
|
||||
if(tile.isInvalid())
|
||||
return false;
|
||||
|
||||
if (world.getTileEntity(x, y, z) != tile)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -25,8 +25,7 @@ import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.network.PacketPayload;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.TileInventoryAdapter;
|
||||
import static forestry.factory.gadgets.MachineBottler.SLOT_PRODUCT;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
@@ -70,7 +69,6 @@ public class EngineBronze extends Engine implements ISidedInventory, ILiquidTank
|
||||
public FilteredTank fuelTank;
|
||||
public FilteredTank heatingTank;
|
||||
private final TankManager tankManager;
|
||||
private final TileInventoryAdapter inventory;
|
||||
public int burnTime;
|
||||
public int totalTime;
|
||||
public int currentFluidId = -1;
|
||||
@@ -83,7 +81,7 @@ public class EngineBronze extends Engine implements ISidedInventory, ILiquidTank
|
||||
super(Defaults.ENGINE_BRONZE_HEAT_MAX, 300000, 5000);
|
||||
setHints(Config.hints.get("engine.bronze"));
|
||||
|
||||
inventory = new TileInventoryAdapter(this, 1, "Items");
|
||||
setInternalInventory(new TileInventoryAdapter(this, 1, "Items"));
|
||||
|
||||
fuelTank = new FilteredTank(Defaults.ENGINE_TANK_CAPACITY, FuelManager.bronzeEngineFuel.keySet());
|
||||
fuelTank.tankMode = StandardTank.TankMode.INPUT;
|
||||
@@ -107,6 +105,8 @@ public class EngineBronze extends Engine implements ISidedInventory, ILiquidTank
|
||||
|
||||
super.updateServerSide();
|
||||
|
||||
TileInventoryAdapter inventory = getInternalInventory();
|
||||
|
||||
// Check if we have suitable items waiting in the item slot
|
||||
if (inventory.getStackInSlot(SLOT_CAN) != null) {
|
||||
|
||||
@@ -304,7 +304,6 @@ public class EngineBronze extends Engine implements ISidedInventory, ILiquidTank
|
||||
*/
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
burnTime = nbt.getInteger("EngineBurnTime");
|
||||
@@ -317,7 +316,6 @@ public class EngineBronze extends Engine implements ISidedInventory, ILiquidTank
|
||||
}
|
||||
|
||||
tankManager.readTanksFromNBT(nbt);
|
||||
inventory.readFromNBT(nbt);
|
||||
|
||||
}
|
||||
|
||||
@@ -327,7 +325,6 @@ public class EngineBronze extends Engine implements ISidedInventory, ILiquidTank
|
||||
*/
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
nbt.setInteger("EngineBurnTime", burnTime);
|
||||
@@ -338,7 +335,6 @@ public class EngineBronze extends Engine implements ISidedInventory, ILiquidTank
|
||||
nbt.setString("currentFluid", fluid.getName());
|
||||
|
||||
tankManager.writeTanksToNBT(nbt);
|
||||
inventory.writeToNBT(nbt);
|
||||
}
|
||||
|
||||
/* GUI */
|
||||
@@ -382,32 +378,32 @@ public class EngineBronze extends Engine implements ISidedInventory, ILiquidTank
|
||||
/* IINVENTORY */
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventory.getSizeInventory();
|
||||
return getInternalInventory().getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return inventory.getStackInSlot(i);
|
||||
return getInternalInventory().getStackInSlot(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
inventory.setInventorySlotContents(i, itemstack);
|
||||
getInternalInventory().setInventorySlotContents(i, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
return inventory.decrStackSize(i, j);
|
||||
return getInternalInventory().decrStackSize(i, j);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return inventory.getStackInSlotOnClosing(slot);
|
||||
return getInternalInventory().getStackInSlotOnClosing(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return inventory.getInventoryStackLimit();
|
||||
return getInternalInventory().getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -418,14 +414,9 @@ public class EngineBronze extends Engine implements ISidedInventory, ILiquidTank
|
||||
public void closeInventory() {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return super.isUseableByPlayer(player);
|
||||
return getInternalInventory().isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -433,21 +424,11 @@ public class EngineBronze extends Engine implements ISidedInventory, ILiquidTank
|
||||
return getUnlocalizedName();
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return super.hasCustomInventoryName();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
* @param slotIndex
|
||||
* @param itemstack
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemstack) {
|
||||
if (slotIndex == SLOT_CAN) {
|
||||
@@ -457,65 +438,25 @@ public class EngineBronze extends Engine implements ISidedInventory, ILiquidTank
|
||||
return fuelTank.accepts(fluid.getFluid()) || heatingTank.accepts(fluid.getFluid());
|
||||
}
|
||||
|
||||
return super.isItemValidForSlot(slotIndex, itemstack);
|
||||
return getInternalInventory().isItemValidForSlot(slotIndex, itemstack);
|
||||
}
|
||||
|
||||
/* ISIDEDINVENTORY */
|
||||
@Override
|
||||
protected boolean canTakeStackFromSide(int slotIndex, ItemStack stack, int side) {
|
||||
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canPutStackFromSide(int slotIndex, ItemStack stack, int side) {
|
||||
if (!super.canTakeStackFromSide(slotIndex, stack, side))
|
||||
return false;
|
||||
|
||||
FluidContainerData container = LiquidHelper.getLiquidContainer(stack);
|
||||
return container != null;
|
||||
public boolean canInsertItem(int slotIndex, ItemStack stack, int side) {
|
||||
return isItemValidForSlot(slotIndex, stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
|
||||
return super.canExtractItem(i, itemstack, j);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemstack, int j) {
|
||||
return super.canInsertItem(i, itemstack, j);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return super.getAccessibleSlotsFromSide(side); //To change body of generated methods, choose Tools | Templates.
|
||||
return getInternalInventory().getAccessibleSlotsFromSide(side);
|
||||
}
|
||||
|
||||
/* ISPECIALINVENTORY */
|
||||
// @Override
|
||||
// public int addItem(ItemStack stack, boolean doAdd, ForgeDirection from) {
|
||||
// FluidContainerData container = LiquidHelper.getLiquidContainer(stack);
|
||||
// if (container == null)
|
||||
// return 0;
|
||||
//
|
||||
// return inventory.addStack(stack, false, doAdd);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack[] extractItem(boolean doRemove, ForgeDirection from, int maxItemCount) {
|
||||
// return null;
|
||||
// }
|
||||
// IFluidHandler
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
|
||||
@@ -24,8 +24,8 @@ import forestry.core.gadgets.Engine;
|
||||
import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.utils.TileInventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.factory.triggers.FactoryTriggers;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
@@ -32,7 +32,7 @@ import forestry.core.interfaces.ISocketable;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.DelayTimer;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.plugins.PluginIC2;
|
||||
|
||||
public class EngineTin extends Engine implements ISocketable, IInventory {
|
||||
|
||||
@@ -38,7 +38,7 @@ import forestry.core.interfaces.IRenderableMachine;
|
||||
import forestry.core.network.EntityNetData;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.Utils;
|
||||
|
||||
@@ -10,6 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.energy.gui;
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
=======
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
>>>>>>> Stashed changes
|
||||
import forestry.core.gui.ContainerLiquidTanks;
|
||||
import forestry.core.gui.slots.SlotLiquidContainer;
|
||||
import forestry.energy.gadgets.EngineBronze;
|
||||
@@ -18,7 +24,12 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
public class ContainerEngineBronze extends ContainerLiquidTanks {
|
||||
<<<<<<< Updated upstream
|
||||
protected final EngineBronze engine;
|
||||
=======
|
||||
|
||||
protected EngineBronze engine;
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
public ContainerEngineBronze(InventoryPlayer player, EngineBronze engine) {
|
||||
super(engine, engine);
|
||||
@@ -27,18 +38,16 @@ public class ContainerEngineBronze extends ContainerLiquidTanks {
|
||||
this.addSlot(new SlotLiquidContainer(engine, EngineBronze.SLOT_CAN, 143, 40));
|
||||
|
||||
int i;
|
||||
for (i = 0; i < 3; ++i)
|
||||
for (int var4 = 0; var4 < 9; ++var4)
|
||||
for (i = 0; i < 3; ++i) {
|
||||
for (int var4 = 0; var4 < 9; ++var4) {
|
||||
this.addSlot(new Slot(player, var4 + i * 9 + 9, 8 + var4 * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; ++i)
|
||||
for (i = 0; i < 9; ++i) {
|
||||
this.addSlot(new Slot(player, i, 8 + i * 18, 142));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
return engine.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,7 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.energy.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
@@ -20,7 +19,12 @@ import forestry.core.gui.slots.SlotClosed;
|
||||
import forestry.energy.gadgets.EngineCopper;
|
||||
|
||||
public class ContainerEngineCopper extends ContainerForestry {
|
||||
<<<<<<< Updated upstream
|
||||
protected final EngineCopper engine;
|
||||
=======
|
||||
|
||||
protected EngineCopper engine;
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
public ContainerEngineCopper(InventoryPlayer player, EngineCopper tile) {
|
||||
super(tile);
|
||||
@@ -33,12 +37,15 @@ public class ContainerEngineCopper extends ContainerForestry {
|
||||
this.addSlot(new SlotClosed(tile, 3, 116, 35));
|
||||
this.addSlot(new SlotClosed(tile, 4, 116, 53));
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int j = 0; j < 9; ++j)
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
this.addSlot(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; ++i)
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
this.addSlot(new Slot(player, i, 8 + i * 18, 142));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -52,12 +59,14 @@ public class ContainerEngineCopper extends ContainerForestry {
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
for (Object crafter : crafters)
|
||||
engine.sendGUINetworkData(this, (ICrafting) crafter);
|
||||
=======
|
||||
for (Object crafter : crafters) {
|
||||
engine.sendGUINetworkData(this, (ICrafting) crafter);
|
||||
}
|
||||
>>>>>>> Stashed changes
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
return engine.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.energy.gui;
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
=======
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
>>>>>>> Stashed changes
|
||||
import forestry.core.gui.ContainerLiquidTanks;
|
||||
import forestry.core.gui.slots.SlotLiquidContainer;
|
||||
import forestry.energy.gadgets.MachineGenerator;
|
||||
@@ -27,17 +33,15 @@ public class ContainerGenerator extends ContainerLiquidTanks {
|
||||
this.tile = tile;
|
||||
this.addSlot(new SlotLiquidContainer(tile, MachineGenerator.SLOT_CAN, 22, 38));
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int var4 = 0; var4 < 9; ++var4)
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int var4 = 0; var4 < 9; ++var4) {
|
||||
this.addSlot(new Slot(player, var4 + i * 9 + 9, 8 + var4 * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; ++i)
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
this.addSlot(new Slot(player, i, 8 + i * 18, 142));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
return tile.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,7 +25,7 @@ import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.network.EntityNetData;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.Utils;
|
||||
@@ -64,6 +64,7 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq
|
||||
|
||||
/* RECIPE MANAGMENT */
|
||||
public static class Recipe {
|
||||
|
||||
public final int cyclesPerUnit;
|
||||
public final FluidStack input;
|
||||
public final ItemStack can;
|
||||
@@ -86,7 +87,12 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq
|
||||
}
|
||||
|
||||
public static class RecipeManager implements ICraftingProvider {
|
||||
<<<<<<< Updated upstream
|
||||
public static final ArrayList<MachineBottler.Recipe> recipes = new ArrayList<MachineBottler.Recipe>();
|
||||
=======
|
||||
|
||||
public static ArrayList<MachineBottler.Recipe> recipes = new ArrayList<MachineBottler.Recipe>();
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -105,9 +111,9 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq
|
||||
}
|
||||
|
||||
// No recipe matched. See if the liquid dictionary has anything.
|
||||
if(FluidContainerRegistry.isEmptyContainer(empty)) {
|
||||
if (FluidContainerRegistry.isEmptyContainer(empty)) {
|
||||
ItemStack filled = FluidContainerRegistry.fillFluidContainer(res, empty);
|
||||
if(filled != null) {
|
||||
if (filled != null) {
|
||||
FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(filled);
|
||||
Recipe recipe = new Recipe(CYCLES_FILLING_DEFAULT, fluidStack, empty, filled);
|
||||
recipes.add(recipe);
|
||||
@@ -133,8 +139,9 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq
|
||||
public Map<Object[], Object[]> getRecipes() {
|
||||
HashMap<Object[], Object[]> recipeList = new HashMap<Object[], Object[]>();
|
||||
|
||||
for (Recipe recipe : recipes)
|
||||
recipeList.put(new Object[] { recipe.input, recipe.can }, new Object[] { recipe.bottled });
|
||||
for (Recipe recipe : recipes) {
|
||||
recipeList.put(new Object[]{recipe.input, recipe.can}, new Object[]{recipe.bottled});
|
||||
}
|
||||
|
||||
return recipeList;
|
||||
}
|
||||
@@ -184,13 +191,14 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq
|
||||
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
ItemStack[] offspring = pendingProducts.toArray(new ItemStack[pendingProducts.size()]);
|
||||
for (int i = 0; i < offspring.length; i++)
|
||||
for (int i = 0; i < offspring.length; i++) {
|
||||
if (offspring[i] != null) {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
nbttagcompound1.setByte("Slot", (byte) i);
|
||||
offspring[i].writeToNBT(nbttagcompound1);
|
||||
nbttaglist.appendTag(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
nbttagcompound.setTag("PendingProducts", nbttaglist);
|
||||
}
|
||||
|
||||
@@ -379,14 +387,43 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq
|
||||
}
|
||||
|
||||
/* IINVENTORY */
|
||||
@Override public int getSizeInventory() { return inventory.getSizeInventory(); }
|
||||
@Override public ItemStack getStackInSlot(int i) { return inventory.getStackInSlot(i); }
|
||||
@Override public ItemStack decrStackSize(int i, int j) { return inventory.decrStackSize(i, j); }
|
||||
@Override public void setInventorySlotContents(int i, ItemStack itemstack) { inventory.setInventorySlotContents(i, itemstack); }
|
||||
@Override public ItemStack getStackInSlotOnClosing(int slot) { return inventory.getStackInSlotOnClosing(slot); }
|
||||
@Override public int getInventoryStackLimit() { return inventory.getInventoryStackLimit(); }
|
||||
@Override public void openInventory() {}
|
||||
@Override public void closeInventory() {}
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventory.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return inventory.getStackInSlot(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
return inventory.decrStackSize(i, j);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
inventory.setInventorySlotContents(i, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return inventory.getStackInSlotOnClosing(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return inventory.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
@@ -404,36 +441,38 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq
|
||||
return super.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemstack) {
|
||||
return super.isItemValidForSlot(slotIndex, itemstack);
|
||||
if (!getInternalInventory().isItemValidForSlot(slotIndex, itemstack))
|
||||
return false;
|
||||
|
||||
if (slotIndex == SLOT_RESOURCE)
|
||||
return FluidContainerRegistry.isEmptyContainer(itemstack);
|
||||
|
||||
if (slotIndex == SLOT_CAN) {
|
||||
FluidContainerData container = LiquidHelper.getLiquidContainer(itemstack);
|
||||
return container != null && RecipeManager.isInput(container.fluid);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemstack, int j) {
|
||||
return super.canInsertItem(i, itemstack, j);
|
||||
public boolean canInsertItem(int slotIndex, ItemStack itemstack, int side) {
|
||||
return isItemValidForSlot(slotIndex, itemstack);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
|
||||
return super.canExtractItem(i, itemstack, j);
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, int side) {
|
||||
return getInternalInventory().canExtractItem(side, itemstack, side) && slotIndex == SLOT_PRODUCT;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return super.getAccessibleSlotsFromSide(side);
|
||||
return getInternalInventory().getAccessibleSlotsFromSide(side);
|
||||
}
|
||||
|
||||
/* ISIDEDINVENTORY */
|
||||
@@ -445,7 +484,7 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq
|
||||
@Override
|
||||
protected boolean canTakeStackFromSide(int slotIndex, ItemStack itemstack, int side) {
|
||||
|
||||
if(!super.canTakeStackFromSide(slotIndex, itemstack, side))
|
||||
if (!super.canTakeStackFromSide(slotIndex, itemstack, side))
|
||||
return false;
|
||||
|
||||
return slotIndex == SLOT_PRODUCT;
|
||||
@@ -454,18 +493,6 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq
|
||||
@Override
|
||||
protected boolean canPutStackFromSide(int slotIndex, ItemStack itemstack, int side) {
|
||||
|
||||
if(!super.canPutStackFromSide(slotIndex, itemstack, side))
|
||||
return false;
|
||||
|
||||
if(slotIndex == SLOT_RESOURCE)
|
||||
return FluidContainerRegistry.isEmptyContainer(itemstack);
|
||||
|
||||
if(slotIndex == SLOT_CAN) {
|
||||
FluidContainerData container = LiquidHelper.getLiquidContainer(itemstack);
|
||||
return container != null && RecipeManager.isInput(container.fluid);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* ILIQUIDCONTAINER */
|
||||
|
||||
@@ -25,11 +25,11 @@ import forestry.core.network.EntityNetData;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.ShapedRecipeCustom;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.TileInventoryAdapter;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.factory.gui.ContainerCarpenter;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@@ -21,7 +21,7 @@ import forestry.core.config.Defaults;
|
||||
import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.gadgets.TilePowered;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.factory.triggers.FactoryTriggers;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@@ -42,7 +42,7 @@ import forestry.core.proxy.Proxies;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.fluids.TankManager;
|
||||
import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.ShapedRecipeCustom;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
@@ -28,7 +28,7 @@ import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.network.EntityNetData;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.Utils;
|
||||
|
||||
@@ -26,7 +26,7 @@ import forestry.core.interfaces.IRenderableMachine;
|
||||
import forestry.core.network.EntityNetData;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.Utils;
|
||||
|
||||
@@ -21,7 +21,7 @@ import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.Fluids;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.Utils;
|
||||
|
||||
@@ -26,7 +26,7 @@ import forestry.core.network.EntityNetData;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.Utils;
|
||||
|
||||
@@ -25,7 +25,7 @@ import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.network.EntityNetData;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.Utils;
|
||||
|
||||
@@ -34,10 +34,10 @@ import forestry.core.network.PacketIds;
|
||||
import forestry.core.network.PacketTileNBT;
|
||||
import forestry.core.network.PacketTileUpdate;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.PlainInventory;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.TileInventoryAdapter;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
|
||||
public class TileWorktable extends TileBase implements ICrafter {
|
||||
|
||||
|
||||
@@ -10,6 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.factory.gui;
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
=======
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
>>>>>>> Stashed changes
|
||||
import forestry.core.gui.ContainerLiquidTanks;
|
||||
import forestry.core.gui.slots.SlotClosed;
|
||||
import forestry.core.gui.slots.SlotLiquidContainer;
|
||||
@@ -31,17 +37,16 @@ public class ContainerBottler extends ContainerLiquidTanks {
|
||||
this.addSlot(new SlotLiquidContainer(tile, MachineBottler.SLOT_CAN, 26, 38));
|
||||
|
||||
int var3;
|
||||
for (var3 = 0; var3 < 3; ++var3)
|
||||
for (int var4 = 0; var4 < 9; ++var4)
|
||||
for (var3 = 0; var3 < 3; ++var3) {
|
||||
for (int var4 = 0; var4 < 9; ++var4) {
|
||||
this.addSlot(new Slot(player, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (var3 = 0; var3 < 9; ++var3)
|
||||
for (var3 = 0; var3 < 9; ++var3) {
|
||||
this.addSlot(new Slot(player, var3, 8 + var3 * 18, 142));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
return tile.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.factory.gui;
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
=======
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
>>>>>>> Stashed changes
|
||||
import forestry.core.gui.ContainerLiquidTanks;
|
||||
import forestry.core.gui.slots.SlotCustom;
|
||||
import forestry.core.gui.slots.SlotLiquidContainer;
|
||||
@@ -20,7 +26,12 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
public class ContainerFermenter extends ContainerLiquidTanks {
|
||||
<<<<<<< Updated upstream
|
||||
protected final MachineFermenter fermenter;
|
||||
=======
|
||||
|
||||
protected MachineFermenter fermenter;
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
public ContainerFermenter(InventoryPlayer player, MachineFermenter fermenter) {
|
||||
super(fermenter, fermenter);
|
||||
@@ -32,17 +43,16 @@ public class ContainerFermenter extends ContainerLiquidTanks {
|
||||
this.addSlot(new SlotLiquidContainer(fermenter, MachineFermenter.SLOT_CAN_INPUT, 150, 22, true));
|
||||
this.addSlot(new SlotLiquidContainer(fermenter, MachineFermenter.SLOT_INPUT, 10, 40));
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int var4 = 0; var4 < 9; ++var4)
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int var4 = 0; var4 < 9; ++var4) {
|
||||
this.addSlot(new Slot(player, var4 + i * 9 + 9, 8 + var4 * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; ++i)
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
this.addSlot(new Slot(player, i, 8 + i * 18, 142));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
return fermenter.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.factory.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
@@ -30,12 +29,15 @@ public class ContainerMoistener extends ContainerLiquidTanks implements IContain
|
||||
|
||||
this.tile = tile;
|
||||
// Stash
|
||||
for (int l = 0; l < 2; l++)
|
||||
for (int k1 = 0; k1 < 3; k1++)
|
||||
for (int l = 0; l < 2; l++) {
|
||||
for (int k1 = 0; k1 < 3; k1++) {
|
||||
addSlot(new Slot(tile, k1 + l * 3, 39 + k1 * 18, 16 + l * 18));
|
||||
}
|
||||
}
|
||||
// Reservoir
|
||||
for (int k1 = 0; k1 < 3; k1++)
|
||||
for (int k1 = 0; k1 < 3; k1++) {
|
||||
addSlot(new Slot(tile, k1 + 6, 39 + k1 * 18, 22 + 36));
|
||||
}
|
||||
|
||||
// Working slot
|
||||
this.addSlot(new SlotWorking(tile, 9, 105, 37));
|
||||
@@ -47,12 +49,15 @@ public class ContainerMoistener extends ContainerLiquidTanks implements IContain
|
||||
|
||||
// Player inventory
|
||||
int var3;
|
||||
for (var3 = 0; var3 < 3; ++var3)
|
||||
for (int var4 = 0; var4 < 9; ++var4)
|
||||
for (var3 = 0; var3 < 3; ++var3) {
|
||||
for (int var4 = 0; var4 < 9; ++var4) {
|
||||
this.addSlot(new Slot(player, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (var3 = 0; var3 < 9; ++var3)
|
||||
for (var3 = 0; var3 < 9; ++var3) {
|
||||
this.addSlot(new Slot(player, var3, 8 + var3 * 18, 142));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -62,9 +67,4 @@ public class ContainerMoistener extends ContainerLiquidTanks implements IContain
|
||||
tile.checkRecipe();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return this.tile.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,9 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.factory.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
import forestry.core.gui.ContainerLiquidTanks;
|
||||
@@ -31,17 +29,16 @@ public class ContainerRaintank extends ContainerLiquidTanks {
|
||||
this.addSlot(new SlotLiquidContainer(tile, MachineRaintank.SLOT_RESOURCE, 116, 19, true));
|
||||
this.addSlot(new SlotClosed(tile, MachineRaintank.SLOT_PRODUCT, 116, 55));
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int j = 0; j < 9; ++j)
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
this.addSlot(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; ++i)
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
this.addSlot(new Slot(player, i, 8 + i * 18, 142));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
return tile.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.factory.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
import forestry.core.gui.ContainerLiquidTanks;
|
||||
@@ -20,6 +18,7 @@ import forestry.core.gui.slots.SlotLiquidContainer;
|
||||
import forestry.factory.gadgets.MachineStill;
|
||||
|
||||
public class ContainerStill extends ContainerLiquidTanks {
|
||||
|
||||
protected MachineStill processor;
|
||||
|
||||
public ContainerStill(InventoryPlayer player, MachineStill tile) {
|
||||
@@ -30,17 +29,16 @@ public class ContainerStill extends ContainerLiquidTanks {
|
||||
this.addSlot(new SlotLiquidContainer(tile, MachineStill.SLOT_RESOURCE, 150, 18, true));
|
||||
this.addSlot(new SlotLiquidContainer(tile, MachineStill.SLOT_CAN, 10, 36));
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int j = 0; j < 9; ++j)
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
this.addSlot(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; ++i)
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
this.addSlot(new Slot(player, i, 8 + i * 18, 142));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
return processor.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ import forestry.core.network.GuiId;
|
||||
import forestry.core.network.PacketPayload;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.core.utils.TileInventoryAdapter;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.utils.Utils;
|
||||
|
||||
public abstract class TileFarm extends TileForestry implements IFarmComponent {
|
||||
|
||||
@@ -60,10 +60,10 @@ import forestry.core.utils.DelayTimer;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.fluids.TankManager;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.TileInventoryAdapter;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.utils.Vect;
|
||||
import forestry.farming.FarmTarget;
|
||||
import forestry.farming.logic.FarmLogicArboreal;
|
||||
|
||||
@@ -14,7 +14,7 @@ import buildcraft.api.statements.ITriggerExternal;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import forestry.api.core.ITileStructure;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.farming.triggers.FarmingTriggers;
|
||||
|
||||
@@ -24,7 +24,7 @@ import forestry.core.gui.slots.SlotCustom;
|
||||
import forestry.core.gui.slots.SlotForestry;
|
||||
import forestry.core.gui.slots.SlotLiquidContainer;
|
||||
import forestry.core.gui.slots.SlotOutput;
|
||||
import forestry.core.utils.TileInventoryAdapter;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.farming.gadgets.TileFarmPlain;
|
||||
import forestry.plugins.PluginFarming;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.core.utils.AlyzerInventory;
|
||||
import forestry.core.inventory.AlyzerInventory;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.lepidopterology.IButterfly;
|
||||
|
||||
@@ -20,7 +20,7 @@ import forestry.api.core.INBTTagable;
|
||||
import forestry.api.mail.ILetter;
|
||||
import forestry.api.mail.IStamps;
|
||||
import forestry.api.mail.IMailAddress;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
|
||||
public class MailAddress implements INBTTagable, IMailAddress {
|
||||
|
||||
private static final GameProfile invalidGameProfile = new GameProfile(new UUID(0, 0), "");
|
||||
@EntityNetData
|
||||
private EnumAddressee type;
|
||||
@@ -47,17 +48,16 @@ public class MailAddress implements INBTTagable, IMailAddress {
|
||||
throw new IllegalArgumentException("name must not be null");
|
||||
|
||||
this.type = EnumAddressee.TRADER;
|
||||
this.gameProfile = new GameProfile(new UUID(0, 0), name);
|
||||
this.gameProfile = new GameProfile(null, name);
|
||||
}
|
||||
|
||||
public MailAddress(IMailAddress address) {
|
||||
this.type = address.getType();
|
||||
if (type == EnumAddressee.TRADER) {
|
||||
String name = address.getName();
|
||||
this.gameProfile = new GameProfile(new UUID(0, 0), name);
|
||||
} else if (type == EnumAddressee.PLAYER) {
|
||||
this.gameProfile = new GameProfile(null, name);
|
||||
} else if (type == EnumAddressee.PLAYER)
|
||||
this.gameProfile = address.getPlayerProfile();
|
||||
}
|
||||
}
|
||||
|
||||
public static MailAddress loadFromNBT(NBTTagCompound nbttagcompound) {
|
||||
@@ -100,7 +100,7 @@ public class MailAddress implements INBTTagable, IMailAddress {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return gameProfile.hashCode();
|
||||
return gameProfile.getName().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,18 +108,28 @@ public class MailAddress implements INBTTagable, IMailAddress {
|
||||
if (!(o instanceof MailAddress))
|
||||
return false;
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
MailAddress address = (MailAddress) o;
|
||||
return PlayerUtil.isSameGameProfile(address.gameProfile, gameProfile);
|
||||
=======
|
||||
MailAddress other = (MailAddress) o;
|
||||
return isSamePlayer(gameProfile, other.gameProfile);
|
||||
}
|
||||
|
||||
private static boolean isSamePlayer(GameProfile a, GameProfile b) {
|
||||
if (a.getId() != null && b.getId() != null)
|
||||
return a.getId().equals(b.getId());
|
||||
return a.getName() != null && a.getName().equals(b.getName());
|
||||
>>>>>>> Stashed changes
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String name = getName().toLowerCase(Locale.ENGLISH);
|
||||
if (isPlayer()) {
|
||||
if (isPlayer())
|
||||
return type + "-" + name + "-" + gameProfile.getId();
|
||||
} else {
|
||||
else
|
||||
return type + "-" + name;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,7 @@ import net.minecraft.world.WorldSavedData;
|
||||
import forestry.api.mail.ILetter;
|
||||
import forestry.api.mail.PostManager;
|
||||
import forestry.api.mail.IMailAddress;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
|
||||
public class POBox extends WorldSavedData implements IInventory {
|
||||
|
||||
|
||||
@@ -35,8 +35,13 @@ import forestry.plugins.PluginMail;
|
||||
public class PostRegistry implements IPostRegistry {
|
||||
|
||||
public static PostOffice cachedPostOffice;
|
||||
<<<<<<< Updated upstream
|
||||
public static final HashMap<IMailAddress, POBox> cachedPOBoxes = new HashMap<IMailAddress, POBox>();
|
||||
public static final HashMap<IMailAddress, ITradeStation> cachedTradeStations = new HashMap<IMailAddress, ITradeStation>();
|
||||
=======
|
||||
public static Map<IMailAddress, POBox> cachedPOBoxes = new HashMap<IMailAddress, POBox>();
|
||||
public static Map<IMailAddress, ITradeStation> cachedTradeStations = new HashMap<IMailAddress, ITradeStation>();
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
/**
|
||||
* @param world the Minecraft world the PO box will be in
|
||||
|
||||
@@ -20,7 +20,7 @@ import forestry.api.mail.ITradeStation;
|
||||
import forestry.api.mail.PostManager;
|
||||
import forestry.api.mail.TradeStationInfo;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.PlayerUtil;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.mail.items.ItemLetter;
|
||||
|
||||
@@ -23,7 +23,7 @@ import forestry.core.config.Config;
|
||||
import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.mail.EnumDeliveryState;
|
||||
import forestry.mail.IMailContainer;
|
||||
import forestry.mail.POBox;
|
||||
|
||||
@@ -20,7 +20,7 @@ import forestry.api.mail.IStamps;
|
||||
import forestry.api.mail.PostManager;
|
||||
import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.StackUtils;
|
||||
|
||||
public class MachinePhilatelist extends TileBase implements IInventory {
|
||||
|
||||
@@ -22,7 +22,7 @@ import forestry.core.network.EntityNetData;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.EnumAccess;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.mail.MailAddress;
|
||||
import forestry.mail.TradeStation;
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.mail.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.core.gui.ContainerForestry;
|
||||
@@ -18,7 +17,7 @@ import forestry.core.network.PacketIds;
|
||||
import forestry.core.network.PacketPayload;
|
||||
import forestry.core.network.PacketUpdate;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.mail.gadgets.MachineTrader;
|
||||
import forestry.api.mail.PostManager;
|
||||
import forestry.api.mail.IMailAddress;
|
||||
@@ -61,9 +60,4 @@ public class ContainerTradeName extends ContainerForestry {
|
||||
machine.setAddress(address);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,7 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.mail.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -37,11 +36,14 @@ public class ContainerTrader extends ContainerForestry {
|
||||
this.addSlot(new Slot(inventory, TradeStation.SLOT_TRADEGOOD, 78, 109));
|
||||
|
||||
// Exchange
|
||||
for (int i = 0; i < 2; i++)
|
||||
for (int j = 0; j < 2; j++)
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
addSlot(new Slot(inventory, TradeStation.SLOT_EXCHANGE_1 + j + i * 2, 69 + j * 18, 55 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
// Stamps
|
||||
<<<<<<< Updated upstream
|
||||
for (int i = 0; i < 2; i++)
|
||||
for (int j = 0; j < 2; j++)
|
||||
addSlot(new SlotCustom(inventory, TradeStation.SLOT_STAMPS_1 + j + i * 2, 15 + j * 18, 37 + i * 18, ItemStamps.class));
|
||||
@@ -50,24 +52,45 @@ public class ContainerTrader extends ContainerForestry {
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int j = 0; j < 2; j++)
|
||||
addSlot(new SlotCustom(inventory, TradeStation.SLOT_LETTERS_1 + j + i * 2, 15 + j * 18, 73 + i * 18, Items.paper));
|
||||
=======
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
addSlot(new SlotCustom(inventory, TradeStation.SLOT_STAMPS_1 + j + i * 2, 15 + j * 18, 37 + i * 18, new Object[]{ItemStamps.class}));
|
||||
}
|
||||
}
|
||||
|
||||
// Letters
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
addSlot(new SlotCustom(inventory, TradeStation.SLOT_LETTERS_1 + j + i * 2, 15 + j * 18, 73 + i * 18, new Object[]{Items.paper}));
|
||||
}
|
||||
}
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
// Buffers
|
||||
final int bufCols = 5;
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int j = 0; j < bufCols; j++)
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < bufCols; j++) {
|
||||
addSlot(new Slot(inventory, TradeStation.SLOT_RECEIVE_BUFFER + j + i * bufCols, 123 + j * 18, 19 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
for (int j = 0; j < bufCols; j++)
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (int j = 0; j < bufCols; j++) {
|
||||
addSlot(new Slot(inventory, TradeStation.SLOT_SEND_BUFFER + j + i * bufCols, 123 + j * 18, (19 + (18 * 4)) + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
// Player inventory
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int j = 0; j < 9; j++)
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
addSlot(new Slot(player, j + i * 9 + 9, 33 + j * 18, 138 + i * 18));
|
||||
}
|
||||
}
|
||||
// Player hotbar
|
||||
for (int i = 0; i < 9; i++)
|
||||
for (int i = 0; i < 9; i++) {
|
||||
addSlot(new Slot(player, i, 33 + i * 18, 196));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -79,8 +102,4 @@ public class ContainerTrader extends ContainerForestry {
|
||||
return machine.getAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ import forestry.core.items.ItemInventoried;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.core.utils.ItemInventory;
|
||||
import forestry.core.inventory.ItemInventory;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.mail.Letter;
|
||||
|
||||
|
||||
@@ -6,15 +6,12 @@
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package forestry.pipes.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import buildcraft.transport.Pipe;
|
||||
import forestry.core.gui.ContainerForestry;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.pipes.PipeItemsPropolis;
|
||||
import forestry.pipes.PipeLogicPropolis;
|
||||
|
||||
@@ -28,17 +25,15 @@ public class ContainerPropolisPipe extends ContainerForestry {
|
||||
this.playerIInventory = playerInventory;
|
||||
this.pipeLogic = pipe.pipeLogic;
|
||||
|
||||
for (int l = 0; l < 3; l++)
|
||||
for (int k1 = 0; k1 < 9; k1++)
|
||||
for (int l = 0; l < 3; l++) {
|
||||
for (int k1 = 0; k1 < 9; k1++) {
|
||||
addSlot(new Slot(playerInventory, k1 + l * 9 + 9, 8 + k1 * 18, 140 + l * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i1 = 0; i1 < 9; i1++)
|
||||
for (int i1 = 0; i1 < 9; i1++) {
|
||||
addSlot(new Slot(playerInventory, i1, 8 + i1 * 18, 198));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,7 +23,7 @@ import forestry.core.config.Defaults;
|
||||
import forestry.core.gui.GuiNaturalistInventory;
|
||||
import forestry.core.gui.IPagedInventory;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.ItemInventory;
|
||||
import forestry.core.inventory.ItemInventory;
|
||||
import forestry.storage.gui.ContainerBackpack;
|
||||
import forestry.storage.gui.ContainerNaturalistBackpack;
|
||||
import forestry.storage.gui.GuiBackpack;
|
||||
|
||||
@@ -22,7 +22,7 @@ import forestry.api.storage.BackpackManager;
|
||||
import forestry.api.storage.BackpackResupplyEvent;
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
import forestry.core.interfaces.IResupplyHandler;
|
||||
import forestry.core.utils.ItemInventory;
|
||||
import forestry.core.inventory.ItemInventory;
|
||||
import forestry.storage.items.ItemBackpack;
|
||||
|
||||
public class ResupplyHandler implements IResupplyHandler {
|
||||
|
||||
@@ -16,7 +16,7 @@ import net.minecraft.item.ItemStack;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.gui.ContainerItemInventory;
|
||||
import forestry.core.gui.slots.SlotForestry;
|
||||
import forestry.core.utils.ItemInventory;
|
||||
import forestry.core.inventory.ItemInventory;
|
||||
import forestry.storage.items.ItemBackpack;
|
||||
|
||||
public class ContainerBackpack extends ContainerItemInventory {
|
||||
|
||||
@@ -40,7 +40,7 @@ import forestry.core.items.ItemInventoried;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.core.utils.ItemInventory;
|
||||
import forestry.core.inventory.ItemInventory;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.storage.BackpackMode;
|
||||
|
||||
|
||||
Reference in new issue
Block a user