Make BooleanPropertyMixin and UtilMixin more compatible
This commit is contained in:
@@ -4,7 +4,8 @@ import ca.spottedleaf.moonrise.patches.blockstate_propertyaccess.PropertyAccess;
|
||||
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
||||
import net.minecraft.world.level.block.state.properties.Property;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(BooleanProperty.class)
|
||||
abstract class BooleanPropertyMixin extends Property<Boolean> implements PropertyAccess<Boolean> {
|
||||
@@ -13,13 +14,39 @@ abstract class BooleanPropertyMixin extends Property<Boolean> implements Propert
|
||||
}
|
||||
|
||||
/**
|
||||
* This skips all ops after the identity comparison in the original code.
|
||||
*
|
||||
* @reason Properties are identity comparable
|
||||
* @author Spottedleaf
|
||||
*/
|
||||
@Overwrite
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
return this == obj;
|
||||
/*
|
||||
TODO: idk why this isn't working, we'll just redirect the super call for now and deal with the useless instanceof op
|
||||
@WrapOperation(
|
||||
method = "equals",
|
||||
at = @At(
|
||||
value = "CONSTANT",
|
||||
opcode = Opcodes.INSTANCEOF,
|
||||
args = "classValue=net/minecraft/world/level/block/state/properties/BooleanProperty"
|
||||
)
|
||||
)
|
||||
private boolean skipFurtherComparison(final Object obj, final Operation<Boolean> orig) {
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @reason Properties are identity comparable
|
||||
* @author Spottedleaf
|
||||
*/
|
||||
@Redirect(
|
||||
method = "equals",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/level/block/state/properties/Property;equals(Ljava/lang/Object;)Z"
|
||||
)
|
||||
)
|
||||
private boolean skipSuperCheck(final Property instance, final Object object) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package ca.spottedleaf.moonrise.mixin.util_thread_counts;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.util.Mth;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -41,7 +42,7 @@ abstract class UtilMixin {
|
||||
* not lost due to some timeout, as G1GC has some issues cleaning up those.
|
||||
* @author Spottedleaf
|
||||
*/
|
||||
@Redirect(
|
||||
@WrapOperation(
|
||||
method = "makeExecutor",
|
||||
at = @At(
|
||||
value = "NEW",
|
||||
@@ -49,7 +50,8 @@ abstract class UtilMixin {
|
||||
)
|
||||
)
|
||||
private static ForkJoinPool modifyExecutor(final int parallelism, final ForkJoinPool.ForkJoinWorkerThreadFactory factory,
|
||||
final Thread.UncaughtExceptionHandler handler, final boolean asyncMode) {
|
||||
final Thread.UncaughtExceptionHandler handler, final boolean asyncMode,
|
||||
final Operation<ForkJoinPool> original) {
|
||||
final int threads = getThreadCounts(1, getMaxThreads());
|
||||
|
||||
return new ForkJoinPool(threads, factory, handler, asyncMode, 0, Integer.MAX_VALUE, 1, null, 365, TimeUnit.DAYS);
|
||||
|
||||
Reference in New Issue
Block a user