From f66cedc5b20ad19d7e128a43681e76d1c5e58908 Mon Sep 17 00:00:00 2001 From: Michael Hillcox Date: Wed, 2 Dec 2020 15:35:24 +0000 Subject: [PATCH] Night right yet but I want to move on with the items --- src/generated/resources/.cache/cache | 2 +- .../atomic_reconstructor_block.json | 17 +++++++-------- .../common/blocks/FullyDirectionalBlock.java | 2 +- .../data/GeneratorBlockStates.java | 21 +++++++++++++------ 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 9080e3aa7..fdf0a88a8 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -1,5 +1,5 @@ 308eb79ef3014c4cf1cc0453e827f43e0a9bcf5f assets/actuallyadditions/blockstates/advanced_item_laser_relay_block.json -0bc1a2d02d57a6b8ca85b8d3d286eafc727088e1 assets/actuallyadditions/blockstates/atomic_reconstructor_block.json +37e925d4aca37833f9f4ef8e863beed31deba62c assets/actuallyadditions/blockstates/atomic_reconstructor_block.json 6cc10cd01255886d05b71b898b05faa76e2ccc8a assets/actuallyadditions/blockstates/battery_box_block.json b25315def4a9ff486d8a564449764cfb76b00d78 assets/actuallyadditions/blockstates/bio_reactor_block.json eefccdcc7bb6e2e26af2195d266691148bb2c25b assets/actuallyadditions/blockstates/black_chiseled_quartz_slab_block.json diff --git a/src/generated/resources/assets/actuallyadditions/blockstates/atomic_reconstructor_block.json b/src/generated/resources/assets/actuallyadditions/blockstates/atomic_reconstructor_block.json index 77b9c58d2..49941772e 100644 --- a/src/generated/resources/assets/actuallyadditions/blockstates/atomic_reconstructor_block.json +++ b/src/generated/resources/assets/actuallyadditions/blockstates/atomic_reconstructor_block.json @@ -2,29 +2,26 @@ "variants": { "facing=down": { "model": "actuallyadditions:block/atomic_reconstructor_block", - "x": 180 + "x": 90 }, "facing=up": { - "model": "actuallyadditions:block/atomic_reconstructor_block" + "model": "actuallyadditions:block/atomic_reconstructor_block", + "x": 270 }, "facing=north": { "model": "actuallyadditions:block/atomic_reconstructor_block", - "x": 90 + "y": 180 }, "facing=south": { - "model": "actuallyadditions:block/atomic_reconstructor_block", - "x": 90, - "y": 180 + "model": "actuallyadditions:block/atomic_reconstructor_block" }, "facing=west": { "model": "actuallyadditions:block/atomic_reconstructor_block", - "x": 90, - "y": 270 + "y": 90 }, "facing=east": { "model": "actuallyadditions:block/atomic_reconstructor_block", - "x": 90, - "y": 90 + "y": 270 } } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/common/blocks/FullyDirectionalBlock.java b/src/main/java/de/ellpeck/actuallyadditions/common/blocks/FullyDirectionalBlock.java index 3bb4d83b2..84d172d9e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/common/blocks/FullyDirectionalBlock.java +++ b/src/main/java/de/ellpeck/actuallyadditions/common/blocks/FullyDirectionalBlock.java @@ -22,7 +22,7 @@ public class FullyDirectionalBlock extends ActuallyBlock { } public BlockState getStateForPlacement(BlockItemUseContext context) { - return this.getDefaultState().with(FACING, context.getPlacementHorizontalFacing().getOpposite()); + return this.getDefaultState().with(FACING, context.getNearestLookingDirection().getOpposite()); } protected void fillStateContainer(StateContainer.Builder builder) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/GeneratorBlockStates.java b/src/main/java/de/ellpeck/actuallyadditions/data/GeneratorBlockStates.java index ae2840e52..c5f489278 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/GeneratorBlockStates.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/GeneratorBlockStates.java @@ -8,6 +8,7 @@ import net.minecraft.block.StairsBlock; import net.minecraft.block.WallBlock; import net.minecraft.data.DataGenerator; import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.generators.BlockStateProvider; import net.minecraftforge.client.model.generators.ConfiguredModel; @@ -162,13 +163,21 @@ public class GeneratorBlockStates extends BlockStateProvider { private void fullyDirectionalBlock(Supplier block) { ResourceLocation name = block.get().getRegistryName(); + // Todo: come back and fix this, it's still not right assert name != null; - directionalBlock(block.get(), models().orientable( - name.toString(), - modLoc(String.format("block/%s", name.getPath())), - modLoc(String.format("block/%s_front", name.getPath())), - modLoc(String.format("block/%s_top", name.getPath())) - )); + getVariantBuilder(block.get()) + .forAllStates(state -> { + Direction dir = state.get(BlockStateProperties.FACING); + System.out.println(dir); + return ConfiguredModel.builder() + .modelFile(models().withExistingParent(name.toString(), "block/orientable") + .texture("side", modLoc(String.format("block/%s", name.getPath()))) + .texture("front", modLoc(String.format("block/%s_front", name.getPath()))) + .texture("top", modLoc(String.format("block/%s_top", name.getPath())))) + .rotationX(dir == Direction.DOWN ? 90 : (dir == Direction.UP ? 270 : 0)) + .rotationY(dir.getAxis().isVertical() ? 0 : dir.getHorizontalIndex() * 90) + .build(); + }); } }