Fixed machines loosing state
This commit is contained in:
parent
8e3136ecf0
commit
2320ceb2c3
1 changed files with 12 additions and 0 deletions
|
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue