Fixed tile entity duplicates
This commit is contained in:
parent
59fddb6116
commit
b38393e29e
2 changed files with 18 additions and 5 deletions
|
@ -64,11 +64,16 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
public boolean hasTileEntity(IBlockState state) {return state.getValue(BlockDoor.HALF) == EnumDoorHalf.LOWER;}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
|
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
|
||||||
placeLink(world, pos);
|
if(state.getValue(BlockDoor.HALF) == EnumDoorHalf.UPPER) placeLink(world, pos);
|
||||||
world.setTileEntity(pos, createNewTileEntity(world, 0));
|
else {
|
||||||
updateAttachedTile(world, pos);
|
world.setTileEntity(pos, createNewTileEntity(world, 0));
|
||||||
|
updateAttachedTile(world, pos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Called to update the render information on the tile entity. Could probably implement a data watcher,
|
//Called to update the render information on the tile entity. Could probably implement a data watcher,
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
package com.zixiken.dimdoors.tileentities;
|
package com.zixiken.dimdoors.tileentities;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public abstract class DDTileEntityBase extends TileEntity
|
public abstract class DDTileEntityBase extends TileEntity
|
||||||
{
|
{
|
||||||
|
@ -10,4 +14,8 @@ public abstract class DDTileEntityBase extends TileEntity
|
||||||
*/
|
*/
|
||||||
public abstract float[] getRenderColor(Random rand);
|
public abstract float[] getRenderColor(Random rand);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate) {
|
||||||
|
return oldState.getBlock() != newSate.getBlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue