I've been trying to make a block that I can see but walk through, as in not collide with it, but I don't want to be made of 'air' as then I'm able to place other blocks in the same position, destroying my block.
There's a method "getBlocksMovement" that looks like it should work for allowing movement, but it doesn't seem to get called when I override it. Returning 'null' from "getCollisionBoundingBoxFromPool" does the job, but materials other than 'air' still block movement even with this.
I've tried setting the bounding box of the block to 0, but then I take damage when I try to walk through and I get shoved back out.
As for being able to place blocks in the same space, I tried setting "isAirBlock" to false, but that didn't help.
I can use Material.circuits to allow walking through and not placing blocks in the same position, but then I can also place blocks on this block, which I don't want, as it should behave like air in this regard.
It's sort of trivial, but I'm curious because so many of the methods provided by Block don't seem to do what they claim to do, or am I mistaken?
Sample code for block with no collision, but blocks can be placed in its position, destroying it:
public BlockDarkness(int par1)
{
super(par1, Material.air);
this.setLightOpacity(1);
this.setBlockUnbreakable();
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
{
return null;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
Hah, yes that does it. Sorry messed around with that when using other materials thinking that it would allow me to walk through the block, didn't realize what it did.
There's a method "getBlocksMovement" that looks like it should work for allowing movement, but it doesn't seem to get called when I override it. Returning 'null' from "getCollisionBoundingBoxFromPool" does the job, but materials other than 'air' still block movement even with this.
I've tried setting the bounding box of the block to 0, but then I take damage when I try to walk through and I get shoved back out.
As for being able to place blocks in the same space, I tried setting "isAirBlock" to false, but that didn't help.
I can use Material.circuits to allow walking through and not placing blocks in the same position, but then I can also place blocks on this block, which I don't want, as it should behave like air in this regard.
It's sort of trivial, but I'm curious because so many of the methods provided by Block don't seem to do what they claim to do, or am I mistaken?
Sample code for block with no collision, but blocks can be placed in its position, destroying it:
Thanks!