Posted December 21, 20204 yr Hello, I have tried to update the code to my door. The door is a special type of door where instead of hanging on the edge of a block, it goes through the center. For some reason however, the villagers do not recognize it as a door, and therefore never use it. How can I add to my code to make them use it? package com.kenmod.objects.blocks.doors; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.DoorBlock; import net.minecraft.block.HorizontalBlock; import net.minecraft.state.BooleanProperty; import net.minecraft.state.DirectionProperty; import net.minecraft.state.EnumProperty; import net.minecraft.state.Property; import net.minecraft.state.StateContainer.Builder; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.DoorHingeSide; import net.minecraft.state.properties.DoubleBlockHalf; import net.minecraft.util.Direction; 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; public class CenteredDoor extends DoorBlock { public static final DirectionProperty FACING = HorizontalBlock.HORIZONTAL_FACING; public static final BooleanProperty OPEN = BlockStateProperties.OPEN; public static final EnumProperty<DoorHingeSide> HINGE = BlockStateProperties.DOOR_HINGE; public static final BooleanProperty POWERED = BlockStateProperties.POWERED; public static final EnumProperty<DoubleBlockHalf> HALF = BlockStateProperties.DOUBLE_BLOCK_HALF; protected static final VoxelShape default_shape = Block.makeCuboidShape(0.0D, 0.0D, 7.0D, 16.0D, 16.0D, 9.0D); protected static final VoxelShape north_south = Block.makeCuboidShape(0.0D, 0.0D, 7.0D, 16.0D, 16.0D, 9.0D); protected static final VoxelShape east_west = Block.makeCuboidShape(7.0D, 0.0D, 0.0D, 9.0D, 16.0D, 16.0D); protected static final VoxelShape south_l = Block.makeCuboidShape(13.0D, 0.0D, 7.0D, 16.0D, 16.0D, 21.0D); protected static final VoxelShape south_r = Block.makeCuboidShape(0.0D, 0.0D, 7.0D, 3.0D, 16.0D, 21.0D); protected static final VoxelShape north_l = Block.makeCuboidShape(0.0D, 0.0D, 9.0D, 3.0D, 16.0D, -5.0D); protected static final VoxelShape north_r = Block.makeCuboidShape(13.0D, 0.0D, 9.0D, 16.0D, 16.0D, -5.0D); protected static final VoxelShape east_l = Block.makeCuboidShape(7.0D, 0.0D, 0.0D, 21.0D, 16.0D, 3.0D); protected static final VoxelShape east_r = Block.makeCuboidShape(7.0D, 0.0D, 13.0D, 21.0D, 16.0D, 16.0D); protected static final VoxelShape west_l = Block.makeCuboidShape(9.0D, 0.0D, 13.0D, -5.0D, 16.0D, 16.0D); protected static final VoxelShape west_r = Block.makeCuboidShape(9.0D, 0.0D, 0.0D, -5.0D, 16.0D, 3.0D); public CenteredDoor (Properties properties) { super(properties); } @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { Direction dir = (Direction)state.get((Property<?>)FACING); DoorHingeSide side = (DoorHingeSide)state.get((Property<DoorHingeSide>)HINGE); Boolean open = (Boolean)state.get((Property<?>)OPEN); if ((dir == Direction.NORTH || dir == Direction.SOUTH) && !open.booleanValue()) { return north_south; } if ((dir == Direction.EAST || dir == Direction.WEST) && !open.booleanValue()) { return east_west; } if (dir == Direction.NORTH && side == DoorHingeSide.LEFT) { return north_l; } if (dir == Direction.NORTH && side == DoorHingeSide.RIGHT) { return north_r; } if (dir == Direction.SOUTH && side == DoorHingeSide.LEFT) { return south_l; } if (dir == Direction.SOUTH && side == DoorHingeSide.RIGHT) { return south_r; } if (dir == Direction.EAST && side == DoorHingeSide.LEFT) { return east_l; } if (dir == Direction.EAST && side == DoorHingeSide.RIGHT) { return east_r; } if (dir == Direction.WEST && side == DoorHingeSide.LEFT) { return west_l; } if (dir == Direction.WEST && side == DoorHingeSide.RIGHT) { return west_r; } return default_shape; } @Override protected void fillStateContainer(Builder<Block, BlockState> builder) { builder.add(new Property[] { HALF, FACING, OPEN, HINGE, POWERED }); } }
December 21, 20204 yr I think this has something to do with Tags...you should add your door to the WOODEN_DOORS block tag Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port
December 27, 20204 yr Author Ok I did this: { "replace": false, "values": [ "minecraft:oak_door", "minecraft:spruce_door", "minecraft:birch_door", "minecraft:jungle_door", "minecraft:acacia_door", "minecraft:dark_oak_door", "minecraft:crimson_door", "minecraft:warped_door", "kenmod:oak_cabin_door" ] } { "replace": false, "values": [ "minecraft:oak_door", "minecraft:spruce_door", "minecraft:birch_door", "minecraft:jungle_door", "minecraft:acacia_door", "minecraft:dark_oak_door", "minecraft:crimson_door", "minecraft:warped_door", "kenmod:oak_cabin_door" ] } But they still don't open the door.
December 28, 20204 yr 19 hours ago, ken2020 said: Ok I did this: { "replace": false, "values": [ "minecraft:oak_door", "minecraft:spruce_door", "minecraft:birch_door", "minecraft:jungle_door", "minecraft:acacia_door", "minecraft:dark_oak_door", "minecraft:crimson_door", "minecraft:warped_door", "kenmod:oak_cabin_door" ] } { "replace": false, "values": [ "minecraft:oak_door", "minecraft:spruce_door", "minecraft:birch_door", "minecraft:jungle_door", "minecraft:acacia_door", "minecraft:dark_oak_door", "minecraft:crimson_door", "minecraft:warped_door", "kenmod:oak_cabin_door" ] } But they still don't open the door. Where did you put this? How to ask a good coding question: https://stackoverflow.com/help/how-to-ask Give logs, code, desired effects, and actual effects. Be thorough or we can't help you. Don't post code without putting it in a code block (the <> button on the post - select "C-type Language"): syntax highlighting makes everything easier, and it keeps the post tidy. My own mod, Magiks Most Evile: GitHub (https://github.com/GenElectrovise/MagiksMostEvile) Wiki (https://magiksmostevile.fandom.com/wiki/Magiks_Most_Evile_Wiki) Edit your own signature at https://www.minecraftforge.net/forum/settings/signature/
December 29, 20204 yr it should be in src/main/resources/data/minecraft/tags/blocks and should be named doors.json
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.