mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-19 19:49:54 +00:00
Fixed permissions for restricted and private access
This commit is contained in:
1 parent
0f2e5c8e11
commit
3c46ea1b8b
3 files changed
+17
-13
No files matched your search
@@ -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() {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user