Jump to content

[1.14.4] Custom Door Model JSON help


Kenneth201998

Recommended Posts

I am creating a door that is placed not on the edge of a block (like in vanilla) but rather through the center of the block. This is causing me a couple problems:

 

I need to make a collision system that can detect when the player right clicks on either the lower or upper half of the door (The door is just one block with its collision set to be higher that a normal block)

And at the same time allows the player to pass through its collider when the door is in an open state.

 

Here is what I coded so far:

 

package com.kenneths_mod.objects.blocks.doors;

import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
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 KenmodDoor extends Block {
	
	protected static final VoxelShape shape = Block.makeCuboidShape(1, 0, 7, 15, 31, 9);
	
	public KenmodDoor(Properties properties) {
		super(properties);
	}
	@Override
	public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
		return shape;
	}
	@Override
	public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
		return shape;
	}
}

 

I can't use regular vanilla code because of the way the door is designed so if anyone can help me please do. Thanks.

Edited by Kenneth201998
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.