Chiseled Bookshelves placed by world gen are rendered empty
SiverDX opened this issue ยท 2 comments
@Override
public void handleUpdateTag(final CompoundTag tag) {
if (tag != null) {
super.handleUpdateTag(tag);
}
updateBlockState(getBlockState());
}
in ChiseledBookshelfBlockEntity
seems to work
Actually only seems to work when loaded through jigsaw blocks directly but not when placed by world gen
But mybe loadStatic
is a better choice, not sure
Once you interact with them it seems to work but before that it'll show the properties as false
These might have helped?
At least it's shown correctly when generating the structure now
Not sure if all are needed or if it was just the rotate one...
// ChiseledBookshelfBlock
@Overwrite
public BlockState rotate(BlockState state, Rotation rotation) {
return state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}
@Overwrite
public BlockState getStateForPlacement(BlockPlaceContext context) {
ChiseledBookshelfBlock instance = (ChiseledBookshelfBlock) (Object) this;
return instance.defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite());
}
// ChiseledBookshelfBlockEntity
@Override
public void onPlace(LivingEntity placer, ItemStack stack) {
super.onPlace(placer, stack);
ChiseledBookshelfBlockEntity chiseledBookshelf = (ChiseledBookshelfBlockEntity) (Object) this;
BlockState newBlockState = chiseledBookshelf.getBlockState()
.setValue(ChiseledBookshelfBlock.SLOT_0_OCCUPIED, !chiseledBookshelf.inventory.getStackInSlot(0).isEmpty())
.setValue(ChiseledBookshelfBlock.SLOT_1_OCCUPIED, !chiseledBookshelf.inventory.getStackInSlot(1).isEmpty())
.setValue(ChiseledBookshelfBlock.SLOT_2_OCCUPIED, !chiseledBookshelf.inventory.getStackInSlot(2).isEmpty())
.setValue(ChiseledBookshelfBlock.SLOT_3_OCCUPIED, !chiseledBookshelf.inventory.getStackInSlot(3).isEmpty())
.setValue(ChiseledBookshelfBlock.SLOT_4_OCCUPIED, !chiseledBookshelf.inventory.getStackInSlot(4).isEmpty())
.setValue(ChiseledBookshelfBlock.SLOT_5_OCCUPIED, !chiseledBookshelf.inventory.getStackInSlot(5).isEmpty());
chiseledBookshelf.setBlockState(newBlockState);
if (level != null) {
BlockHelper.updateStateAndNeighbor(newBlockState, level, chiseledBookshelf.getBlockPos());
}
}