Jump to content

Marca

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by Marca

  1. Found out I just had to send a packet to the server to set the value
  2. How should I go about setting a value in a tileEntity from a Container?
  3. So apparently i was able to use the vanilla BlockStates and so the fix was simply put: { "multipart": [ { "apply": { "model": "se:block/iron_itemduct" } }, { "when": { "up": "true" }, "apply": { "model": "se:block/iron_itemduct_side", "x": 90 } } ] } Though this is a vanilla fix, not a Forge fix
  4. I am making an Itemduct block which will connect to every Itemduct on its sides. Though for some reason only the default model is visible (is the center part of the Itemduct) blockstates/Itemduct.json: { "forge_marker": 1, "defaults": { "model": "se:block/iron_itemduct" }, "variants": { "up": { "true": { "submodel": "se:block/iron_itemduct_side", "x": 90 }, "false": { } }, "down": { "true": { "submodel": "se:block/iron_itemduct_side", "x": 180 }, "false": { } }, "east": { "true": { "submodel": "se:block/iron_itemduct_side", "y": 90 }, "false": { } }, "south": { "true": { "submodel": "se:block/iron_itemduct_side", "y": 180 }, "false": { } }, "west": { "true": { "submodel": "se:block/iron_itemduct_side", "y": 270 }, "false": { } }, "north": { "true": { "submodel": "se:block/iron_itemduct_side" }, "false": { } } } } models/block/itemduct.json: <- This is the parent model of models/block/iron_itemduct { "__comment": "Designed by Marca with Cubik Studio - https://cubik.studio", "textures": { "particle": "#center" }, "display": { "gui": { "rotation": [ 30, 45, 0 ], "translation": [ 0, -1.5, 0 ], "scale": [ 0.625, 0.625, 0.625 ] }, "ground": { "rotation": [ 0, 0, 0 ], "translation": [ 0, 3, 0 ], "scale": [ 0.25, 0.25, 0.25 ] }, "fixed": { "rotation": [ 0, 180, 0 ], "translation": [ 0, 0, 0 ], "scale": [ 1, 1, 1 ] }, "firstperson_righthand": { "rotation": [ 0, 315, 0 ], "translation": [ 0, 2.5, 0 ], "scale": [ 0.4, 0.4, 0.4 ] }, "thirdperson_righthand": { "rotation": [ 0, 315, 0 ], "translation": [ 0, 0.5, 1 ], "scale": [ 0.375, 0.375, 0.375 ] } }, "elements": [ { "from": [ 6, 6, 6 ], "to": [ 10, 10, 10 ], "faces": { "down": { "uv": [ 6, 6, 10, 10 ], "texture": "#center" }, "up": { "uv": [ 6, 6, 10, 10 ], "texture": "#center" }, "north": { "uv": [ 6, 6, 10, 10 ], "texture": "#center" }, "south": { "uv": [ 6, 6, 10, 10 ], "texture": "#center" }, "west": { "uv": [ 6, 6, 10, 10 ], "texture": "#center" }, "east": { "uv": [ 6, 6, 10, 10 ], "texture": "#center" } } } ] } models/block/itemduct_side: <- This is the parent model of models/block/iron_itemduct_side { "__comment": "Designed by Marca with Cubik Studio - https://cubik.studio", "elements": [ { "from": [ 6, 6, 10 ], "to": [10, 10, 16 ], "faces": { "down": { "uv": [ 10, 6, 16, 10 ], "texture": "#side" }, "up": { "uv": [ 10, 6, 16, 10 ], "texture": "#side" }, "north": { "uv": [ 0, 6, 6, 10 ], "texture": "#side", "cullface": "north" }, "south": { "uv": [ 10, 6, 16, 10 ], "texture": "#side" }, "west": { "uv": [ 6, 6, 10, 10 ], "texture": "#side" }, "east": { "uv": [ 6, 6, 10, 10 ], "texture": "#side" } } } ] } ItemductBlock: public class ItemductBlock extends SurvivalEvolvedWaterloggedBlock { public static final BooleanProperty UP = BooleanProperty.create("up"); public static final BooleanProperty DOWN = BooleanProperty.create("down"); public static final BooleanProperty EAST = BooleanProperty.create("east"); public static final BooleanProperty SOUTH = BooleanProperty.create("south"); public static final BooleanProperty WEST = BooleanProperty.create("west"); public static final BooleanProperty NORTH = BooleanProperty.create("north"); public final ImmutableMap<BlockState, VoxelShape> SHAPES; public ItemductBlock (Properties properties) { super(properties); setDefaultState(getStateContainer().getBaseState().with(UP, false).with(DOWN, false).with(NORTH, false).with(EAST, false).with(SOUTH, false) .with(WEST, false)); SHAPES = generateShapes(getStateContainer().getValidStates()); } private ImmutableMap<BlockState, VoxelShape> generateShapes (ImmutableList<BlockState> states) { final VoxelShape ITEMDUCT_CENTER = Block.makeCuboidShape(6.0, 6.0, 6.0, 10.0, 10.0, 10.0); final VoxelShape ITEMDUCT_SIDE = Block.makeCuboidShape(10.0, 6.0, 6.0, 16.0, 10.0, 10.0); ImmutableMap.Builder<BlockState, VoxelShape> builder = new ImmutableMap.Builder<>(); for (BlockState state : states) { boolean up = state.get(UP); boolean down = state.get(DOWN); boolean east = state.get(EAST); boolean south = state.get(SOUTH); boolean west = state.get(WEST); boolean north = state.get(NORTH); List<VoxelShape> shapes = new ArrayList<>(); shapes.add(ITEMDUCT_CENTER); if (up) shapes.add(VoxelShapeHelper.rotate(ITEMDUCT_SIDE, Direction.UP)); if (down) shapes.add(VoxelShapeHelper.rotate(ITEMDUCT_SIDE, Direction.DOWN)); if (east) shapes.add(VoxelShapeHelper.rotate(ITEMDUCT_SIDE, Direction.EAST)); if (south) shapes.add(VoxelShapeHelper.rotate(ITEMDUCT_SIDE, Direction.SOUTH)); if (west) shapes.add(VoxelShapeHelper.rotate(ITEMDUCT_SIDE, Direction.WEST)); if (north) shapes.add(VoxelShapeHelper.rotate(ITEMDUCT_SIDE, Direction.NORTH)); builder.put(state, VoxelShapeHelper.combineAll(shapes)); } return builder.build(); } @Override public VoxelShape getShape (BlockState state, IBlockReader reader, BlockPos pos, ISelectionContext context) { return SHAPES.get(state); } @Override public VoxelShape getCollisionShape (BlockState state, IBlockReader reader, BlockPos pos, ISelectionContext context) { return SHAPES.get(state); } @Override public BlockState updatePostPlacement (BlockState state, Direction direction, BlockState newState, IWorld world, BlockPos pos, BlockPos newPos) { boolean up = world.getBlockState(pos.up()).getBlock() == this; boolean down = world.getBlockState(pos.down()).getBlock() == this; boolean east = world.getBlockState(pos.east()).getBlock() == this; boolean south = world.getBlockState(pos.south()).getBlock() == this; boolean west = world.getBlockState(pos.west()).getBlock() == this; boolean north = world.getBlockState(pos.north()).getBlock() == this; return state.with(UP, up).with(DOWN, down).with(EAST, east).with(SOUTH, south).with(WEST, west).with(NORTH, north); } @Override protected void fillStateContainer (Builder<Block, BlockState> builder) { super.fillStateContainer(builder); builder.add(UP); builder.add(DOWN); builder.add(EAST); builder.add(SOUTH); builder.add(WEST); builder.add(NORTH); } }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.