Merge remote-tracking branch 'origin/1.16' into 1.18
This commit is contained in:
commit
896c8d1f5f
|
|
@ -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() {}
|
||||||
|
}
|
||||||
|
|
@ -213,8 +213,8 @@ public class ModernFixEarlyConfig {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Mod compat */
|
/* Mod compat */
|
||||||
disableIfModPresent("mixin.perf.thread_priorities", "smoothboot");
|
disableIfModPresent("mixin.perf.thread_priorities", "smoothboot", "threadtweak");
|
||||||
disableIfModPresent("mixin.perf.boost_worker_count", "smoothboot");
|
disableIfModPresent("mixin.perf.boost_worker_count", "smoothboot", "threadtweak");
|
||||||
disableIfModPresent("mixin.perf.async_jei", "modernui");
|
disableIfModPresent("mixin.perf.async_jei", "modernui");
|
||||||
disableIfModPresent("mixin.perf.compress_biome_container", "chocolate", "betterendforge" ,"skyblockbuilder");
|
disableIfModPresent("mixin.perf.compress_biome_container", "chocolate", "betterendforge" ,"skyblockbuilder");
|
||||||
disableIfModPresent("mixin.bugfix.mc218112", "performant");
|
disableIfModPresent("mixin.bugfix.mc218112", "performant");
|
||||||
|
|
@ -281,7 +281,10 @@ public class ModernFixEarlyConfig {
|
||||||
continue;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,20 @@ public class OptionList extends ContainerObjectSelectionList<OptionList.Entry> {
|
||||||
this.option.setEnabled(!this.option.isEnabled(), !this.option.isUserDefined());
|
this.option.setEnabled(!this.option.isEnabled(), !this.option.isUserDefined());
|
||||||
ModernFix.LOGGER.error("Unable to save config", e);
|
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,
|
||||||
|
new TranslatableComponent("modernfix.option." + (this.option.isEnabled() ? "enabled" : "disabled"))
|
||||||
|
.append(new TranslatableComponent("modernfix.option.mod_override", disablingMods)),
|
||||||
|
x,
|
||||||
|
y
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
if(this.option.isModDefined())
|
||||||
|
this.toggleButton.active = false;
|
||||||
this.helpButton = new Button(75, 0, 20, 20, new TextComponent("?"), (arg) -> {
|
this.helpButton = new Button(75, 0, 20, 20, new TextComponent("?"), (arg) -> {
|
||||||
Minecraft.getInstance().setScreen(new ModernFixOptionInfoScreen(mainScreen, optionName));
|
Minecraft.getInstance().setScreen(new ModernFixOptionInfoScreen(mainScreen, optionName));
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,9 @@
|
||||||
"modernfix.config.done_restart": "Done (restart required)",
|
"modernfix.config.done_restart": "Done (restart required)",
|
||||||
"modernfix.option.on": "on",
|
"modernfix.option.on": "on",
|
||||||
"modernfix.option.off": "off",
|
"modernfix.option.off": "off",
|
||||||
|
"modernfix.option.disabled": "disabled",
|
||||||
|
"modernfix.option.enabled": "enabled",
|
||||||
|
"modernfix.option.mod_override": " by mods [%s]",
|
||||||
"modernfix.config.not_default": " (modified)",
|
"modernfix.config.not_default": " (modified)",
|
||||||
"asynclocator.map.locating": "Map (Locating...)",
|
"asynclocator.map.locating": "Map (Locating...)",
|
||||||
"asynclocator.map.none": "Map (No nearby feature found)",
|
"asynclocator.map.none": "Map (No nearby feature found)",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user