mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-20 03:59:45 +00:00
Fix #452 Opening a multiblock inventory momentarily places a block
This commit is contained in:
1 parent
122af6d72d
commit
2a35b05ec1
3 files changed
+23
-11
No files matched your search
@@ -124,8 +124,12 @@ public abstract class TileAlveary extends TileForestry implements IAlvearyCompon
|
||||
|
||||
@Override
|
||||
public PacketPayload getPacketPayload() {
|
||||
PacketPayload payload = new PacketPayload(0, 1);
|
||||
PacketPayload payload = new PacketPayload(0, 2);
|
||||
payload.shortPayload[0] = (short) (isMaster() ? 1 : 0);
|
||||
|
||||
// so the client can know if it is part of an integrated structure
|
||||
payload.shortPayload[1] = (short) this.masterY;
|
||||
|
||||
return payload;
|
||||
}
|
||||
|
||||
@@ -133,6 +137,9 @@ public abstract class TileAlveary extends TileForestry implements IAlvearyCompon
|
||||
public void fromPacketPayload(PacketPayload payload) {
|
||||
if (payload.shortPayload[0] > 0)
|
||||
makeMaster();
|
||||
|
||||
// so the client can know if it is part of an integrated structure
|
||||
this.masterY = payload.shortPayload[1];
|
||||
}
|
||||
|
||||
/* ITILESTRUCTURE */
|
||||
|
||||
@@ -64,18 +64,17 @@ public abstract class BlockStructure extends BlockForestry {
|
||||
if (!Utils.isUseableByPlayer(player, tile))
|
||||
return false;
|
||||
|
||||
if (!Proxies.common.isSimulating(world))
|
||||
return player.getCurrentEquippedItem() == null || !(player.getCurrentEquippedItem().getItem() instanceof IStructureBlockItem);
|
||||
|
||||
// GUIs can only be opened on integrated structure blocks.
|
||||
if (tile instanceof ITileStructure)
|
||||
if (!((ITileStructure) tile).isIntegratedIntoStructure())
|
||||
return false;
|
||||
|
||||
if (tile.allowsViewing(player)) {
|
||||
tile.openGui(player);
|
||||
} else {
|
||||
player.addChatMessage(new ChatComponentTranslation("for.chat.accesslocked", PlayerUtil.getOwnerName(tile)));
|
||||
if (Proxies.common.isSimulating(world)) {
|
||||
if (tile.allowsViewing(player)) {
|
||||
tile.openGui(player);
|
||||
} else {
|
||||
player.addChatMessage(new ChatComponentTranslation("for.chat.accesslocked", PlayerUtil.getOwnerName(tile)));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ package forestry.farming.gadgets;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -28,7 +27,6 @@ import forestry.api.farming.IFarmComponent;
|
||||
import forestry.api.farming.IFarmListener;
|
||||
import forestry.core.gadgets.TileForestry;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.network.PacketPayload;
|
||||
import forestry.core.proxy.Proxies;
|
||||
@@ -151,9 +149,14 @@ public abstract class TileFarm extends TileForestry implements IFarmComponent {
|
||||
/* TILEFORESTRY */
|
||||
@Override
|
||||
public PacketPayload getPacketPayload() {
|
||||
PacketPayload payload = new PacketPayload(0, 2);
|
||||
PacketPayload payload = new PacketPayload(0, 3);
|
||||
payload.shortPayload[0] = (short) farmBlock.ordinal();
|
||||
|
||||
payload.shortPayload[1] = (short) (isMaster() ? 1 : 0);
|
||||
|
||||
// so the client can know if it is part of an integrated structure
|
||||
payload.shortPayload[2] = (short) masterY;
|
||||
|
||||
return payload;
|
||||
}
|
||||
|
||||
@@ -163,6 +166,9 @@ public abstract class TileFarm extends TileForestry implements IFarmComponent {
|
||||
if (payload.shortPayload[1] > 0)
|
||||
makeMaster();
|
||||
|
||||
// so the client can know if it is part of an integrated structure
|
||||
this.masterY = payload.shortPayload[2];
|
||||
|
||||
if (this.farmBlock != farmType) {
|
||||
this.farmBlock = farmType;
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
|
||||
Reference in new issue
Block a user