-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed minor Issues and added LiveOverflow Bypass button
- Loading branch information
Showing
11 changed files
with
122 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 12 additions & 6 deletions
18
src/main/java/net/wubz/wubzmod/mixin/PlayerC2SPacketPositionAndOnGroundMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,26 @@ | ||
/* | ||
* This solution was provided by LynJuice | ||
*/ | ||
package net.wubz.wubzmod.mixin; | ||
|
||
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; | ||
import net.wubz.wubzmod.WubzMod; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyArgs; | ||
import org.spongepowered.asm.mixin.injection.invoke.arg.Args; | ||
|
||
@Mixin(PlayerMoveC2SPacket.PositionAndOnGround.class) | ||
public class PlayerC2SPacketPositionAndOnGroundMixin { | ||
private static double roundCoordinate(double n) { | ||
n = Math.round(n * 100) / 100d; | ||
return Math.nextAfter(n, n + Math.signum(n)); | ||
} | ||
@ModifyArgs(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/c2s/play/PlayerMoveC2SPacket;<init>(DDDFFZZZ)V")) | ||
private static void init(Args args) { | ||
args.set(0, roundCoordinate(args.get(0))); // Round x | ||
args.set(2, roundCoordinate(args.get(2))); // Round z | ||
} | ||
private static double roundCoordinate(double n) { | ||
n = Math.round(n * 100) / 100d; // Round to 1/100th | ||
return Math.nextAfter(n, n + Math.signum(n)); // Fix floating point errors | ||
if(WubzMod.LiveOverflowBypass) { | ||
args.set(0, roundCoordinate(args.get(0))); | ||
args.set(2, roundCoordinate(args.get(2))); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/main/java/net/wubz/wubzmod/mixin/TitleScreenMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package net.wubz.wubzmod.mixin; | ||
|
||
import net.minecraft.client.gui.screen.Screen; | ||
import net.minecraft.client.gui.screen.TitleScreen; | ||
import net.minecraft.client.gui.screen.world.SelectWorldScreen; | ||
import net.minecraft.client.gui.widget.ButtonWidget; | ||
import net.minecraft.text.MutableText; | ||
import net.minecraft.text.Text; | ||
import net.wubz.wubzmod.WubzMod; | ||
import net.wubz.wubzmod.gui.ModOptions; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(TitleScreen.class) | ||
public abstract class TitleScreenMixin extends Screen { | ||
|
||
protected TitleScreenMixin(Text title) { super(title); } | ||
|
||
MutableText ModText(boolean modEnabled,String modName) { | ||
if(modEnabled) | ||
return Text.translatable(modName + " \u00a7aEnabled"); | ||
else | ||
return Text.translatable(modName + " \u00a7cDisabled"); | ||
} | ||
|
||
@Inject(at = @At("HEAD"), method = "initWidgetsNormal(II)V") | ||
private void onInitWigets(int y, int spacingY, CallbackInfo ci){ | ||
this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, y + spacingY * 5 - 10, 200, 20, ModText(WubzMod.LiveOverflowBypass, "LiveOverflow Bypass:"), (button) -> { | ||
WubzMod.LiveOverflowBypass = !WubzMod.LiveOverflowBypass; | ||
button.setMessage(ModText(WubzMod.LiveOverflowBypass, "LiveOverflow Bypass:")); | ||
})); | ||
} | ||
} |
17 changes: 13 additions & 4 deletions
17
src/main/java/net/wubz/wubzmod/mixin/WorldBorderInitializeS2CPacketMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
package net.wubz.wubzmod.mixin; | ||
|
||
import net.minecraft.network.listener.ClientPlayPacketListener; | ||
import net.minecraft.network.packet.s2c.play.GameStateChangeS2CPacket; | ||
import net.minecraft.network.packet.s2c.play.WorldBorderInitializeS2CPacket; | ||
import net.wubz.wubzmod.WubzMod; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Overwrite; | ||
|
||
@Mixin(WorldBorderInitializeS2CPacket.class) | ||
public class WorldBorderInitializeS2CPacketMixin { | ||
/** | ||
* @author | ||
* Wubz (dkonis) | ||
* @reason | ||
* Bypassing LiveOverflow's border by not applying | ||
* the WorldBorderInitialize Packet | ||
*/ | ||
@Overwrite | ||
public void apply(ClientPlayPacketListener clientPlayPacketListener) { | ||
/** | ||
* Bypassing LiveOverflow's border by not applying | ||
* the WorldBorderInitialize Packet | ||
*/ | ||
WorldBorderInitializeS2CPacket packet = (WorldBorderInitializeS2CPacket) (Object) this; | ||
if(!WubzMod.LiveOverflowBypass){ | ||
clientPlayPacketListener.onWorldBorderInitialize(packet); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters