Kaynağa Gözat

新下界合金砧模型

00ll00 6 yıl önce
ebeveyn
işleme
b16f518686

+ 25 - 0
src/main/java/com/hexdragon/blacksmithre/block/anvil/NetheriteAnvil.java

@@ -9,13 +9,32 @@ import net.minecraft.item.BlockItem;
 import net.minecraft.item.Item;
 import net.minecraft.item.ItemGroup;
 import net.minecraft.item.ItemStack;
+import net.minecraft.state.DirectionProperty;
 import net.minecraft.util.Direction;
 import net.minecraft.util.math.BlockPos;
 import net.minecraft.util.math.MathHelper;
+import net.minecraft.util.math.shapes.ISelectionContext;
+import net.minecraft.util.math.shapes.VoxelShape;
+import net.minecraft.util.math.shapes.VoxelShapes;
+import net.minecraft.world.IBlockReader;
 import net.minecraft.world.World;
 import net.minecraftforge.common.ToolType;
 
 public class NetheriteAnvil extends AnvilBlock {
+    public static final DirectionProperty FACING = HorizontalBlock.HORIZONTAL_FACING;
+    private static final VoxelShape PART_BASE = Block.makeCuboidShape(3.0D, 0.0D, 3.0D, 13.0D, 3.0D, 13.0D);
+    private static final VoxelShape PART_LOWER = Block.makeCuboidShape(4.0D, 3.0D, 4.0D, 12.0D, 5.0D, 12.0D);
+
+    private static final VoxelShape PART_MID_X = Block.makeCuboidShape(5.0D, 5.0D, 6.0D, 11.0D, 9.0D, 10.0D);
+    private static final VoxelShape PART_UPPER_X = Block.makeCuboidShape(3.0D, 9.0D, 5.0D, 13.0D, 10.0D, 11.0D);
+    private static final VoxelShape PART_TOP_X = Block.makeCuboidShape(0.0D, 10.0D, 3.0D, 16.0D, 15.0D, 13.0D);
+
+    private static final VoxelShape PART_MID_Z = Block.makeCuboidShape(6.0D, 5.0D, 5.0D, 10.0D, 9.0D, 11.0D);
+    private static final VoxelShape PART_UPPER_Z = Block.makeCuboidShape(5.0D, 9.0D, 3.0D, 11.0D, 10.0D, 13.0D);
+    private static final VoxelShape PART_TOP_Z = Block.makeCuboidShape(3.0D, 10.0D, 0.0D, 13.0D, 15.0D, 16.0D);
+
+    private static final VoxelShape X_AXIS_AABB = VoxelShapes.or(PART_BASE, PART_LOWER, PART_MID_X, PART_UPPER_X, PART_TOP_X);
+    private static final VoxelShape Z_AXIS_AABB = VoxelShapes.or(PART_BASE, PART_LOWER, PART_MID_Z, PART_UPPER_Z, PART_TOP_Z);
 
     public NetheriteAnvil() {
         super(AbstractBlock.Properties.create(Material.ANVIL, MaterialColor.IRON).setRequiresTool().hardnessAndResistance(50F, 1200.0F).harvestTool(ToolType.PICKAXE).harvestLevel(3).sound(SoundType.ANVIL));
@@ -28,6 +47,12 @@ public class NetheriteAnvil extends AnvilBlock {
         }
     }
 
+    //设置碰撞箱
+    public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
+        Direction direction = state.get(FACING);
+        return direction.getAxis() == Direction.Axis.X ? X_AXIS_AABB : Z_AXIS_AABB;
+    }
+
     // 设置红石比较器输出
     public boolean hasComparatorInputOverride(BlockState state) {return true;}
     public int getComparatorInputOverride(BlockState blockState, World worldIn, BlockPos pos) {return Container.calcRedstone(worldIn.getTileEntity(pos));}

+ 223 - 4
src/main/resources/assets/blacksmithre/models/block/netherite_anvil.json

