aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/entity/projectile
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/core/entity/projectile')
-rw-r--r--src/Java/gtPlusPlus/core/entity/projectile/EntitySulfuricAcidPotion.java58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/core/entity/projectile/EntitySulfuricAcidPotion.java b/src/Java/gtPlusPlus/core/entity/projectile/EntitySulfuricAcidPotion.java
index 6f4c57f294..b12dc7e0a8 100644
--- a/src/Java/gtPlusPlus/core/entity/projectile/EntitySulfuricAcidPotion.java
+++ b/src/Java/gtPlusPlus/core/entity/projectile/EntitySulfuricAcidPotion.java
@@ -1,9 +1,15 @@
package gtPlusPlus.core.entity.projectile;
+import gregtech.common.GT_Pollution;
+import gtPlusPlus.core.util.PollutionUtils;
+import gtPlusPlus.core.util.array.BlockPos;
import gtPlusPlus.core.util.entity.EntityUtils;
import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.player.PlayerUtils;
+import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityThrowable;
+import net.minecraft.init.Blocks;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
@@ -26,10 +32,18 @@ public class EntitySulfuricAcidPotion extends EntityThrowable {
* Called when this EntityThrowable hits a block or entity.
*/
protected void onImpact(MovingObjectPosition object) {
+ int xBlock = object.blockX;
+ int yBlock = object.blockY;
+ int zBlock = object.blockZ;
if (object.entityHit != null) {
byte b0 = 6;
object.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float) b0);
EntityUtils.setEntityOnFire(object.entityHit, 10);
+ object.entityHit.fireResistance = 0;
+ ravage(new BlockPos(xBlock, yBlock, zBlock));
+ }
+ if (object.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK){
+ ravage(new BlockPos(xBlock, yBlock, zBlock));
}
String mParticleType = "reddust";
@@ -48,4 +62,48 @@ public class EntitySulfuricAcidPotion extends EntityThrowable {
this.setDead();
}
}
+
+ private boolean ravage(BlockPos blockpos){
+
+ for (int i=(blockpos.xPos-1);i<(blockpos.xPos+1);i++){
+ for (int j=(blockpos.yPos-1);j<(blockpos.yPos+1);j++){
+ for (int h=(blockpos.zPos-1);h<(blockpos.zPos+1);h++){
+
+ Block mBlockhit = worldObj.getBlock(i, j, h);
+ this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(0, 2), this.posY+MathUtils.randDouble(0, 2), this.posZ+MathUtils.randDouble(0, 2), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(0, 2), this.posY+MathUtils.randDouble(0, 2), this.posZ+MathUtils.randDouble(0, 2), 0.0D, 0.0D, 0.0D);
+
+ int mPol = 500000000;
+
+ GT_Pollution.addPollution(worldObj.getChunkFromBlockCoords(blockpos.xPos, blockpos.zPos), mPol);
+
+ if (mBlockhit == Blocks.grass || mBlockhit == Blocks.mycelium){
+ worldObj.setBlock(i, j+1, h, Blocks.fire);
+ worldObj.setBlock(i, j, h, Blocks.dirt);
+ }
+ else if (mBlockhit == Blocks.leaves || mBlockhit == Blocks.leaves2){
+ worldObj.setBlock(i, j, h, Blocks.fire);
+ }
+ else if (mBlockhit == Blocks.tallgrass){
+ worldObj.setBlock(i, j, h, Blocks.fire);
+ if (worldObj.getBlock(i, j-1, h) == Blocks.grass){
+ worldObj.setBlock(i, j-1, h, Blocks.dirt);
+ }
+ }
+ else if (mBlockhit == Blocks.carrots || mBlockhit == Blocks.melon_block || mBlockhit == Blocks.pumpkin || mBlockhit == Blocks.potatoes){
+ worldObj.setBlock(i, j+1, h, Blocks.fire);
+ worldObj.setBlock(i, j, h, Blocks.dirt);
+ }
+ else if (mBlockhit == Blocks.air){
+ worldObj.setBlock(i, j, h, Blocks.fire);
+ }
+ }
+ }
+ }
+
+
+ return true;
+ }
+
+
} \ No newline at end of file