make MFQM way faster to load

This commit is contained in:
FalsePattern committed 2022-07-23 00:36:58 +02:00
1 parent c00c54e686
commit 356a980bc7
1 file changed
+16
@@ -3,9 +3,15 @@ package com.falsepattern.endlessids.mixin.mixins.common.mfqm;
import MoreFunQuicksandMod.main.MFQM;
import com.falsepattern.endlessids.constants.ExtendedConstants;
import com.falsepattern.endlessids.constants.VanillaConstants;
import lombok.val;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import org.spongepowered.asm.mixin.injection.Redirect;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
@Mixin(value = MFQM.class,
remap = false)
@@ -25,4 +31,14 @@ public abstract class MFQMMixin {
private int extendIDs(int constant) {
return ExtendedConstants.maxBlockID;
}
@Redirect(method = "postInit",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/block/Block;getBlockById(I)Lnet/minecraft/block/Block;",
remap = true),
require = 1)
private Block getBlockByIDNullable(int id) {
val block = Block.getBlockById(id);
return block == Blocks.air ? null : block;
}
}