From 6d79cf16f6d5128c3a6bfaa1d78793daa6c5f023 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Sun, 21 Jun 2020 11:54:27 +0200 Subject: [PATCH] Mockup Fixes --- .../java/com/simibubi/create/AllBlocks.java | 6 ++--- .../java/com/simibubi/create/AllShapes.java | 2 +- .../realityFunnel/RealityFunnelBlock.java | 25 +++++++++++++++---- .../models/block/chute/block_windowed.json | 2 +- .../models/block/reality_funnel/block.json | 16 +++++++----- 5 files changed, 35 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index 888e3beed..f1afcd90e 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -124,7 +124,6 @@ import com.tterrag.registrate.util.DataIngredient; import com.tterrag.registrate.util.entry.BlockEntry; import net.minecraft.block.Block; -import net.minecraft.block.Block.Properties; import net.minecraft.block.Blocks; import net.minecraft.block.SoundType; import net.minecraft.block.material.MaterialColor; @@ -360,7 +359,7 @@ public class AllBlocks { public static final BlockEntry MECHANICAL_PRESS = REGISTRATE.block("mechanical_press", MechanicalPressBlock::new) .initialProperties(SharedProperties::stone) - .properties(Properties::nonOpaque) + .properties(p -> p.nonOpaque()) .blockstate(BlockStateGen.horizontalBlockProvider(true)) .transform(StressConfigDefaults.setImpact(8.0)) .item(BasinOperatorBlockItem::new) @@ -713,6 +712,7 @@ public class AllBlocks { public static final BlockEntry CHUTE = REGISTRATE.block("chute", ChuteBlock::new) .initialProperties(SharedProperties::softMetal) + .addLayer(() -> RenderType::getCutoutMipped) .blockstate((c, p) -> p.getVariantBuilder(c.get()) .forAllStates(s -> ConfiguredModel.builder() .modelFile(s.get(ChuteBlock.WINDOW) ? AssetLookup.partialBaseModel(c, p, "windowed") @@ -731,7 +731,7 @@ public class AllBlocks { public static final BlockEntry PACKAGER = REGISTRATE.block("packager", PackagerBlock::new) .initialProperties(SharedProperties::softMetal) .transform(StressConfigDefaults.setImpact(4.0)) - .properties(Properties::nonOpaque) + .properties(p -> p.nonOpaque()) .blockstate((c, p) -> p.getVariantBuilder(c.get()) .forAllStates(s -> ConfiguredModel.builder() .modelFile(AssetLookup.partialBaseModel(c, p)) diff --git a/src/main/java/com/simibubi/create/AllShapes.java b/src/main/java/com/simibubi/create/AllShapes.java index 003e524c4..e690a9169 100644 --- a/src/main/java/com/simibubi/create/AllShapes.java +++ b/src/main/java/com/simibubi/create/AllShapes.java @@ -65,7 +65,7 @@ public class AllShapes { NIXIE_TUBE_CEILING = shape(0, 12, 0, 16, 16, 16).add(9, 1, 5, 15, 16, 11) .add(1, 1, 5, 7, 16, 11) .forHorizontalAxis(), - REALITY_FUNNEL = shape(2, 2, 14, 14, 14, 18).forDirectional(NORTH), + REALITY_FUNNEL = shape(2, -2, 2, 14, 2, 14).forDirectional(UP), BELT_FUNNEL_RETRACTED = shape(3, -5, 14, 13, 13, 19).add(0, -5, 8, 16, 16, 14) .forHorizontal(NORTH), BELT_FUNNEL_DEFAULT = shape(3, -5, 12, 13, 13, 17).add(0, -5, 6, 16, 16, 12) diff --git a/src/main/java/com/simibubi/create/content/logistics/block/realityFunnel/RealityFunnelBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/realityFunnel/RealityFunnelBlock.java index 68b669091..6d367e59f 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/realityFunnel/RealityFunnelBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/realityFunnel/RealityFunnelBlock.java @@ -1,5 +1,6 @@ package com.simibubi.create.content.logistics.block.realityFunnel; +import com.simibubi.create.AllBlocks; import com.simibubi.create.AllShapes; import com.simibubi.create.foundation.block.ProperDirectionalBlock; @@ -11,6 +12,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; +import net.minecraft.world.IWorld; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; @@ -19,18 +21,32 @@ public class RealityFunnelBlock extends ProperDirectionalBlock { public RealityFunnelBlock(Properties p_i48415_1_) { super(p_i48415_1_); } - + @Override public BlockState getStateForPlacement(BlockItemUseContext context) { return getDefaultState().with(FACING, context.getFace()); } - + @Override public VoxelShape getShape(BlockState state, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) { return AllShapes.REALITY_FUNNEL.get(state.get(FACING)); } - + + @Override + public BlockState updatePostPlacement(BlockState state, Direction direction, BlockState p_196271_3_, IWorld world, + BlockPos pos, BlockPos p_196271_6_) { + if (state.get(FACING) + .getAxis() + .isHorizontal() && direction == Direction.DOWN) { + BlockState equivalentFunnel = AllBlocks.BELT_FUNNEL.getDefaultState() + .with(BeltFunnelBlock.HORIZONTAL_FACING, state.get(FACING)); + if (BeltFunnelBlock.isOnValidBelt(equivalentFunnel, world, pos)) + return equivalentFunnel; + } + return state; + } + @Override public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) { @@ -43,7 +59,7 @@ public class RealityFunnelBlock extends ProperDirectionalBlock { if (!isValidPosition(state, worldIn, pos)) worldIn.destroyBlock(pos, true); } - + @Override public boolean isValidPosition(BlockState state, IWorldReader world, BlockPos pos) { return !world.getBlockState(pos.offset(state.get(FACING) @@ -51,6 +67,5 @@ public class RealityFunnelBlock extends ProperDirectionalBlock { .getShape(world, pos) .isEmpty(); } - } diff --git a/src/main/resources/assets/create/models/block/chute/block_windowed.json b/src/main/resources/assets/create/models/block/chute/block_windowed.json index 2897f4c6f..801008eb3 100644 --- a/src/main/resources/assets/create/models/block/chute/block_windowed.json +++ b/src/main/resources/assets/create/models/block/chute/block_windowed.json @@ -51,7 +51,7 @@ "rotation": {"angle": 0, "axis": "y", "origin": [9, 16, 9]}, "faces": { "north": {"uv": [15, 0, 16, 4], "texture": "#13"}, - "east": {"uv": [9, 0, 16, 4], "texture": "#13"}, + "east": {"uv": [0, 12, 7, 16], "texture": "#13"}, "south": {"uv": [9, 0, 10, 4], "texture": "#13"}, "west": {"uv": [0, 12, 7, 16], "texture": "#13"}, "up": {"uv": [0, 0, 1, 7], "texture": "#13"}, diff --git a/src/main/resources/assets/create/models/block/reality_funnel/block.json b/src/main/resources/assets/create/models/block/reality_funnel/block.json index ebfd1e4a6..9800e0c56 100644 --- a/src/main/resources/assets/create/models/block/reality_funnel/block.json +++ b/src/main/resources/assets/create/models/block/reality_funnel/block.json @@ -7,8 +7,8 @@ }, "elements": [ { - "from": [2, -2, 2], - "to": [14, 0, 14], + "from": [2.1, -2, 2.1], + "to": [13.9, 0, 13.9], "rotation": {"angle": 0, "axis": "z", "origin": [9, 8, 8]}, "faces": { "north": {"uv": [0, 13, 0.5, 16], "rotation": 270, "texture": "#10"}, @@ -34,7 +34,8 @@ "east": {"uv": [0.5, 13, 1, 16], "rotation": 270, "texture": "#10"}, "south": {"uv": [0.5, 13, 1, 13.25], "rotation": 270, "texture": "#10"}, "west": {"uv": [0.5, 13, 1, 16], "rotation": 270, "texture": "#10"}, - "up": {"uv": [0.75, 13, 1, 16], "rotation": 180, "texture": "#10"} + "up": {"uv": [0.75, 13, 1, 16], "rotation": 180, "texture": "#10"}, + "down": {"uv": [0.75, 13, 1, 16], "rotation": 180, "texture": "#10"} } }, { @@ -46,7 +47,8 @@ "east": {"uv": [0.5, 13, 1, 16], "rotation": 270, "texture": "#10"}, "south": {"uv": [0.5, 15.75, 1, 16], "rotation": 270, "texture": "#10"}, "west": {"uv": [0.5, 13, 1, 16], "rotation": 270, "texture": "#10"}, - "up": {"uv": [0.75, 13, 1, 16], "rotation": 180, "texture": "#10"} + "up": {"uv": [0.75, 13, 1, 16], "rotation": 180, "texture": "#10"}, + "down": {"uv": [0.75, 13, 1, 16], "rotation": 180, "texture": "#10"} } }, { @@ -56,7 +58,8 @@ "faces": { "north": {"uv": [0.5, 13.25, 1, 15.75], "rotation": 270, "texture": "#10"}, "south": {"uv": [0.5, 13.25, 1, 15.75], "rotation": 270, "texture": "#10"}, - "up": {"uv": [0.75, 13.25, 1, 15.75], "rotation": 90, "texture": "#10"} + "up": {"uv": [0.75, 13.25, 1, 15.75], "rotation": 90, "texture": "#10"}, + "down": {"uv": [0.75, 13.25, 1, 15.75], "rotation": 90, "texture": "#10"} } }, { @@ -66,7 +69,8 @@ "faces": { "north": {"uv": [0.5, 13.25, 1, 15.75], "rotation": 270, "texture": "#10"}, "south": {"uv": [0.5, 13.25, 1, 15.75], "rotation": 270, "texture": "#10"}, - "up": {"uv": [0.75, 13.25, 1, 15.75], "rotation": 270, "texture": "#10"} + "up": {"uv": [0.75, 13.25, 1, 15.75], "rotation": 270, "texture": "#10"}, + "down": {"uv": [0.75, 13.25, 1, 15.75], "rotation": 270, "texture": "#10"} } } ],