@@ -1,6 +1,225 @@
 {
-  "parent": "blacksmithre:block/template_netherite_anvil",
-  "textures": {
-    "top": "blacksmithre:block/netherite_anvil_top"
-  }
+	"credit": "Made with Blockbench",
+	"textures": {
+		"1": "blacksmithre:block/netherite_anvil_top",
+		"2": "blacksmithre:block/netherite_anvil",
+		"particle": "blacksmithre:block/netherite_anvil"
+	},
+	"elements": [
+		{
+			"from": [8.67817, 2.61918, 5],
+			"to": [10.67817, 9.61918, 11],
+			"rotation": {"angle": 22.5, "axis": "z", "origin": [8, 5.46963, 8]},
+			"faces": {
+				"north": {"uv": [6, 0, 13, 2], "rotation": 90, "texture": "#2"},
+				"east": {"uv": [6, 0, 13, 6], "rotation": 270, "texture": "#2"},
+				"south": {"uv": [6, 0, 13, 2], "rotation": 270, "texture": "#2"},
+				"west": {"uv": [6, 0, 13, 6], "rotation": 270, "texture": "#2"},
+				"up": {"uv": [4, 0, 10, 2], "rotation": 270, "texture": "#2"},
+				"down": {"uv": [4, 0, 10, 2], "rotation": 270, "texture": "#2"}
+			}
+		},
+		{
+			"from": [5.32183, 2.61918, 5],
+			"to": [7.32183, 9.61918, 11],
+			"rotation": {"angle": -22.5, "axis": "z", "origin": [8, 5.46963, 8]},
+			"faces": {
+				"north": {"uv": [6, 2, 13, 4], "rotation": 90, "texture": "#2"},
+				"east": {"uv": [6, 4, 13, 10], "rotation": 270, "texture": "#2"},
+				"south": {"uv": [6, 2, 13, 4], "rotation": 270, "texture": "#2"},
+				"west": {"uv": [6, 4, 13, 10], "rotation": 270, "texture": "#2"},
+				"up": {"uv": [4, 2, 10, 4], "rotation": 270, "texture": "#2"},
+				"down": {"uv": [4, 2, 10, 4], "rotation": 270, "texture": "#2"}
+			}
+		},
+		{
+			"from": [6, 2.5, 9.5],
+			"to": [10, 9.5, 11.75],
+			"rotation": {"angle": 22.5, "axis": "x", "origin": [8.5, 8.5, 11]},
+			"faces": {
+				"north": {"uv": [6, 6, 12, 0], "texture": "#2"},
+				"east": {"uv": [6, 2, 0, 4], "rotation": 90, "texture": "#2"},
+				"south": {"uv": [3, 16, 12, 7], "rotation": 180, "texture": "#2"},
+				"west": {"uv": [7, 2, 0, 4.25], "rotation": 270, "texture": "#2"},
+				"up": {"uv": [0, 4, 6, 2], "rotation": 180, "texture": "#2"},
+				"down": {"uv": [0, 4, 6, 2], "texture": "#2"}
+			}
+		},
+		{
+			"from": [6, 2.5, 4.25],
+			"to": [10, 9.5, 6.5],
+			"rotation": {"angle": -22.5, "axis": "x", "origin": [8.5, 8.5, 5]},
+			"faces": {
+				"north": {"uv": [12, 16, 3, 7], "rotation": 180, "texture": "#2"},
+				"east": {"uv": [6, 4, 0, 2], "rotation": 90, "texture": "#2"},
+				"south": {"uv": [12, 6, 6, 0], "texture": "#2"},
+				"west": {"uv": [7, 4.25, 0, 2], "rotation": 270, "texture": "#2"},
+				"up": {"uv": [0, 2, 6, 4], "rotation": 180, "texture": "#2"},
+				"down": {"uv": [0, 2, 6, 4], "texture": "#2"}
+			}
+		},
+		{
+			"from": [5, 9, 3],
+			"to": [11, 10, 13],
+			"rotation": {"angle": 0, "axis": "y", "origin": [8, 17, 11]},
+			"faces": {
+				"north": {"uv": [5, 6, 11, 7], "texture": "#2"},
+				"east": {"uv": [3, 6, 13, 7], "texture": "#2"},
+				"south": {"uv": [5, 6, 11, 7], "texture": "#2"},
+				"west": {"uv": [3, 6, 13, 7], "texture": "#2"},
+				"up": {"uv": [5, 3, 11, 13], "texture": "#2"},
+				"down": {"uv": [5, 3, 11, 13], "texture": "#2"}
+			}
+		},
+		{
+			"from": [3, 10, 0],
+			"to": [13, 15, 16],
+			"rotation": {"angle": 0, "axis": "y", "origin": [8, 12.5, 8]},
+			"faces": {
+				"north": {"uv": [0, 0, 10, 5], "texture": "#2"},
+				"east": {"uv": [0, 0, 16, 5], "texture": "#2"},
+				"south": {"uv": [0, 0, 10, 5], "texture": "#2"},
+				"west": {"uv": [0, 0, 16, 5], "texture": "#2"},
+				"up": {"uv": [3, 0, 13, 16], "texture": "#1"},
+				"down": {"uv": [0, 0, 10, 16], "texture": "#2"}
+			}
+		},
+		{
+			"from": [4, 3, 4],
+			"to": [12, 5, 12],
+			"rotation": {"angle": 0, "axis": "y", "origin": [12, 12, 12]},
+			"faces": {
+				"north": {"uv": [0, 0, 8, 2], "texture": "#2"},
+				"east": {"uv": [0, 0, 10, 2], "texture": "#2"},
+				"south": {"uv": [0, 0, 8, 2], "texture": "#2"},
+				"west": {"uv": [4, 11, 12, 13], "texture": "#2"},
+				"up": {"uv": [0, 0, 8, 10], "texture": "#2"},
+				"down": {"uv": [0, 0, 8, 10], "texture": "#2"}
+			}
+		},
+		{
+			"from": [3, 0, 3],
+			"to": [13, 3, 13],
+			"rotation": {"angle": 0, "axis": "y", "origin": [15, 8, 11]},
+			"faces": {
+				"north": {"uv": [0, 0, 10, 4], "texture": "#2"},
+				"east": {"uv": [0, 0, 12, 4], "texture": "#2"},
+				"south": {"uv": [0, 0, 10, 4], "texture": "#2"},
+				"west": {"uv": [0, 0, 10, 3], "texture": "#2"},
+				"up": {"uv": [2, 4, 12, 16], "texture": "#2"},
+				"down": {"uv": [0, 0, 10, 12], "texture": "#2"}
+			}
+		},
+		{
+			"from": [3.25736, 0, 12.24264],
+			"to": [6.25736, 2, 15.24264],
+			"rotation": {"angle": -22.5, "axis": "y", "origin": [4.75736, 0.5, 12.24264]},
+			"faces": {
+				"north": {"uv": [0, 0, 3, 2], "texture": "#2"},
+				"east": {"uv": [0, 0, 3, 2], "texture": "#2"},
+				"south": {"uv": [0, 0, 3, 2], "texture": "#2"},
+				"west": {"uv": [0, 0, 3, 2], "texture": "#2"},
+				"up": {"uv": [0, 0, 3, 3], "texture": "#2"},
+				"down": {"uv": [0, 0, 3, 3], "texture": "#2"}
+			}
+		},
+		{
+			"from": [3.25736, 0, 0.75736],
+			"to": [6.25736, 2, 3.75736],
+			"rotation": {"angle": 22.5, "axis": "y", "origin": [4.75736, 0.5, 3.75736]},
+			"faces": {
+				"north": {"uv": [3, 0, 6, 2], "texture": "#2"},
+				"east": {"uv": [6, 0, 12, 2], "texture": "#2"},
+				"south": {"uv": [3, 0, 6, 2], "texture": "#2"},
+				"west": {"uv": [6, 0, 12, 2], "texture": "#2"},
+				"up": {"uv": [0, 6, 3, 12], "texture": "#2"},
+				"down": {"uv": [0, 6, 3, 12], "texture": "#2"}
+			}
+		},
+		{
+			"from": [9.74264, 0, 12.24264],
+			"to": [12.74264, 2, 15.24264],
+			"rotation": {"angle": 22.5, "axis": "y", "origin": [11.24264, 0.5, 12.24264]},
+			"faces": {
+				"north": {"uv": [3, 0, 6, 2], "texture": "#2"},
+				"east": {"uv": [6, 0, 9, 2], "texture": "#2"},
+				"south": {"uv": [3, 0, 6, 2], "texture": "#2"},
+				"west": {"uv": [6, 0, 9, 2], "texture": "#2"},
+				"up": {"uv": [3, 0, 6, 3], "texture": "#2"},
+				"down": {"uv": [3, 0, 6, 3], "texture": "#2"}
+			}
+		},
+		{
+			"from": [9.74264, 0, 0.75736],
+			"to": [12.74264, 2, 3.75736],
+			"rotation": {"angle": -22.5, "axis": "y", "origin": [11.24264, 0.5, 3.75736]},
+			"faces": {
+				"north": {"uv": [3.25736, 14, 6.25736, 16], "texture": "#2"},
+				"east": {"uv": [12.24264, 14, 15.24264, 16], "texture": "#2"},
+				"south": {"uv": [9.74264, 14, 12.74264, 16], "texture": "#2"},
+				"west": {"uv": [0.75736, 14, 3.75736, 16], "texture": "#2"},
+				"up": {"uv": [9.74264, 0.75736, 12.74264, 3.75736], "texture": "#2"},
+				"down": {"uv": [9.74264, 12.24264, 12.74264, 15.24264], "texture": "#2"}
+			}
+		}
+	],
+	"display": {
+		"thirdperson_righthand": {
+			"rotation": [75, 45, 0],
+			"translation": [0, 2.5, 0],
+			"scale": [0.375, 0.375, 0.375]
+		},
+		"thirdperson_lefthand": {
+			"rotation": [75, 45, 0],
+			"translation": [0, 2.5, 0],
+			"scale": [0.375, 0.375, 0.375]
+		},
+		"firstperson_righthand": {
+			"rotation": [0, 45, 0],
+			"scale": [0.4, 0.4, 0.4]
+		},
+		"firstperson_lefthand": {
+			"rotation": [0, 225, 0],
+			"scale": [0.4, 0.4, 0.4]
+		},
+		"ground": {
+			"translation": [0, 3, 0],
+			"scale": [0.25, 0.25, 0.25]
+		},
+		"gui": {
+			"rotation": [30, 225, 0],
+			"scale": [0.625, 0.625, 0.625]
+		},
+		"fixed": {
+			"rotation": [0, 90, 0],
+			"scale": [0.5, 0.5, 0.5]
+		}
+	},
+	"groups": [
+		{
+			"name": "neck_z",
+			"origin": [8, 1.5, 9.5],
+			"children": [0, 1]
+		},
+		{
+			"name": "neck_x",
+			"origin": [8.5, 1.5, 5],
+			"children": [2, 3]
+		},
+		{
+			"name": "top",
+			"origin": [8, 16, 11],
+			"children": [4, 5]
+		},
+		{
+			"name": "base",
+			"origin": [15, 8, 11],
+			"children": [6, 7]
+		},
+		{
+			"name": "feet",
+			"origin": [8, 0.5, 8],
+			"children": [8, 9, 10, 11]
+		}
+	]
 }