Code cleanup
This commit is contained in:
parent
497393bf59
commit
8e99cac6a7
|
|
@ -41,6 +41,8 @@ public class BlockStateCacheHandler {
|
|||
else
|
||||
handleStateCache(state);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void rebuildParallel(boolean force) {
|
||||
/* Run some special sauce for Refined Storage since it has very slow collision shapes */
|
||||
Stopwatch realtimeStopwatch = Stopwatch.createStarted();
|
||||
|
|
|
|||
|
|
@ -10,11 +10,8 @@ import org.embeddedt.modernfix.classloading.ModernFixResourceFinder;
|
|||
import org.embeddedt.modernfix.core.config.ModernFixEarlyConfig;
|
||||
import org.embeddedt.modernfix.core.config.Option;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.spongepowered.asm.mixin.MixinEnvironment;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
||||
import org.spongepowered.asm.mixin.injection.invoke.arg.ArgsClassGenerator;
|
||||
import sun.misc.Unsafe;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
|
@ -32,18 +29,6 @@ public class ModernFixMixinPlugin implements IMixinConfigPlugin {
|
|||
private final Logger logger = LogManager.getLogger("ModernFix");
|
||||
public static ModernFixEarlyConfig config = null;
|
||||
|
||||
private static Unsafe unsafe;
|
||||
|
||||
static{
|
||||
try{
|
||||
final Field unsafeField = Unsafe.class.getDeclaredField("theUnsafe");
|
||||
unsafeField.setAccessible(true);
|
||||
unsafe = (Unsafe) unsafeField.get(null);
|
||||
}catch(Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public ModernFixMixinPlugin() {
|
||||
try {
|
||||
config = ModernFixEarlyConfig.load(new File("./config/modernfix-mixins.properties"));
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import net.minecraft.util.math.shapes.VoxelShape;
|
|||
import org.embeddedt.modernfix.ModernFix;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Mutable;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
|
@ -16,7 +17,9 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
|
||||
@Mixin(ShapeCache.class)
|
||||
public class ShapeCacheMixin {
|
||||
@Shadow private static Map<BlockState, VoxelShape> CACHE;
|
||||
@Final
|
||||
@Mutable
|
||||
@Shadow(remap = false) private static Map<BlockState, VoxelShape> CACHE;
|
||||
|
||||
@Inject(method = "<clinit>", at = @At("TAIL"))
|
||||
private static void useConcurrentMap(CallbackInfo ci) {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import net.minecraftforge.client.model.obj.OBJModel;
|
|||
import org.objectweb.asm.Opcodes;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Mutable;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
|
@ -16,9 +17,13 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
|
||||
@Mixin(OBJLoader.class)
|
||||
public class OBJLoaderMixin {
|
||||
@Shadow private Map<ResourceLocation, MaterialLibrary> materialCache;
|
||||
@Final
|
||||
@Mutable
|
||||
@Shadow(remap = false) private Map<ResourceLocation, MaterialLibrary> materialCache;
|
||||
|
||||
@Shadow private Map<OBJModel.ModelSettings, OBJModel> modelCache;
|
||||
@Final
|
||||
@Mutable
|
||||
@Shadow(remap = false) private Map<OBJModel.ModelSettings, OBJModel> modelCache;
|
||||
|
||||
@Redirect(method = "<init>", at = @At(value = "FIELD", opcode = Opcodes.PUTFIELD, target = "Lnet/minecraftforge/client/model/obj/OBJLoader;materialCache:Ljava/util/Map;", remap = false))
|
||||
private void useConcMap1(OBJLoader instance, Map<ResourceLocation, MaterialLibrary> value) {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
|
||||
@Mixin(Scanner.class)
|
||||
public class ScannerMixin {
|
||||
@Shadow @Final private ModFile fileToScan;
|
||||
@Shadow(remap = false) @Final private ModFile fileToScan;
|
||||
|
||||
@Inject(method = "scan", at = @At(value = "HEAD"), cancellable = true, remap = false)
|
||||
private void useCachedScanResults(CallbackInfoReturnable<ModFileScanData> cir) {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import java.util.concurrent.locks.LockSupport;
|
|||
|
||||
@Mixin(targets = "net/minecraftforge/fml/ModWorkManager$SyncExecutor")
|
||||
public class SyncExecutorMixin {
|
||||
@Shadow private ConcurrentLinkedDeque<Runnable> tasks;
|
||||
@Shadow(remap = false) private ConcurrentLinkedDeque<Runnable> tasks;
|
||||
private static final long PARK_TIME = TimeUnit.MILLISECONDS.toNanos(50);
|
||||
/**
|
||||
* Currently FML spins in driveOne while waiting for the modloading workers. We can improve this
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user