Tile -> BlockEntity + some more refactors
This commit is contained in:
parent
7f8674f1ca
commit
dbc89adaf7
193 changed files with 3194 additions and 3214 deletions
|
@ -82,16 +82,16 @@ public class StackToolTipHandler implements ItemTooltipCallback {
|
|||
try {
|
||||
Block block = Block.getBlockFromItem(item);
|
||||
if (block != null && (block instanceof BlockWithEntity || block instanceof BlockEntityProvider) && Registry.BLOCK.getId(block).getNamespace().contains("techreborn")) {
|
||||
BlockEntity tile = ((BlockEntityProvider) block).createBlockEntity(MinecraftClient.getInstance().world);
|
||||
BlockEntity blockEntity = ((BlockEntityProvider) block).createBlockEntity(MinecraftClient.getInstance().world);
|
||||
boolean hasData = false;
|
||||
if (stack.hasTag() && stack.getTag().containsKey("tile_data")) {
|
||||
CompoundTag tileData = stack.getTag().getCompound("tile_data");
|
||||
tile.fromTag(tileData);
|
||||
if (stack.hasTag() && stack.getTag().containsKey("blockEntity_data")) {
|
||||
CompoundTag blockEntityData = stack.getTag().getCompound("blockEntity_data");
|
||||
blockEntity.fromTag(blockEntityData);
|
||||
hasData = true;
|
||||
components.add(new LiteralText("Block data contained").formatted(Formatting.DARK_GREEN));
|
||||
}
|
||||
if (tile instanceof IListInfoProvider) {
|
||||
((IListInfoProvider) tile).addInfo(components, false, hasData);
|
||||
if (blockEntity instanceof IListInfoProvider) {
|
||||
((IListInfoProvider) blockEntity).addInfo(components, false, hasData);
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue