aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorくぁーりぃ <39122497+Quarri6343@users.noreply.github.com>2022-09-09 18:36:31 +0900
committerGitHub <noreply@github.com>2022-09-09 11:36:31 +0200
commitbab4770748defcaf093af1cce44656c829d4e78f (patch)
tree297c8c0b76e739e52cabf1b928363a00724d249d
parentc7f9ac2f9300278d829524b16f893bd775cfda24 (diff)
downloadGT5-Unofficial-bab4770748defcaf093af1cce44656c829d4e78f.tar.gz
GT5-Unofficial-bab4770748defcaf093af1cce44656c829d4e78f.tar.bz2
GT5-Unofficial-bab4770748defcaf093af1cce44656c829d4e78f.zip
fix chainsaw spawns water when harvests ice (#1358)
-rw-r--r--src/main/java/gregtech/common/tools/GT_Tool_Chainsaw_LV.java14
-rw-r--r--src/main/java/gregtech/common/tools/GT_Tool_Saw.java14
2 files changed, 26 insertions, 2 deletions
diff --git a/src/main/java/gregtech/common/tools/GT_Tool_Chainsaw_LV.java b/src/main/java/gregtech/common/tools/GT_Tool_Chainsaw_LV.java
index f0b26eb913..83825c9fee 100644
--- a/src/main/java/gregtech/common/tools/GT_Tool_Chainsaw_LV.java
+++ b/src/main/java/gregtech/common/tools/GT_Tool_Chainsaw_LV.java
@@ -11,6 +11,7 @@ import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
+import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
@@ -128,8 +129,19 @@ public class GT_Tool_Chainsaw_LV extends GT_Tool_Saw {
} else if (((aBlock.getMaterial() == Material.ice) || (aBlock.getMaterial() == Material.packedIce))
&& (aDrops.isEmpty())) {
aDrops.add(new ItemStack(aBlock, 1, aMetaData));
- aPlayer.worldObj.setBlockToAir(aX, aY, aZ);
aEvent.dropChance = 1.0F;
+ EntityCreature iceBreaker = new EntityCreature(aPlayer.worldObj) {
+ @Override
+ public void onUpdate() {
+ aPlayer.worldObj.setBlockToAir(aX, aY, aZ);
+ setDead();
+ }
+ };
+ iceBreaker.forceSpawn = true;
+ iceBreaker.posX = aX;
+ iceBreaker.posY = aY;
+ iceBreaker.posZ = aZ;
+ aPlayer.worldObj.spawnEntityInWorld(iceBreaker);
return 1;
}
if ((GregTech_API.sTimber)
diff --git a/src/main/java/gregtech/common/tools/GT_Tool_Saw.java b/src/main/java/gregtech/common/tools/GT_Tool_Saw.java
index 881ed6f61f..e646d88b34 100644
--- a/src/main/java/gregtech/common/tools/GT_Tool_Saw.java
+++ b/src/main/java/gregtech/common/tools/GT_Tool_Saw.java
@@ -8,6 +8,7 @@ import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
+import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
@@ -100,8 +101,19 @@ public class GT_Tool_Saw extends GT_Tool {
} else if (((aBlock.getMaterial() == Material.ice) || (aBlock.getMaterial() == Material.packedIce))
&& (aDrops.isEmpty())) {
aDrops.add(new ItemStack(aBlock, 1, aMetaData));
- aPlayer.worldObj.setBlockToAir(aX, aY, aZ);
aEvent.dropChance = 1.0F;
+ EntityCreature iceBreaker = new EntityCreature(aPlayer.worldObj) {
+ @Override
+ public void onUpdate() {
+ aPlayer.worldObj.setBlockToAir(aX, aY, aZ);
+ setDead();
+ }
+ };
+ iceBreaker.forceSpawn = true;
+ iceBreaker.posX = aX;
+ iceBreaker.posY = aY;
+ iceBreaker.posZ = aZ;
+ aPlayer.worldObj.spawnEntityInWorld(iceBreaker);
return 1;
}
return 0;