Compare commits

...
Author SHA1 Message Date
Martin Robertz c38bc1857d update 2025-07-08 12:47:45 +02:00
slprime 594642672c Disable play sound when crafting with gt tools 2025-07-08 11:52:19 +03:00
5 changed files with 29 additions and 1 deletions

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@
dependencies {
api('com.github.GTNewHorizons:CodeChickenCore:1.4.3:dev')
implementation('com.github.GTNewHorizons:GTNHLib:0.6.32:dev')
implementation('com.github.GTNewHorizons:GTNHLib:0.6.36:dev')
shadowImplementation('org.apache.commons:commons-csv:1.10.0')
@@ -24,4 +24,6 @@ public interface IStackStringifyHandler {
return null;
}
default void playItemDamageSound(boolean enabled) {}
}
@@ -32,6 +32,8 @@ public class AutoCraftingManager {
boolean processed = false;
boolean changed = false;
StackInfo.playItemDamageSound(false);
do {
changed = false;
@@ -68,6 +70,8 @@ public class AutoCraftingManager {
} while (changed && !interrupted(guiContainer));
StackInfo.playItemDamageSound(true);
if (processed && !changed && !interrupted(guiContainer)) {
NEIClientUtils.playClickSound();
}
@@ -84,6 +84,12 @@ public class StackInfo {
return result;
}
public static void playItemDamageSound(boolean enabled) {
for (IStackStringifyHandler handler : stackStringifyHandlers) {
handler.playItemDamageSound(enabled);
}
}
public static ItemStack withAmount(ItemStack stack, long customCount) {
if (stack == null) return null;
final NBTTagCompound nbTag = StackInfo.itemStackToNBT(stack);
@@ -1,5 +1,6 @@
package codechicken.nei.recipe.stackinfo;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Optional;
@@ -22,6 +23,7 @@ public class GTFluidStackStringifyHandler implements IStackStringifyHandler {
public static boolean replaceAE2FCFluidDrop = false;
private static Class<?> gtMetaGeneratedTool = null;
private static Method getContainerItem = null;
private static Field playSound = null;
static {
try {
@@ -40,6 +42,9 @@ public class GTFluidStackStringifyHandler implements IStackStringifyHandler {
getContainerItem = gtMetaGeneratedTool
.getDeclaredMethod("getContainerItem", ItemStack.class, boolean.class, boolean.class);
getContainerItem.setAccessible(true);
playSound = gtMetaGeneratedTool.getDeclaredField("playSound");
playSound.setAccessible(true);
} catch (Exception ignored) {
/* Do nothing */
}
@@ -125,4 +130,15 @@ public class GTFluidStackStringifyHandler implements IStackStringifyHandler {
return null;
}
@Override
public void playItemDamageSound(boolean enabled) {
if (playSound != null) {
try {
playSound.setBoolean(null, enabled);
} catch (Exception e) {}
}
}
}