Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package icecreammod;
- import net.minecraft.block.Block;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.entity.projectile.EntityThrowable;
- import net.minecraft.util.MovingObjectPosition;
- import net.minecraft.world.World;
- public class EntityIcebolt extends EntityThrowable {
- /** Explosion radius for this entity. */
- private int damageRadius = 2;
- public EntityIcebolt(World par1World) {
- super(par1World);
- }
- public EntityIcebolt(World par1World, EntityPlayer par3EntityPlayer) {
- super(par1World, par3EntityPlayer);
- }
- public EntityIcebolt(World par1World, double par2, double par4, double par6) {
- super(par1World, par2, par4, par6);
- }
- @Override
- protected void onImpact(MovingObjectPosition movingobjectposition) {
- this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)this.damageRadius, false);
- this.setFire(25);
- this.setDead();
- if (!this.worldObj.isRemote)
- {
- if (movingobjectposition.entityHit != null)
- {
- if (!movingobjectposition.entityHit.isImmuneToFire())
- {
- movingobjectposition.entityHit.setFire(20);
- }
- }
- else
- {
- int i = movingobjectposition.blockX;
- int j = movingobjectposition.blockY;
- int k = movingobjectposition.blockZ;
- switch (movingobjectposition.sideHit)
- {
- case 0:
- --j;
- break;
- case 1:
- ++j;
- break;
- case 2:
- --k;
- break;
- case 3:
- ++k;
- break;
- case 4:
- --i;
- break;
- case 5:
- ++i;
- }
- if (this.worldObj.isAirBlock(i, j, k))
- {
- trySet(i, j, k, Block.snow.blockID);
- trySet(i+2, j, k, Block.snow.blockID);
- trySet(i, j, k+3, Block.snow.blockID);
- trySet(i+4, j, k, Block.snow.blockID);
- trySet(i, j, k+1, Block.snow.blockID);
- trySet(i+2, j, k+4, Block.snow.blockID);
- trySet(i+1, j, k+1, Block.snow.blockID);
- trySet(i+4, j, k+5, Block.snow.blockID);
- trySet(i+6, j, k, Block.snow.blockID);
- }
- }
- }
- }
- @Override
- protected float getGravityVelocity()
- {
- return 0;
- }
- protected boolean trySet(int a, int b, int c, int d) {
- if (!this.worldObj.isAirBlock(a,b-1,c) && (this.worldObj.getBlockId(a, b-1, c) != Block.snow.blockID)) {
- return this.worldObj.setBlock(a, b, c, d);
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement