diff --git a/src/main/java/forestry/apiculture/blocks/BlockAlveary.java b/src/main/java/forestry/apiculture/blocks/BlockAlveary.java index f1abbed2d..d1aec8076 100644 --- a/src/main/java/forestry/apiculture/blocks/BlockAlveary.java +++ b/src/main/java/forestry/apiculture/blocks/BlockAlveary.java @@ -37,6 +37,7 @@ import forestry.api.core.IModelManager; import forestry.api.core.IStateMapperRegister; import forestry.api.core.Tabs; import forestry.apiculture.MaterialBeehive; +import forestry.apiculture.multiblock.IAlvearyControllerInternal; import forestry.apiculture.multiblock.TileAlveary; import forestry.apiculture.multiblock.TileAlvearyFan; import forestry.apiculture.multiblock.TileAlvearyHeater; @@ -45,6 +46,7 @@ import forestry.apiculture.multiblock.TileAlvearyPlain; import forestry.apiculture.multiblock.TileAlvearySieve; import forestry.apiculture.multiblock.TileAlvearyStabiliser; import forestry.apiculture.multiblock.TileAlvearySwarmer; +import forestry.apiculture.network.packets.PacketAlveryChange; import forestry.core.blocks.BlockStructure; import forestry.core.proxy.Proxies; import forestry.core.tiles.IActivatable; @@ -258,7 +260,9 @@ public abstract class BlockAlveary extends BlockStructure implements IStateMappe TileAlveary tileAlveary = (TileAlveary) tileEntity; // We must check that the slabs on top were not removed - tileAlveary.getMultiblockLogic().getController().reassemble(); + IAlvearyControllerInternal alvery = tileAlveary.getMultiblockLogic().getController(); + alvery.reassemble(); + Proxies.net.sendNetworkPacket(new PacketAlveryChange(alvery), world); } } } diff --git a/src/main/java/forestry/apiculture/network/PacketRegistryApiculture.java b/src/main/java/forestry/apiculture/network/PacketRegistryApiculture.java index c92709727..1a77b7c03 100644 --- a/src/main/java/forestry/apiculture/network/PacketRegistryApiculture.java +++ b/src/main/java/forestry/apiculture/network/PacketRegistryApiculture.java @@ -11,6 +11,7 @@ package forestry.apiculture.network; import forestry.apiculture.network.packets.PacketActiveUpdate; +import forestry.apiculture.network.packets.PacketAlveryChange; import forestry.apiculture.network.packets.PacketBeeLogicActive; import forestry.apiculture.network.packets.PacketBeeLogicActiveEntity; import forestry.apiculture.network.packets.PacketBeeLogicEntityRequest; @@ -30,5 +31,7 @@ public class PacketRegistryApiculture extends PacketRegistry { registerClientPacket(new PacketCandleUpdate()); registerServerPacket(new PacketBeeLogicEntityRequest()); + + registerClientPacket(new PacketAlveryChange()); } } diff --git a/src/main/java/forestry/apiculture/network/packets/PacketAlveryChange.java b/src/main/java/forestry/apiculture/network/packets/PacketAlveryChange.java new file mode 100644 index 000000000..7b14bc3fe --- /dev/null +++ b/src/main/java/forestry/apiculture/network/packets/PacketAlveryChange.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.apiculture.network.packets; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import forestry.api.multiblock.IMultiblockComponent; +import forestry.apiculture.multiblock.IAlvearyControllerInternal; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.IForestryPacketClient; +import forestry.core.network.PacketIdClient; +import forestry.core.network.packets.PacketCoordinates; +import forestry.core.proxy.Proxies; + +public class PacketAlveryChange extends PacketCoordinates implements IForestryPacketClient { + + public PacketAlveryChange() { + } + + public PacketAlveryChange(IAlvearyControllerInternal controller) { + super(controller.getReferenceCoord()); + } + + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.ALVERAY_CONTROLLER_CHANGE; + } + + @Override + public void onPacketData(DataInputStreamForestry data, EntityPlayer player) { + TileEntity tile = getTarget(Proxies.common.getRenderWorld()); + if (tile instanceof IMultiblockComponent) { + ((IMultiblockComponent) tile).getMultiblockLogic().getController().reassemble();; + } + } +} diff --git a/src/main/java/forestry/core/network/PacketIdClient.java b/src/main/java/forestry/core/network/PacketIdClient.java index 78a726415..1424d9304 100644 --- a/src/main/java/forestry/core/network/PacketIdClient.java +++ b/src/main/java/forestry/core/network/PacketIdClient.java @@ -48,6 +48,7 @@ public enum PacketIdClient implements IPacketId { HABITAT_BIOME_POINTER, CANDLE_UPDATE, IMPRINT_SELECTION_RESPONSE, + ALVERAY_CONTROLLER_CHANGE, // Arboriculture RIPENING_UPDATE, diff --git a/src/main/java/forestry/core/utils/BlockUtil.java b/src/main/java/forestry/core/utils/BlockUtil.java index b1e31ea6c..9da2a5c55 100644 --- a/src/main/java/forestry/core/utils/BlockUtil.java +++ b/src/main/java/forestry/core/utils/BlockUtil.java @@ -20,6 +20,7 @@ import net.minecraft.block.BlockPlanks; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; @@ -117,6 +118,9 @@ public abstract class BlockUtil { if (block == null || block.isAir(world, pos)) { return false; } + if(Item.getItemFromBlock(block) == null){ + return false; + } int[] oreIds = OreDictionary.getOreIDs(new ItemStack(block)); for (int oreId : oreIds) { if (oreId == slabWoodId) {