Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.jivalon.giantdiamond.procedures;
- /* imports omitted */
- public class GiantOakWoodBlockAddedProcedure {
- public static void executeProcedure(Map<String, Object> dependencies) {
- if (dependencies.get("world") == null) {
- if (!dependencies.containsKey("world"))
- GiantDiamondMod.LOGGER.warn("Failed to load dependency world for procedure GiantOakWoodBlockAdded!");
- return;
- }
- if (dependencies.get("x") == null) {
- if (!dependencies.containsKey("x"))
- GiantDiamondMod.LOGGER.warn("Failed to load dependency x for procedure GiantOakWoodBlockAdded!");
- return;
- }
- if (dependencies.get("y") == null) {
- if (!dependencies.containsKey("y"))
- GiantDiamondMod.LOGGER.warn("Failed to load dependency y for procedure GiantOakWoodBlockAdded!");
- return;
- }
- if (dependencies.get("z") == null) {
- if (!dependencies.containsKey("z"))
- GiantDiamondMod.LOGGER.warn("Failed to load dependency z for procedure GiantOakWoodBlockAdded!");
- return;
- }
- IWorld world = (IWorld) dependencies.get("world");
- double x = dependencies.get("x") instanceof Integer ? (int) dependencies.get("x") : (double) dependencies.get("x");
- double y = dependencies.get("y") instanceof Integer ? (int) dependencies.get("y") : (double) dependencies.get("y");
- double z = dependencies.get("z") instanceof Integer ? (int) dependencies.get("z") : (double) dependencies.get("z");
- if ((new Object() {
- public Direction getDirection(BlockPos pos) {
- try {
- BlockState _bs = world.getBlockState(pos);
- DirectionProperty property = (DirectionProperty) _bs.getBlock().getStateContainer().getProperty("facing");
- if (property != null)
- return _bs.get(property);
- return Direction.getFacingFromAxisDirection(
- _bs.get((EnumProperty<Direction.Axis>) _bs.getBlock().getStateContainer().getProperty("axis")),
- Direction.AxisDirection.POSITIVE);
- } catch (Exception e) {
- return Direction.NORTH;
- }
- }
- }.getDirection(new BlockPos((int) x, (int) y, (int) z))) == Direction.NORTH) {
- if (world instanceof ServerWorld) {
- Template template = ((ServerWorld) world).getStructureTemplateManager()
- .getTemplateDefaulted(new ResourceLocation("giant_diamond", "bridge"));
- if (template != null) {
- template.func_237144_a_(
- (ServerWorld) world, new BlockPos((int) (x - 1), (int) y, (int) z), new PlacementSettings()
- .setRotation(Rotation.COUNTERCLOCKWISE_90).setMirror(Mirror.NONE).setChunk(null).setIgnoreEntities(false),
- ((World) world).rand);
- }
- }
- }
- if ((new Object() {
- public Direction getDirection(BlockPos pos) {
- try {
- BlockState _bs = world.getBlockState(pos);
- DirectionProperty property = (DirectionProperty) _bs.getBlock().getStateContainer().getProperty("facing");
- if (property != null)
- return _bs.get(property);
- return Direction.getFacingFromAxisDirection(
- _bs.get((EnumProperty<Direction.Axis>) _bs.getBlock().getStateContainer().getProperty("axis")),
- Direction.AxisDirection.POSITIVE);
- } catch (Exception e) {
- return Direction.NORTH;
- }
- }
- }.getDirection(new BlockPos((int) x, (int) y, (int) z))) == Direction.SOUTH) {
- if (world instanceof ServerWorld) {
- Template template = ((ServerWorld) world).getStructureTemplateManager()
- .getTemplateDefaulted(new ResourceLocation("giant_diamond", "bridge"));
- if (template != null) {
- template.func_237144_a_((ServerWorld) world, new BlockPos((int) (x + 1), (int) y, (int) z),
- new PlacementSettings().setRotation(Rotation.CLOCKWISE_90).setMirror(Mirror.NONE).setChunk(null).setIgnoreEntities(false),
- ((World) world).rand);
- }
- }
- }
- if ((new Object() {
- public Direction getDirection(BlockPos pos) {
- try {
- BlockState _bs = world.getBlockState(pos);
- DirectionProperty property = (DirectionProperty) _bs.getBlock().getStateContainer().getProperty("facing");
- if (property != null)
- return _bs.get(property);
- return Direction.getFacingFromAxisDirection(
- _bs.get((EnumProperty<Direction.Axis>) _bs.getBlock().getStateContainer().getProperty("axis")),
- Direction.AxisDirection.POSITIVE);
- } catch (Exception e) {
- return Direction.NORTH;
- }
- }
- }.getDirection(new BlockPos((int) x, (int) y, (int) z))) == Direction.WEST) {
- if (world instanceof ServerWorld) {
- Template template = ((ServerWorld) world).getStructureTemplateManager()
- .getTemplateDefaulted(new ResourceLocation("giant_diamond", "bridge"));
- if (template != null) {
- template.func_237144_a_(
- (ServerWorld) world, new BlockPos((int) x, (int) y, (int) (z + 1)), new PlacementSettings()
- .setRotation(Rotation.CLOCKWISE_180).setMirror(Mirror.NONE).setChunk(null).setIgnoreEntities(false),
- ((World) world).rand);
- }
- }
- }
- if ((new Object() {
- public Direction getDirection(BlockPos pos) {
- try {
- BlockState _bs = world.getBlockState(pos);
- DirectionProperty property = (DirectionProperty) _bs.getBlock().getStateContainer().getProperty("facing");
- if (property != null)
- return _bs.get(property);
- return Direction.getFacingFromAxisDirection(
- _bs.get((EnumProperty<Direction.Axis>) _bs.getBlock().getStateContainer().getProperty("axis")),
- Direction.AxisDirection.POSITIVE);
- } catch (Exception e) {
- return Direction.NORTH;
- }
- }
- }.getDirection(new BlockPos((int) x, (int) y, (int) z))) == Direction.EAST) {
- if (world instanceof ServerWorld) {
- Template template = ((ServerWorld) world).getStructureTemplateManager()
- .getTemplateDefaulted(new ResourceLocation("giant_diamond", "bridge"));
- if (template != null) {
- template.func_237144_a_((ServerWorld) world, new BlockPos((int) x, (int) y, (int) (z - 1)),
- new PlacementSettings().setRotation(Rotation.NONE).setMirror(Mirror.NONE).setChunk(null).setIgnoreEntities(false),
- ((World) world).rand);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment