- 1,031
- 19
- 87
Сделал кастомный boundbox для своего блока по модели, но он не работает, тобишь boundbox обычный квадратный.
Код:
public class BlockSacredPlate extends Block {
public static final float HARDNESS = 5.0F;
public static final String TOOL_CLASS = "pickaxe";
public static final int TOOL_LEVEL = 3;
public static final float LIGHT_LEVEL = 7.0F;
public static final String REGISTRY_NAME = "sacred_plate";
public static final float RESISTANCE = 50.0F;
public static final String LOCALIZATION_KEY = ExcaliburCraft.MOD_ID + "." + BlockSacredPlate.REGISTRY_NAME;
public BlockSacredPlate() {
super(Material.IRON);
//this.setCreativeTab(tab)
this.setHardness(HARDNESS);
this.setHarvestLevel(TOOL_CLASS, TOOL_LEVEL);
this.setLightLevel(LIGHT_LEVEL);
this.setRegistryName(REGISTRY_NAME);
this.setResistance(RESISTANCE);
this.setSoundType(SoundType.METAL);
this.setUnlocalizedName(LOCALIZATION_KEY);
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Override
public boolean isFullCube(IBlockState state) {
return false;
}
private static final AxisAlignedBB[] SACRED_PLATE_AABB = new AxisAlignedBB[] {
new AxisAlignedBB(0.125, 0.0, 0.4375, 0.4375, 0.875, 0.75),
new AxisAlignedBB(0.25, 0.75, 0.4375, 0.75, 0.875, 0.5625)
};
@Override
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean isActualState) {
addCollisionBoxToList(pos, entityBox, collidingBoxes, SACRED_PLATE_AABB[0]);
addCollisionBoxToList(pos, entityBox, collidingBoxes, SACRED_PLATE_AABB[1]);
}
public AxisAlignedBB getBoundingBox(IBlockState blockState, IBlockAccess source, BlockPos position) {
return FULL_BLOCK_AABB;
}
}
Код:
{
"textures": {
"1": "excaliburcraft:blocks/sacred_plate",
"particle": "excaliburcraft:blocks/sacred_plate"
},
"elements": [
{
"from": [2, 0, 7],
"to": [14, 12, 9],
"faces": {
"north": {"uv": [2, 4, 14, 16], "texture": "#1"},
"east": {"uv": [0, 4, 2, 16], "texture": "#1"},
"south": {"uv": [2, 4, 14, 16], "texture": "#1"},
"west": {"uv": [14, 4, 16, 16], "texture": "#1"},
"up": {"uv": [2, 0, 14, 2], "texture": "#1"},
"down": {"uv": [2, 0, 14, 2], "texture": "#1"}
}
},
{
"from": [4, 12, 7],
"to": [12, 14, 9],
"faces": {
"north": {"uv": [4, 2, 12, 4], "texture": "#1"},
"east": {"uv": [12, 2, 14, 4], "texture": "#1"},
"south": {"uv": [4, 2, 12, 4], "texture": "#1"},
"west": {"uv": [2, 2, 4, 4], "texture": "#1"},
"up": {"uv": [4, 0, 12, 2], "texture": "#1"},
"down": {"uv": [4, 2, 12, 4], "texture": "#1"}
}
}
],
"display": {
"thirdperson_righthand": {
"scale": [0.325, 0.325, 0.325],
"translation": [0, -1.5, -1],
"rotation": [0, -95, 0]
},
"thirdperson_lefthand": {
"scale": [0.3249, 0.3249, 0.3249],
"translation": [0, -1.5, -1],
"rotation": [0, -95, 0]
},
"head": {
"translation": [0, 7.5, -2],
"rotation": [90, 0, 180]
},
"ground": {
"translation": [0, 7, 0]
},
"fixed": {
"translation": [0, 1, 0]
},
"gui": {
"translation": [0, 1, 0]
}
}
}