Jump to content

[1.7.2][Not needed now]Making an uncollideable block


Naiten

Recommended Posts

Here's my code:

public class BlockLight extends Block{
public BlockLight(Material par1){
	super(Material.air);
	this.setLightLevel(1.0F);
	this.setResistance(1000.0F);
	this.blockParticleGravity = 0.0F;
}

@Override
public boolean isCollidable(){
	return false;
}

@Override
public boolean canCollideCheck(int p_149678_1_, boolean p_149678_2_){
	return false;
}

@Override
public void onEntityCollidedWithBlock(World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity p_149670_5_){
	Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new ChatComponentTranslation("ouch", new Object[0]));
}

@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k){
	return null;
}

@Override
public boolean isOpaqueCube(){
	return false;
}

@Override
public boolean renderAsNormalBlock()
   {
       return false;
   }

@Override
public int getRenderType(){
	return -1;
}

@Override
public int quantityDropped(Random par1Random){
	return 0;
}

@Override
public boolean canDropFromExplosion(Explosion par1Explosion){
	return false;
}
}

And it still collides (i'm getting „ouch“ messages). Any ideas?

If i helped you, don't forget pressing "Thank You" button. Thanks for your time.

Link to comment
Share on other sites

What do you want? Can you go through the block? Is that the problem or is it that it still displays the message even though the collision box is null?

Link to comment
Share on other sites

Can the player go through it? Describe exactly how you want it to work.

Yes, he can. And what do you think I can describe more? I want the damn block not to collide any entity and not to stop my locomotive.

If i helped you, don't forget pressing "Thank You" button. Thanks for your time.

Link to comment
Share on other sites

Hi

 

Just because the onEntityCollidedWithBlock method is called, doesn't mean that anything will happen.

 

For each entity, vanilla calls onEntityCollidedWithBlock for all blocks that partially overlap the entity's bounding box.  But if you don't override it, it won't do anything.  I don't think this is causing the issue.

 

As far as I can tell, your block shouldn't collide with anything.

Show us your loco code?  perhaps the problem is there. 

 

-TGG

 

 

Link to comment
Share on other sites

Can the player go through it? Describe exactly how you want it to work.

Yes, he can. And what do you think I can describe more? I want the damn block not to collide any entity and not to stop my locomotive.

 

Being mad doesn't help, and it definitely doesn't make others want to help.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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