diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core/entity')
3 files changed, 117 insertions, 8 deletions
diff --git a/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java b/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java index e5c779adcf..aec82119cc 100644 --- a/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java +++ b/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java @@ -13,6 +13,7 @@ import gtPlusPlus.core.entity.monster.EntityGiantChickenBase; import gtPlusPlus.core.entity.monster.EntitySickBlaze; import gtPlusPlus.core.entity.monster.EntityStaballoyConstruct; import gtPlusPlus.core.entity.projectile.EntityHydrofluoricAcidPotion; +import gtPlusPlus.core.entity.projectile.EntityLightningAttack; import gtPlusPlus.core.entity.projectile.EntitySulfuricAcidPotion; import gtPlusPlus.core.entity.projectile.EntityThrowableBomb; import gtPlusPlus.core.entity.projectile.EntityToxinballSmall; @@ -54,6 +55,8 @@ public class InternalEntityRegistry { EntityRegistry.registerModEntity(EntityThrowableBomb.class, "EntityThrowableBomb", mEntityID++, GTplusplus.instance, 64, 10, true); + EntityRegistry.registerModEntity(EntityLightningAttack.class, "EntityLightningAttack", mEntityID++, GTplusplus.instance, 64, 20, true); + /** * Globals, which generate spawn eggs. (Currently required for Giant chicken spawning) */ diff --git a/src/Java/gtPlusPlus/core/entity/projectile/EntityLightningAttack.java b/src/Java/gtPlusPlus/core/entity/projectile/EntityLightningAttack.java new file mode 100644 index 0000000000..868517d1db --- /dev/null +++ b/src/Java/gtPlusPlus/core/entity/projectile/EntityLightningAttack.java @@ -0,0 +1,76 @@ +package gtPlusPlus.core.entity.projectile; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.projectile.EntityWitherSkull; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.World; + +public class EntityLightningAttack extends EntityWitherSkull { + + public EntityLightningAttack(World p_i1793_1_) + { + super(p_i1793_1_); + this.setSize(0.3125F, 0.3125F); + } + + public EntityLightningAttack(World p_i1794_1_, EntityLivingBase p_i1794_2_, double p_i1794_3_, double p_i1794_5_, double p_i1794_7_) + { + super(p_i1794_1_, p_i1794_2_, p_i1794_3_, p_i1794_5_, p_i1794_7_); + this.setSize(0.3125F, 0.3125F); + } + + @SideOnly(Side.CLIENT) + public EntityLightningAttack(World p_i1795_1_, double p_i1795_2_, double p_i1795_4_, double p_i1795_6_, double p_i1795_8_, double p_i1795_10_, double p_i1795_12_) + { + super(p_i1795_1_, p_i1795_2_, p_i1795_4_, p_i1795_6_, p_i1795_8_, p_i1795_10_, p_i1795_12_); + this.setSize(0.3125F, 0.3125F); + } + + + /** + * Called when this EntityFireball hits a block or entity. + */ + protected void onImpact(MovingObjectPosition p_70227_1_) { + + if (!this.worldObj.isRemote) { + if (p_70227_1_.entityHit != null) { + if (this.shootingEntity != null) { + if (p_70227_1_.entityHit.attackEntityFrom(DamageSource.causeMobDamage(this.shootingEntity), 8.0F) + && !p_70227_1_.entityHit.isEntityAlive()) { + this.shootingEntity.heal(0.5F); + } + } else { + p_70227_1_.entityHit.attackEntityFrom(DamageSource.lava, 10.0F); + } + + if (p_70227_1_.entityHit instanceof EntityLivingBase) { + byte b0 = 0; + + if (this.worldObj.difficultySetting == EnumDifficulty.NORMAL) { + b0 = 10; + } else if (this.worldObj.difficultySetting == EnumDifficulty.HARD) { + b0 = 40; + } + + if (b0 > 0) { + ((EntityLivingBase) p_70227_1_.entityHit).addPotionEffect(new PotionEffect(Potion.poison.id, 20 * b0, 1)); + ((EntityLivingBase) p_70227_1_.entityHit).addPotionEffect(new PotionEffect(Potion.confusion.id, 20 * b0, 1)); + ((EntityLivingBase) p_70227_1_.entityHit).addPotionEffect(new PotionEffect(Potion.weakness.id, 20 * b0, 1)); + } + } + } + + this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, 1.0F, false, + this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")); + this.setDead(); + } + } + + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/entity/projectile/EntityThrowableBomb.java b/src/Java/gtPlusPlus/core/entity/projectile/EntityThrowableBomb.java index 9e72daf687..49daa459e0 100644 --- a/src/Java/gtPlusPlus/core/entity/projectile/EntityThrowableBomb.java +++ b/src/Java/gtPlusPlus/core/entity/projectile/EntityThrowableBomb.java @@ -13,6 +13,7 @@ import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.minecraft.BlockPos; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.EntityUtils; +import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; public class EntityThrowableBomb extends EntityThrowable { @@ -39,19 +40,26 @@ public class EntityThrowableBomb extends EntityThrowable { if (object.entityHit != null) { byte b0 = 6; if (!GT_Utility.isWearingFullRadioHazmat((EntityLivingBase) object.entityHit)){ - object.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), b0); - EntityUtils.setEntityOnFire(object.entityHit, 10); + object.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 20); + EntityUtils.setEntityOnFire(object.entityHit, 20); object.entityHit.fireResistance = 0; ravage(EntityUtils.findBlockPosUnderEntity(object.entityHit)); } } - if (object.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK){ - ravage(new BlockPos(xBlock, yBlock, zBlock)); + if (object.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK){ + + ravage(new BlockPos(xBlock, yBlock, zBlock)); + for (BlockPos aSur : new BlockPos(xBlock, yBlock, zBlock).getSurroundingBlocks()) { + ravage(new BlockPos(aSur.xPos, aSur.yPos, aSur.zPos)); + for (BlockPos aSur2 : new BlockPos(aSur.xPos, aSur.yPos, aSur.zPos).getSurroundingBlocks()) { + //ravage(new BlockPos(aSur2.xPos, aSur2.yPos, aSur2.zPos)); + } + } } String mParticleType = "reddust"; int e=0; - for (int i = 0; i < 24; ++i) { + for (int i = 0; i < 127; ++i) { if ((e = MathUtils.randInt(0, 5)) <= 1){ if (e==0) mParticleType = "largesmoke"; @@ -68,19 +76,41 @@ public class EntityThrowableBomb extends EntityThrowable { private boolean ravage(BlockPos blockpos){ - int radius = 1; + int radius = 5; for (int i=(blockpos.xPos-radius);i<(blockpos.xPos+radius);i++){ for (int j=(blockpos.yPos-radius);j<(blockpos.yPos+radius);j++){ for (int h=(blockpos.zPos-radius);h<(blockpos.zPos+radius);h++){ - int mChance = MathUtils.randInt(1, 10); + int mChance = MathUtils.randInt(0, 100); if (mChance <= 3){ Block mBlockhit = worldObj.getBlock(i, j, h); this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - //GT_Pollution.addPollution(worldObj.getChunkFromBlockCoords(blockpos.xPos, blockpos.zPos), mPol); + PollutionUtils.addPollution(worldObj.getChunkFromBlockCoords(blockpos.xPos, blockpos.zPos), 500); this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 0.01f, true); if (mBlockhit == Blocks.grass || mBlockhit == Blocks.mycelium){ worldObj.setBlock(i, j+1, h, Blocks.fire); |