mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-25 06:14:46 +00:00
Fix usage usability checks to account for access setting.
This commit is contained in:
1 parent
8406073107
commit
06549d1e2d
16 files changed
+32
-21
No files matched your search
@@ -231,6 +231,9 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
IInventory inv = getInternalInventory();
|
||||
if (inv != null)
|
||||
return inv.isUseableByPlayer(player);
|
||||
return Utils.isUseableByPlayer(player, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -614,6 +614,9 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IB
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
IInventory inv = getStructureInventory();
|
||||
if (inv != null)
|
||||
return inv.isUseableByPlayer(player);
|
||||
return Utils.isUseableByPlayer(player, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import forestry.plugins.PluginApiculture;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Stack;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -284,6 +285,9 @@ public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory {
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
IInventory inv = getInternalInventory();
|
||||
if (inv != null)
|
||||
return inv.isUseableByPlayer(player);
|
||||
return Utils.isUseableByPlayer(player, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.interfaces.IOwnable;
|
||||
import forestry.core.items.ItemNBTTile;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.EnumAccess;
|
||||
import forestry.core.utils.PlayerUtil;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.core.utils.Utils;
|
||||
import java.util.ArrayList;
|
||||
@@ -164,7 +166,7 @@ public class BlockBase extends BlockForestry {
|
||||
return false;
|
||||
|
||||
ItemStack current = player.getCurrentEquippedItem();
|
||||
if (current != null && current.getItem() != Items.bucket && tile instanceof IFluidHandler) {
|
||||
if (current != null && current.getItem() != Items.bucket && tile instanceof IFluidHandler && tile.allowsInteraction(player)) {
|
||||
if (Proxies.common.isSimulating(world)) {
|
||||
if (FluidHelper.handleRightClick((IFluidHandler) tile, ForgeDirection.getOrientation(side), player, true, tile.canDrainWithBucket())) {
|
||||
return true;
|
||||
|
||||
@@ -71,16 +71,15 @@ public abstract class BlockStructure extends BlockForestry {
|
||||
if (!((ITileStructure) tile).isIntegratedIntoStructure())
|
||||
return false;
|
||||
|
||||
if (tile.allowsInteraction(player)) {
|
||||
if (tile.allowsInteraction(player))
|
||||
tile.openGui(player);
|
||||
}
|
||||
else {
|
||||
String ownerName = StringUtil.localize("gui.derelict");
|
||||
|
||||
|
||||
if (tile.getOwnerProfile() != null)
|
||||
ownerName = tile.getOwnerProfile().getName();
|
||||
|
||||
player.addChatMessage(new ChatComponentTranslation("for.chat.accesslocked",ownerName));
|
||||
player.addChatMessage(new ChatComponentTranslation("for.chat.accesslocked", ownerName));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ package forestry.core.inventory;
|
||||
|
||||
import forestry.core.gadgets.TileForestry;
|
||||
import forestry.core.utils.EnumAccess;
|
||||
import forestry.core.utils.PlayerUtil;
|
||||
import forestry.core.utils.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -34,9 +33,7 @@ public class TileInventoryAdapter extends InventoryAdapter {
|
||||
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;
|
||||
return tile.allowsInteraction(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -378,7 +378,7 @@ public class MachineCentrifuge extends TilePowered implements ISidedInventory {
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return Utils.isUseableByPlayer(player, this);
|
||||
return getInternalInventory().isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -522,7 +522,7 @@ public class MachineFabricator extends TilePowered implements ICrafter, ILiquidT
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return Utils.isUseableByPlayer(player, this);
|
||||
return getInternalInventory().isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -547,7 +547,7 @@ public class MachineFermenter extends TilePowered implements ISidedInventory, IL
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return Utils.isUseableByPlayer(player, this);
|
||||
return getInternalInventory().isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -559,7 +559,7 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return Utils.isUseableByPlayer(player, this);
|
||||
return getInternalInventory().isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -193,7 +193,7 @@ public class MachineRaintank extends TileBase implements ISidedInventory, ILiqui
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return Utils.isUseableByPlayer(player, this);
|
||||
return getInternalInventory().isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -440,7 +440,7 @@ public class MachineSqueezer extends TilePowered implements ISidedInventory, ILi
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return Utils.isUseableByPlayer(player, this);
|
||||
return getInternalInventory().isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -355,7 +355,7 @@ public class MachineStill extends TilePowered implements ISidedInventory, ILiqui
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return Utils.isUseableByPlayer(player, this);
|
||||
return getInternalInventory().isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -77,9 +77,8 @@ public class TileHatch extends TileFarm implements ISidedInventory {
|
||||
public TileInventoryAdapter getStructureInventory() {
|
||||
if (hasMaster()) {
|
||||
ITileStructure central = getCentralTE();
|
||||
if (central != null){
|
||||
if (central != null)
|
||||
return (TileInventoryAdapter) central.getInventory();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -152,6 +151,9 @@ public class TileHatch extends TileFarm implements ISidedInventory {
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
IInventory inv = getStructureInventory();
|
||||
if (inv != null)
|
||||
return inv.isUseableByPlayer(player);
|
||||
return Utils.isUseableByPlayer(player, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -108,7 +107,7 @@ public class MachinePhilatelist extends TileBase implements IInventory {
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return Utils.isUseableByPlayer(player, this);
|
||||
return getInternalInventory().isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -332,7 +332,9 @@ public class MachineTrader extends TileBase implements ISidedInventory {
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return Utils.isUseableByPlayer(player, this);
|
||||
if (!Utils.isUseableByPlayer(player, this))
|
||||
return false;
|
||||
return getOrCreateTradeInventory().isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
/* ISIDEDINVENTORY */
|
||||
|
||||
Reference in new issue
Block a user