Skip to content

Commit

Permalink
Configurable movement packets for Mining Glitch bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Mar 11, 2024
1 parent 001f125 commit 0e4e4ee
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ All changes are toggleable via config files.
* **Locale:** Prevents various crashes with Turkish locale
* **Max Health:** Corrects maximum player health on joining by setting the last saved health value
* **Minecart AI:** Fixes non-player entities being able to control minecarts
* **Mining Glitch:** Avoids the need for multiple mining attempts by sending additional movement packets
* **Mining Glitch:** Prevents ghost blocks by sending additional movement packets
* **Model Gap:** Fixes transparent gaps in all 3D models of blocks and items
* **Mount Desync:** Fixes mounts and boats sometimes disappearing after dismounting
* **Packet Size:** Increases the packet size limit to account for large packets in modded environments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ public class UTPlayerPacketsMixin
@ModifyConstant(method = "processPlayer", constant = @Constant(intValue = 5, ordinal = 0))
private int utModifyMaxPlayerMovementPacketsPerTick(int maxPackets)
{
if (!UTConfigBugfixes.BLOCKS.utMiningGlitchToggle) return maxPackets;
if (!UTConfigBugfixes.BLOCKS.MINING_GLITCH.utMiningGlitchToggle) return maxPackets;
if (UTConfigGeneral.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.debug("UTPlayerPacketsMixin ::: Process player");
if (maxPackets == 5) return 10;
if (maxPackets == 5) return UTConfigBugfixes.BLOCKS.MINING_GLITCH.utMiningGlitchPackets;
else return maxPackets;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class UTPlayerPositionMixin
@Inject(slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;getTutorial()Lnet/minecraft/client/tutorial/Tutorial;", ordinal = 1), to = @At(value = "INVOKE", target = "Lnet/minecraft/block/state/IBlockState;getMaterial()Lnet/minecraft/block/material/Material;", ordinal = 0)), method = "clickBlock", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/NetHandlerPlayClient;sendPacket(Lnet/minecraft/network/Packet;)V", ordinal = 0))
private void utUpdatePlayerPositionBeforeDigging(BlockPos loc, EnumFacing face, CallbackInfoReturnable<Boolean> ci)
{
if (!UTConfigBugfixes.BLOCKS.utMiningGlitchToggle) return;
if (!UTConfigBugfixes.BLOCKS.MINING_GLITCH.utMiningGlitchToggle) return;
if (UTConfigGeneral.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.debug("UTPlayerPositionMixin ::: Update player position");
((IEntityPlayerSP) this.mc.player).updateWalkingPlayer();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public static class BlocksCategory
@Config.Name("Block Overlay")
public final BlockOverlayCategory BLOCK_OVERLAY = new BlockOverlayCategory();

@Config.LangKey("cfg.universaltweaks.tweaks.blocks.miningglitch")
@Config.Name("Mining Glitch")
public final MiningGlitchCategory MINING_GLITCH = new MiningGlitchCategory();

@Config.RequiresMcRestart
@Config.Name("Banner Bounding Box")
@Config.Comment
Expand Down Expand Up @@ -80,11 +84,6 @@ public static class BlocksCategory
@Config.Comment("Disables climbing movement when flying")
public boolean utLadderFlyingToggle = true;

@Config.RequiresMcRestart
@Config.Name("Mining Glitch")
@Config.Comment("Avoids the need for multiple mining attempts by sending additional movement packets")
public boolean utMiningGlitchToggle = true;

@Config.RequiresMcRestart
@Config.Name("Piston Progress")
@Config.Comment("Properly saves the last state of pistons to tags")
Expand Down Expand Up @@ -123,6 +122,22 @@ public static class BlockOverlayCategory
})
public String[] utBlockOverlayWhitelist = new String[] {};
}

