Remap to full Mojmap (including classnames)

Mod does not yet run in dev
This commit is contained in:
embeddedt 2023-02-14 21:59:30 -05:00
parent d06ba2b7bf
commit cfbe21d72f
No known key found for this signature in database
GPG Key ID: A69433EC199B5613
71 changed files with 517 additions and 565 deletions

View File

@ -1,118 +1,35 @@
buildscript {
repositories {
// These repositories are only for Gradle plugins, put any other repositories in the repository block further below
maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
mavenCentral()
}
dependencies {
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
}
}
plugins {
id 'net.minecraftforge.gradle' version '5.1.61'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
id "dev.architectury.loom" version "1.0.312"
id "maven-publish"
id 'com.matthewprenger.cursegradle' version '1.4.0'
}
apply plugin: 'org.spongepowered.mixin'
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
group = 'org.embeddedt'
version = '1.6.0-beta3'
java {
archivesBaseName = 'modernfix-mc' + minecraft_version
toolchain.languageVersion = JavaLanguageVersion.of(8)
}
minecraft {
// The mappings can be changed at any time and must be in the following format.
// Channel: Version:
// official MCVersion Official field/method names from Mojang mapping files
// parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official
//
// You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
// See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
//
// Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
// Additional setup is needed to use their mappings: https://github.com/ParchmentMC/Parchment/wiki/Getting-Started
//
// Use non-default mappings at your own risk. They may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}"
loom {
// use this if you are using the official mojang mappings
// and want loom to stop warning you about their license
silentMojangMappingsLicense()
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
client {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
// The markers can be added/remove as needed separated by commas.
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
property 'forge.logging.markers', 'REGISTRIES'
// Recommended logging level for the console
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
property 'forge.logging.console.level', 'info'
mods {
modernfix {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
mods {
modernfix {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args '--mod', 'modernfix', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
mods {
modernfix {
source sourceSets.main
}
}
}
// since loom 0.10, you are **required** to use the
// "forge" block to configure forge-specific features,
// such as the mixinConfigs array or datagen
forge {
// specify the mixin configs used in this mod
// this will be added to the jar manifest as well!
mixinConfigs = [
"modernfix.mixins.json"
]
}
}
mixin {
add sourceSets.main, "modernfix.refmap.json"
config "modernfix.mixins.json"
}
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories {
maven { url 'https://modmaven.dev/' }
maven {
@ -124,35 +41,66 @@ repositories {
}
dependencies {
// Specify the version of Minecraft to use. If this is any group other than 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
// to change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
// choose what mappings you want to use here
// leave this uncommented if you want to use
// mojang's official mappings, or feel free
// to add your own mappings here (how about
// mojmap layered with parchment, for example?)
mappings loom.officialMojangMappings()
runtimeOnly fg.deobf("curse.maven:lazydfu-460819:${lazydfu_version}")
// uncomment this if you want to use yarn mappings
// mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}")
compileOnly fg.deobf("curse.maven:ferritecore-429235:4074330")
// your forge dependency, this is **required** when using Forge Loom in forge mode!
forge "net.minecraftforge:forge:${project.forge_version}"
modRuntimeOnly "curse.maven:lazydfu-460819:${lazydfu_version}"
modCompileOnly("mezz.jei:jei-${minecraft_version}:${jei_version}")
modCompileOnly("curse.maven:ferritecore-429235:4074330")
if(include_optimization_mods.toBoolean()) {
runtimeOnly fg.deobf("curse.maven:roadrunner-529754:3683120")
runtimeOnly fg.deobf("curse.maven:rubidium-574856:3949659")
runtimeOnly fg.deobf("curse.maven:noexperimental-407174:3188120")
runtimeOnly fg.deobf("curse.maven:spark-361579:3767277")
runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}")
modRuntimeOnly("curse.maven:roadrunner-529754:3683120")
modRuntimeOnly("curse.maven:rubidium-574856:3949659")
modRuntimeOnly("curse.maven:noexperimental-407174:3188120")
modRuntimeOnly("curse.maven:spark-361579:3767277")
modRuntimeOnly("mezz.jei:jei-${minecraft_version}:${jei_version}")
}
if(include_content_mods.toBoolean()) {
runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}")// core
runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}:generators")// Mekanism: Generators
runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}:tools")// Mekanism: Tools
modRuntimeOnly("mekanism:Mekanism:${mekanism_version}")// core
modRuntimeOnly("mekanism:Mekanism:${mekanism_version}:generators")// Mekanism: Generators
modRuntimeOnly("mekanism:Mekanism:${mekanism_version}:tools")// Mekanism: Tools
runtimeOnly fg.deobf("curse.maven:betterfoliage-470013:3396105")
modRuntimeOnly("curse.maven:betterfoliage-470013:3396105")
}
compileOnly fg.deobf("curse.maven:refinedstorage-243076:3807951")
modCompileOnly("curse.maven:refinedstorage-243076:3807951")
}
tasks.withType(JavaCompile) {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
options.encoding = "UTF-8"
// The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too
// JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used.
// We'll use that if it's available, but otherwise we'll use the older option.
def targetVersion = 8
if (JavaVersion.current().isJava9Compatible()) {
options.release = targetVersion
}
}
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}
// Example for how to get properties into the manifest for reading at runtime.
@ -171,10 +119,27 @@ jar {
}
}
jar.finalizedBy('reobfJar')
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
// add all the jars that should be included when publishing to maven
artifact(remapJar) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
curseforge {

View File

@ -1,7 +1,15 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
# tell architectury loom that this project is a forge project.
# this will enable us to use the "forge" dependency.
# using archloom without this is possible and will give you a
# "standard" loom installation with some extra features.
loom.platform=forge
mod_id=modernfix
minecraft_version=1.16.5
forge_version=36.2.39
forge_version=1.16.5-36.2.39
lazydfu_version=3249059
mekanism_version=1.16.5-10.1.2.457
parchment_version=2022.03.06

View File

@ -1,8 +1,9 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven { url = 'https://maven.minecraftforge.net/' }
maven { url = 'https://maven.parchmentmc.org' }
maven { url "https://maven.fabricmc.net/" }
maven { url "https://maven.architectury.dev/" }
maven { url "https://maven.minecraftforge.net/" }
}
}

View File

@ -1,29 +1,14 @@
package org.embeddedt.modernfix;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.ConnectingScreen;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.ExtensionPoint;
import net.minecraftforge.fml.InterModComms;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
import net.minecraftforge.fml.event.server.FMLServerStartedEvent;
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.loading.FMLLoader;
import net.minecraftforge.fml.network.FMLNetworkConstants;
import org.apache.commons.lang3.tuple.Pair;
@ -32,7 +17,6 @@ import org.apache.logging.log4j.Logger;
import org.embeddedt.modernfix.core.config.ModernFixConfig;
import java.lang.management.ManagementFactory;
import java.util.stream.Collectors;
// The value here should match an entry in the META-INF/mods.toml file
@Mod(ModernFix.MODID)

View File

