Skip to content
Closed
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
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ org.gradle.jvmargs=-Xmx2G

# Mod properties
mod_id=modernfix
version=5.27.5-build.3
version=5.27.7-build.1

# Minecraft/Fabric
minecraft_version=26.2-snapshot-5
loader_version=0.19.2
minecraft_version=26.1.2
loader_version=0.18.6
loom_version=1.16-SNAPSHOT

# Fabric API
fabric_api_version=0.147.1+26.2
fabric_api_version=0.145.4+26.1.2

# Dependencies
mixinextras_version=0.4.1
modmenu_version=18.0.0-alpha.8
modmenu_version=18.0.0-alpha.5

# For mod sites
supported_minecraft_versions=~26.2-
supported_minecraft_versions=~26.1-

# Build
shadow_version=8.1.1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class WorldSelectionListMixin {

@Inject(method = "*", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/worldselection/WorldSelectionList$WorldListEntry;doDeleteWorld()V", ordinal = 0, shift = At.Shift.AFTER), cancellable = true)
private void preventClosingCreateScreenAfterDelete(CallbackInfo ci) {
if(minecraft.gui.screen() instanceof CreateWorldScreen)
if(minecraft.screen instanceof CreateWorldScreen)
ci.cancel();
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.embeddedt.modernfix.common.mixin.feature.measure_time;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.screens.Overlay;
import org.embeddedt.modernfix.ModernFixClient;
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
import org.spongepowered.asm.mixin.Final;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -16,11 +16,11 @@
@ClientOnlyMixin
public class MinecraftMixin {
// TODO re-add datapack reload time measurement
@Shadow @Final public Gui gui;
@Shadow @Nullable public Overlay overlay;

@Inject(method = "tick", at = @At("HEAD"))
private void onClientTick(CallbackInfo ci) {
if(this.gui.overlay() == null && ModernFixClient.INSTANCE != null) {
if(this.overlay == null && ModernFixClient.INSTANCE != null) {
ModernFixClient.INSTANCE.onGameLaunchFinish();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,14 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;

import java.util.function.Function;

// Update the file when embeddedt patches this file for 26.2 in the neoforge version to keep it conisitent with the upstream changes.
import java.util.function.Supplier;

@Mixin(targets = {"net/minecraft/world/level/levelgen/SurfaceRules$Context"}, priority = 100)
public class SurfaceRulesContextMixin {
@Shadow private long lastUpdateY;

@Shadow private int blockX;

@Shadow private int blockZ;

@Shadow private int blockY;

@Shadow private int waterHeight;
Expand All @@ -30,53 +24,27 @@ public class SurfaceRulesContextMixin {

@Shadow private int stoneDepthAbove;

@Shadow private Holder<Biome> biome;
@Shadow private Supplier<Holder<Biome>> biome;

@Shadow @Final private Function<BlockPos, Holder<Biome>> biomeGetter;

@Shadow @Final private BlockPos.MutableBlockPos pos;

@Unique
private PositionalBiomeGetter modernfix$biomeCache;

/**
* @author embeddedt
* @reason Keep a reusable biome cache helper instead of rebuilding intermediate state
* @reason Reuse supplier object instead of creating new ones every time
*/
@Overwrite
protected void updateY(int stoneDepthAbove, int stoneDepthBelow, int waterHeight, int blockY) {
public void updateY(int stoneDepthAbove, int stoneDepthBelow, int waterHeight, int blockX, int blockY, int blockZ) {
++this.lastUpdateY;

var getter = this.modernfix$biomeCache;
var getter = this.biome;
if(getter == null) {
this.modernfix$biomeCache = getter = new PositionalBiomeGetter(this.biomeGetter, this.pos);
this.biome = getter = new PositionalBiomeGetter(this.biomeGetter, this.pos);
}

getter.update(this.blockX, blockY, this.blockZ);
this.biome = null;
((PositionalBiomeGetter)getter).update(blockX, blockY, blockZ);
this.blockY = blockY;
this.waterHeight = waterHeight;
this.stoneDepthBelow = stoneDepthBelow;
this.stoneDepthAbove = stoneDepthAbove;
}

/**
* @author coredex
* @reason Reuse a single positional getter object for biome lookups
*/
@Overwrite
protected Holder<Biome> getBiome() {
var biome = this.biome;
if(biome == null) {
var getter = this.modernfix$biomeCache;
if(getter == null) {
this.modernfix$biomeCache = getter = new PositionalBiomeGetter(this.biomeGetter, this.pos);
}

getter.update(this.blockX, this.blockY, this.blockZ);
this.biome = biome = getter.get();
}

return biome;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -186,28 +186,19 @@ public DefaultSettingMapBuilder put(String key, Boolean value) {
.put("mixin.feature.blockentity_incorrect_thread", false)
.put("mixin.perf.clear_mixin_classinfo", false)
.put("mixin.perf.deduplicate_climate_parameters", false)
.put("mixin.bugfix.packet_leak", false)
.put("mixin.perf.deduplicate_location", false)
.put("mixin.perf.dynamic_entity_renderers", false)
.put("mixin.feature.integrated_server_watchdog", true)
.put("mixin.perf.faster_item_rendering", false)
.put("mixin.feature.spam_thread_dump", false)
.put("mixin.feature.remove_chat_signing", false)
.put("mixin.bugfix.skip_redundant_saves", false)
.put("mixin.feature.snapshot_easter_egg", true)
.put("mixin.feature.warn_missing_perf_mods", true)
.put("mixin.feature.spark_profile_launch", false)
.put("mixin.feature.spark_profile_world_join", false)
.put("mixin.feature.log_stdout_in_log_files", true)
.put("mixin.devenv", isDevEnv)
.putConditionally(() -> !isFabric, "mixin.bugfix.fix_config_crashes", true)
.putConditionally(() -> !isFabric, "mixin.feature.registry_event_progress", true)
.putConditionally(() -> isFabric, "mixin.perf.clear_fabric_mapping_tables", false)
// Beta (promote on next release)
.put("mixin.perf.compact_entity_models", false)
.put("mixin.perf.dynamic_languages", false)
.put("mixin.perf.faster_capabilities.bytecode_analysis", false)
.put("mixin.perf.ingredient_item_deduplication", false)
// END
.build();

Expand All @@ -234,7 +225,6 @@ private ModernFixEarlyConfig(File file) {
}
// Defines the default rules which can be configured by the user or other mods.
// You must manually add a rule for any new mixins not covered by an existing package rule.
this.addMixinRule("launch.class_search_cache", true);

/* Mod compat */
disableIfModPresent("mixin.perf.thread_priorities", "smoothboot", "threadtweak");
Expand All @@ -252,8 +242,7 @@ private ModernFixEarlyConfig(File file) {
disableIfModPresent("mixin.bugfix.item_cache_flag", "lithium", "canary", "radium");
// DimThread makes changes to the server chunk manager (understandably), C2ME probably does the same
disableIfModPresent("mixin.bugfix.chunk_deadlock", "c2me", "dimthread");
disableIfModPresent("mixin.perf.release_protochunks", "c2me");
disableIfModPresent("mixin.launch.class_search_cache", "optifine");
disableIfModPresent("mixin.perf.release_protochunks", "c2me", "moonrise");
disableIfModPresent("mixin.perf.faster_texture_stitching", "optifine");
disableIfModPresent("mixin.bugfix.entity_pose_stack", "optifine");
disableIfModPresent("mixin.perf.datapack_reload_exceptions", "cyanide");
Expand All @@ -262,9 +251,6 @@ private ModernFixEarlyConfig(File file) {
disableIfModPresent("mixin.perf.faster_texture_loading", "stitch", "optifine", "changed");
disableIfModPresent("mixin.perf.faster_ingredients", "vmp");
disableIfModPresent("mixin.perf.smart_ingredient_sync", "crafttweaker");
if(isFabric) {
disableIfModPresent("mixin.bugfix.packet_leak", "memoryleakfix");
}

checkBlockstateCacheRebuilds();
checkModelDataManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@
import it.unimi.dsi.fastutil.objects.ObjectSet;
import it.unimi.dsi.fastutil.objects.ObjectSets;
import it.unimi.dsi.fastutil.objects.ReferenceSets;
// import net.fabricmc.fabric.impl.client.model.loading.UnbakedModelDeserializerRegistry; // Disabled by FRAPI
import net.fabricmc.fabric.impl.client.model.loading.UnbakedModelDeserializerRegistry;
import net.minecraft.client.color.block.BlockColors;
import net.minecraft.client.renderer.item.ClientItem;
import net.minecraft.client.renderer.block.dispatch.BlockStateModel;
import net.minecraft.client.resources.model.cuboid.CuboidModel;
import net.minecraft.client.resources.model.cuboid.ItemModelGenerator;
import net.minecraft.client.resources.model.BlockStateModelLoader;
import net.minecraft.client.resources.model.ClientItemInfoLoader;
Expand Down Expand Up @@ -65,8 +64,7 @@ public UnbakedModel load(Identifier key) throws Exception {
ModernFix.LOGGER.info("Loading unbaked model {}", key);
}
try (Reader reader = resource.openAsReader()) {
// return UnbakedModelDeserializerRegistry.deserialize(reader); // Disabled by FRAPI
return CuboidModel.fromStream(reader);
return UnbakedModelDeserializerRegistry.deserialize(reader);
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected void init() {

@Override
public void onClose() {
this.minecraft.gui.setScreen(lastScreen);
this.minecraft.setScreen(lastScreen);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected void init() {

@Override
public void onClose() {
this.minecraft.gui.setScreen(lastScreen);
this.minecraft.setScreen(lastScreen);
}

private void drawMultilineString(GuiGraphicsExtractor guiGraphics, Font fr, Component str, int x, int y) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/embeddedt/modernfix/screen/OptionList.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public CategoryEntry(Component component) {

public void extractContent(GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, boolean isMouseOver, float partialTicks) {
Font var10000 = OptionList.this.minecraft.font;
float x = (float)(OptionList.this.minecraft.gui.screen().width / 2 - this.width / 2);
float x = (float)(OptionList.this.minecraft.screen.width / 2 - this.width / 2);
int y = getY() + getHeight() - 10;
guiGraphics.text(var10000, this.name, (int)x, y, -1);
/*
Expand Down Expand Up @@ -164,7 +164,7 @@ public OptionEntry(String optionName, Option option) {
updateStatus();
this.helpButton = new Button.Builder(Component.literal("?"), (arg) -> {
mainScreen.setLastScrollAmount(scrollAmount());
Minecraft.getInstance().gui.setScreen(new ModernFixOptionInfoScreen(mainScreen, optionName));
Minecraft.getInstance().setScreen(new ModernFixOptionInfoScreen(mainScreen, optionName));
}).pos(75, 0).size(20, 20).build();
String helpKey = "modernfix.option." + optionName;
String helpText = I18n.get(helpKey);
Expand Down
Loading