Fixed creative engine desync

This commit is contained in:
dmillerw 2014-04-13 12:59:40 -07:00
parent b96480371e
commit 2cc2183e23

View file

@ -1,6 +1,7 @@
package buildcraft.energy;
import buildcraft.api.tools.IToolWrench;
import buildcraft.core.network.NetworkData;
import buildcraft.core.utils.StringUtils;
import buildcraft.transport.pipes.PipePowerIron;
import net.minecraft.entity.player.EntityPlayer;
@ -12,6 +13,7 @@ import net.minecraftforge.common.util.ForgeDirection;
public class TileEngineCreative extends TileEngine {
@NetworkData
private PipePowerIron.PowerMode powerMode = PipePowerIron.PowerMode.M2;
@Override
@ -36,21 +38,23 @@ public class TileEngineCreative extends TileEngine {
@Override
public boolean onBlockActivated(EntityPlayer player, ForgeDirection side) {
Item equipped = player.getCurrentEquippedItem() != null ? player.getCurrentEquippedItem().getItem() : null;
if (!getWorld().isRemote) {
Item equipped = player.getCurrentEquippedItem() != null ? player.getCurrentEquippedItem().getItem() : null;
if (equipped instanceof IToolWrench && ((IToolWrench) equipped).canWrench(player, xCoord, yCoord, zCoord)) {
powerMode = powerMode.getNext();
energy = 0;
if (equipped instanceof IToolWrench && ((IToolWrench) equipped).canWrench(player, xCoord, yCoord, zCoord)) {
powerMode = powerMode.getNext();
energy = 0;
if (!getWorld().isRemote) {
player.addChatMessage(new ChatComponentText(String.format(StringUtils.localize("chat.pipe.power.iron.mode"), powerMode.maxPower)));
}
((IToolWrench) equipped).wrenchUsed(player, xCoord, yCoord, zCoord);
return true;
sendNetworkUpdate();
((IToolWrench) equipped).wrenchUsed(player, xCoord, yCoord, zCoord);
return true;
}
}
return false;
return !player.isSneaking();
}
@Override