net.minecraft.block.enums.ChestType Java Examples
The following examples show how to use
net.minecraft.block.enums.ChestType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MixinBlockItem.java From multiconnect with MIT License | 6 votes |
@Inject(method = "canPlace", at = @At("HEAD"), cancellable = true) private void onCanPlace(ItemPlacementContext context, BlockState state, CallbackInfoReturnable<Boolean> ci) { if (ConnectionInfo.protocolVersion <= Protocols.V1_12_2) { Block block = state.getBlock(); if (block == Blocks.CHEST || block == Blocks.TRAPPED_CHEST) { World world = context.getWorld(); BlockPos pos = context.getBlockPos(); boolean foundAdjChest = false; for (Direction dir : Direction.Type.HORIZONTAL) { BlockState otherState = world.getBlockState(pos.offset(dir)); if (otherState.getBlock() == block) { if (foundAdjChest) { ci.setReturnValue(false); return; } foundAdjChest = true; if (otherState.get(ChestBlock.CHEST_TYPE) != ChestType.SINGLE) { ci.setReturnValue(false); return; } } } } } }
Example #2
Source File: ChestEspHack.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
private Box getBoxFromChest(ChestBlockEntity chestBE) { BlockState state = chestBE.getCachedState(); if(!state.contains(ChestBlock.CHEST_TYPE)) return null; ChestType chestType = state.get(ChestBlock.CHEST_TYPE); // ignore other block in double chest if(chestType == ChestType.LEFT) return null; BlockPos pos = chestBE.getPos(); if(!BlockUtils.canBeClicked(pos)) return null; Box box = BlockUtils.getBoundingBox(pos); // larger box for double chest if(chestType != ChestType.SINGLE) { BlockPos pos2 = pos.offset(ChestBlock.getFacing(state)); if(BlockUtils.canBeClicked(pos2)) { Box box2 = BlockUtils.getBoundingBox(pos2); box = box.union(box2); } } return box; }
Example #3
Source File: PistonHandler_movableTEMixin.java From fabric-carpet with MIT License | 5 votes |
/** * @param blockState blockState of one double chest half block * @return Direction towards the other block of the double chest, null if the blockState is not a double chest * @author 2No2Name */ private Direction getDirectionToOtherChestHalf(BlockState blockState){ ChestType chestType; try{ chestType = blockState.get(ChestBlock.CHEST_TYPE); }catch(IllegalArgumentException e){return null;} if(chestType == ChestType.SINGLE) return null; return ChestBlock.getFacing(blockState); }