Skip to content

Commit

Permalink
Band-aid fix bad mods throwing on getAmount()
Browse files Browse the repository at this point in the history
  • Loading branch information
Spottedleaf committed Aug 8, 2024
1 parent 09d9292 commit 2fcae45
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@
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() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -66,7 +66,7 @@ public static void adjustWorkerThreads(final MoonriseConfig.WorkerPool config) {
}

public static final PrioritisedThreadPool IO_POOL = new PrioritisedThreadPool(
new Consumer<Thread>() {
new Consumer<>() {
private final AtomicInteger idGenerator = new AtomicInteger();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ protected FluidStateMixin(Fluid object, Reference2ObjectArrayMap<Property<?>, Co
)
)
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);
Expand Down

0 comments on commit 2fcae45

Please sign in to comment.