How to programatically add a new box
vinz243 opened this issue ยท 7 comments
I'm trying to programatically add new Box to an extisting tile :
TileEntity tileEntity = world.getTileEntity(new BlockPos(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()));
if (tileEntity instanceof TileEntityLittleTiles) {
TileEntityLittleTiles tiles = (TileEntityLittleTiles) tileEntity;
LittleTileBlock tile = new LittleTileBlock(littleTile.getBlock(), littleTile.getMeta());// LittleTile.CreateandLoadTile
tile.te = tiles;
tile.setBox(littleTileBox);
tiles.place()
}
However when this is executed nothing happens
You should rather use one of the Actions, like LittleActionPlaceStack or LittleActionPlaceAbsolute. Everything is done there already.
I'm trying to do something lower level, because I need to apply geometric 3d transforms (like mirroring etc)
There is already mirroring. Besides that you should rather work with previews and hand them over to the actions. You might want to take a look at the door code, it might give you an idea of how this works (source).
I found that it was a lack of a few things (needed to convert grid context, updateTiles, etc). However in a few stiuations I have a few glitches, but I guess Ill check it on my own
I can only highly recommend to use the Actions because it takes care of literally everything. It doesn't make sense to do it somewhere else again, but that's your choice.