Compare commits
60 Commits
1.20
...
eol/1.20.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0eb70468a1 | ||
|
|
04aac43db0 | ||
|
|
8d5e66218e | ||
|
|
2ec1000ae8 | ||
|
|
ccc21d76d8 | ||
|
|
bfdd1f913d | ||
|
|
473597a915 | ||
|
|
29d1f88539 | ||
|
|
acb6809459 | ||
|
|
13ee6b3523 | ||
|
|
af8e23f41a | ||
|
|
19ba30280c | ||
|
|
33609d234c | ||
|
|
6e3134161a | ||
|
|
c672948d8c | ||
|
|
d8263c55f8 | ||
|
|
7af609b56f | ||
|
|
894173cf1d | ||
|
|
fc52570951 | ||
|
|
9efe912090 | ||
|
|
95f2dc95d3 | ||
|
|
79751dac21 | ||
|
|
1339fc7af6 | ||
|
|
3b7d2f1e2e | ||
|
|
546a362d9c | ||
|
|
7a2b71381c | ||
|
|
3add97202e | ||
|
|
6d096e8ae0 | ||
|
|
fbacc85f86 | ||
|
|
f6f7badde8 | ||
|
|
2a099d8537 | ||
|
|
348a2bcf3d | ||
|
|
7f80f38862 | ||
|
|
cc54b6d67d | ||
|
|
e8fa483917 | ||
|
|
dc3cb998b0 | ||
|
|
972121fa50 | ||
|
|
93554d1854 | ||
|
|
a00efe62c7 | ||
|
|
1267a25db1 | ||
|
|
0149a113a8 | ||
|
|
97d4f6bbc2 | ||
|
|
dfb0c52fa3 | ||
|
|
02fa2be42b | ||
|
|
45c29216a8 | ||
|
|
5e8e7649e5 | ||
|
|
0a2cda0814 | ||
|
|
5952fa2178 | ||
|
|
9bf0017aeb | ||
|
|
cb286c0bca | ||
|
|
b56a65c192 | ||
|
|
8d1058cc3f | ||
|
|
eb15718023 | ||
|
|
861474d635 | ||
|
|
f3bda91ebf | ||
|
|
84c72f8da8 | ||
|
|
3716912a53 | ||
|
|
42688757a7 | ||
|
|
23b473f85d | ||
|
|
7fcaf716d8 |
|
|
@ -1,6 +1,6 @@
|
||||||
plugins {
|
plugins {
|
||||||
id "architectury-plugin" version "3.4-SNAPSHOT"
|
id "architectury-plugin" version "3.4-SNAPSHOT"
|
||||||
id "dev.architectury.loom" version "1.3-SNAPSHOT" apply false
|
id "dev.architectury.loom" version "1.4-SNAPSHOT" apply false
|
||||||
id "maven-publish"
|
id "maven-publish"
|
||||||
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
|
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
|
||||||
id 'com.palantir.git-version' version '1.0.0'
|
id 'com.palantir.git-version' version '1.0.0'
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ architectury {
|
||||||
common(rootProject.enabled_platforms.split(","))
|
common(rootProject.enabled_platforms.split(","))
|
||||||
}
|
}
|
||||||
|
|
||||||
ext.jei_minecraft_version = "1.19.4" /* temporary, till 1.20 releases */
|
ext.jei_minecraft_version = "1.20.2" /* temporary, till 1.20 releases */
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
|
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ public class MinecraftMixin {
|
||||||
/**
|
/**
|
||||||
* To mitigate the effect of leaked client worlds, clear most of the data structures that waste memory.
|
* To mitigate the effect of leaked client worlds, clear most of the data structures that waste memory.
|
||||||
*/
|
*/
|
||||||
@Inject(method = "clearLevel(Lnet/minecraft/client/gui/screens/Screen;)V", at = @At(value = "FIELD", opcode = Opcodes.PUTFIELD, target = "Lnet/minecraft/client/Minecraft;level:Lnet/minecraft/client/multiplayer/ClientLevel;"))
|
@Inject(method = "disconnect(Lnet/minecraft/client/gui/screens/Screen;)V", at = @At(value = "FIELD", opcode = Opcodes.PUTFIELD, target = "Lnet/minecraft/client/Minecraft;level:Lnet/minecraft/client/multiplayer/ClientLevel;"))
|
||||||
private void clearLevelDataForLeaks(CallbackInfo ci) {
|
private void clearLevelDataForLeaks(CallbackInfo ci) {
|
||||||
if(this.level != null) {
|
if(this.level != null) {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
public class CrashReportMixin {
|
public class CrashReportMixin {
|
||||||
@Shadow @Final private Throwable exception;
|
@Shadow @Final private Throwable exception;
|
||||||
|
|
||||||
@Inject(method = "addCategory(Ljava/lang/String;I)Lnet/minecraft/CrashReportCategory;", at = @At(value = "INVOKE", target = "Ljava/io/PrintStream;println(Ljava/lang/String;)V"))
|
@Inject(method = "addCategory(Ljava/lang/String;I)Lnet/minecraft/CrashReportCategory;", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;error(Ljava/lang/String;[Ljava/lang/Object;)V", remap = false))
|
||||||
private void dumpStacktrace(String s, int i, CallbackInfoReturnable<CrashReportCategory> cir) {
|
private void dumpStacktrace(String s, int i, CallbackInfoReturnable<CrashReportCategory> cir) {
|
||||||
new Exception("ModernFix crash stacktrace").printStackTrace();
|
new Exception("ModernFix crash stacktrace").printStackTrace();
|
||||||
if(this.exception != null)
|
if(this.exception != null)
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package org.embeddedt.modernfix.common.mixin.perf.cache_profile_texture_url;
|
||||||
import com.google.common.cache.Cache;
|
import com.google.common.cache.Cache;
|
||||||
import com.google.common.cache.CacheBuilder;
|
import com.google.common.cache.CacheBuilder;
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||||
import net.minecraft.client.resources.SkinManager;
|
|
||||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
|
|
@ -13,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@Mixin(SkinManager.class)
|
@Mixin(targets = {"net/minecraft/client/resources/SkinManager$TextureCache" })
|
||||||
@ClientOnlyMixin
|
@ClientOnlyMixin
|
||||||
public class SkinManagerMixin {
|
public class SkinManagerMixin {
|
||||||
@Unique
|
@Unique
|
||||||
|
|
@ -22,7 +21,7 @@ public class SkinManagerMixin {
|
||||||
.concurrencyLevel(1)
|
.concurrencyLevel(1)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@Redirect(method = "registerTexture(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;)Lnet/minecraft/resources/ResourceLocation;",
|
@Redirect(method = { "getOrLoad", "registerTexture" },
|
||||||
at = @At(value = "INVOKE", target = "Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;getHash()Ljava/lang/String;", remap = false))
|
at = @At(value = "INVOKE", target = "Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;getHash()Ljava/lang/String;", remap = false))
|
||||||
private String useCachedHash(MinecraftProfileTexture texture) {
|
private String useCachedHash(MinecraftProfileTexture texture) {
|
||||||
// avoid lambda allocation for common case
|
// avoid lambda allocation for common case
|
||||||
|
|
|
||||||
|
|
@ -48,8 +48,8 @@ public abstract class ServerLevelMixin extends Level implements IServerLevel {
|
||||||
*/
|
*/
|
||||||
@Inject(method = "<init>", at = @At("TAIL"))
|
@Inject(method = "<init>", at = @At("TAIL"))
|
||||||
private void ensureGeneration(CallbackInfo ci) {
|
private void ensureGeneration(CallbackInfo ci) {
|
||||||
mfix$strongholdCache = this.getDataStorage().computeIfAbsent(StrongholdLocationCache::load,
|
mfix$strongholdCache = this.getDataStorage().computeIfAbsent(
|
||||||
StrongholdLocationCache::new,
|
StrongholdLocationCache.factory((ServerLevel)(Object)this),
|
||||||
StrongholdLocationCache.getFileId(this.dimensionTypeRegistration()));
|
StrongholdLocationCache.getFileId(this.dimensionTypeRegistration()));
|
||||||
this.chunkSource.getGeneratorState().ensureStructuresGenerated();
|
this.chunkSource.getGeneratorState().ensureStructuresGenerated();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import java.util.concurrent.ExecutorService;
|
||||||
@Mixin(Minecraft.class)
|
@Mixin(Minecraft.class)
|
||||||
@ClientOnlyMixin
|
@ClientOnlyMixin
|
||||||
public class MinecraftMixin {
|
public class MinecraftMixin {
|
||||||
@Redirect(method = { "<init>", "reloadResourcePacks(Z)Ljava/util/concurrent/CompletableFuture;" }, at = @At(value = "INVOKE", target = "Lnet/minecraft/Util;backgroundExecutor()Ljava/util/concurrent/ExecutorService;", ordinal = 0))
|
@Redirect(method = { "<init>", "reloadResourcePacks(ZLnet/minecraft/client/Minecraft$GameLoadCookie;)Ljava/util/concurrent/CompletableFuture;" }, at = @At(value = "INVOKE", target = "Lnet/minecraft/Util;backgroundExecutor()Ljava/util/concurrent/ExecutorService;", ordinal = 0))
|
||||||
private ExecutorService getResourceReloadExecutor() {
|
private ExecutorService getResourceReloadExecutor() {
|
||||||
return ModernFix.resourceReloadExecutor();
|
return ModernFix.resourceReloadExecutor();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ import java.util.Map;
|
||||||
|
|
||||||
@Mixin(targets = "net/minecraft/nbt/CompoundTag$1")
|
@Mixin(targets = "net/minecraft/nbt/CompoundTag$1")
|
||||||
public class CompoundTag1Mixin {
|
public class CompoundTag1Mixin {
|
||||||
@ModifyVariable(method = "load(Ljava/io/DataInput;ILnet/minecraft/nbt/NbtAccounter;)Lnet/minecraft/nbt/CompoundTag;", at = @At(value = "INVOKE_ASSIGN", target = "Lcom/google/common/collect/Maps;newHashMap()Ljava/util/HashMap;", remap = false))
|
@ModifyVariable(method = "loadCompound", at = @At(value = "INVOKE_ASSIGN", target = "Lcom/google/common/collect/Maps;newHashMap()Ljava/util/HashMap;", remap = false))
|
||||||
private Map<String, Tag> modifyMap(Map<String, Tag> map) {
|
private static Map<String, Tag> modifyMap(Map<String, Tag> map) {
|
||||||
CanonizingStringMap<Tag> newMap = new CanonizingStringMap<>();
|
CanonizingStringMap<Tag> newMap = new CanonizingStringMap<>();
|
||||||
if(map != null)
|
if(map != null)
|
||||||
newMap.putAll(map);
|
newMap.putAll(map);
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,10 @@ public class ModernFixConfigScreen extends Screen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
|
public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
|
||||||
this.renderBackground(guiGraphics);
|
super.render(guiGraphics, mouseX, mouseY, partialTicks);
|
||||||
this.optionList.render(guiGraphics, mouseX, mouseY, partialTicks);
|
this.optionList.render(guiGraphics, mouseX, mouseY, partialTicks);
|
||||||
guiGraphics.drawCenteredString(this.font, this.title, this.width / 2, 8, 16777215);
|
guiGraphics.drawCenteredString(this.font, this.title, this.width / 2, 8, 16777215);
|
||||||
this.doneButton.setMessage(madeChanges ? Component.translatable("modernfix.config.done_restart") : CommonComponents.GUI_DONE);
|
this.doneButton.setMessage(madeChanges ? Component.translatable("modernfix.config.done_restart") : CommonComponents.GUI_DONE);
|
||||||
super.render(guiGraphics, mouseX, mouseY, partialTicks);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLastScrollAmount(double d) {
|
public void setLastScrollAmount(double d) {
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ public class ModernFixOptionInfoScreen extends Screen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
|
public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
|
||||||
this.renderBackground(guiGraphics);
|
this.renderBackground(guiGraphics, mouseX, mouseY, partialTicks);
|
||||||
guiGraphics.drawCenteredString(this.font, this.title, this.width / 2, 8, 16777215);
|
guiGraphics.drawCenteredString(this.font, this.title, this.width / 2, 8, 16777215);
|
||||||
this.drawMultilineString(guiGraphics, this.minecraft.font, description, 10, 50);
|
this.drawMultilineString(guiGraphics, this.minecraft.font, description, 10, 50);
|
||||||
super.render(guiGraphics, mouseX, mouseY, partialTicks);
|
super.render(guiGraphics, mouseX, mouseY, partialTicks);
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ package org.embeddedt.modernfix.world;
|
||||||
import net.minecraft.core.Holder;
|
import net.minecraft.core.Holder;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.util.datafix.DataFixTypes;
|
||||||
import net.minecraft.world.level.ChunkPos;
|
import net.minecraft.world.level.ChunkPos;
|
||||||
import net.minecraft.world.level.dimension.DimensionType;
|
import net.minecraft.world.level.dimension.DimensionType;
|
||||||
import net.minecraft.world.level.saveddata.SavedData;
|
import net.minecraft.world.level.saveddata.SavedData;
|
||||||
|
|
@ -17,6 +19,11 @@ public class StrongholdLocationCache extends SavedData {
|
||||||
chunkPosList = new ArrayList<>();
|
chunkPosList = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SavedData.Factory<StrongholdLocationCache> factory(ServerLevel serverLevel) {
|
||||||
|
// FIXME datafixer will probably throw on update
|
||||||
|
return new SavedData.Factory<>(StrongholdLocationCache::new, StrongholdLocationCache::load, DataFixTypes.SAVED_DATA_FORCED_CHUNKS);
|
||||||
|
}
|
||||||
|
|
||||||
public List<ChunkPos> getChunkPosList() {
|
public List<ChunkPos> getChunkPosList() {
|
||||||
return new ArrayList<>(chunkPosList);
|
return new ArrayList<>(chunkPosList);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package org.embeddedt.modernfix.fabric.mixin.core;
|
||||||
|
|
||||||
|
import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl;
|
||||||
|
import org.embeddedt.modernfix.ModernFixClientFabric;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Mixin(ClientCommonPacketListenerImpl.class)
|
||||||
|
public class ClientCommonPacketListenerImplMixin {
|
||||||
|
@Inject(method = "handleUpdateTags", at = @At("RETURN"))
|
||||||
|
private void signalTags(CallbackInfo ci) {
|
||||||
|
ModernFixClientFabric.commonMod.onTagsUpdated();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -15,9 +15,4 @@ public class ClientPlayNetHandlerMixin {
|
||||||
private void signalRecipes(CallbackInfo ci) {
|
private void signalRecipes(CallbackInfo ci) {
|
||||||
ModernFixClientFabric.commonMod.onRecipesUpdated();
|
ModernFixClientFabric.commonMod.onRecipesUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "handleUpdateTags", at = @At("RETURN"))
|
|
||||||
private void signalTags(CallbackInfo ci) {
|
|
||||||
ModernFixClientFabric.commonMod.onTagsUpdated();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.level.EmptyBlockGetter;
|
import net.minecraft.world.level.EmptyBlockGetter;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.material.FluidState;
|
|
||||||
import org.embeddedt.modernfix.duck.IBlockState;
|
import org.embeddedt.modernfix.duck.IBlockState;
|
||||||
import org.embeddedt.modernfix.testing.util.BootstrapMinecraft;
|
import org.embeddedt.modernfix.testing.util.BootstrapMinecraft;
|
||||||
import org.junit.jupiter.api.*;
|
import org.junit.jupiter.api.*;
|
||||||
|
|
@ -79,6 +78,7 @@ public class BlockStateCacheTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
@Test
|
@Test
|
||||||
@Order(5)
|
@Order(5)
|
||||||
public void checkRecursiveFluidState() {
|
public void checkRecursiveFluidState() {
|
||||||
|
|
@ -93,4 +93,5 @@ public class BlockStateCacheTest {
|
||||||
// this should not throw
|
// this should not throw
|
||||||
state.getFluidState();
|
state.getFluidState();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ dependencies {
|
||||||
modImplementation(fabricApi.module("fabric-models-v0", "0.84.0+1.20.1")) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
modImplementation(fabricApi.module("fabric-models-v0", "0.84.0+1.20.1")) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||||
modImplementation(fabricApi.module("fabric-registry-sync-v0", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
modImplementation(fabricApi.module("fabric-registry-sync-v0", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||||
modImplementation(fabricApi.module("fabric-renderer-api-v1", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
modImplementation(fabricApi.module("fabric-renderer-api-v1", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||||
modImplementation(fabricApi.module("fabric-rendering-data-attachment-v1", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
modImplementation("net.fabricmc.fabric-api:fabric-rendering-data-attachment-v1:0.3.36+92a0d36777") { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||||
modImplementation(fabricApi.module("fabric-rendering-fluids-v1", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
modImplementation(fabricApi.module("fabric-rendering-fluids-v1", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||||
modRuntimeOnly(fabricApi.module("fabric-renderer-indigo", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
modRuntimeOnly(fabricApi.module("fabric-renderer-indigo", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ import net.minecraftforge.client.event.CustomizeGuiOverlayEvent;
|
||||||
import net.minecraftforge.client.event.RecipesUpdatedEvent;
|
import net.minecraftforge.client.event.RecipesUpdatedEvent;
|
||||||
import net.minecraftforge.client.event.RegisterClientCommandsEvent;
|
import net.minecraftforge.client.event.RegisterClientCommandsEvent;
|
||||||
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
|
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
|
||||||
import net.minecraftforge.client.gui.overlay.ForgeGui;
|
|
||||||
import net.minecraftforge.client.settings.KeyConflictContext;
|
import net.minecraftforge.client.settings.KeyConflictContext;
|
||||||
import net.minecraftforge.event.TagsUpdatedEvent;
|
import net.minecraftforge.event.TagsUpdatedEvent;
|
||||||
import net.minecraftforge.event.TickEvent;
|
import net.minecraftforge.event.TickEvent;
|
||||||
|
|
@ -19,12 +18,13 @@ import net.minecraftforge.event.level.LevelEvent;
|
||||||
import net.minecraftforge.event.server.ServerStartedEvent;
|
import net.minecraftforge.event.server.ServerStartedEvent;
|
||||||
import net.minecraftforge.eventbus.api.EventPriority;
|
import net.minecraftforge.eventbus.api.EventPriority;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.*;
|
import net.minecraftforge.fml.ModLoader;
|
||||||
|
import net.minecraftforge.fml.ModLoadingContext;
|
||||||
|
import net.minecraftforge.fml.ModLoadingStage;
|
||||||
|
import net.minecraftforge.fml.ModLoadingWarning;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
import net.minecraftforge.fml.util.ObfuscationReflectionHelper;
|
|
||||||
import org.embeddedt.modernfix.ModernFixClient;
|
import org.embeddedt.modernfix.ModernFixClient;
|
||||||
import org.embeddedt.modernfix.core.ModernFixMixinPlugin;
|
|
||||||
import org.embeddedt.modernfix.forge.config.NightConfigFixer;
|
import org.embeddedt.modernfix.forge.config.NightConfigFixer;
|
||||||
import org.embeddedt.modernfix.screen.ModernFixConfigScreen;
|
import org.embeddedt.modernfix.screen.ModernFixConfigScreen;
|
||||||
|
|
||||||
|
|
@ -52,8 +52,7 @@ public class ModernFixClientForge {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onClientSetup(FMLClientSetupEvent event) {
|
private void onClientSetup(FMLClientSetupEvent event) {
|
||||||
if(false && ModernFixMixinPlugin.instance.isOptionEnabled("perf.dynamic_resources.ConnectednessCheck")
|
if(false) {
|
||||||
&& ModList.get().isLoaded("connectedness")) {
|
|
||||||
event.enqueueWork(() -> {
|
event.enqueueWork(() -> {
|
||||||
ModLoader.get().addWarning(new ModLoadingWarning(ModLoadingContext.get().getActiveContainer().getModInfo(), ModLoadingStage.SIDED_SETUP, "modernfix.connectedness_dynresoruces"));
|
ModLoader.get().addWarning(new ModLoadingWarning(ModLoadingContext.get().getActiveContainer().getModInfo(), ModLoadingStage.SIDED_SETUP, "modernfix.connectedness_dynresoruces"));
|
||||||
});
|
});
|
||||||
|
|
@ -80,7 +79,7 @@ public class ModernFixClientForge {
|
||||||
|
|
||||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||||
public void onRenderOverlay(CustomizeGuiOverlayEvent.DebugText event) {
|
public void onRenderOverlay(CustomizeGuiOverlayEvent.DebugText event) {
|
||||||
if(commonMod.brandingString != null && Minecraft.getInstance().options.renderDebug) {
|
if(commonMod.brandingString != null && Minecraft.getInstance().getDebugOverlay().showDebugScreen()) {
|
||||||
if(brandingList.size() == 0) {
|
if(brandingList.size() == 0) {
|
||||||
brandingList.add("");
|
brandingList.add("");
|
||||||
brandingList.add(commonMod.brandingString);
|
brandingList.add(commonMod.brandingString);
|
||||||
|
|
@ -103,10 +102,8 @@ public class ModernFixClientForge {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onDisconnect(LevelEvent.Unload event) {
|
public void onDisconnect(LevelEvent.Unload event) {
|
||||||
if(event.getLevel().isClientSide()) {
|
if(event.getLevel().isClientSide()) {
|
||||||
DebugScreenOverlay overlay = ObfuscationReflectionHelper.getPrivateValue(ForgeGui.class, (ForgeGui)Minecraft.getInstance().gui, "debugOverlay");
|
DebugScreenOverlay overlay = Minecraft.getInstance().getDebugOverlay();
|
||||||
if(overlay != null) {
|
Minecraft.getInstance().tell(overlay::clearChunkCache);
|
||||||
Minecraft.getInstance().tell(overlay::clearChunkCache);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ import net.minecraftforge.fml.config.ModConfig;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
import net.minecraftforge.fml.loading.FMLLoader;
|
import net.minecraftforge.fml.loading.FMLLoader;
|
||||||
import net.minecraftforge.network.NetworkConstants;
|
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import net.minecraftforge.registries.RegisterEvent;
|
import net.minecraftforge.registries.RegisterEvent;
|
||||||
import net.minecraftforge.server.ServerLifecycleHooks;
|
import net.minecraftforge.server.ServerLifecycleHooks;
|
||||||
|
|
@ -49,7 +48,7 @@ public class ModernFixForge {
|
||||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::commonSetup);
|
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::commonSetup);
|
||||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::registerItems);
|
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::registerItems);
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> MinecraftForge.EVENT_BUS.register(new ModernFixClientForge()));
|
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> MinecraftForge.EVENT_BUS.register(new ModernFixClientForge()));
|
||||||
ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(() -> NetworkConstants.IGNORESERVERONLY, (a, b) -> true));
|
ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(() -> IExtensionPoint.DisplayTest.IGNORESERVERONLY, (a, b) -> true));
|
||||||
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, ModernFixConfig.COMMON_CONFIG);
|
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, ModernFixConfig.COMMON_CONFIG);
|
||||||
PacketHandler.register();
|
PacketHandler.register();
|
||||||
ModFileScanDataDeduplicator.deduplicate();
|
ModFileScanDataDeduplicator.deduplicate();
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
package org.embeddedt.modernfix.forge.mixin.core;
|
package org.embeddedt.modernfix.forge.mixin.core;
|
||||||
|
|
||||||
import net.minecraft.server.Bootstrap;
|
import net.minecraft.server.Bootstrap;
|
||||||
import net.minecraftforge.network.NetworkConstants;
|
import net.minecraftforge.network.NetworkInitialization;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.embeddedt.modernfix.forge.load.ModWorkManagerQueue;
|
import org.embeddedt.modernfix.forge.load.ModWorkManagerQueue;
|
||||||
import org.embeddedt.modernfix.util.TimeFormatter;
|
import org.embeddedt.modernfix.util.TimeFormatter;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
@ -31,6 +31,6 @@ public class BootstrapMixin {
|
||||||
/* for https://github.com/MinecraftForge/MinecraftForge/issues/9505 */
|
/* for https://github.com/MinecraftForge/MinecraftForge/issues/9505 */
|
||||||
@Inject(method = "bootStrap", at = @At("RETURN"))
|
@Inject(method = "bootStrap", at = @At("RETURN"))
|
||||||
private static void doClassloadHack(CallbackInfo ci) {
|
private static void doClassloadHack(CallbackInfo ci) {
|
||||||
NetworkConstants.init();
|
NetworkInitialization.init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,19 @@
|
||||||
package org.embeddedt.modernfix.forge.mixin.core;
|
package org.embeddedt.modernfix.forge.mixin.core;
|
||||||
|
|
||||||
import net.minecraft.network.Connection;
|
import net.minecraft.network.Connection;
|
||||||
import net.minecraftforge.network.NetworkHooks;
|
import net.minecraftforge.common.ForgeHooks;
|
||||||
|
import net.minecraftforge.network.ConnectionType;
|
||||||
|
import net.minecraftforge.network.NetworkContext;
|
||||||
import org.embeddedt.modernfix.forge.packet.NetworkUtils;
|
import org.embeddedt.modernfix.forge.packet.NetworkUtils;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
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.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
@Mixin(NetworkHooks.class)
|
@Mixin(ForgeHooks.class)
|
||||||
public abstract class NetworkHooksMixin {
|
public abstract class NetworkHooksMixin {
|
||||||
@Shadow public static boolean isVanillaConnection(Connection manager) {
|
@Inject(method = "handleClientConfigurationComplete", at = @At("RETURN"), remap = false)
|
||||||
throw new AssertionError();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(method = "handleClientLoginSuccess", at = @At("RETURN"), remap = false)
|
|
||||||
private static void setVanillaGlobalFlag(Connection manager, CallbackInfo ci) {
|
private static void setVanillaGlobalFlag(Connection manager, CallbackInfo ci) {
|
||||||
NetworkUtils.isCurrentlyVanilla = isVanillaConnection(manager);
|
NetworkUtils.isCurrentlyVanilla = NetworkContext.get(manager).getType() == ConnectionType.VANILLA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,30 @@
|
||||||
package org.embeddedt.modernfix.forge.packet;
|
package org.embeddedt.modernfix.forge.packet;
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraftforge.network.NetworkEvent;
|
|
||||||
import net.minecraftforge.network.NetworkRegistry;
|
|
||||||
import net.minecraftforge.network.simple.SimpleChannel;
|
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
import net.minecraftforge.network.Channel;
|
||||||
|
import net.minecraftforge.network.ChannelBuilder;
|
||||||
|
import net.minecraftforge.network.SimpleChannel;
|
||||||
import org.embeddedt.modernfix.ModernFix;
|
import org.embeddedt.modernfix.ModernFix;
|
||||||
import org.embeddedt.modernfix.ModernFixClient;
|
import org.embeddedt.modernfix.ModernFixClient;
|
||||||
import org.embeddedt.modernfix.packet.EntityIDSyncPacket;
|
import org.embeddedt.modernfix.packet.EntityIDSyncPacket;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
public class PacketHandler {
|
public class PacketHandler {
|
||||||
private static final String PROTOCOL_VERSION = "1";
|
private static final int PROTOCOL_VERSION = 1;
|
||||||
public static final SimpleChannel INSTANCE = NetworkRegistry.newSimpleChannel(
|
public static final SimpleChannel INSTANCE = ChannelBuilder
|
||||||
new ResourceLocation(ModernFix.MODID, "main"),
|
.named(new ResourceLocation(ModernFix.MODID, "main"))
|
||||||
() -> PROTOCOL_VERSION,
|
.networkProtocolVersion(PROTOCOL_VERSION)
|
||||||
NetworkRegistry.acceptMissingOr(PROTOCOL_VERSION),
|
.serverAcceptedVersions(Channel.VersionTest.ACCEPT_MISSING.or(Channel.VersionTest.exact(PROTOCOL_VERSION)))
|
||||||
NetworkRegistry.acceptMissingOr(PROTOCOL_VERSION)
|
.clientAcceptedVersions(Channel.VersionTest.ACCEPT_MISSING.or(Channel.VersionTest.exact(PROTOCOL_VERSION)))
|
||||||
);
|
.simpleChannel();
|
||||||
|
|
||||||
public static void register() {
|
public static void register() {
|
||||||
int id = 1;
|
INSTANCE.messageBuilder(EntityIDSyncPacket.class).encoder(EntityIDSyncPacket::serialize).decoder(EntityIDSyncPacket::deserialize).consumerNetworkThread((msg, ctx) -> {
|
||||||
INSTANCE.registerMessage(id++, EntityIDSyncPacket.class, EntityIDSyncPacket::serialize, EntityIDSyncPacket::deserialize, PacketHandler::handleSyncPacket);
|
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> {
|
||||||
}
|
ctx.enqueueWork(() -> ModernFixClient.handleEntityIDSync(msg));
|
||||||
|
ctx.setPacketHandled(true);
|
||||||
private static void handleSyncPacket(EntityIDSyncPacket packet, Supplier<NetworkEvent.Context> contextSupplier) {
|
});
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> {
|
}).add();
|
||||||
contextSupplier.get().enqueueWork(() -> ModernFixClient.handleEntityIDSync(packet));
|
|
||||||
contextSupplier.get().setPacketHandled(true);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ public class ModernFixPlatformHooksImpl implements ModernFixPlatformHooks {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(ServerPlayer player, Object packet) {
|
public void sendPacket(ServerPlayer player, Object packet) {
|
||||||
PacketHandler.INSTANCE.send(PacketDistributor.PLAYER.with(() -> player), packet);
|
PacketHandler.INSTANCE.send(packet, PacketDistributor.PLAYER.with(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void injectPlatformSpecificHacks() {
|
public void injectPlatformSpecificHacks() {
|
||||||
|
|
|
||||||
|
|
@ -5,26 +5,26 @@ junit_version=5.10.0-M1
|
||||||
mixinextras_version=0.2.0-beta.9
|
mixinextras_version=0.2.0-beta.9
|
||||||
|
|
||||||
mod_id=modernfix
|
mod_id=modernfix
|
||||||
minecraft_version=1.20.1
|
minecraft_version=1.20.2
|
||||||
enabled_platforms=fabric,forge
|
enabled_platforms=fabric,forge
|
||||||
forge_version=1.20.1-47.1.3
|
forge_version=1.20.2-48.0.40
|
||||||
parchment_version=2023.07.09
|
# parchment_version=2023.07.09
|
||||||
refined_storage_version=4392788
|
refined_storage_version=4392788
|
||||||
jei_version=13.1.0.2
|
jei_version=16.0.0.28
|
||||||
rei_version=11.0.597
|
rei_version=13.0.678
|
||||||
ctm_version=1.20.1-1.1.8+4
|
ctm_version=1.20.1-1.1.8+4
|
||||||
kubejs_version=1902.6.0-build.142
|
kubejs_version=1902.6.0-build.142
|
||||||
rhino_version=1902.2.2-build.268
|
rhino_version=1902.2.2-build.268
|
||||||
supported_minecraft_versions=1.20.1
|
supported_minecraft_versions=1.20.2
|
||||||
|
|
||||||
fabric_loader_version=0.14.21
|
fabric_loader_version=0.14.22
|
||||||
fabric_api_version=0.86.0+1.20.1
|
fabric_api_version=0.89.2+1.20.2
|
||||||
|
|
||||||
continuity_version=3.0.0-beta.2+1.19.3
|
continuity_version=3.0.0-beta.4+1.20.2
|
||||||
|
|
||||||
modmenu_version=7.0.0-beta.2
|
modmenu_version=7.0.0-beta.2
|
||||||
diagonal_fences_version=4558828
|
diagonal_fences_version=4558828
|
||||||
|
|
||||||
spark_version=4587310
|
spark_version=4587310
|
||||||
|
|
||||||
use_fabric_api_at_runtime=true
|
use_fabric_api_at_runtime=false
|
||||||
|
|
|
||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user