Merge remote-tracking branch 'origin/1.18' into 1.19.2

This commit is contained in:
embeddedt 2023-07-11 21:17:59 -04:00
commit 406a4a3a91
No known key found for this signature in database
GPG Key ID: A69433EC199B5613
4 changed files with 62 additions and 3 deletions

View File

@ -0,0 +1,40 @@
package org.embeddedt.modernfix.common.mixin.bugfix.item_cache_flag;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
/**
* Remove emptyCacheFlag from ItemStack, as Mojang did in 1.20 due to <a href="https://bugs.mojang.com/browse/MC-258939">MC-258939</a>.
*/
@Mixin(ItemStack.class)
public class ItemStackMixin {
@Shadow @Final @Deprecated private Item item;
/**
* @author embeddedt, Mojang
* @reason avoid getItem()
*/
@Redirect(method = "isEmpty", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;getItem()Lnet/minecraft/world/item/Item;"))
private Item getItemDirect(ItemStack stack) {
return this.item;
}
@Redirect(method = "*", at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/world/item/ItemStack;emptyCacheFlag:Z"))
private boolean checkEmptyDirect(ItemStack stack) {
return stack.isEmpty();
}
/**
* @author embeddedt, Mojang
* @reason flag is no longer used
*/
@Overwrite
private void updateEmptyCacheFlag() {}
}

View File

@ -213,8 +213,8 @@ public class ModernFixEarlyConfig {
*/
/* Mod compat */
disableIfModPresent("mixin.perf.thread_priorities", "smoothboot");
disableIfModPresent("mixin.perf.boost_worker_count", "smoothboot");
disableIfModPresent("mixin.perf.thread_priorities", "smoothboot", "threadtweak");
disableIfModPresent("mixin.perf.boost_worker_count", "smoothboot", "threadtweak");
disableIfModPresent("mixin.perf.async_jei", "modernui");
disableIfModPresent("mixin.perf.compress_biome_container", "chocolate", "betterendforge" ,"skyblockbuilder");
disableIfModPresent("mixin.bugfix.mc218112", "performant");
@ -281,7 +281,10 @@ public class ModernFixEarlyConfig {
continue;
}
option.setEnabled(enabled, true);
if(!option.isModDefined())
option.setEnabled(enabled, true);
else
LOGGER.warn("Option '{}' already disabled by a mod. Ignoring user configuration", key);
}
}

View File

@ -137,7 +137,20 @@ public class OptionList extends ContainerObjectSelectionList<OptionList.Entry> {
this.option.setEnabled(!this.option.isEnabled(), !this.option.isUserDefined());
ModernFix.LOGGER.error("Unable to save config", e);
}
}, (btn, gfx, x, y) -> {
if(this.option.isModDefined()) {
String disablingMods = String.join(", ", this.option.getDefiningMods());
OptionList.this.mainScreen.renderTooltip(
gfx,
Component.translatable("modernfix.option." + (this.option.isEnabled() ? "enabled" : "disabled"))
.append(Component.translatable("modernfix.option.mod_override", disablingMods)),
x,
y
);
}
});
if(this.option.isModDefined())
this.toggleButton.active = false;
this.helpButton = new Button(75, 0, 20, 20, Component.literal("?"), (arg) -> {
Minecraft.getInstance().setScreen(new ModernFixOptionInfoScreen(mainScreen, optionName));
});

View File

@ -9,6 +9,9 @@
"modernfix.config.done_restart": "Done (restart required)",
"modernfix.option.on": "on",
"modernfix.option.off": "off",
"modernfix.option.disabled": "disabled",
"modernfix.option.enabled": "enabled",
"modernfix.option.mod_override": " by mods [%s]",
"modernfix.config.not_default": " (modified)",
"asynclocator.map.locating": "Map (Locating...)",
"asynclocator.map.none": "Map (No nearby feature found)",