Jump to content

How to prevent suffocation?


jordsta95

Recommended Posts

Hey guys, so I am trying to make a block players can walk through but I am having a few issues.

1) If inside the block, the player takes suffocation damage

2) When walking through a single block at feet level, no issues, but when trying to walk through at head level, either momentum is needed, or some sides don't seem work.

 

Anything you could suggest, here is an example of of the blocks:

 

 

public class secretDirt extends Block {
public secretDirt(){
	super(Material.grass);
	setBlockName("secretDirt");
	setCreativeTab(JordTab.JordTab);
	RegisterHelper.registerBlock(this);
}

@Override
    public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
    {
        return null;
    }


@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister)
{
	blockIcon = iconRegister.registerIcon("minecraft:dirt");
}
}

 

 

Why bother?

Link to comment
Share on other sites

Try Material.plants instead.

 

Or you can make your own material. The key part is the

isSolid

method.

  private static Material myMaterial = new Material(MapColor.grassColor) {
    @Override
    public boolean isSolid() {
      return false;
    }
    
    @Override
    public boolean blocksLight() {
      return true;
    }
    
    @Override
    public boolean blocksMovement() {
      return false;
    }
  };

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.

Announcements



×
×
  • Create New...

Important Information

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