Fixed machines loosing state

This commit is contained in:
modmuss50 2015-12-23 12:40:48 +00:00
parent 8e3136ecf0
commit 2320ceb2c3

View file

@ -1,13 +1,16 @@
package techreborn.tiles; package techreborn.tiles;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager; import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable; import net.minecraft.util.ITickable;
import net.minecraft.world.World;
import reborncore.common.packets.PacketHandler; import reborncore.common.packets.PacketHandler;
import techreborn.blocks.BlockMachineBase; import techreborn.blocks.BlockMachineBase;
@ -67,4 +70,13 @@ public class TileMachineBase extends TileEntity implements ITickable {
} }
} }
//This stops the tile from getting cleared when the state is updated(rotation and on/off)
@Override
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate) {
if(oldState.getBlock() != newSate.getBlock()){
return true;
}
return false;
}
} }