Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package dev.isxander.debugify.client;

import dev.isxander.debugify.Debugify;
import dev.isxander.debugify.client.utils.ClientUtils;

public class DebugifyClient {
public static void onInitializeClient() {
Debugify.inMultiplayerWorld = ClientUtils::isInMultiplayerWorld;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package dev.isxander.debugify.client.helpers.mc251068;

public class LastWorldDeleted {
private static boolean marked = false;

public static void mark() {
marked = true;
}

public static boolean consume() {
boolean wasMarked = marked;
marked = false;
return wasMarked;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package dev.isxander.debugify.client.mixins.basic.mc251068;

import dev.isxander.debugify.client.helpers.mc251068.LastWorldDeleted;
import dev.isxander.debugify.fixes.BugFix;
import dev.isxander.debugify.fixes.FixCategory;
import net.minecraft.client.gui.screens.worldselection.WorldSelectionList;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@BugFix(id = "MC-251068", category = FixCategory.BASIC, env = BugFix.Env.CLIENT, description = "If you delete your only world, then you are no longer automatically thrown into the menu of creating a new world")
@Mixin(WorldSelectionList.WorldListEntry.class)
public abstract class WorldListEntryMixin {
@Shadow
@Final
private WorldSelectionList list;

@Inject(method = "doDeleteWorld", at = @At("TAIL"))
private void markLastWorldDeleted(CallbackInfo ci) {
if (this.list.children().size() <= 1) {
LastWorldDeleted.mark();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package dev.isxander.debugify.client.mixins.basic.mc251068;

import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import dev.isxander.debugify.client.helpers.mc251068.LastWorldDeleted;
import dev.isxander.debugify.fixes.BugFix;
import dev.isxander.debugify.fixes.FixCategory;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.ObjectSelectionList;
import net.minecraft.client.gui.screens.ConfirmScreen;
import net.minecraft.client.gui.screens.ProgressScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.worldselection.CreateWorldScreen;
import net.minecraft.client.gui.screens.worldselection.WorldSelectionList;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -17,13 +17,20 @@
@BugFix(id = "MC-251068", category = FixCategory.BASIC, env = BugFix.Env.CLIENT, description = "If you delete your only world, then you are no longer automatically thrown into the menu of creating a new world")
@Mixin(WorldSelectionList.class)
public abstract class WorldSelectionListMixin extends ObjectSelectionList<WorldSelectionList.Entry> {
@Shadow
@Final
WorldSelectionList.EntryType entryType;

public WorldSelectionListMixin(Minecraft minecraft, int i, int j, int k, int l) {
super(minecraft, i, j, k, l);
}

@WrapWithCondition(method = "returnToScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;setScreen(Lnet/minecraft/client/gui/screens/Screen;)V"))
private boolean dontShowEmptyWorldList(Minecraft instance, Screen screen) {
return (this.minecraft.screen instanceof ProgressScreen || this.minecraft.screen instanceof ConfirmScreen);
if (!LastWorldDeleted.consume() || this.entryType != WorldSelectionList.EntryType.SINGLEPLAYER)
return true;

CreateWorldScreen.openFresh(this.minecraft, () -> this.minecraft.setScreen(null));
return false;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.isxander.debugify.client.mixins.gameplay.mc231097;

import dev.isxander.debugify.Debugify;
import dev.isxander.debugify.fixes.BugFix;
import dev.isxander.debugify.fixes.FixCategory;
import net.minecraft.client.Minecraft;
Expand All @@ -20,7 +21,7 @@ public abstract class LocalPlayerMixin {

@Inject(method = "drop", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/player/Inventory;removeFromSelected(Z)Lnet/minecraft/world/item/ItemStack;", shift = At.Shift.AFTER))
private void onDropItem(boolean entireStack, CallbackInfoReturnable<Boolean> cir) {
if (isUsingItem()) {
if (isUsingItem() && Debugify.isGameplayFixesEnabled()) {
minecraft.gameMode.releaseUsingItem((LocalPlayer) (Object) this);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/client/resources/debugify.client.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"basic.mc237493.TelemetryInfoScreenMixin",
"basic.mc242809.DirectJoinServerScreenMixin",
"basic.mc242809.ManageServerScreenMixin",
"basic.mc251068.WorldListEntryMixin",
"basic.mc251068.WorldSelectionListMixin",
"basic.mc263865.KeyboardHandlerMixin",
"basic.mc267376.GameRendererMixin",
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/dev/isxander/debugify/Debugify.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import java.util.List;
import java.util.Map;
import java.util.function.BooleanSupplier;

public class Debugify {
public static final Logger LOGGER = LoggerFactory.getLogger("Debugify");
Expand Down Expand Up @@ -41,7 +42,9 @@ public static BugFix.Env getEnv() {
return FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT ? BugFix.Env.CLIENT : BugFix.Env.SERVER;
}

public static BooleanSupplier inMultiplayerWorld = () -> false;

public static boolean isGameplayFixesEnabled() {
return Debugify.CONFIG.gameplayFixesInMultiplayer;
return !inMultiplayerWorld.getAsBoolean() || Debugify.CONFIG.gameplayFixesInMultiplayer;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.llamalad7.mixinextras.expression.Definition;
import com.llamalad7.mixinextras.expression.Expression;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import dev.isxander.debugify.Debugify;
import dev.isxander.debugify.fixes.BugFix;
import dev.isxander.debugify.fixes.FixCategory;
import net.minecraft.world.entity.LivingEntity;
Expand All @@ -21,6 +22,6 @@ public abstract class LivingEntityMixin{
@Expression("this.getAttributeValue(WATER_MOVEMENT_EFFICIENCY)")
@ModifyExpressionValue(method = "travelInWater", at = @At("MIXINEXTRAS:EXPRESSION"))
private double checkRiptide(double original) {
return this.isAutoSpinAttack() ? 0 : original;
return this.isAutoSpinAttack() && Debugify.isGameplayFixesEnabled() ? 0 : original;
}
}
1 change: 1 addition & 0 deletions src/main/resources/assets/debugify/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"debugify.fix_explanation.mc-132878": "Spawns breaking particles when armour stands are hurt.",
"debugify.fix_explanation.mc-134110": "Correctly rotates double chests when a structure that is mirrored is placed.",
"debugify.fix_explanation.mc-135971": "Overrides CTRL+Q behaviour in crafting slot to repeatedly CTRL+Q until there are no items left in the crafting slot.",
"debugify.fix_explanation.mc-136249": "Ignores the water movement efficiency attribute (granted by depth strider) while the player is riptide spin attacking.",
"debugify.fix_explanation.mc-155509": "Checks if the pufferfish is alive before attempting to sting the player.",
"debugify.fix_explanation.mc-159283": "Casts 32-bit integers to 64-bit equivalents to prevent integer overflow at high X and Z values.",
"debugify.fix_effect.mc-159283": "Affects world generation.",
Expand Down