public static class MiningGlitchCategory
{
@Config.RequiresMcRestart
@Config.Name("[1] Mining Glitch Toggle")
@Config.Comment("Prevents ghost blocks by sending additional movement packets")
public boolean utMiningGlitchToggle = true;

@Config.Name("[2] Maximum Movement Packets")
@Config.Comment
({
"Defines the maximum number of movement packets that can be sent per tick",
"Vanilla default is 5"
})
public int utMiningGlitchPackets = 10;
}
}

public static class EntitiesCategory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public boolean shouldMixinConfigQueue(String mixinConfig)
case "mixins.bugfixes.blocks.blockoverlay.json":
return UTConfigBugfixes.BLOCKS.BLOCK_OVERLAY.utBlockOverlayToggle;
case "mixins.bugfixes.blocks.miningglitch.client.json":
return UTConfigBugfixes.BLOCKS.utMiningGlitchToggle;
return UTConfigBugfixes.BLOCKS.MINING_GLITCH.utMiningGlitchToggle;
case "mixins.bugfixes.entities.elytra.json":
return UTConfigBugfixes.ENTITIES.utElytraDeploymentLandingToggle;
case "mixins.bugfixes.entities.villagermantle.json":
Expand Down Expand Up @@ -352,7 +352,7 @@ public boolean shouldMixinConfigQueue(String mixinConfig)
case "mixins.bugfixes.blocks.ladderflying.json":
return UTConfigBugfixes.BLOCKS.utLadderFlyingToggle;
case "mixins.bugfixes.blocks.miningglitch.server.json":
return UTConfigBugfixes.BLOCKS.utMiningGlitchToggle;
return UTConfigBugfixes.BLOCKS.MINING_GLITCH.utMiningGlitchToggle;
case "mixins.bugfixes.blocks.piston.tile.json":
return UTConfigBugfixes.BLOCKS.utPistonTileToggle;
case "mixins.bugfixes.blocks.piston.retraction.json":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public static List<String> obsoleteModsMessage()
if (Loader.isModLoaded("pathundergates") && UTConfigTweaks.BLOCKS.utLenientPathsToggle) messages.add("Path Under Gates");
if (Loader.isModLoaded("pickupnotifier") && UTConfigTweaks.MISC.PICKUP_NOTIFICATION.utPickupNotificationToggle) messages.add("Pick Up Notifier");
if (Loader.isModLoaded("portaldupebegone") && UTConfigBugfixes.WORLD.utPortalTravelingDupeToggle) messages.add("PortalDupeBegone");
if (Loader.isModLoaded("preventghost") && UTConfigBugfixes.BLOCKS.utMiningGlitchToggle) messages.add("Prevent Ghost Blocks");
if (Loader.isModLoaded("preventghost") && UTConfigBugfixes.BLOCKS.MINING_GLITCH.utMiningGlitchToggle) messages.add("Prevent Ghost Blocks");
if (Loader.isModLoaded("quickleafdecay") && UTConfigTweaks.BLOCKS.utLeafDecayToggle) messages.add("Quick Leaf Decay");
if (Loader.isModLoaded("rallyhealth") && UTConfigTweaks.ENTITIES.RALLY_HEALTH.utRallyHealthToggle) messages.add("Rally Health");
if (Loader.isModLoaded("salwayseat") && UTConfigTweaks.ITEMS.utAlwaysEatToggle) messages.add("AlwaysEat");
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/universaltweaks/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ cfg.universaltweaks.tweaks.blocks.betterplacement=Better Placement
cfg.universaltweaks.tweaks.blocks.blockdispenser=Block Dispenser
cfg.universaltweaks.tweaks.blocks.breakablebedrock=Breakable Bedrock
cfg.universaltweaks.tweaks.blocks.finitewater=Finite Water
cfg.universaltweaks.tweaks.blocks.miningglitch=Mining Glitch
cfg.universaltweaks.tweaks.blocks.overhaulbeacon=Overhaul Beacon
cfg.universaltweaks.tweaks.blocks.sapling=Sapling Behavior
cfg.universaltweaks.tweaks.entities.attributes=Attributes
Expand Down

0 comments on commit 0e4e4ee

Please sign in to comment.