diff --git a/src/main/java/forestry/core/gadgets/TileBase.java b/src/main/java/forestry/core/gadgets/TileBase.java index 142d83671..c49dc0eb6 100755 --- a/src/main/java/forestry/core/gadgets/TileBase.java +++ b/src/main/java/forestry/core/gadgets/TileBase.java @@ -18,6 +18,7 @@ import forestry.core.network.IndexInPayload; import forestry.core.network.PacketPayload; import forestry.core.proxy.Proxies; import forestry.core.utils.Utils; +import forestry.core.utils.EnumAccess; public abstract class TileBase extends TileForestry implements IHintSource { @@ -90,7 +91,12 @@ public abstract class TileBase extends TileForestry implements IHintSource { @Override public boolean isUseableByPlayer(EntityPlayer player) { - return Utils.isUseableByPlayer(player, this, worldObj, xCoord, yCoord, zCoord); + if (!Utils.isUseableByPlayer(player, this, worldObj, xCoord, yCoord, zCoord)) + return false; + if (getAccess() == EnumAccess.PRIVATE) + return owner.equals(player.getGameProfile()); + + return true; } public boolean canDrainWithBucket() { diff --git a/src/main/java/forestry/core/gadgets/TileForestry.java b/src/main/java/forestry/core/gadgets/TileForestry.java index 38e2fcdc3..8ec5cf658 100755 --- a/src/main/java/forestry/core/gadgets/TileForestry.java +++ b/src/main/java/forestry/core/gadgets/TileForestry.java @@ -23,9 +23,6 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; import buildcraft.api.gates.ITrigger; import com.mojang.authlib.GameProfile; @@ -33,9 +30,7 @@ import com.mojang.authlib.GameProfile; import forestry.core.EnumErrorCode; import forestry.core.config.Config; import forestry.core.config.Defaults; -import forestry.core.fluids.tanks.FakeTank; import forestry.core.interfaces.IErrorSource; -import forestry.core.interfaces.ILiquidTankContainer; import forestry.core.interfaces.IOwnable; import forestry.core.interfaces.IPowerHandler; import forestry.core.network.ForestryPacket; @@ -44,7 +39,6 @@ import forestry.core.network.PacketPayload; import forestry.core.network.PacketTileUpdate; import forestry.core.proxy.Proxies; import forestry.core.utils.EnumAccess; -import forestry.core.fluids.tanks.StandardTank; import forestry.core.utils.InventoryAdapter; import forestry.core.utils.Vect; @@ -321,7 +315,7 @@ public abstract class TileForestry extends TileEntity implements INetworkedEntit } protected boolean canTakeStackFromSide(int slotIndex, ItemStack itemstack, int side) { - if (getAccess() == EnumAccess.PRIVATE) + if (getAccess() != EnumAccess.SHARED) return false; return true; @@ -332,7 +326,7 @@ public abstract class TileForestry extends TileEntity implements INetworkedEntit } protected boolean canPutStackFromSide(int slotIndex, ItemStack itemstack, int side) { - if (getAccess() == EnumAccess.PRIVATE) + if (getAccess() != EnumAccess.SHARED) return false; return true; diff --git a/src/main/java/forestry/core/gui/ContainerForestry.java b/src/main/java/forestry/core/gui/ContainerForestry.java index 31fd7293d..c04379acb 100755 --- a/src/main/java/forestry/core/gui/ContainerForestry.java +++ b/src/main/java/forestry/core/gui/ContainerForestry.java @@ -10,26 +10,27 @@ ******************************************************************************/ package forestry.core.gui; -import forestry.core.fluids.tanks.FakeTank; -import forestry.core.fluids.tanks.StandardTank; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import forestry.core.gadgets.TileForestry; import forestry.core.gui.slots.SlotForestry; +import forestry.core.utils.EnumAccess; import forestry.core.utils.StackUtils; -import net.minecraftforge.fluids.IFluidTank; public class ContainerForestry extends Container { protected IInventory inventory; + protected TileForestry inventoryForestry; public ContainerForestry(IInventory inventory) { this.inventory = inventory; + if (inventory instanceof TileForestry) + this.inventoryForestry = (TileForestry)inventory; } /** @@ -43,6 +44,9 @@ public class ContainerForestry extends Container { @Override public ItemStack slotClick(int slotIndex, int button, int modifier, EntityPlayer player) { + if (inventoryForestry != null && (inventoryForestry.getAccess() != EnumAccess.SHARED) && !inventoryForestry.owner.equals(player.getGameProfile())) + return null; + Slot slot = slotIndex < 0 ? null : (Slot) this.inventorySlots.get(slotIndex); if (slot instanceof SlotForestry) { ((SlotForestry) slot).onSlotClick(slotIndex, button, modifier, player);