Band-aid fix bad mods throwing on getAmount()

https://github.com/JDKDigital/productivetrees/issues/16
This commit is contained in:
Spottedleaf
2024-08-08 16:49:59 -07:00
parent 09d9292f90
commit 2fcae456b9
3 changed files with 9 additions and 8 deletions

View File

@@ -5,15 +5,11 @@ import me.shedaniel.clothconfig2.api.ConfigCategory;
import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
import me.shedaniel.clothconfig2.impl.builders.AbstractFieldBuilder;
import net.minecraft.network.chat.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
public final class ConfigWalker<T> {
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigWalker.class);
public final class ConfigWalker {
private ConfigWalker() {}

View File

@@ -18,7 +18,7 @@ public final class MoonriseCommon {
private static final Logger LOGGER = LoggerFactory.getLogger(MoonriseCommon.class);
public static final PrioritisedThreadPool WORKER_POOL = new PrioritisedThreadPool(
new Consumer<Thread>() {
new Consumer<>() {
private final AtomicInteger idGenerator = new AtomicInteger();
@Override
@@ -66,7 +66,7 @@ public final class MoonriseCommon {
}
public static final PrioritisedThreadPool IO_POOL = new PrioritisedThreadPool(
new Consumer<Thread>() {
new Consumer<>() {
private final AtomicInteger idGenerator = new AtomicInteger();
@Override

View File

@@ -54,7 +54,12 @@ abstract class FluidStateMixin extends StateHolder<Fluid, FluidState> {
)
)
private void init(final CallbackInfo ci) {
this.amount = this.getType().getAmount((FluidState)(Object)this);
try {
this.amount = this.getType().getAmount((FluidState)(Object)this);
} catch (final Exception ex) {
// https://github.com/JDKDigital/productivetrees/issues/16
new RuntimeException("Failed to retrieve fluid amount for " + this, ex).printStackTrace();
}
this.isEmpty = this.getType().isEmpty();
this.isSource = this.getType().isSource((FluidState)(Object)this);
this.ownHeight = this.getType().getOwnHeight((FluidState)(Object)this);