@ -1,8 +1,8 @@
package org.embeddedt.modernfix;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.ConnectingScreen;
import net.minecraft.client.gui.screen.MainMenuScreen;
import net.minecraft.client.gui.screens.ConnectScreen;
import net.minecraft.client.gui.screens.TitleScreen;
import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.eventbus.api.EventPriority;
@ -24,9 +24,9 @@ public class ModernFixClient {
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onMultiplayerConnect(GuiOpenEvent event) {
if(event.getGui() instanceof ConnectingScreen && !event.isCanceled()) {
if(event.getGui() instanceof ConnectScreen && !event.isCanceled()) {
worldLoadStartTime = System.nanoTime();
} else if (event.getGui() instanceof MainMenuScreen && gameStartTimeSeconds < 0) {
} else if (event.getGui() instanceof TitleScreen && gameStartTimeSeconds < 0) {
gameStartTimeSeconds = ManagementFactory.getRuntimeMXBean().getUptime() / 1000f;
ModernFix.LOGGER.warn("Game took " + gameStartTimeSeconds + " seconds to start");
}

View File

@ -2,12 +2,12 @@ package org.embeddedt.modernfix.blockstate;
import com.google.common.base.Stopwatch;
import com.google.common.collect.ImmutableSet;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.util.Util;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.world.EmptyBlockReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.level.EmptyBlockGetter;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.loading.FMLLoader;
import org.embeddedt.modernfix.ModernFix;
@ -102,8 +102,8 @@ public class BlockStateCacheHandler {
specialStates.parallelStream()
.forEach(state -> {
/* Force these blocks to compute their shapes ahead of time on worker threads */
state.getBlock().getCollisionShape(state, EmptyBlockReader.INSTANCE, BlockPos.ZERO, ISelectionContext.empty());
state.getBlock().getOcclusionShape(state, EmptyBlockReader.INSTANCE, BlockPos.ZERO);
state.getBlock().getCollisionShape(state, EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CollisionContext.empty());
state.getBlock().getOcclusionShape(state, EmptyBlockGetter.INSTANCE, BlockPos.ZERO);
});
}, Util.backgroundExecutor()).join();
rebuildCache();

View File

@ -2,7 +2,7 @@ package org.embeddedt.modernfix.core.config;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import net.minecraft.util.ResourceLocation;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

View File

@ -1,7 +1,7 @@
package org.embeddedt.modernfix.duck;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.FriendlyByteBuf;
public interface IClientNetHandler {
PacketBuffer getCopiedCustomBuffer();
FriendlyByteBuf getCopiedCustomBuffer();
}

View File

@ -1,8 +1,8 @@
package org.embeddedt.modernfix.duck;
import net.minecraft.client.renderer.texture.SpriteMap;
import net.minecraft.client.renderer.texture.AtlasSet;
public interface IExtendedModelBakery {
SpriteMap getUnfinishedAtlasSet();
AtlasSet getUnfinishedAtlasSet();
}

View File

@ -1,7 +1,7 @@
package org.embeddedt.modernfix.duck;
import net.minecraft.world.storage.SaveFormat;
import net.minecraft.world.level.storage.LevelStorageSource;
public interface ILevelSave {
public void runWorldPersistenceHooks(SaveFormat format);
public void runWorldPersistenceHooks(LevelStorageSource format);
}

View File

@ -1,14 +1,14 @@
package org.embeddedt.modernfix.mixin.bugfix.concurrency;
import net.minecraft.client.Minecraft;
import net.minecraft.util.concurrent.ThreadTaskExecutor;
import net.minecraft.util.thread.BlockableEventLoop;
import org.embeddedt.modernfix.ModernFix;
import org.spongepowered.asm.mixin.Mixin;
import java.util.function.BooleanSupplier;
@Mixin(Minecraft.class)
public abstract class MinecraftMixin<R extends Runnable> extends ThreadTaskExecutor<R> {
public abstract class MinecraftMixin<R extends Runnable> extends BlockableEventLoop<R> {
protected MinecraftMixin(String p_i50403_1_) {
super(p_i50403_1_);

View File

@ -2,24 +2,24 @@ package org.embeddedt.modernfix.mixin.bugfix.concurrency;
import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.vertex.VertexFormat;
import com.mojang.blaze3d.vertex.VertexFormat;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(targets = {"net/minecraft/client/renderer/RenderType$Type"})
@Mixin(RenderType.CompositeRenderType.class)
public class RenderTypeMixin {
@Shadow @Final private static ObjectOpenCustomHashSet<RenderType.Type> INSTANCES;
@Shadow @Final private static ObjectOpenCustomHashSet<RenderType.CompositeRenderType> INSTANCES;
/**
* @author embeddedt
* @reason synchronize, can be accessed by multiple mods during modloading
*/
@Overwrite
private static RenderType.Type memoize(String name, VertexFormat format, int drawMode, int bufferSize, boolean useDelegate, boolean needsSorting, RenderType.State renderState) {
private static RenderType.CompositeRenderType memoize(String name, VertexFormat format, int drawMode, int bufferSize, boolean useDelegate, boolean needsSorting, RenderType.CompositeState renderState) {
synchronized (INSTANCES){
return INSTANCES.addOrGet(new RenderType.Type(name, format, drawMode, bufferSize, useDelegate, needsSorting, renderState));
return INSTANCES.addOrGet(new RenderType.CompositeRenderType(name, format, drawMode, bufferSize, useDelegate, needsSorting, renderState));
}
}
}

View File

@ -1,11 +1,11 @@
package org.embeddedt.modernfix.mixin.bugfix.edge_chunk_not_saved;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ChunkPrimer;
import net.minecraft.world.chunk.ChunkPrimerWrapper;
import net.minecraft.world.chunk.IChunk;
import net.minecraft.world.server.ChunkHolder;
import net.minecraft.world.server.ChunkManager;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.chunk.ProtoChunk;
import net.minecraft.world.level.chunk.ImposterProtoChunk;
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.server.level.ChunkHolder;
import net.minecraft.server.level.ChunkMap;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;
@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.ModifyArg;
import java.util.function.Predicate;
/* https://github.com/SuperCoder7979/chunksavingfix-fabric/blob/main/src/main/java/supercoder79/chunksavingfix/mixin/MixinThreadedAnvilChunkStorage.java */
@Mixin(ChunkManager.class)
@Mixin(ChunkMap.class)
public class ChunkManagerMixin {
// TODO: hits both at the moment- check and re-evaluate
@ModifyArg(method = "saveAllChunks(Z)V", at = @At(value = "INVOKE", target = "Ljava/util/stream/Stream;filter(Ljava/util/function/Predicate;)Ljava/util/stream/Stream;", ordinal = 0), require = 0)
@ -21,8 +21,8 @@ public class ChunkManagerMixin {
return c -> true;
}
@ModifyArg(method = "saveAllChunks(Z)V", at = @At(value = "INVOKE", target = "Ljava/util/stream/Stream;filter(Ljava/util/function/Predicate;)Ljava/util/stream/Stream;", ordinal = 1), require = 0)
private Predicate<IChunk> allowProtoChunkFlush(Predicate<IChunk> chunk) {
return c -> c instanceof ChunkPrimer || c instanceof ChunkPrimerWrapper || c instanceof Chunk;
private Predicate<ChunkAccess> allowProtoChunkFlush(Predicate<ChunkAccess> chunk) {
return c -> c instanceof ProtoChunk || c instanceof ImposterProtoChunk || c instanceof LevelChunk;
}
@ModifyArg(method = "saveAllChunks(Z)V", at = @At(value = "INVOKE", target = "Ljava/util/stream/Stream;filter(Ljava/util/function/Predicate;)Ljava/util/stream/Stream;", ordinal = 3), require = 0)

View File

@ -1,30 +1,30 @@
package org.embeddedt.modernfix.mixin.bugfix.packet_leak;
import net.minecraft.client.network.play.ClientPlayNetHandler;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.server.SCustomPayloadPlayPacket;
import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket;
import org.embeddedt.modernfix.duck.IClientNetHandler;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(ClientPlayNetHandler.class)
@Mixin(ClientPacketListener.class)
public class ClientPlayNetHandlerMixin implements IClientNetHandler {
private PacketBuffer savedCopy = null;
private FriendlyByteBuf savedCopy = null;
/**
* @author embeddedt
* @reason Release the packet buffer at the end. Needed in f
*/
@Redirect(method = "handleCustomPayload", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/play/server/SCustomPayloadPlayPacket;getData()Lnet/minecraft/network/PacketBuffer;"))
private PacketBuffer saveCopyForRelease(SCustomPayloadPlayPacket instance) {
PacketBuffer copy = instance.getData();
@Redirect(method = "handleCustomPayload", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/protocol/game/ClientboundCustomPayloadPacket;getData()Lnet/minecraft/network/FriendlyByteBuf;"))
private FriendlyByteBuf saveCopyForRelease(ClientboundCustomPayloadPacket instance) {
FriendlyByteBuf copy = instance.getData();
savedCopy = copy;
return copy;
}
@Override
public PacketBuffer getCopiedCustomBuffer() {
PacketBuffer copy = savedCopy;
public FriendlyByteBuf getCopiedCustomBuffer() {
FriendlyByteBuf copy = savedCopy;
savedCopy = null;
return copy;
}

View File

@ -1,9 +1,9 @@
package org.embeddedt.modernfix.mixin.bugfix.packet_leak;
import net.minecraft.client.network.play.IClientPlayNetHandler;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.server.SCustomPayloadPlayPacket;
import net.minecraft.util.ResourceLocation;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket;
import net.minecraft.resources.ResourceLocation;
import org.embeddedt.modernfix.duck.IClientNetHandler;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@ -12,28 +12,28 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(SCustomPayloadPlayPacket.class)
@Mixin(ClientboundCustomPayloadPacket.class)
public class SCustomPayloadPlayPacketMixin {
@Shadow private PacketBuffer data;
@Shadow private FriendlyByteBuf data;
private boolean needsRelease;
@Inject(method = "<init>(Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/network/PacketBuffer;)V", at = @At("RETURN"))
private void markNotOwned(ResourceLocation pIdentifier, PacketBuffer pData, CallbackInfo ci) {
@Inject(method = "<init>(Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/network/FriendlyByteBuf;)V", at = @At("RETURN"))
private void markNotOwned(ResourceLocation pIdentifier, FriendlyByteBuf pData, CallbackInfo ci) {
this.needsRelease = false;
}
@Inject(method = "read", at = @At("RETURN"))
private void markOwned(PacketBuffer p_148837_1_, CallbackInfo ci) {
private void markOwned(FriendlyByteBuf p_148837_1_, CallbackInfo ci) {
this.needsRelease = true;
}
@Redirect(method = "handle(Lnet/minecraft/client/network/play/IClientPlayNetHandler;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/play/IClientPlayNetHandler;handleCustomPayload(Lnet/minecraft/network/play/server/SCustomPayloadPlayPacket;)V"))
private void handleAndFree(IClientPlayNetHandler instance, SCustomPayloadPlayPacket sCustomPayloadPlayPacket) {
@Redirect(method = "handle(Lnet/minecraft/network/protocol/game/ClientGamePacketListener;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/protocol/game/ClientGamePacketListener;handleCustomPayload(Lnet/minecraft/network/protocol/game/ClientboundCustomPayloadPacket;)V"))
private void handleAndFree(ClientGamePacketListener instance, ClientboundCustomPayloadPacket sCustomPayloadPlayPacket) {
try {
instance.handleCustomPayload(sCustomPayloadPlayPacket);
} finally {
PacketBuffer copied = ((IClientNetHandler)instance).getCopiedCustomBuffer();
FriendlyByteBuf copied = ((IClientNetHandler)instance).getCopiedCustomBuffer();
if(copied != null)
copied.release();
}

View File

@ -1,7 +1,7 @@
package org.embeddedt.modernfix.mixin.feature.measure_time;
import com.google.common.base.Stopwatch;
import net.minecraft.util.registry.Bootstrap;
import net.minecraft.server.Bootstrap;
import org.apache.logging.log4j.Logger;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Final;
@ -17,7 +17,7 @@ import java.util.concurrent.TimeUnit;
public class BootstrapMixin {
@Shadow @Final private static Logger LOGGER;
private static Stopwatch startWatch;
@Inject(method = "bootStrap", at = @At(value = "FIELD", opcode = Opcodes.PUTSTATIC, target = "Lnet/minecraft/util/registry/Bootstrap;isBootstrapped:Z", ordinal = 0))
@Inject(method = "bootStrap", at = @At(value = "FIELD", opcode = Opcodes.PUTSTATIC, target = "Lnet/minecraft/server/Bootstrap;isBootstrapped:Z", ordinal = 0))
private static void recordStartTime(CallbackInfo ci) {
startWatch = Stopwatch.createStarted();
}

View File

@ -2,11 +2,11 @@ package org.embeddedt.modernfix.mixin.feature.measure_time;
import com.mojang.datafixers.util.Function4;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.IResourceManager;
import net.minecraft.util.datafix.codec.DatapackCodec;
import net.minecraft.util.registry.DynamicRegistries;
import net.minecraft.world.storage.IServerConfiguration;
import net.minecraft.world.storage.SaveFormat;
import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraft.world.level.DataPackConfig;
import net.minecraft.core.RegistryAccess;
import net.minecraft.world.level.storage.WorldData;
import net.minecraft.world.level.storage.LevelStorageSource;
import org.embeddedt.modernfix.ModernFix;
import org.embeddedt.modernfix.ModernFixClient;
import org.spongepowered.asm.mixin.Mixin;
@ -22,18 +22,18 @@ public class MinecraftMixin {
private long datapackReloadStartTime;
@Inject(method = "makeServerStem", at = @At(value = "HEAD"))
private void recordReloadStart(DynamicRegistries.Impl p_238189_1_, Function<SaveFormat.LevelSave, DatapackCodec> p_238189_2_, Function4<SaveFormat.LevelSave, DynamicRegistries.Impl, IResourceManager, DatapackCodec, IServerConfiguration> p_238189_3_, boolean p_238189_4_, SaveFormat.LevelSave p_238189_5_, CallbackInfoReturnable<Minecraft.PackManager> cir) {
private void recordReloadStart(RegistryAccess.RegistryHolder p_238189_1_, Function<LevelStorageSource.LevelStorageAccess, DataPackConfig> p_238189_2_, Function4<LevelStorageSource.LevelStorageAccess, RegistryAccess.RegistryHolder, ResourceManager, DataPackConfig, WorldData> p_238189_3_, boolean p_238189_4_, LevelStorageSource.LevelStorageAccess p_238189_5_, CallbackInfoReturnable<Minecraft.ServerStem> cir) {
datapackReloadStartTime = System.nanoTime();
}
@Inject(method = "makeServerStem", at = @At(value = "RETURN"))
private void recordReloadEnd(DynamicRegistries.Impl p_238189_1_, Function<SaveFormat.LevelSave, DatapackCodec> p_238189_2_, Function4<SaveFormat.LevelSave, DynamicRegistries.Impl, IResourceManager, DatapackCodec, IServerConfiguration> p_238189_3_, boolean p_238189_4_, SaveFormat.LevelSave p_238189_5_, CallbackInfoReturnable<Minecraft.PackManager> cir) {
private void recordReloadEnd(RegistryAccess.RegistryHolder p_238189_1_, Function<LevelStorageSource.LevelStorageAccess, DataPackConfig> p_238189_2_, Function4<LevelStorageSource.LevelStorageAccess, RegistryAccess.RegistryHolder, ResourceManager, DataPackConfig, WorldData> p_238189_3_, boolean p_238189_4_, LevelStorageSource.LevelStorageAccess p_238189_5_, CallbackInfoReturnable<Minecraft.ServerStem> cir) {
float timeSpentReloading = ((float)(System.nanoTime() - datapackReloadStartTime) / 1000000000f);
ModernFix.LOGGER.warn("Datapack reload took " + timeSpentReloading + " seconds.");
}
@Inject(method = "loadWorld(Ljava/lang/String;Lnet/minecraft/util/registry/DynamicRegistries$Impl;Ljava/util/function/Function;Lcom/mojang/datafixers/util/Function4;ZLnet/minecraft/client/Minecraft$WorldSelectionType;Z)V", at = @At("HEAD"), remap = false)
private void recordWorldLoadStart(String worldName, DynamicRegistries.Impl dynamicRegistries, Function<SaveFormat.LevelSave, DatapackCodec> levelSaveToDatapackFunction, Function4<SaveFormat.LevelSave, DynamicRegistries.Impl, IResourceManager, DatapackCodec, IServerConfiguration> quadFunction, boolean vanillaOnly, Minecraft.WorldSelectionType selectionType, boolean creating, CallbackInfo ci) {
@Inject(method = "loadWorld", at = @At("HEAD"), remap = false)
private void recordWorldLoadStart(String worldName, RegistryAccess.RegistryHolder dynamicRegistries, Function<LevelStorageSource.LevelStorageAccess, DataPackConfig> levelSaveToDatapackFunction, Function4<LevelStorageSource.LevelStorageAccess, RegistryAccess.RegistryHolder, ResourceManager, DataPackConfig, WorldData> quadFunction, boolean vanillaOnly, Minecraft.ExperimentalDialogType selectionType, boolean creating, CallbackInfo ci) {
ModernFixClient.worldLoadStartTime = System.nanoTime();
}
}

View File

@ -1,8 +1,8 @@
package org.embeddedt.modernfix.mixin.feature.reduce_loading_screen_freezes;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.model.ModelBakery;
import net.minecraft.util.Util;
import net.minecraft.client.resources.model.ModelBakery;
import net.minecraft.Util;
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

View File

@ -4,7 +4,7 @@ import mezz.jei.api.ingredients.IIngredientType;
import mezz.jei.api.runtime.IIngredientManager;
import mezz.jei.gui.ingredients.IIngredientListElement;
import mezz.jei.ingredients.IngredientListElementFactory;
import net.minecraft.util.NonNullList;
import net.minecraft.core.NonNullList;
import org.embeddedt.modernfix.jei.async.IAsyncJeiStarter;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

View File

@ -2,7 +2,7 @@ package org.embeddedt.modernfix.mixin.perf.async_jei;
import com.google.common.collect.ImmutableListMultimap;
import mezz.jei.recipes.RecipeManagerInternal;
import net.minecraft.util.ResourceLocation;
import net.minecraft.resources.ResourceLocation;
import org.embeddedt.modernfix.jei.async.IAsyncJeiStarter;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

View File

@ -9,6 +9,6 @@ import java.util.List;
@Mixin(IngredientFilter.class)
public interface IngredientFilterInvoker {
@Invoker
@Invoker(remap = false)
List<IIngredientListElementInfo<?>> invokeGetIngredientListUncached(String filterText);
}

View File

@ -1,7 +1,7 @@
package org.embeddedt.modernfix.mixin.perf.blast_search_trees;
import net.minecraft.client.Minecraft;
import net.minecraft.client.util.SearchTreeManager;
import net.minecraft.client.searchtree.SearchRegistry;
import net.minecraftforge.fml.ModList;
import org.embeddedt.modernfix.searchtree.DummySearchTree;
import org.embeddedt.modernfix.searchtree.JEIBackedSearchTree;
@ -14,18 +14,18 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(Minecraft.class)
public class MinecraftMixin {
@Shadow @Final private SearchTreeManager searchRegistry;
@Shadow @Final private SearchRegistry searchRegistry;
@Inject(method = "createSearchTrees", at = @At("HEAD"), cancellable = true)
private void replaceSearchTrees(CallbackInfo ci) {
ci.cancel();
if(ModList.get().getModFileById("jei") != null) {
this.searchRegistry.register(SearchTreeManager.CREATIVE_NAMES, new JEIBackedSearchTree(false));
this.searchRegistry.register(SearchTreeManager.CREATIVE_TAGS, new JEIBackedSearchTree(true));
this.searchRegistry.register(SearchRegistry.CREATIVE_NAMES, new JEIBackedSearchTree(false));
this.searchRegistry.register(SearchRegistry.CREATIVE_TAGS, new JEIBackedSearchTree(true));
} else {
this.searchRegistry.register(SearchTreeManager.CREATIVE_NAMES, new DummySearchTree<>());
this.searchRegistry.register(SearchTreeManager.CREATIVE_TAGS, new DummySearchTree<>());
this.searchRegistry.register(SearchRegistry.CREATIVE_NAMES, new DummySearchTree<>());
this.searchRegistry.register(SearchRegistry.CREATIVE_TAGS, new DummySearchTree<>());
}
this.searchRegistry.register(SearchTreeManager.RECIPE_COLLECTIONS, new DummySearchTree<>());
this.searchRegistry.register(SearchRegistry.RECIPE_COLLECTIONS, new DummySearchTree<>());
}
}

View File

@ -1,6 +1,6 @@
package org.embeddedt.modernfix.mixin.perf.boost_worker_count;
import net.minecraft.util.Util;
import net.minecraft.Util;
import org.embeddedt.modernfix.ModernFix;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;

View File

@ -1,22 +1,23 @@
package org.embeddedt.modernfix.mixin.perf.cache_blockstate_cache_arrays;
import net.minecraft.util.BlockVoxelShape;
import net.minecraft.util.Direction;
import net.minecraft.world.level.block.SupportType;
import net.minecraft.core.Direction;
import net.minecraft.world.level.block.state.BlockBehaviour;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(targets = { "net/minecraft/block/AbstractBlock$AbstractBlockState$Cache" })
@Mixin(BlockBehaviour.BlockStateBase.Cache.class)
public class AbstractBlockStateCacheMixin {
private static final BlockVoxelShape[] MF_BLOCK_VOXEL_SHAPES = BlockVoxelShape.values();
private static final SupportType[] MF_BLOCK_VOXEL_SHAPES = SupportType.values();
private static final Direction.Axis[] DIRECTION_AXIS_VALUES = Direction.Axis.values();
@Redirect(method = "<init>(Lnet/minecraft/block/BlockState;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/BlockVoxelShape;values()[Lnet/minecraft/util/BlockVoxelShape;"))
private BlockVoxelShape[] getVoxelShapeValues() {
@Redirect(method = "<init>(Lnet/minecraft/world/level/block/state/BlockState;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/SupportType;values()[Lnet/minecraft/world/level/block/SupportType;"))
private SupportType[] getVoxelShapeValues() {
return MF_BLOCK_VOXEL_SHAPES;
}
@Redirect(method = "<init>(Lnet/minecraft/block/BlockState;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Direction$Axis;values()[Lnet/minecraft/util/Direction$Axis;"))
@Redirect(method = "<init>(Lnet/minecraft/world/level/block/state/BlockState;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/core/Direction$Axis;values()[Lnet/minecraft/core/Direction$Axis;"))
private Direction.Axis[] getDirectionAxisValues() {
return DIRECTION_AXIS_VALUES;
}

View File

@ -1,7 +1,7 @@
package org.embeddedt.modernfix.mixin.perf.cache_model_materials;
import net.minecraft.client.renderer.model.multipart.Multipart;
import net.minecraft.util.ResourceLocation;
import net.minecraft.client.renderer.block.model.multipart.MultiPart;
import net.minecraft.resources.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.Collection;
@Mixin(Multipart.class)
@Mixin(MultiPart.class)
public class MultipartMixin {
private Collection<ResourceLocation> dependencyCache = null;
@Inject(method = "getDependencies", at = @At("HEAD"), cancellable = true)

View File

@ -1,12 +1,12 @@
package org.embeddedt.modernfix.mixin.perf.cache_model_materials;
import com.mojang.datafixers.util.Pair;
import net.minecraft.client.renderer.model.BlockModel;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraft.client.renderer.model.RenderMaterial;
import net.minecraft.client.renderer.model.VariantList;
import net.minecraft.client.renderer.model.multipart.Multipart;
import net.minecraft.util.ResourceLocation;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.client.resources.model.Material;
import net.minecraft.client.renderer.block.model.MultiVariant;
import net.minecraft.client.renderer.block.model.multipart.MultiPart;
import net.minecraft.resources.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@ -17,19 +17,19 @@ import java.util.Collections;
import java.util.Set;
import java.util.function.Function;
@Mixin(value = {VariantList.class, Multipart.class, BlockModel.class})
@Mixin(value = {MultiVariant.class, MultiPart.class, BlockModel.class})
public class VanillaModelMixin {
private Collection<RenderMaterial> materialsCache = null;
private Collection<Material> materialsCache = null;
@Inject(method = "getMaterials", at = @At("HEAD"), cancellable = true)
private void useCachedMaterials(Function<ResourceLocation, IUnbakedModel> pModelGetter, Set<Pair<String, String>> pMissingTextureErrors, CallbackInfoReturnable<Collection<RenderMaterial>> cir) {
private void useCachedMaterials(Function<ResourceLocation, UnbakedModel> pModelGetter, Set<Pair<String, String>> pMissingTextureErrors, CallbackInfoReturnable<Collection<Material>> cir) {
if(materialsCache != null) {
cir.setReturnValue(materialsCache);
}
}
@Inject(method = "getMaterials", at = @At("RETURN"))
private void storeCachedMaterials(Function<ResourceLocation, IUnbakedModel> pModelGetter, Set<Pair<String, String>> pMissingTextureErrors, CallbackInfoReturnable<Collection<RenderMaterial>> cir) {
private void storeCachedMaterials(Function<ResourceLocation, UnbakedModel> pModelGetter, Set<Pair<String, String>> pMissingTextureErrors, CallbackInfoReturnable<Collection<Material>> cir) {
if(materialsCache == null)
materialsCache = Collections.unmodifiableCollection(cir.getReturnValue());
}

View File

@ -2,19 +2,19 @@ package org.embeddedt.modernfix.mixin.perf.compress_biome_container;
import it.unimi.dsi.fastutil.objects.Reference2ShortMap;
import it.unimi.dsi.fastutil.objects.Reference2ShortOpenHashMap;
import net.minecraft.util.BitArray;
import net.minecraft.util.IObjectIntIterable;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeContainer;
import net.minecraft.world.biome.provider.BiomeProvider;
import net.minecraft.util.BitStorage;
import net.minecraft.core.IdMap;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.util.Mth;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.chunk.ChunkBiomeContainer;
import net.minecraft.world.level.biome.BiomeSource;
import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(BiomeContainer.class)
@Mixin(ChunkBiomeContainer.class)
public class MixinBiomeContainer {
@Mutable
@Shadow
@ -23,32 +23,32 @@ public class MixinBiomeContainer {
@Shadow
@Final
private IObjectIntIterable<Biome> biomeRegistry;
private IdMap<Biome> biomeRegistry;
@Shadow
@Final
private static int WIDTH_BITS;
private Biome[] palette;
private BitArray intArray;
private BitStorage intArray;
@Inject(method = "<init>(Lnet/minecraft/util/IObjectIntIterable;[I)V", at = @At("RETURN"))
private void reinit1(IObjectIntIterable p_i241970_1_, int[] p_i241970_2_, CallbackInfo ci) {
@Inject(method = "<init>(Lnet/minecraft/core/IdMap;[I)V", at = @At("RETURN"))
private void reinit1(IdMap p_i241970_1_, int[] p_i241970_2_, CallbackInfo ci) {
this.createCompact();
}
@Inject(method = "<init>(Lnet/minecraft/util/IObjectIntIterable;[Lnet/minecraft/world/biome/Biome;)V", at = @At("RETURN"))
private void reinit2(IObjectIntIterable p_i241971_1_, Biome[] p_i241971_2_, CallbackInfo ci) {
@Inject(method = "<init>(Lnet/minecraft/core/IdMap;[Lnet/minecraft/world/level/biome/Biome;)V", at = @At("RETURN"))
private void reinit2(IdMap p_i241971_1_, Biome[] p_i241971_2_, CallbackInfo ci) {
this.createCompact();
}
@Inject(method = "<init>(Lnet/minecraft/util/IObjectIntIterable;Lnet/minecraft/util/math/ChunkPos;Lnet/minecraft/world/biome/provider/BiomeProvider;)V", at = @At("RETURN"))
private void reinit3(IObjectIntIterable p_i241968_1_, ChunkPos p_i241968_2_, BiomeProvider p_i241968_3_, CallbackInfo ci) {
@Inject(method = "<init>(Lnet/minecraft/core/IdMap;Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/world/level/biome/BiomeSource;)V", at = @At("RETURN"))
private void reinit3(IdMap p_i241968_1_, ChunkPos p_i241968_2_, BiomeSource p_i241968_3_, CallbackInfo ci) {
this.createCompact();
}
@Inject(method = "<init>(Lnet/minecraft/util/IObjectIntIterable;Lnet/minecraft/util/math/ChunkPos;Lnet/minecraft/world/biome/provider/BiomeProvider;[I)V", at = @At("RETURN"))
private void reinit4(IObjectIntIterable p_i241969_1_, ChunkPos p_i241969_2_, BiomeProvider p_i241969_3_, int[] p_i241969_4_, CallbackInfo ci) {
@Inject(method = "<init>(Lnet/minecraft/core/IdMap;Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/world/level/biome/BiomeSource;[I)V", at = @At("RETURN"))
private void reinit4(IdMap p_i241969_1_, ChunkPos p_i241969_2_, BiomeSource p_i241969_3_, int[] p_i241969_4_, CallbackInfo ci) {
this.createCompact();
}
@ -64,8 +64,8 @@ public class MixinBiomeContainer {
paletteIndexed[entry.getShortValue()] = entry.getKey();
}
int packedIntSize = Math.max(2, MathHelper.ceillog2(paletteTable.size()));
BitArray integerArray = new BitArray(packedIntSize, BiomeContainer.BIOMES_SIZE);
int packedIntSize = Math.max(2, Mth.ceillog2(paletteTable.size()));
BitStorage integerArray = new BitStorage(packedIntSize, ChunkBiomeContainer.BIOMES_SIZE);
Biome prevBiome = null;
short prevId = -1;
@ -139,9 +139,9 @@ public class MixinBiomeContainer {
*/
@Overwrite
public Biome getNoiseBiome(int biomeX, int biomeY, int biomeZ) {
int x = biomeX & BiomeContainer.HORIZONTAL_MASK;
int y = MathHelper.clamp(biomeY, 0, BiomeContainer.VERTICAL_MASK);
int z = biomeZ & BiomeContainer.HORIZONTAL_MASK;
int x = biomeX & ChunkBiomeContainer.HORIZONTAL_MASK;
int y = Mth.clamp(biomeY, 0, ChunkBiomeContainer.VERTICAL_MASK);
int z = biomeZ & ChunkBiomeContainer.HORIZONTAL_MASK;
return this.palette[this.intArray.get(y << WIDTH_BITS + WIDTH_BITS | z << WIDTH_BITS | x)];
}

View File

@ -1,15 +1,15 @@
package org.embeddedt.modernfix.mixin.perf.datapack_reload_exceptions;
import net.minecraft.loot.LootTableManager;
import net.minecraft.world.level.storage.loot.LootTables;
import org.apache.logging.log4j.Logger;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(LootTableManager.class)
@Mixin(LootTables.class)
public class LootTableManagerMixin {
@Redirect(method = "*(Lnet/minecraft/resources/IResourceManager;Lcom/google/common/collect/ImmutableMap$Builder;Lnet/minecraft/util/ResourceLocation;Lcom/google/gson/JsonElement;)V",
at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V"))
at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V", remap = false))
private void logWithoutStacktrace(Logger instance, String s, Object location, Object exc) {
instance.error(s + ": {}", location, exc.toString());
}

View File

@ -1,6 +1,6 @@
package org.embeddedt.modernfix.mixin.perf.datapack_reload_exceptions;
import net.minecraft.item.crafting.RecipeManager;
import net.minecraft.world.item.crafting.RecipeManager;
import org.apache.logging.log4j.Logger;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@ -8,7 +8,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(RecipeManager.class)
public class RecipeManagerMixin {
@Redirect(method = "apply(Ljava/util/Map;Lnet/minecraft/resources/IResourceManager;Lnet/minecraft/profiler/IProfiler;)V", at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V"))
@Redirect(method = "apply(Ljava/util/Map;Lnet/minecraft/server/packs/resources/ResourceManager;Lnet/minecraft/util/profiling/ProfilerFiller;)V", at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V", remap = false))
private void silenceException(Logger instance, String s, Object location, Object exc) {
instance.error(s + ": {}", location, exc.toString());
}

View File

@ -1,6 +1,6 @@
package org.embeddedt.modernfix.mixin.perf.deduplicate_location;
import net.minecraft.util.ResourceLocation;
import net.minecraft.resources.ResourceLocation;
import org.embeddedt.modernfix.dedup.IdentifierCaches;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;

View File

@ -1,14 +1,13 @@
package org.embeddedt.modernfix.mixin.perf.faster_baking;
import com.mojang.datafixers.util.Pair;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.BlockModelShapes;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ModelManager;
import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.util.Util;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.client.renderer.block.BlockModelShaper;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.client.resources.model.ModelManager;
import net.minecraft.Util;
import net.minecraft.core.Registry;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@ -18,11 +17,11 @@ import java.util.ArrayList;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
@Mixin(BlockModelShapes.class)
@Mixin(BlockModelShaper.class)
public abstract class BlockModelShapesMixin {
@Shadow @Final private ModelManager modelManager;
@Shadow @Final private Map<BlockState, IBakedModel> modelByStateCache;
@Shadow @Final private Map<BlockState, BakedModel> modelByStateCache;
/**
* @author embeddedt
@ -31,16 +30,16 @@ public abstract class BlockModelShapesMixin {
@Overwrite
public void rebuildCache() {
this.modelByStateCache.clear();
ArrayList<CompletableFuture<Pair<BlockState, IBakedModel>>> futures = new ArrayList<>();
ArrayList<CompletableFuture<Pair<BlockState, BakedModel>>> futures = new ArrayList<>();
for(Block block : Registry.BLOCK) {
block.getStateDefinition().getPossibleStates().forEach((state) -> {
futures.add(CompletableFuture.supplyAsync(() -> {
return Pair.of(state, this.modelManager.getModel(BlockModelShapes.stateToModelLocation(state)));
return Pair.of(state, this.modelManager.getModel(BlockModelShaper.stateToModelLocation(state)));
}, Util.backgroundExecutor()));
});
}
for(CompletableFuture<Pair<BlockState, IBakedModel>> future : futures) {
Pair<BlockState, IBakedModel> pair = future.join();
for(CompletableFuture<Pair<BlockState, BakedModel>> future : futures) {
Pair<BlockState, BakedModel> pair = future.join();
this.modelByStateCache.put(pair.getFirst(), pair.getSecond());
}
}

View File

@ -3,28 +3,16 @@ package org.embeddedt.modernfix.mixin.perf.faster_baking;
import com.google.common.collect.ImmutableSet;
import com.mojang.datafixers.util.Pair;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.model.multipart.Multipart;
import net.minecraft.client.renderer.model.multipart.Selector;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.SpriteMap;
import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.client.renderer.texture.AtlasSet;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.profiler.IProfiler;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Util;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.resources.ResourceLocation;
import com.mojang.math.Transformation;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.EventBus;
import net.minecraftforge.eventbus.api.EventListenerHelper;
import net.minecraftforge.eventbus.api.IEventListener;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
import org.apache.commons.lang3.tuple.Triple;
import org.apache.logging.log4j.Logger;
import org.embeddedt.modernfix.ModernFix;
import org.embeddedt.modernfix.ModernFixClient;
import org.embeddedt.modernfix.core.config.ModernFixConfig;
import org.embeddedt.modernfix.duck.IExtendedModelBakery;
import org.embeddedt.modernfix.models.LazyBakedModel;
@ -43,31 +31,40 @@ import java.util.stream.Collectors;
import static org.embeddedt.modernfix.ModernFix.LOGGER;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.client.resources.model.BlockModelRotation;
import net.minecraft.client.resources.model.Material;
import net.minecraft.client.resources.model.ModelBakery;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.client.resources.model.ModelState;
import net.minecraft.client.resources.model.UnbakedModel;
@Mixin(ModelBakery.class)
public abstract class ModelBakeryMixin implements IExtendedModelBakery {
@Shadow @Final private Map<ResourceLocation, IUnbakedModel> topLevelModels;
@Shadow @Final private Map<ResourceLocation, UnbakedModel> topLevelModels;
@Shadow @Final private Map<ResourceLocation, IBakedModel> bakedTopLevelModels;
@Shadow @Final private Map<ResourceLocation, BakedModel> bakedTopLevelModels;
@Shadow @Deprecated @Nullable public abstract IBakedModel bake(ResourceLocation pLocation, IModelTransform pTransform);
@Shadow @Deprecated @Nullable public abstract BakedModel bake(ResourceLocation pLocation, ModelState pTransform);
@Shadow private Map<ResourceLocation, Pair<AtlasTexture, AtlasTexture.SheetData>> atlasPreparations;
@Shadow private Map<ResourceLocation, Pair<TextureAtlas, TextureAtlas.Preparations>> atlasPreparations;
@Shadow @Nullable private SpriteMap atlasSet;
@Shadow @Nullable private AtlasSet atlasSet;
@Shadow @Nullable public abstract IBakedModel getBakedModel(ResourceLocation pLocation, IModelTransform pTransform, Function<RenderMaterial, TextureAtlasSprite> textureGetter);
@Shadow @Nullable public abstract BakedModel getBakedModel(ResourceLocation pLocation, ModelState pTransform, Function<Material, TextureAtlasSprite> textureGetter);
@Shadow @Final public static ModelResourceLocation MISSING_MODEL_LOCATION;
@Shadow @Final private Map<Triple<ResourceLocation, TransformationMatrix, Boolean>, IBakedModel> bakedCache;
@Shadow @Final private Map<Triple<ResourceLocation, Transformation, Boolean>, BakedModel> bakedCache;
@Shadow @Final private Map<ResourceLocation, IUnbakedModel> unbakedCache;
@Shadow @Final private Map<ResourceLocation, UnbakedModel> unbakedCache;
private IBakedModel bakeIfPossible(ResourceLocation p_229350_1_) {
IBakedModel ibakedmodel = null;
private BakedModel bakeIfPossible(ResourceLocation p_229350_1_) {
BakedModel ibakedmodel = null;
try {
ibakedmodel = this.bake(p_229350_1_, ModelRotation.X0_Y0);
ibakedmodel = this.bake(p_229350_1_, BlockModelRotation.X0_Y0);
} catch (Exception exception) {
exception.printStackTrace();
LOGGER.warn("Unable to bake model: '{}': {}", p_229350_1_, exception);
@ -76,27 +73,27 @@ public abstract class ModelBakeryMixin implements IExtendedModelBakery {
return ibakedmodel;
}
private boolean requiresBake(IUnbakedModel model) {
private boolean requiresBake(UnbakedModel model) {
if(model instanceof BlockModel && ((BlockModel)model).customData.hasCustomGeometry())
return true;
else
return false;
}
@Inject(method = "processLoading", at = @At(value = "INVOKE", target = "Lnet/minecraft/profiler/IProfiler;pop()V"))
private void bakeModels(IProfiler pProfiler, int p_i226056_4_, CallbackInfo ci) {
@Inject(method = "processLoading", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiling/ProfilerFiller;pop()V"))
private void bakeModels(ProfilerFiller pProfiler, int p_i226056_4_, CallbackInfo ci) {
pProfiler.popPush("atlas");
Minecraft.getInstance().executeBlocking(() -> {
for(Pair<AtlasTexture, AtlasTexture.SheetData> pair : this.atlasPreparations.values()) {
AtlasTexture atlastexture = pair.getFirst();
AtlasTexture.SheetData atlastexture$sheetdata = pair.getSecond();
for(Pair<TextureAtlas, TextureAtlas.Preparations> pair : this.atlasPreparations.values()) {
TextureAtlas atlastexture = pair.getFirst();
TextureAtlas.Preparations atlastexture$sheetdata = pair.getSecond();
atlastexture.reload(atlastexture$sheetdata);
}
});
pProfiler.popPush("baking");
StartupMessageManager.mcLoaderConsumer().ifPresent(c -> c.accept("Baking models"));
this.atlasSet = new SpriteMap(this.atlasPreparations.values().stream().map(Pair::getFirst).collect(Collectors.toList()));
IBakedModel missingModel = this.bake(MISSING_MODEL_LOCATION, ModelRotation.X0_Y0);
this.atlasSet = new AtlasSet(this.atlasPreparations.values().stream().map(Pair::getFirst).collect(Collectors.toList()));
BakedModel missingModel = this.bake(MISSING_MODEL_LOCATION, BlockModelRotation.X0_Y0);
this.bakedTopLevelModels.put(MISSING_MODEL_LOCATION, missingModel);
Collection<String> modsListening = ModUtil.findAllModsListeningToEvent(ModelBakeEvent.class);
LOGGER.debug("Found ModelBakeEvent listeners: [" + String.join(", ", modsListening) + "]");
@ -113,13 +110,13 @@ public abstract class ModelBakeryMixin implements IExtendedModelBakery {
/* Then store them as top-level models if needed, and set up the lazy models */
this.topLevelModels.forEach((location, value) -> {
if (incompatibleLazyBakedModels.contains(location.getNamespace()) || requiresBake(value)) {
IBakedModel model = this.bakeIfPossible(location);
BakedModel model = this.bakeIfPossible(location);
if (model != null)
this.bakedTopLevelModels.put(location, model);
} else {
this.bakedTopLevelModels.put(location, new LazyBakedModel(() -> {
synchronized (this.bakedCache) {
IBakedModel ibakedmodel = this.bakeIfPossible(location);
BakedModel ibakedmodel = this.bakeIfPossible(location);
return ibakedmodel != null ? ibakedmodel : missingModel;
}
@ -133,11 +130,11 @@ public abstract class ModelBakeryMixin implements IExtendedModelBakery {
* @reason texture loading and baking are moved earlier in the launch process, only render thread stuff is done here
*/
@Overwrite
public SpriteMap uploadTextures(TextureManager pResourceManager, IProfiler pProfiler) {
public AtlasSet uploadTextures(TextureManager pResourceManager, ProfilerFiller pProfiler) {
pProfiler.push("atlas_upload");
for(Pair<AtlasTexture, AtlasTexture.SheetData> pair : this.atlasPreparations.values()) {
AtlasTexture atlastexture = pair.getFirst();
AtlasTexture.SheetData atlastexture$sheetdata = pair.getSecond();
for(Pair<TextureAtlas, TextureAtlas.Preparations> pair : this.atlasPreparations.values()) {
TextureAtlas atlastexture = pair.getFirst();
TextureAtlas.Preparations atlastexture$sheetdata = pair.getSecond();
pResourceManager.register(atlastexture.location(), atlastexture);
pResourceManager.bind(atlastexture.location());
atlastexture.updateFilter(atlastexture$sheetdata);
@ -147,7 +144,7 @@ public abstract class ModelBakeryMixin implements IExtendedModelBakery {
}
@Override
public SpriteMap getUnfinishedAtlasSet() {
public AtlasSet getUnfinishedAtlasSet() {
return this.atlasSet;
}
}

View File

@ -1,17 +1,17 @@
package org.embeddedt.modernfix.mixin.perf.faster_baking;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import net.minecraft.block.BlockState;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BlockModelShapes;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ModelBakery;
import net.minecraft.client.renderer.model.ModelManager;
import net.minecraft.client.renderer.texture.SpriteMap;
import net.minecraft.client.renderer.block.BlockModelShaper;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.client.resources.model.ModelBakery;
import net.minecraft.client.resources.model.ModelManager;
import net.minecraft.client.renderer.texture.AtlasSet;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.profiler.IProfiler;
import net.minecraft.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import org.embeddedt.modernfix.duck.IExtendedModelBakery;
@ -31,20 +31,20 @@ import java.util.Map;
@Mixin(ModelManager.class)
public class ModelManagerMixin {
@Shadow @Nullable private SpriteMap atlases;
@Shadow @Nullable private AtlasSet atlases;
@Shadow private Map<ResourceLocation, IBakedModel> bakedRegistry;
@Shadow private Map<ResourceLocation, BakedModel> bakedRegistry;
@Shadow private Object2IntMap<BlockState> modelGroups;
@Shadow @Final private TextureManager textureManager;
@Shadow private IBakedModel missingModel;
@Shadow private BakedModel missingModel;
@Shadow @Final private BlockModelShapes blockModelShaper;
@Shadow @Final private BlockModelShaper blockModelShaper;
@Inject(method = "prepare(Lnet/minecraft/resources/IResourceManager;Lnet/minecraft/profiler/IProfiler;)Lnet/minecraft/client/renderer/model/ModelBakery;", at = @At(value = "INVOKE", target = "Lnet/minecraft/profiler/IProfiler;endTick()V"), locals = LocalCapture.CAPTURE_FAILHARD)
private void fireModelBakeEvent(IResourceManager pResourceManager, IProfiler pProfiler, CallbackInfoReturnable<ModelBakery> cir, ModelLoader pObject) {
@Inject(method = "prepare(Lnet/minecraft/server/packs/resources/ResourceManager;Lnet/minecraft/util/profiling/ProfilerFiller;)Lnet/minecraft/client/resources/model/ModelBakery;", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiling/ProfilerFiller;endTick()V"), locals = LocalCapture.CAPTURE_FAILHARD)
private void fireModelBakeEvent(ResourceManager pResourceManager, ProfilerFiller pProfiler, CallbackInfoReturnable<ModelBakery> cir, ModelLoader pObject) {
pProfiler.push("modelevent");
if (this.atlases != null) {
Minecraft.getInstance().executeBlocking(() -> {
@ -66,7 +66,7 @@ public class ModelManagerMixin {
* @reason most of the code is moved to prepare()
*/
@Overwrite
protected void apply(ModelBakery pObject, IResourceManager pResourceManager, IProfiler pProfiler) {
protected void apply(ModelBakery pObject, ResourceManager pResourceManager, ProfilerFiller pProfiler) {
pProfiler.startTick();
pProfiler.push("upload");
this.atlases = pObject.uploadTextures(this.textureManager, pProfiler);

View File

@ -1,11 +1,11 @@
package org.embeddedt.modernfix.mixin.perf.flatten_model_predicates;
import com.google.common.collect.Streams;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.model.multipart.AndCondition;
import net.minecraft.client.renderer.model.multipart.ICondition;
import net.minecraft.state.StateContainer;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.client.renderer.block.model.multipart.AndCondition;
import net.minecraft.client.renderer.block.model.multipart.Condition;
import net.minecraft.world.level.block.state.StateDefinition;
import org.embeddedt.modernfix.predicate.StatePropertyPredicateHelper;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
@ -17,14 +17,14 @@ import java.util.stream.Collectors;
@Mixin(AndCondition.class)
public class AndConditionMixin {
@Shadow @Final private Iterable<? extends ICondition> conditions;
@Shadow @Final private Iterable<? extends Condition> conditions;
/**
* @author JellySquid
* @reason Flatten predicates
*/
@Overwrite
public Predicate<BlockState> getPredicate(StateContainer<Block, BlockState> stateManager) {
public Predicate<BlockState> getPredicate(StateDefinition<Block, BlockState> stateManager) {
return StatePropertyPredicateHelper.allMatch(Streams.stream(this.conditions).map((multipartModelSelector) -> {
return multipartModelSelector.getPredicate(stateManager);
}).collect(Collectors.toList()));

View File

@ -1,11 +1,11 @@
package org.embeddedt.modernfix.mixin.perf.flatten_model_predicates;
import com.google.common.collect.Streams;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.model.multipart.ICondition;
import net.minecraft.client.renderer.model.multipart.OrCondition;
import net.minecraft.state.StateContainer;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.client.renderer.block.model.multipart.Condition;
import net.minecraft.client.renderer.block.model.multipart.OrCondition;
import net.minecraft.world.level.block.state.StateDefinition;
import org.embeddedt.modernfix.predicate.StatePropertyPredicateHelper;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
@ -17,14 +17,14 @@ import java.util.stream.Collectors;
@Mixin(OrCondition.class)
public class OrConditionMixin {
@Shadow @Final private Iterable<? extends ICondition> conditions;
@Shadow @Final private Iterable<? extends Condition> conditions;
/**
* @author JellySquid
* @reason Flatten predicates
*/
@Overwrite
public Predicate<BlockState> getPredicate(StateContainer<Block, BlockState> stateManager) {
public Predicate<BlockState> getPredicate(StateDefinition<Block, BlockState> stateManager) {
return StatePropertyPredicateHelper.anyMatch(Streams.stream(this.conditions).map((multipartModelSelector) -> {
return multipartModelSelector.getPredicate(stateManager);
}).collect(Collectors.toList()));

View File

@ -1,11 +1,11 @@
package org.embeddedt.modernfix.mixin.perf.flatten_model_predicates;
import com.google.common.base.Splitter;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.model.multipart.PropertyValueCondition;
import net.minecraft.state.Property;
import net.minecraft.state.StateContainer;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.client.renderer.block.model.multipart.KeyValueCondition;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.block.state.StateDefinition;
import org.embeddedt.modernfix.predicate.single.SingleMatchAny;
import org.embeddedt.modernfix.predicate.single.SingleMatchOne;
import org.spongepowered.asm.mixin.Final;
@ -17,7 +17,7 @@ import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@Mixin(PropertyValueCondition.class)
@Mixin(KeyValueCondition.class)
public class PropertyValueConditionMixin {
@Shadow @Final private String key;
@ -30,7 +30,7 @@ public class PropertyValueConditionMixin {
* @reason De-duplication
*/
@Overwrite
public Predicate<BlockState> getPredicate(StateContainer<Block, BlockState> stateManager) {
public Predicate<BlockState> getPredicate(StateDefinition<Block, BlockState> stateManager) {
Property<?> property = stateManager.getProperty(this.key);
if (property == null) {
@ -63,7 +63,7 @@ public class PropertyValueConditionMixin {
return negate ? predicate.negate() : predicate;
}
private Object getPropertyValue(StateContainer<Block, BlockState> stateFactory, Property<?> property, String valueString) {
private Object getPropertyValue(StateDefinition<Block, BlockState> stateFactory, Property<?> property, String valueString) {
Object value = property.getValue(valueString)
.orElse(null);

View File

@ -1,12 +1,12 @@
package org.embeddedt.modernfix.mixin.perf.nuke_empty_chunk_sections;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.palette.UpgradeData;
import net.minecraft.world.ITickList;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeContainer;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ChunkSection;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.chunk.UpgradeData;
import net.minecraft.world.level.TickList;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.chunk.ChunkBiomeContainer;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.chunk.LevelChunkSection;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@ -16,21 +16,18 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.function.Consumer;
@Mixin(Chunk.class)
@Mixin(LevelChunk.class)
public class MixinChunk {
@Shadow @Final private ChunkSection[] sections;
@Shadow @Final private LevelChunkSection[] sections;
@Inject(method = "<init>(Lnet/minecraft/world/World;" +
"Lnet/minecraft/util/math/ChunkPos;Lnet/minecraft/world/biome/BiomeContainer;" +
"Lnet/minecraft/util/palette/UpgradeData;Lnet/minecraft/world/ITickList;" +
"Lnet/minecraft/world/ITickList;J[Lnet/minecraft/world/chunk/ChunkSection;Ljava/util/function/Consumer;)V",
@Inject(method = "<init>(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/world/level/chunk/ChunkBiomeContainer;Lnet/minecraft/world/level/chunk/UpgradeData;Lnet/minecraft/world/level/TickList;Lnet/minecraft/world/level/TickList;J[Lnet/minecraft/world/level/chunk/LevelChunkSection;Ljava/util/function/Consumer;)V",
at = @At("RETURN"))
private void reinit(World world, ChunkPos pos, BiomeContainer container, UpgradeData data,
ITickList list1, ITickList list2, long inhabited,
ChunkSection[] oldSections, Consumer consumer, CallbackInfo ci) {
private void reinit(Level world, ChunkPos pos, ChunkBiomeContainer container, UpgradeData data,
TickList list1, TickList list2, long inhabited,
LevelChunkSection[] oldSections, Consumer consumer, CallbackInfo ci) {
/* taken from Hydrogen */
for(int i = 0; i < this.sections.length; i++) {
if(ChunkSection.isEmpty(this.sections[i])) {
if(LevelChunkSection.isEmpty(this.sections[i])) {
this.sections[i] = null;
}
}

View File

@ -1,7 +1,7 @@
package org.embeddedt.modernfix.mixin.perf.parallelize_model_loading;
import com.google.common.collect.ImmutableSet;
import net.minecraft.state.BooleanProperty;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@ -12,7 +12,7 @@ public class BooleanPropertyMixin {
* There is no point comparing the immutable sets in any two instances of this class, as they will always be
* the same.
*/
@Redirect(method = "equals", at = @At(value = "INVOKE", target = "Lcom/google/common/collect/ImmutableSet;equals(Ljava/lang/Object;)Z"))
@Redirect(method = "equals", at = @At(value = "INVOKE", target = "Lcom/google/common/collect/ImmutableSet;equals(Ljava/lang/Object;)Z", remap = false))
private boolean skipEqualityCheck(ImmutableSet instance, Object object) {
return true;
}

View File

@ -1,16 +1,15 @@
package org.embeddedt.modernfix.mixin.perf.parallelize_model_loading;
import com.mojang.datafixers.util.Pair;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.model.*;
import net.minecraft.profiler.IProfiler;
import net.minecraft.resources.IResource;
import net.minecraft.resources.IResourceManager;
import net.minecraft.state.StateContainer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Util;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.server.packs.resources.Resource;
import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.Util;
import net.minecraft.core.Registry;
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
import org.embeddedt.modernfix.ModernFix;
import org.embeddedt.modernfix.util.AsyncStopwatch;
@ -31,25 +30,29 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.stream.Stream;
import net.minecraft.client.renderer.block.model.BlockModelDefinition;
import net.minecraft.client.resources.model.ModelBakery;
import net.minecraft.client.resources.model.ModelResourceLocation;
@Mixin(ModelBakery.class)
public abstract class ModelBakeryMixin {
@Shadow @Final protected IResourceManager resourceManager;
@Shadow @Final protected ResourceManager resourceManager;
private Map<ResourceLocation, List<Pair<String, BlockModelDefinition>>> deserializedBlockstateCache = null;
@Inject(method = "processLoading", at = @At(value = "INVOKE", target = "Lnet/minecraft/profiler/IProfiler;popPush(Ljava/lang/String;)V", ordinal = 0))
private void preloadJsonModels(IProfiler profilerIn, int maxMipmapLevel, CallbackInfo ci) {
@Inject(method = "processLoading", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiling/ProfilerFiller;popPush(Ljava/lang/String;)V", ordinal = 0))
private void preloadJsonModels(ProfilerFiller profilerIn, int maxMipmapLevel, CallbackInfo ci) {
StartupMessageManager.mcLoaderConsumer().ifPresent(c -> c.accept("Loading models"));
profilerIn.popPush("loadblockstates");
AsyncStopwatch.measureAndLogSerialRunningTime("Parallel blockstate loading", () -> {
ThreadLocal<BlockModelDefinition.ContainerHolder> containerHolder = ThreadLocal.withInitial(BlockModelDefinition.ContainerHolder::new);
ThreadLocal<BlockModelDefinition.Context> containerHolder = ThreadLocal.withInitial(BlockModelDefinition.Context::new);
this.deserializedBlockstateCache = new ConcurrentHashMap<>();
ArrayList<CompletableFuture<Void>> futures = new ArrayList<>();
for(Block block : Registry.BLOCK) {
ResourceLocation blockLocation = Registry.BLOCK.getKey(block);
futures.add(CompletableFuture.runAsync(() -> {
ResourceLocation blockStateJSON = new ResourceLocation(blockLocation.getNamespace(), "blockstates/" + blockLocation.getPath() + ".json");
List<IResource> blockStates;
List<Resource> blockStates;
try {
blockStates = this.resourceManager.getResources(blockStateJSON);
} catch(IOException e) {
@ -57,10 +60,10 @@ public abstract class ModelBakeryMixin {
return;
}
List<Pair<String, BlockModelDefinition>> definitions = new ArrayList<>();
StateContainer<Block, BlockState> stateContainer = block.getStateDefinition();
BlockModelDefinition.ContainerHolder context = containerHolder.get();
StateDefinition<Block, BlockState> stateContainer = block.getStateDefinition();
BlockModelDefinition.Context context = containerHolder.get();
context.setDefinition(stateContainer);
for(IResource resource : blockStates) {
for(Resource resource : blockStates) {
try (InputStream inputstream = resource.getInputStream()) {
BlockModelDefinition definition = BlockModelDefinition.fromStream(context, new InputStreamReader(inputstream, StandardCharsets.UTF_8));
definitions.add(Pair.of(resource.getSourceName(), definition));
@ -77,14 +80,14 @@ public abstract class ModelBakeryMixin {
}
@Inject(method = "processLoading", at = @At("RETURN"), remap = false)
private void clearModelCache(IProfiler profilerIn, int maxMipmapLevel, CallbackInfo ci) {
private void clearModelCache(ProfilerFiller profilerIn, int maxMipmapLevel, CallbackInfo ci) {
deserializedBlockstateCache.clear();
}
private List<?> replacementList = null;
@Redirect(method = "loadModel", at = @At(value = "INVOKE", target = "Lnet/minecraft/resources/IResourceManager;getResources(Lnet/minecraft/util/ResourceLocation;)Ljava/util/List;", ordinal = 0))
private List<?> getResourceList(IResourceManager instance, ResourceLocation jsonLocation, ResourceLocation originalBlockLocation) throws IOException {
@Redirect(method = "loadModel", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/packs/resources/ResourceManager;getResources(Lnet/minecraft/resources/ResourceLocation;)Ljava/util/List;", ordinal = 0))
private List<?> getResourceList(ResourceManager instance, ResourceLocation jsonLocation, ResourceLocation originalBlockLocation) throws IOException {
replacementList = null;
if(this.deserializedBlockstateCache != null) {
if(!(originalBlockLocation instanceof ModelResourceLocation)) {

View File

@ -1,6 +1,6 @@
package org.embeddedt.modernfix.mixin.perf.parallelize_model_loading;
import net.minecraft.util.ResourceLocation;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.client.model.obj.MaterialLibrary;
import net.minecraftforge.client.model.obj.OBJLoader;
import net.minecraftforge.client.model.obj.OBJModel;

View File

@ -1,6 +1,6 @@
package org.embeddedt.modernfix.mixin.perf.parallelize_model_loading;
import net.minecraft.state.Property;
import net.minecraft.world.level.block.state.properties.Property;
import org.embeddedt.modernfix.dedup.IdentifierCaches;
import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.injection.At;
@ -17,7 +17,7 @@ public class PropertyMixin {
@Shadow @Final private Class clazz;
@Redirect(method = "<init>", at = @At(value = "FIELD", target = "Lnet/minecraft/state/Property;name:Ljava/lang/String;"))
@Redirect(method = "<init>", at = @At(value = "FIELD", target = "Lnet/minecraft/world/level/block/state/properties/Property;name:Ljava/lang/String;"))
private void internName(Property instance, String name) {
this.name = IdentifierCaches.PROPERTY.deduplicate(name);
}

View File

@ -1,10 +1,10 @@
package org.embeddedt.modernfix.mixin.perf.parallelize_model_loading;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.model.multipart.Selector;
import net.minecraft.state.StateContainer;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.client.renderer.block.model.multipart.Selector;
import net.minecraft.world.level.block.state.StateDefinition;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@ -15,16 +15,16 @@ import java.util.function.Predicate;
@Mixin(Selector.class)
public class SelectorMixin {
private ConcurrentHashMap<StateContainer<Block, BlockState>, Predicate<BlockState>> predicateCache = new ConcurrentHashMap<>();
private ConcurrentHashMap<StateDefinition<Block, BlockState>, Predicate<BlockState>> predicateCache = new ConcurrentHashMap<>();
@Inject(method = "getPredicate", at = @At("HEAD"), cancellable = true)
private void useCachedPredicate(StateContainer<Block, BlockState> pState, CallbackInfoReturnable<Predicate<BlockState>> cir) {
private void useCachedPredicate(StateDefinition<Block, BlockState> pState, CallbackInfoReturnable<Predicate<BlockState>> cir) {
Predicate<BlockState> cached = this.predicateCache.get(pState);
if(cached != null)
cir.setReturnValue(cached);
}
@Inject(method = "getPredicate", at = @At("RETURN"))
private void storeCachedPredicate(StateContainer<Block, BlockState> pState, CallbackInfoReturnable<Predicate<BlockState>> cir) {
private void storeCachedPredicate(StateDefinition<Block, BlockState> pState, CallbackInfoReturnable<Predicate<BlockState>> cir) {
this.predicateCache.put(pState, cir.getReturnValue());
}
}

View File

@ -1,7 +1,7 @@
package org.embeddedt.modernfix.mixin.perf.parallelize_model_loading;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.TransformationMatrix;
import com.mojang.math.Matrix4f;
import com.mojang.math.Transformation;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.Shadow;
import java.util.Objects;
@Mixin(TransformationMatrix.class)
@Mixin(Transformation.class)
public class TransformationMatrixMixin {
@Shadow @Final private Matrix4f matrix;
private Integer cachedHashCode = null;

View File

@ -1,6 +1,6 @@
package org.embeddedt.modernfix.mixin.perf.parallelize_model_loading.multipart;
import net.minecraft.client.renderer.model.multipart.Multipart;
import net.minecraft.client.renderer.block.model.multipart.MultiPart;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@ -8,7 +8,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
import java.util.List;
import java.util.stream.Stream;
@Mixin(Multipart.class)
@Mixin(MultiPart.class)
public class MultipartMixin {
@Redirect(method = "getMaterials", at = @At(value = "INVOKE", target = "Ljava/util/List;stream()Ljava/util/stream/Stream;", ordinal = 0))
private Stream makeStreamParallel(List instance) {

View File

@ -1,11 +1,11 @@
package org.embeddedt.modernfix.mixin.perf.parallelize_model_loading.multipart;
import com.mojang.datafixers.util.Pair;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraft.client.renderer.model.RenderMaterial;
import net.minecraft.client.renderer.model.Variant;
import net.minecraft.client.renderer.model.VariantList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.client.resources.model.Material;
import net.minecraft.client.renderer.block.model.Variant;
import net.minecraft.client.renderer.block.model.MultiVariant;
import net.minecraft.resources.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
@ -16,7 +16,7 @@ import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
@Mixin(VariantList.class)
@Mixin(MultiVariant.class)
public abstract class VariantListMixin {
@Shadow public abstract List<Variant> getVariants();
@ -25,8 +25,8 @@ public abstract class VariantListMixin {
* @reason Parallelize calls to getMaterials
*/
@Overwrite
public Collection<RenderMaterial> getMaterials(Function<ResourceLocation, IUnbakedModel> pModelGetter, Set<Pair<String, String>> pMissingTextureErrors) {
List<IUnbakedModel> models = this.getVariants().stream().map(Variant::getModelLocation).distinct().map(pModelGetter).collect(Collectors.toList());
public Collection<Material> getMaterials(Function<ResourceLocation, UnbakedModel> pModelGetter, Set<Pair<String, String>> pMissingTextureErrors) {
List<UnbakedModel> models = this.getVariants().stream().map(Variant::getModelLocation).distinct().map(pModelGetter).collect(Collectors.toList());
return models.parallelStream().flatMap(model -> model.getMaterials(pModelGetter, pMissingTextureErrors).stream()).collect(Collectors.toSet());
}
}

View File

@ -1,7 +1,7 @@
package org.embeddedt.modernfix.mixin.perf.reduce_blockstate_cache_rebuilds;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.registries.IForgeRegistryInternal;
import net.minecraftforge.registries.RegistryManager;
import org.embeddedt.modernfix.blockstate.BlockStateCacheHandler;
@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(targets = { "net/minecraftforge/registries/GameData$BlockCallbacks" })
public class BlockCallbacksMixin {
@Redirect(method = "onBake", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;initCache()V"))
@Redirect(method = "onBake", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/BlockState;initCache()V"), remap = false)
private void skipCache(BlockState instance) {
}

View File

@ -1,6 +1,6 @@
package org.embeddedt.modernfix.mixin.perf.reduce_blockstate_cache_rebuilds;
import net.minecraft.block.Blocks;
import net.minecraft.world.level.block.Blocks;
import org.embeddedt.modernfix.blockstate.BlockStateCacheHandler;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

View File

@ -1,7 +1,7 @@
package org.embeddedt.modernfix.mixin.perf.reduce_blockstate_cache_rebuilds;
import com.google.common.collect.Multimap;
import net.minecraft.util.ResourceLocation;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.registries.ForgeRegistry;
import net.minecraftforge.registries.GameData;
import org.embeddedt.modernfix.util.BakeReason;

View File

@ -1,8 +1,8 @@
package org.embeddedt.modernfix.mixin.perf.reduce_blockstate_cache_rebuilds;
import com.refinedmods.refinedstorage.block.shape.ShapeCache;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.embeddedt.modernfix.ModernFix;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;

View File

@ -1,7 +1,7 @@
package org.embeddedt.modernfix.mixin.perf.remove_biome_temperature_cache;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.biome.Biome;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.biome.Biome;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;

View File

@ -1,8 +1,8 @@
package org.embeddedt.modernfix.mixin.perf.resourcepacks;
import com.google.common.base.Joiner;
import net.minecraft.resources.ResourcePackType;
import net.minecraft.util.ResourceLocation;
import net.minecraft.server.packs.PackType;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
import net.minecraftforge.fml.packs.ModFileResourcePack;
import org.embeddedt.modernfix.ModernFix;
@ -28,11 +28,11 @@ import java.util.stream.Stream;
@Mixin(ModFileResourcePack.class)
public abstract class ModFileResourcePackMixin {
@Shadow public abstract Set<String> getNamespaces(ResourcePackType type);
@Shadow public abstract Set<String> getNamespaces(PackType type);
@Shadow(remap = false) @Final private ModFile modFile;
private EnumMap<ResourcePackType, Set<String>> namespacesByType;
private EnumMap<ResourcePackType, HashMap<String, List<Path>>> rootListingByNamespaceAndType;
private EnumMap<PackType, Set<String>> namespacesByType;
private EnumMap<PackType, HashMap<String, List<Path>>> rootListingByNamespaceAndType;
private Set<String> containedPaths;
private boolean useNamespaceCaches;
private FileSystem resourcePackFS;
@ -42,14 +42,14 @@ public abstract class ModFileResourcePackMixin {
private void cacheResources(ModFile modFile, CallbackInfo ci) {
this.resourcePackFS = modFile.getLocator().findPath(modFile, "").getFileSystem();
this.useNamespaceCaches = false;
this.namespacesByType = new EnumMap<>(ResourcePackType.class);
for(ResourcePackType type : ResourcePackType.values()) {
this.namespacesByType = new EnumMap<>(PackType.class);
for(PackType type : PackType.values()) {
this.namespacesByType.put(type, this.getNamespaces(type));
}
this.useNamespaceCaches = true;
this.rootListingByNamespaceAndType = new EnumMap<>(ResourcePackType.class);
this.rootListingByNamespaceAndType = new EnumMap<>(PackType.class);
this.containedPaths = new HashSet<>();
for(ResourcePackType type : ResourcePackType.values()) {
for(PackType type : PackType.values()) {
Set<String> namespaces = this.namespacesByType.get(type);
HashMap<String, List<Path>> rootListingForNamespaces = new HashMap<>();
for(String namespace : namespaces) {
@ -88,7 +88,7 @@ public abstract class ModFileResourcePackMixin {
}
@Inject(method = "getNamespaces", at = @At("HEAD"), cancellable = true)
private void useCacheForNamespaces(ResourcePackType type, CallbackInfoReturnable<Set<String>> cir) {
private void useCacheForNamespaces(PackType type, CallbackInfoReturnable<Set<String>> cir) {
if(useNamespaceCaches) {
cir.setReturnValue(this.namespacesByType.get(type));
}
@ -104,7 +104,7 @@ public abstract class ModFileResourcePackMixin {
* @reason Use cached listing of mod resources
*/
@Overwrite
public Collection<ResourceLocation> getResources(ResourcePackType type, String resourceNamespace, String pathIn, int maxDepth, Predicate<String> filter)
public Collection<ResourceLocation> getResources(PackType type, String resourceNamespace, String pathIn, int maxDepth, Predicate<String> filter)
{
Path inputPath = this.resourcePackFS.getPath(pathIn);
return this.rootListingByNamespaceAndType.get(type).getOrDefault(resourceNamespace, Collections.emptyList()).stream().

View File

@ -4,9 +4,9 @@ import com.google.common.base.Joiner;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import net.minecraft.resources.ResourcePackType;
import net.minecraft.resources.VanillaPack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.VanillaPackResources;
import net.minecraft.resources.ResourceLocation;
import org.apache.commons.lang3.tuple.Pair;
import org.embeddedt.modernfix.FileWalker;
import org.embeddedt.modernfix.ModernFix;
@ -26,9 +26,9 @@ import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.stream.Stream;
@Mixin(VanillaPack.class)
@Mixin(VanillaPackResources.class)
public class VanillaPackMixin {
@Shadow @Final private static Map<ResourcePackType, FileSystem> JAR_FILESYSTEM_BY_TYPE;
@Shadow @Final private static Map<PackType, FileSystem> JAR_FILESYSTEM_BY_TYPE;
private static LoadingCache<Pair<Path, Integer>, List<Path>> pathStreamLoadingCache = CacheBuilder.newBuilder()
.build(FileWalker.INSTANCE);
@ -40,7 +40,7 @@ public class VanillaPackMixin {
return;
containedPaths = new HashSet<>();
Joiner slashJoiner = Joiner.on('/');
for(ResourcePackType type : ResourcePackType.values()) {
for(PackType type : PackType.values()) {
FileSystem fs = JAR_FILESYSTEM_BY_TYPE.get(type);
if(fs == null)
throw new IllegalStateException("No filesystem for vanilla " + type.name() + " assets");
@ -70,7 +70,7 @@ public class VanillaPackMixin {
}
@Inject(method = "hasResource", at = @At(value = "INVOKE", target = "Ljava/lang/Class;getResource(Ljava/lang/String;)Ljava/net/URL;"), cancellable = true)
private void useCacheForExistence(ResourcePackType type, ResourceLocation location, CallbackInfoReturnable<Boolean> cir) {
private void useCacheForExistence(PackType type, ResourceLocation location, CallbackInfoReturnable<Boolean> cir) {
cir.setReturnValue(containedPaths.contains(type.getDirectory() + "/" + location.getNamespace() + "/" + location.getPath()));
}
}

View File

@ -1,9 +1,9 @@
package org.embeddedt.modernfix.mixin.perf.skip_first_datapack_reload;
import net.minecraft.client.Minecraft;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.world.storage.SaveFormat;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtIo;
import net.minecraft.world.level.storage.LevelStorageSource;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import org.embeddedt.modernfix.ModernFix;
import org.embeddedt.modernfix.duck.ILevelSave;
@ -14,15 +14,15 @@ import org.spongepowered.asm.mixin.Shadow;
import java.nio.file.Path;
@Mixin(SaveFormat.LevelSave.class)
@Mixin(LevelStorageSource.LevelStorageAccess.class)
public class LevelSaveMixin implements ILevelSave {
@Shadow @Final private Path levelPath;
public void runWorldPersistenceHooks(SaveFormat format) {
public void runWorldPersistenceHooks(LevelStorageSource format) {
((SaveFormatAccessor)format).invokeReadLevelData(this.levelPath.toFile(), (file, dataFixer) -> {
try {
CompoundNBT compoundTag = CompressedStreamTools.readCompressed(file);
net.minecraftforge.fml.WorldPersistenceHooks.handleWorldDataLoad((SaveFormat.LevelSave)(Object)this, new DummyServerConfiguration(), compoundTag);
CompoundTag compoundTag = NbtIo.readCompressed(file);
net.minecraftforge.fml.WorldPersistenceHooks.handleWorldDataLoad((LevelStorageSource.LevelStorageAccess)(Object)this, new DummyServerConfiguration(), compoundTag);
} catch (Exception e) {
ModernFix.LOGGER.error("Exception reading {}", file, e);
}

View File

@ -2,11 +2,11 @@ package org.embeddedt.modernfix.mixin.perf.skip_first_datapack_reload;
import com.mojang.datafixers.util.Function4;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.IResourceManager;
import net.minecraft.util.datafix.codec.DatapackCodec;
import net.minecraft.util.registry.DynamicRegistries;
import net.minecraft.world.storage.IServerConfiguration;
import net.minecraft.world.storage.SaveFormat;
import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraft.world.level.DataPackConfig;
import net.minecraft.core.RegistryAccess;
import net.minecraft.world.level.storage.WorldData;
import net.minecraft.world.level.storage.LevelStorageSource;
import org.embeddedt.modernfix.ModernFix;
import org.embeddedt.modernfix.ModernFixClient;
import org.embeddedt.modernfix.duck.ILevelSave;
@ -24,17 +24,17 @@ import java.util.function.Function;
@Mixin(Minecraft.class)
public abstract class MinecraftMixin {
@Shadow public abstract Minecraft.PackManager makeServerStem(DynamicRegistries.Impl dynamicRegistries, Function<SaveFormat.LevelSave, DatapackCodec> worldStorageToDatapackFunction, Function4<SaveFormat.LevelSave, DynamicRegistries.Impl, IResourceManager, DatapackCodec, IServerConfiguration> quadFunction, boolean vanillaOnly, SaveFormat.LevelSave worldStorage) throws InterruptedException, ExecutionException;
@Shadow public abstract Minecraft.ServerStem makeServerStem(RegistryAccess.RegistryHolder dynamicRegistries, Function<LevelStorageSource.LevelStorageAccess, DataPackConfig> worldStorageToDatapackFunction, Function4<LevelStorageSource.LevelStorageAccess, RegistryAccess.RegistryHolder, ResourceManager, DataPackConfig, WorldData> quadFunction, boolean vanillaOnly, LevelStorageSource.LevelStorageAccess worldStorage) throws InterruptedException, ExecutionException;
@Shadow @Final private SaveFormat levelSource;
@Shadow @Final private LevelStorageSource levelSource;
@Redirect(method = "loadLevel(Ljava/lang/String;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/registry/DynamicRegistries;builtin()Lnet/minecraft/util/registry/DynamicRegistries$Impl;"))
private DynamicRegistries.Impl useNullRegistry() {
@Redirect(method = "loadLevel(Ljava/lang/String;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/core/RegistryAccess;builtin()Lnet/minecraft/core/RegistryAccess$RegistryHolder;"))
private RegistryAccess.RegistryHolder useNullRegistry() {
return null;
}
@Redirect(method = "loadWorld(Ljava/lang/String;Lnet/minecraft/util/registry/DynamicRegistries$Impl;Ljava/util/function/Function;Lcom/mojang/datafixers/util/Function4;ZLnet/minecraft/client/Minecraft$WorldSelectionType;Z)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;makeServerStem(Lnet/minecraft/util/registry/DynamicRegistries$Impl;Ljava/util/function/Function;Lcom/mojang/datafixers/util/Function4;ZLnet/minecraft/world/storage/SaveFormat$LevelSave;)Lnet/minecraft/client/Minecraft$PackManager;", ordinal = 0))
private Minecraft.PackManager skipFirstReload(Minecraft client, DynamicRegistries.Impl dynamicRegistries, Function<SaveFormat.LevelSave, DatapackCodec> worldStorageToDatapackFunction, Function4<SaveFormat.LevelSave, DynamicRegistries.Impl, IResourceManager, DatapackCodec, IServerConfiguration> quadFunction, boolean vanillaOnly, SaveFormat.LevelSave levelSave, String worldName, DynamicRegistries.Impl originalRegistries, Function<SaveFormat.LevelSave, DatapackCodec> levelSaveToDatapackFunction, Function4<SaveFormat.LevelSave, DynamicRegistries.Impl, IResourceManager, DatapackCodec, IServerConfiguration> quadFunction2, boolean vanillaOnly2, Minecraft.WorldSelectionType selectionType, boolean creating) throws InterruptedException, ExecutionException {
@Redirect(method = "loadWorld", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;makeServerStem(Lnet/minecraft/core/RegistryAccess$RegistryHolder;Ljava/util/function/Function;Lcom/mojang/datafixers/util/Function4;ZLnet/minecraft/world/level/storage/LevelStorageSource$LevelStorageAccess;)Lnet/minecraft/client/Minecraft$ServerStem;", ordinal = 0))
private Minecraft.ServerStem skipFirstReload(Minecraft client, RegistryAccess.RegistryHolder dynamicRegistries, Function<LevelStorageSource.LevelStorageAccess, DataPackConfig> worldStorageToDatapackFunction, Function4<LevelStorageSource.LevelStorageAccess, RegistryAccess.RegistryHolder, ResourceManager, DataPackConfig, WorldData> quadFunction, boolean vanillaOnly, LevelStorageSource.LevelStorageAccess levelSave, String worldName, RegistryAccess.RegistryHolder originalRegistries, Function<LevelStorageSource.LevelStorageAccess, DataPackConfig> levelSaveToDatapackFunction, Function4<LevelStorageSource.LevelStorageAccess, RegistryAccess.RegistryHolder, ResourceManager, DataPackConfig, WorldData> quadFunction2, boolean vanillaOnly2, Minecraft.ExperimentalDialogType selectionType, boolean creating) throws InterruptedException, ExecutionException {
if(!creating) {
ModernFix.LOGGER.warn("Skipping first reload, this is still experimental");
ModernFix.runningFirstInjection = true;

View File

@ -1,14 +1,14 @@
package org.embeddedt.modernfix.mixin.perf.skip_first_datapack_reload;
import com.mojang.datafixers.DataFixer;
import net.minecraft.world.storage.SaveFormat;
import net.minecraft.world.level.storage.LevelStorageSource;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
import java.io.File;
import java.util.function.BiFunction;
@Mixin(SaveFormat.class)
@Mixin(LevelStorageSource.class)
public interface SaveFormatAccessor {
@Invoker
<T> T invokeReadLevelData(File saveDir, BiFunction<File, DataFixer, T> levelDatReader);

View File

@ -3,14 +3,14 @@ package org.embeddedt.modernfix.mixin.perf.thread_priorities;
import com.mojang.authlib.GameProfileRepository;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.DataPackRegistries;
import net.minecraft.resources.ResourcePackList;
import net.minecraft.server.integrated.IntegratedServer;
import net.minecraft.server.management.PlayerProfileCache;
import net.minecraft.util.registry.DynamicRegistries;
import net.minecraft.world.chunk.listener.IChunkStatusListenerFactory;
import net.minecraft.world.storage.IServerConfiguration;
import net.minecraft.world.storage.SaveFormat;
import net.minecraft.server.ServerResources;
import net.minecraft.server.packs.repository.PackRepository;
import net.minecraft.client.server.IntegratedServer;
import net.minecraft.server.players.GameProfileCache;
import net.minecraft.core.RegistryAccess;
import net.minecraft.server.level.progress.ChunkProgressListenerFactory;
import net.minecraft.world.level.storage.WorldData;
import net.minecraft.world.level.storage.LevelStorageSource;
import org.embeddedt.modernfix.ModernFix;
import org.embeddedt.modernfix.core.config.ModernFixConfig;
import org.spongepowered.asm.mixin.Mixin;
@ -21,7 +21,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(IntegratedServer.class)
public class IntegratedServerMixin {
@Inject(method = "<init>", at = @At("RETURN"))
private void adjustServerPriority(Thread pServerThread, Minecraft pMinecraft, DynamicRegistries.Impl pRegistryHolder, SaveFormat.LevelSave pStorageSource, ResourcePackList pPackRepository, DataPackRegistries pResources, IServerConfiguration pWorldData, MinecraftSessionService pSessionService, GameProfileRepository pProfileRepository, PlayerProfileCache pProfileCache, IChunkStatusListenerFactory pProgressListenerfactory, CallbackInfo ci) {
private void adjustServerPriority(Thread pServerThread, Minecraft pMinecraft, RegistryAccess.RegistryHolder pRegistryHolder, LevelStorageSource.LevelStorageAccess pStorageSource, PackRepository pPackRepository, ServerResources pResources, WorldData pWorldData, MinecraftSessionService pSessionService, GameProfileRepository pProfileRepository, GameProfileCache pProfileCache, ChunkProgressListenerFactory pProgressListenerfactory, CallbackInfo ci) {
int pri = ModernFixConfig.INTEGRATED_SERVER_PRIORITY.get();
ModernFix.LOGGER.info("Changing server thread priority to " + pri);
pServerThread.setPriority(pri);

View File

@ -1,6 +1,6 @@
package org.embeddedt.modernfix.mixin.perf.thread_priorities;
import net.minecraft.util.Util;
import net.minecraft.Util;
import org.embeddedt.modernfix.ModernFix;
import org.embeddedt.modernfix.core.config.ModernFixConfig;
import org.spongepowered.asm.mixin.Mixin;

View File

@ -1,9 +1,9 @@
package org.embeddedt.modernfix.mixin.safety;
import net.minecraft.block.Block;
import net.minecraft.world.level.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.color.block.BlockColors;
import net.minecraft.client.color.block.BlockColor;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@ -16,11 +16,11 @@ import java.util.concurrent.locks.ReentrantLock;
public class BlockColorsMixin {
private Lock mapLock = new ReentrantLock();
@Inject(method = "register", at = @At("HEAD"))
private void lockMapBeforeAccess(IBlockColor pBlockColor, Block[] pBlocks, CallbackInfo ci) {
private void lockMapBeforeAccess(BlockColor pBlockColor, Block[] pBlocks, CallbackInfo ci) {
mapLock.lock();
}
@Inject(method = "register", at = @At("TAIL"))
private void unlockMap(IBlockColor pBlockColor, Block[] pBlocks, CallbackInfo ci) {
private void unlockMap(BlockColor pBlockColor, Block[] pBlocks, CallbackInfo ci) {
mapLock.unlock();
}
}

View File

@ -1,18 +1,18 @@
package org.embeddedt.modernfix.models;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.datafixers.util.Pair;
import net.minecraft.block.BlockState;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.client.renderer.block.model.ItemTransforms;
import net.minecraft.client.renderer.block.model.ItemOverrides;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockDisplayReader;
import net.minecraft.world.item.ItemStack;
import net.minecraft.core.Direction;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraftforge.client.model.data.EmptyModelData;
import net.minecraftforge.client.model.data.IModelData;
import org.embeddedt.modernfix.ModernFix;
@ -23,9 +23,9 @@ import java.util.List;
import java.util.Random;
import java.util.function.Supplier;
public class LazyBakedModel implements IBakedModel {
private IBakedModel delegate = null;
private Supplier<IBakedModel> delegateSupplier;
public class LazyBakedModel implements BakedModel {
private BakedModel delegate = null;
private Supplier<BakedModel> delegateSupplier;
/**
* This flag is changed to true when we should bake instead of returning reasonable defaults for certain
@ -33,11 +33,11 @@ public class LazyBakedModel implements IBakedModel {
*/
public static boolean allowBakeForFlags = false;
public LazyBakedModel(Supplier<IBakedModel> delegateSupplier) {
public LazyBakedModel(Supplier<BakedModel> delegateSupplier) {
this.delegateSupplier = delegateSupplier;
}
public IBakedModel computeDelegate() {
public BakedModel computeDelegate() {
if(this.delegate == null) {
this.delegate = this.delegateSupplier.get();
this.delegateSupplier = null;
@ -80,17 +80,17 @@ public class LazyBakedModel implements IBakedModel {
}
@Override
public ItemCameraTransforms getTransforms() {
public ItemTransforms getTransforms() {
return computeDelegate().getTransforms();
}
@Override
public ItemOverrideList getOverrides() {
public ItemOverrides getOverrides() {
return computeDelegate().getOverrides();
}
@Override
public IBakedModel getBakedModel() {
public BakedModel getBakedModel() {
return computeDelegate().getBakedModel();
}
@ -111,13 +111,13 @@ public class LazyBakedModel implements IBakedModel {
}
@Override
public IBakedModel handlePerspective(ItemCameraTransforms.TransformType cameraTransformType, MatrixStack mat) {
public BakedModel handlePerspective(ItemTransforms.TransformType cameraTransformType, PoseStack mat) {
return computeDelegate().handlePerspective(cameraTransformType, mat);
}
@Nonnull
@Override
public IModelData getModelData(@Nonnull IBlockDisplayReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData) {
public IModelData getModelData(@Nonnull BlockAndTintGetter world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData) {
return computeDelegate().getModelData(world, pos, state, tileData);
}
@ -132,7 +132,7 @@ public class LazyBakedModel implements IBakedModel {
}
@Override
public List<Pair<IBakedModel, RenderType>> getLayerModels(ItemStack itemStack, boolean fabulous) {
public List<Pair<BakedModel, RenderType>> getLayerModels(ItemStack itemStack, boolean fabulous) {
return computeDelegate().getLayerModels(itemStack, fabulous);
}
}

View File

@ -1,7 +1,7 @@
package org.embeddedt.modernfix.predicate;
import me.jellysquid.mods.hydrogen.common.state.all.AllMatchOneBoolean;
import net.minecraft.block.BlockState;
import net.minecraft.world.level.block.state.BlockState;
import org.embeddedt.modernfix.predicate.all.AllMatchOneBoolean;
import org.embeddedt.modernfix.predicate.all.AllMatchOneObject;
import org.embeddedt.modernfix.predicate.any.AllMatchAnyObject;
import org.embeddedt.modernfix.predicate.single.SingleMatchAny;

View File

@ -1,7 +1,7 @@
package me.jellysquid.mods.hydrogen.common.state.all;
package org.embeddedt.modernfix.predicate.all;
import net.minecraft.block.BlockState;
import net.minecraft.state.Property;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.Property;
import org.embeddedt.modernfix.predicate.single.SingleMatchOne;
import java.util.List;

View File

@ -1,7 +1,7 @@
package org.embeddedt.modernfix.predicate.all;
import net.minecraft.block.BlockState;
import net.minecraft.state.Property;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.Property;
import org.embeddedt.modernfix.predicate.single.SingleMatchOne;
import java.util.List;

View File

@ -1,7 +1,7 @@
package org.embeddedt.modernfix.predicate.any;
import net.minecraft.block.BlockState;
import net.minecraft.state.Property;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.Property;
import org.apache.commons.lang3.ArrayUtils;
import org.embeddedt.modernfix.predicate.single.SingleMatchAny;

View File

@ -1,8 +1,8 @@
package org.embeddedt.modernfix.predicate.single;
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
import net.minecraft.block.BlockState;
import net.minecraft.state.Property;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.Property;
import org.apache.commons.lang3.ArrayUtils;
import java.util.Arrays;

View File

@ -1,7 +1,7 @@
package org.embeddedt.modernfix.predicate.single;
import net.minecraft.block.BlockState;
import net.minecraft.state.Property;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.Property;
import java.util.List;
import java.util.function.Predicate;

View File

@ -1,7 +1,7 @@
package org.embeddedt.modernfix.registry;
import com.google.common.base.Stopwatch;
import net.minecraft.util.ResourceLocation;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.fml.ModWorkManager;
import org.embeddedt.modernfix.ModernFix;
import org.embeddedt.modernfix.util.AsyncStopwatch;

View File

@ -1,19 +1,16 @@
package org.embeddedt.modernfix.searchtree;
import net.minecraft.client.util.IMutableSearchTree;
import net.minecraft.client.util.SearchTree;
import net.minecraft.client.util.SearchTreeReloadable;
import net.minecraft.util.ResourceLocation;
import net.minecraft.client.searchtree.MutableSearchTree;
import net.minecraft.client.searchtree.ReloadableIdSearchTree;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Stream;
/**
* Dummy search tree that stores nothing and returns nothing on searches.
*/
public class DummySearchTree<T> extends SearchTreeReloadable<T> implements IMutableSearchTree<T> {
public class DummySearchTree<T> extends ReloadableIdSearchTree<T> implements MutableSearchTree<T> {
public DummySearchTree() {
super(t -> Stream.empty());
}

View File

@ -4,7 +4,7 @@ import mezz.jei.Internal;
import mezz.jei.ingredients.IIngredientListElementInfo;
import mezz.jei.ingredients.IngredientFilter;
import mezz.jei.runtime.JeiRuntime;
import net.minecraft.item.ItemStack;
import net.minecraft.world.item.ItemStack;
import org.embeddedt.modernfix.mixin.perf.blast_search_trees.IngredientFilterInvoker;
import java.util.ArrayList;

View File

@ -1,8 +1,8 @@
package org.embeddedt.modernfix.util;
import com.google.common.base.Stopwatch;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.Block;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.ModWorkManager;
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
@ -22,7 +22,7 @@ public class BlockClassPreloader {
Stopwatch stopwatch = Stopwatch.createStarted();
ModernFix.LOGGER.warn("Preparing to preload classes...");
HashMap<Type, Boolean> isABlockClass = new HashMap<>();
isABlockClass.put(Type.getType(AbstractBlock.class), true);
isABlockClass.put(Type.getType(BlockBehaviour.class), true);
isABlockClass.put(Type.getType(Block.class), true);
Field selfField, parentField;
List<CompletableFuture> futures = new ArrayList<>();
@ -37,7 +37,7 @@ public class BlockClassPreloader {
.flatMap(data -> data.getClasses().stream())
.collect(Collectors.toList());
HashSet<Type> blockClasses = new HashSet<>();
blockClasses.add(Type.getType(AbstractBlock.class));
blockClasses.add(Type.getType(BlockBehaviour.class));
HashSet<Type> nonBlockClasses = new HashSet<>();
int previousSize = -1;
nonBlockClasses.add(Type.getType(Object.class));

View File

@ -2,28 +2,28 @@ package org.embeddedt.modernfix.util;
import com.google.common.collect.ImmutableSet;
import com.mojang.serialization.Lifecycle;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.datafix.codec.DatapackCodec;
import net.minecraft.util.registry.DynamicRegistries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.DataPackConfig;
import net.minecraft.core.RegistryAccess;
import net.minecraft.world.Difficulty;
import net.minecraft.world.GameRules;
import net.minecraft.world.GameType;
import net.minecraft.world.WorldSettings;
import net.minecraft.world.gen.settings.DimensionGeneratorSettings;
import net.minecraft.world.storage.IServerConfiguration;
import net.minecraft.world.storage.IServerWorldInfo;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.GameType;
import net.minecraft.world.level.LevelSettings;
import net.minecraft.world.level.levelgen.WorldGenSettings;
import net.minecraft.world.level.storage.WorldData;
import net.minecraft.world.level.storage.ServerLevelData;
import javax.annotation.Nullable;
import java.util.Set;
public class DummyServerConfiguration implements IServerConfiguration {
public class DummyServerConfiguration implements WorldData {
@Override
public DatapackCodec getDataPackConfig() {
return DatapackCodec.DEFAULT;
public DataPackConfig getDataPackConfig() {
return DataPackConfig.DEFAULT;
}
@Override
public void setDataPackConfig(DatapackCodec codec) {
public void setDataPackConfig(DataPackConfig codec) {
}
@ -44,27 +44,27 @@ public class DummyServerConfiguration implements IServerConfiguration {
@Nullable
@Override
public CompoundNBT getCustomBossEvents() {
public CompoundTag getCustomBossEvents() {
return null;
}
@Override
public void setCustomBossEvents(@Nullable CompoundNBT nbt) {
public void setCustomBossEvents(@Nullable CompoundTag nbt) {
}
@Override
public IServerWorldInfo overworldData() {
public ServerLevelData overworldData() {
return null;
}
@Override
public WorldSettings getLevelSettings() {
public LevelSettings getLevelSettings() {
return null;
}
@Override
public CompoundNBT createTag(DynamicRegistries registries, @Nullable CompoundNBT hostPlayerNBT) {
public CompoundTag createTag(RegistryAccess registries, @Nullable CompoundTag hostPlayerNBT) {
return null;
}
@ -124,22 +124,22 @@ public class DummyServerConfiguration implements IServerConfiguration {
}
@Override
public CompoundNBT getLoadedPlayerTag() {
public CompoundTag getLoadedPlayerTag() {
return null;
}
@Override
public CompoundNBT endDragonFightData() {
public CompoundTag endDragonFightData() {
return null;
}
@Override
public void setEndDragonFightData(CompoundNBT nbt) {
public void setEndDragonFightData(CompoundTag nbt) {
}
@Override
public DimensionGeneratorSettings worldGenSettings() {
public WorldGenSettings worldGenSettings() {
return null;
}

View File

@ -1,6 +1,6 @@
public net.minecraft.client.Minecraft$WorldSelectionType
public net.minecraft.client.renderer.RenderType$Type
public net.minecraft.client.renderer.RenderType$Type <init>(Ljava/lang/String;Lnet/minecraft/client/renderer/vertex/VertexFormat;IIZZLnet/minecraft/client/renderer/RenderType$State;)V
public net.minecraft.block.AbstractBlock$AbstractBlockState$Cache
public net.minecraft.util.math.shapes.VoxelShape <init>(Lnet/minecraft/util/math/shapes/VoxelShapePart;)V # <init>
public net.minecraft.client.renderer.model.ModelBakery$BlockStateDefinitionException
public net.minecraft.client.Minecraft$ExperimentalDialogType
public net.minecraft.client.renderer.RenderType$CompositeRenderType
public net.minecraft.client.renderer.RenderType$CompositeRenderType <init>(Ljava/lang/String;Lcom/mojang/blaze3d/vertex/VertexFormat;IIZZLnet/minecraft/client/renderer/RenderType$CompositeState;)V
public net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase$Cache
public net.minecraft.world.phys.shapes.VoxelShape <init>(Lnet/minecraft/util/math/shapes/VoxelShapePart;)V # <init>
public net.minecraft.client.resources.model.ModelBakery$BlockStateDefinitionException