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) {
|
||||
placeLink(world, pos);
|
||||
world.setTileEntity(pos, createNewTileEntity(world, 0));
|
||||
updateAttachedTile(world, pos);
|
||||
if(state.getValue(BlockDoor.HALF) == EnumDoorHalf.UPPER) placeLink(world, pos);
|
||||
else {
|
||||
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,
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package com.zixiken.dimdoors.tileentities;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class DDTileEntityBase extends TileEntity
|
||||
{
|
||||
|
@ -9,5 +13,9 @@ public abstract class DDTileEntityBase extends TileEntity
|
|||
* @return an array of floats representing RGBA color where 1.0 = 255.
|
||||
*/
|
||||
public abstract float[] getRenderColor(Random rand);
|
||||
|
||||
|
||||
@Override
|
||||
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate) {
|
||||
return oldState.getBlock() != newSate.getBlock();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue