[Answered] Override Damage to Player
3 posters
MC Modding :: Help :: Help
Page 1 of 1
[Answered] Override Damage to Player
Hi, I have a block which makes all entities go on fire when they collide with it, except entity player. The code's like this:
- Code:
public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity)
{
if (!(entity instanceof EntityPlayerSP))
{
entity.fire = 300;
}
Last edited by TheCodeNewbie on Sun Oct 30, 2011 7:52 am; edited 3 times in total
TheCodeNewbie- Member
- Posts : 6
Join date : 2011-10-25
Re: [Answered] Override Damage to Player
how would I do that?
TheCodeNewbie- Member
- Posts : 6
Join date : 2011-10-25
Re: [Answered] Override Damage to Player
TheCodeNewbie wrote:how would I do that?
- Code:
if(entity instanceof EntityPlayer)
{
return;
}else
{
entity.fire = 300;
}
Also it isn't in-wall damage it's because you prolly forgot to tell it the block is not rendered normally (or you edited something else, post your whole code for the block please.)
groxmapper- Member
- Posts : 27
Join date : 2011-10-24
Re: [Answered] Override Damage to Player
Oh wait I figured it out, I was having a derp moment with this in my code:
- Code:
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
{
float f = 0.0625F;
return AxisAlignedBB.getBoundingBoxFromPool((float)i + f, j, (float)k + f, (float)(i + 1) - f, (float)(j + 1) - f, (float)(k + 1) - f);
}
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int i, int j, int k)
{
float f = 0.0625F;
return AxisAlignedBB.getBoundingBoxFromPool((float)i + f, j, (float)k + f, (float)(i + 1) - f, j + 1, (float)(k + 1) - f);
}
TheCodeNewbie- Member
- Posts : 6
Join date : 2011-10-25
Re: [Answered] Override Damage to Player
Wait getting rid of that didn't help, here's the code for my block
Blockburner.java:
Blockburner.java:
- Code:
package net.minecraft.src;
import java.util.Random;
public class Blockburner extends Block
{
public Blockburner(int i, int j)
{
super(i, j, Material.wood);
}
public int idDropped(int i, Random random)
{
return mod_burner.burner.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}
public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity)
{
if(entity instanceof EntityPlayer)
{
return;
}else
{
entity.fire = 300;
}
}
}
- Code:
package net.minecraft.src;
public class mod_burner extends BaseMod
{
public static Block burner = new Blockburner(190, 0).setHardness(1.0F).setResistance(5F).setLightValue(0.2F).setBlockName("burner");
public String Version()
{
return "1.8.1";
}
public mod_burner()
{
ModLoader.RegisterBlock(burner);
burner.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/CreatureBurner.png");
ModLoader.AddName(burner, "Block of Burning Flames");
ModLoader.AddRecipe(new ItemStack(burner, 8), new Object[] {
"###", "#@#", "###", Character.valueOf('#'), Block.netherrack, Character.valueOf('@'), Item.bucketLava
});
}
}
TheCodeNewbie- Member
- Posts : 6
Join date : 2011-10-25
Re: [Answered] Override Damage to Player
*sigh* It didn't fix my problem in the first post. I still don't know how to stop my character from getting damaged when I run into my block if it is stacked 2 high.
TheCodeNewbie- Member
- Posts : 6
Join date : 2011-10-25
MC Modding :: Help :: Help
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum