Skip to content

Commit

Permalink
Separating WthitUtil by version
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendrix-Shen committed Jul 21, 2022
1 parent e2154df commit ae054ea
Show file tree
Hide file tree
Showing 10 changed files with 573 additions and 342 deletions.
6 changes: 3 additions & 3 deletions common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ dependencies {
modImplementation("curse.maven:litematica-308892:${project.litematica_version}")
}
if (mcVersion >= 11600) {
modImplementation("curse.maven:wthit-440979:${project.wthit_version}")
modCompileOnly("curse.maven:wthit-440979:${project.wthit_version}")
if (mcVersion >= 11800) {
modImplementation("curse.maven:badpackets-615134:${project.badpackets_version}")
modCompileOnly("curse.maven:badpackets-615134:${project.badpackets_version}")
}
}

if (mcVersion < 11600) {
modImplementation("curse.maven:hwyla-253449:${project.hwyla_version}")
modCompileOnly("curse.maven:hwyla-253449:${project.hwyla_version}")
}

runtimeOnly(project(path: ":fabricWrapper"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@
import top.hendrixshen.magiclib.dependency.annotation.Dependencies;
import top.hendrixshen.magiclib.dependency.annotation.Dependency;
import top.hendrixshen.tweakmyclient.config.Configs;
import top.hendrixshen.tweakmyclient.util.WthitUtil;
//#if MC >= 11900
import top.hendrixshen.tweakmyclient.util.wthit.WthitUtil_1_19;
//#elseif MC >= 11800
//$$ import top.hendrixshen.tweakmyclient.util.wthit.WthitUtil_1_18;
//#else
//$$ import top.hendrixshen.tweakmyclient.util.wthit.WthitUtil_1_17;
//#endif

@Dependencies(and = @Dependency(value = "wthit"))
//#endif
Expand All @@ -36,7 +42,14 @@ public class MixinClientTickHandler {
cancellable = true
)
private static void onTick(CallbackInfo ci) {
if(Configs.litematicaSchematicWAILACompat && WthitUtil.shouldDisableWthitRender()) {
if(Configs.litematicaSchematicWAILACompat &&
//#if MC >= 11900
WthitUtil_1_19.shouldDisableWthitRender()) {
//#elseif MC >= 11800
//$$ WthitUtil_1_18.shouldDisableWthitRender()) {
//#else
//$$ WthitUtil_1_17.shouldDisableWthitRender()) {
//#endif
ci.cancel();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@
import top.hendrixshen.magiclib.dependency.annotation.Dependencies;
import top.hendrixshen.magiclib.dependency.annotation.Dependency;
import top.hendrixshen.tweakmyclient.config.Configs;
//#if MC < 11600
//$$ import top.hendrixshen.tweakmyclient.util.HwylaUtil;
//#if MC >= 11900
import top.hendrixshen.tweakmyclient.util.wthit.WthitUtil_1_19;
//#elseif MC >= 11800
//$$ import top.hendrixshen.tweakmyclient.util.wthit.WthitUtil_1_18;
//#elseif MC >= 11700
//$$ import top.hendrixshen.tweakmyclient.util.wthit.WthitUtil_1_17;
//#elseif MC >= 11600
//$$ import top.hendrixshen.tweakmyclient.util.wthit.WthitUtil_1_16;
//#else
import top.hendrixshen.tweakmyclient.util.WthitUtil;
//$$ import top.hendrixshen.tweakmyclient.util.HwylaUtil;
//#endif

@Dependencies(or = {@Dependency(value = "waila"), @Dependency(value = "wthit")})
Expand All @@ -25,8 +31,14 @@ public abstract class MixinLocalPlayer {
)
private void onTick(CallbackInfo ci) {
if (Configs.litematicaSchematicWAILACompat) {
//#if MC >= 11600
WthitUtil.tick();
//#if MC >= 11900
WthitUtil_1_19.tick();
//#elseif MC >= 11800
//$$ WthitUtil_1_18.tick();
//#elseif MC >= 11700
//$$ WthitUtil_1_17.tick();
//#elseif MC >= 11600
//$$ WthitUtil_1_16.tick();
//#else
//$$ HwylaUtil.tick();
//#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class MixinOverlayRenderer {
//$$ ),
//$$ index = 2
//$$ )
//$$ private static ItemStack pr(ItemStack stack) {
//$$ private static ItemStack onrenderOverlay(ItemStack stack) {
//$$ return HwylaUtil.shouldDisableWthitRender() ? DataAccessor.INSTANCE.stack : stack;
//$$ }
//#endif
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,27 @@
package top.hendrixshen.tweakmyclient.mixin.patch.litematicaSchematicWAILACompat;

//#if MC >= 11600
//#if MC < 11700
//#if MC >= 11600 && MC < 11700
//$$ import mcp.mobius.waila.overlay.TickHandler;
//#else
import net.minecraft.client.Minecraft;
//#endif
//#else
//$$ import net.minecraft.client.Minecraft;
//#endif
import org.spongepowered.asm.mixin.Mixin;
//#if MC >= 11600
//#if MC < 11700
//$$ import org.spongepowered.asm.mixin.injection.At;
//$$ import org.spongepowered.asm.mixin.injection.Inject;
//$$ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
//$$ import top.hendrixshen.magiclib.dependency.annotation.Dependencies;
//$$ import top.hendrixshen.magiclib.dependency.annotation.Dependency;
//$$ import top.hendrixshen.tweakmyclient.config.Configs;
//$$ import top.hendrixshen.tweakmyclient.util.WthitUtil;
//$$
//$$ import top.hendrixshen.tweakmyclient.util.wthit.WthitUtil_1_16;
//#else
import net.minecraft.client.Minecraft;
//#endif
import org.spongepowered.asm.mixin.Mixin;

//#if MC >= 11600 && MC < 11700
//$$ @Dependencies(and = @Dependency(value = "wthit"))
//$$ @Mixin(value = TickHandler.class,remap = false)
//#else
@Mixin(Minecraft.class)
//#endif
//#else
//$$ @Mixin(Minecraft.class)
//#endif
public class MixinTickHandler {
//#if MC >= 11600
//#if MC < 11700
//#if MC >= 11600 && MC < 11700
//$$ @Inject(
//$$ method = "tickClient",
//$$ at = @At(
Expand All @@ -39,10 +30,9 @@ public class MixinTickHandler {
//$$ cancellable = true
//$$ )
//$$ private static void onTick(CallbackInfo ci) {
//$$ if(Configs.litematicaSchematicWAILACompat && WthitUtil.shouldDisableWthitRender()) {
//$$ if(Configs.litematicaSchematicWAILACompat && WthitUtil_1_16.shouldDisableWthitRender()) {
//$$ ci.cancel();
//$$ }
//$$ }
//#endif
//#endif
}
Loading

0 comments on commit ae054ea

Please sign in to comment.