[1.8.1] Advanced Block
MC Modding :: Modding :: Singleplayer Modding :: Tutorials
Page 1 of 1
[1.8.1] Advanced Block
Advanced Block
- Spoiler:
- Booster Block
1. Add this to your BlockNamehere:- Code:
slipperiness = 1.5F;
- Code:
public BlockNamehere(int i, int j)
{
super(i, j, Material.ground);
slipperiness = 1.5F;
}
Bouncy Block
1. Add this to your BlockNamehere:- Code:
public void onEntityWalking(World world, int x, int y, int z, Entity entity)
{
entity.motionY += 2.0;
}
- Code:
public int idDropped(int i, Random random)
{
return mod_Namehere.Namehere.blockID;
}
public void onEntityWalking(World world, int x, int y, int z, Entity entity)
{
entity.motionY += 2.0;
}
public int quantityDropped(Random random)
{
return 1;
}
}
Change the 2 to whatever you want, 5 will shoot you sky high!Damage/heal on contact1. Put this in your BlockNamehere:- 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);
}
public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity)
{
entity.attackEntityFrom(null, 4);
}
- Code:
public int quantityDropped(Random random)
{
return 1;
}
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);
}
public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity)
{
entity.attackEntityFrom(DamageSource.causeThrownDamage(entity, entity), 4);
}
}
2. The 4 at the bottom is how many half-hearts of damage it does when you walk into it.
3. If you want it to heal you on contact, then change it to something like this:- Code:
entity.attackEntityFrom(null, -4);
4. The only downside to the heal block is the player still makes the hurt sounds...
Similar topics
» [1.8.1] Block
» How Do I Add A Block For 1.2.5
» [1.8.1] On/Off Light Block
» [1.8.1] Explosive Block
» [unsolved]furnace like block 1.8.1/1.0.0/1.1
» How Do I Add A Block For 1.2.5
» [1.8.1] On/Off Light Block
» [1.8.1] Explosive Block
» [unsolved]furnace like block 1.8.1/1.0.0/1.1
MC Modding :: Modding :: Singleplayer Modding :: Tutorials
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum