I’m trying to make a few new doors for v1.15.2 of the game. I’m having shape/collision problems with a bigger door, 2x2 blocks.
As you can see in the pictures above, there’s a few problems.
The collision shape is wrong when facing certain directions. Not only that but the rotation is off. I tried using negative values in the getShape (and also in the JSON file) but it corrects one direction and messes up another.
When the door is broken there’s the missing model texture. My other doors don’t do that. I haven’t investigated this one yet.
Also it seems that the “extended” part of the door is ignored. Like the door is still 2x1 blocks.
The door class extends DoorBlock and overrides the getShape method.
protected static final VoxelShape SOUTH_AABB_X2 = Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 32.0D, 16.0D, 3.0D);
protected static final VoxelShape NORTH_AABB_X2 = Block.makeCuboidShape(0.0D, 0.0D, 13.0D, 32.0D, 16.0D, 16.0D);
protected static final VoxelShape WEST_AABB_X2 = Block.makeCuboidShape(13.0D, 0.0D, 0.0D, 16.0D, 16.0D, 32.0D);
protected static final VoxelShape EAST_AABB_X2 = Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 3.0D, 16.0D, 32.0D);
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
Direction direction = state.get(FACING);
boolean flag = !state.get(OPEN);
boolean flag1 = state.get(HINGE) == DoorHingeSide.RIGHT;
switch (direction) {
case EAST:
default:
return flag ? EAST_AABB_X2 : (flag1 ? NORTH_AABB_X2 : SOUTH_AABB_X2);
case SOUTH:
return flag ? SOUTH_AABB_X2 : (flag1 ? EAST_AABB_X2 : WEST_AABB_X2);
case WEST:
return flag ? WEST_AABB_X2 : (flag1 ? SOUTH_AABB_X2 : NORTH_AABB_X2);
case NORTH:
return flag ? NORTH_AABB_X2 : (flag1 ? WEST_AABB_X2 : EAST_AABB_X2);
}
}
Bottom part JSON:
{
"ambientocclusion": false,
"textures": {
"big_spruce_door_full": "dn-moredoors:block/big_spruce_door_full"
},
"elements": [
{
"from": [ 0, 0, 0 ],
"to": [ 3, 16, 32 ],
"faces": {
"down": { "texture": "#big_spruce_door_full", "uv": [ 0, 10, 16, 12 ], "rotation": 90, "cullface": "down" },
"north": { "texture": "#big_spruce_door_full", "uv": [ 5, 8, 6, 16 ], "cullface": "north" },
"south": { "texture": "#big_spruce_door_full", "uv": [ 5, 8, 6, 16 ], "cullface": "south" },
"west": { "texture": "#big_spruce_door_full", "uv": [ 0, 8, 16, 16 ], "cullface": "west" },
"east": { "texture": "#big_spruce_door_full", "uv": [ 16, 8, 0, 16 ] }
}
}
]
}
Bottom part RH JSON:
{
"ambientocclusion": false,
"textures": {
"big_spruce_door_full": "dn-moredoors:block/big_spruce_door_full"
},
"elements": [
{
"from": [ 0, 0, 0 ],
"to": [ 3, 16, 32 ],
"faces": {
"down": { "texture": "#big_spruce_door_full", "uv": [ 0, 10, 16, 12 ], "rotation": 90, "cullface": "down" },
"north": { "texture": "#big_spruce_door_full", "uv": [ 5, 8, 6, 16 ], "cullface": "north" },
"south": { "texture": "#big_spruce_door_full", "uv": [ 5, 8, 6, 16 ], "cullface": "south" },
"west": { "texture": "#big_spruce_door_full", "uv": [ 16, 8, 0, 16 ], "cullface": "west" },
"east": { "texture": "#big_spruce_door_full", "uv": [ 0, 8, 16, 16 ] }
}
}
]
}
And the blockstate JSON:
{
"variants": {
"facing=east,half=lower,hinge=left,open=false": { "model": "dn-moredoors:block/big_spruce_door_bottom" },
"facing=south,half=lower,hinge=left,open=false": { "model": "dn-moredoors:block/big_spruce_door_bottom", "y": 90 },
"facing=west,half=lower,hinge=left,open=false": { "model": "dn-moredoors:block/big_spruce_door_bottom", "y": 180 },
"facing=north,half=lower,hinge=left,open=false": { "model": "dn-moredoors:block/big_spruce_door_bottom", "y": 270 },
"facing=east,half=lower,hinge=right,open=false": { "model": "dn-moredoors:block/big_spruce_door_bottom_rh" },
"facing=south,half=lower,hinge=right,open=false": { "model": "dn-moredoors:block/big_spruce_door_bottom_rh", "y": 90 },
"facing=west,half=lower,hinge=right,open=false": { "model": "dn-moredoors:block/big_spruce_door_bottom_rh", "y": 180 },
"facing=north,half=lower,hinge=right,open=false": { "model": "dn-moredoors:block/big_spruce_door_bottom_rh", "y": 270 },
"facing=east,half=lower,hinge=left,open=true": { "model": "dn-moredoors:block/big_spruce_door_bottom_rh", "y": 90 },
"facing=south,half=lower,hinge=left,open=true": { "model": "dn-moredoors:block/big_spruce_door_bottom_rh", "y": 180 },
"facing=west,half=lower,hinge=left,open=true": { "model": "dn-moredoors:block/big_spruce_door_bottom_rh", "y": 270 },
"facing=north,half=lower,hinge=left,open=true": { "model": "dn-moredoors:block/big_spruce_door_bottom_rh" },
"facing=east,half=lower,hinge=right,open=true": { "model": "dn-moredoors:block/big_spruce_door_bottom", "y": 270 },
"facing=south,half=lower,hinge=right,open=true": { "model": "dn-moredoors:block/big_spruce_door_bottom" },
"facing=west,half=lower,hinge=right,open=true": { "model": "dn-moredoors:block/big_spruce_door_bottom", "y": 90 },
"facing=north,half=lower,hinge=right,open=true": { "model": "dn-moredoors:block/big_spruce_door_bottom", "y": 180 },
"facing=east,half=upper,hinge=left,open=false": { "model": "dn-moredoors:block/big_spruce_door_top" },
"facing=south,half=upper,hinge=left,open=false": { "model": "dn-moredoors:block/big_spruce_door_top", "y": 90 },
"facing=west,half=upper,hinge=left,open=false": { "model": "dn-moredoors:block/big_spruce_door_top", "y": 180 },
"facing=north,half=upper,hinge=left,open=false": { "model": "dn-moredoors:block/big_spruce_door_top", "y": 270 },
"facing=east,half=upper,hinge=right,open=false": { "model": "dn-moredoors:block/big_spruce_door_top_rh" },
"facing=south,half=upper,hinge=right,open=false": { "model": "dn-moredoors:block/big_spruce_door_top_rh", "y": 90 },
"facing=west,half=upper,hinge=right,open=false": { "model": "dn-moredoors:block/big_spruce_door_top_rh", "y": 180 },
"facing=north,half=upper,hinge=right,open=false": { "model": "dn-moredoors:block/big_spruce_door_top_rh", "y": 270 },
"facing=east,half=upper,hinge=left,open=true": { "model": "dn-moredoors:block/big_spruce_door_top_rh", "y": 90 },
"facing=south,half=upper,hinge=left,open=true": { "model": "dn-moredoors:block/big_spruce_door_top_rh", "y": 180 },
"facing=west,half=upper,hinge=left,open=true": { "model": "dn-moredoors:block/big_spruce_door_top_rh", "y": 270 },
"facing=north,half=upper,hinge=left,open=true": { "model": "dn-moredoors:block/big_spruce_door_top_rh" },
"facing=east,half=upper,hinge=right,open=true": { "model": "dn-moredoors:block/big_spruce_door_top", "y": 270 },
"facing=south,half=upper,hinge=right,open=true": { "model": "dn-moredoors:block/big_spruce_door_top" },
"facing=west,half=upper,hinge=right,open=true": { "model": "dn-moredoors:block/big_spruce_door_top", "y": 90 },
"facing=north,half=upper,hinge=right,open=true": { "model": "dn-moredoors:block/big_spruce_door_top", "y": 180 }
}
}
Most of the JSONs are based on the vanilla Spruce Door. Assuming they are correct, there’s probably a method I need to override but have no clue which.
Any help would be appreciated