public static IInventory getChest(TileEntityChest chest) { for (EnumFacing fside : Plane.HORIZONTAL) { if (chest.getWorld().getBlockState(chest.getPos().offset(fside)).getBlock() == chest.getBlockType()) { return new InventoryLargeChest("container.chestDouble", (TileEntityChest) chest.getWorld().getTileEntity(chest.getPos().offset(fside)), chest); } } return chest; }
private Set<BlockPos> getPositions(BlockPos pos, EnumFacing facing){ Set<BlockPos> stuff = Sets.newHashSet(); stuff.add(pos); Axis a = facing.getAxis(); if(a.isHorizontal()){ stuff.add(pos.up()); stuff.add(pos.down()); if(a == Axis.Z){ stuff.add(pos.east()); stuff.add(pos.east().up()); stuff.add(pos.east().down()); stuff.add(pos.west()); stuff.add(pos.west().up()); stuff.add(pos.west().down()); } else { stuff.add(pos.north()); stuff.add(pos.north().up()); stuff.add(pos.north().down()); stuff.add(pos.south()); stuff.add(pos.south().up()); stuff.add(pos.south().down()); } } else { for(EnumFacing face : Plane.HORIZONTAL.facings()) stuff.add(pos.offset(face)); stuff.add(pos.north().east()); stuff.add(pos.north().west()); stuff.add(pos.south().east()); stuff.add(pos.south().west()); } return stuff; }