From dd7fffaf3a9fc0fd224df9171175fd2b5fdc5743 Mon Sep 17 00:00:00 2001 From: Runakai1 <48415331+Runakai1@users.noreply.github.com> Date: Tue, 2 Aug 2022 10:11:05 +0200 Subject: Crash fix (#1182) * Crash fix * Added nullcheck So that all gt tools work now --- src/main/java/gregtech/api/util/GT_Utility.java | 4 +++- src/main/java/gregtech/common/tools/GT_Tool_Scoop.java | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index 47d66ff816..a1ad2e317c 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -1431,6 +1431,7 @@ public class GT_Utility { } public static boolean doSoundAtClient(String aSoundName, int aTimeUntilNextSound, float aSoundStrength) { + if (aSoundName == null) return false; return doSoundAtClient(aSoundName, aTimeUntilNextSound, aSoundStrength, GT.getThePlayer()); } @@ -1443,7 +1444,7 @@ public class GT_Utility { } public static boolean doSoundAtClient(String aSoundName, int aTimeUntilNextSound, float aSoundStrength, Entity aEntity) { - if (aEntity == null) return false; + if (aEntity == null || aSoundName == null) return false; return doSoundAtClient(aSoundName, aTimeUntilNextSound, aSoundStrength, aEntity.posX, aEntity.posY, aEntity.posZ); } @@ -1462,6 +1463,7 @@ public class GT_Utility { */ @Deprecated public static boolean doSoundAtClient(String aSoundName, int aTimeUntilNextSound, float aSoundStrength, double aX, double aY, double aZ) { + if (aSoundName == null) return false; return doSoundAtClient(new ResourceLocation(aSoundName), aTimeUntilNextSound, aSoundStrength, 1.01818028F, aX, aY, aZ); } diff --git a/src/main/java/gregtech/common/tools/GT_Tool_Scoop.java b/src/main/java/gregtech/common/tools/GT_Tool_Scoop.java index 674a30548f..64c40c3b2a 100644 --- a/src/main/java/gregtech/common/tools/GT_Tool_Scoop.java +++ b/src/main/java/gregtech/common/tools/GT_Tool_Scoop.java @@ -2,6 +2,7 @@ package gregtech.common.tools; import cpw.mods.fml.common.Loader; import gregtech.api.enums.GT_Values; +import gregtech.api.enums.SoundResource; import gregtech.api.enums.Textures; import gregtech.api.interfaces.IIconContainer; import gregtech.api.items.GT_MetaGenerated_Tool; -- cgit