LittleTiles

LittleTiles

12M Downloads

How to programatically add a new box

vinz243 opened this issue ยท 7 comments

commented

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

commented

You should rather use one of the Actions, like LittleActionPlaceStack or LittleActionPlaceAbsolute. Everything is done there already.

commented

I'm trying to do something lower level, because I need to apply geometric 3d transforms (like mirroring etc)

commented

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).

commented

Maybe create a new action, don't know.

commented

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

commented

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.

commented

I needed something lower level to replicate the effects of actions into other blocks. With actions I would have to do this for every action, or redefine the whole caller hierarchy