From bcac60fab544b190ee3d6eb21d399a2935799d8f Mon Sep 17 00:00:00 2001 From: Codex Date: Sun, 26 Apr 2026 14:40:26 +0200 Subject: [PATCH] Port WorldHandler to NeoForge 21.1.225 --- build.gradle | 57 +++++----- gradle.properties | 9 +- gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle | 6 +- .../exopandora/worldhandler/WorldHandler.java | 104 ++++++++---------- .../builder/argument/Arguments.java | 5 +- .../argument/BlockPredicateArgument.java | 4 +- .../builder/argument/BlockStateArgument.java | 6 +- .../builder/argument/EffectArgument.java | 6 +- .../argument/EntitySummonArgument.java | 60 +++++----- .../builder/argument/ItemArgument.java | 8 +- .../argument/ItemPredicateArgument.java | 4 +- .../argument/tag/AbstractAttributeTag.java | 4 +- .../argument/tag/AbstractEffectTag.java | 4 +- .../argument/tag/AttributeModifiersTag.java | 4 +- .../builder/argument/tag/AttributesTag.java | 4 +- .../worldhandler/command/CommandWH.java | 6 +- .../command/CommandWorldHandler.java | 4 +- .../worldhandler/config/Config.java | 10 +- .../config/ConfigCategoryButcher.java | 10 +- .../config/ConfigCategorySettings.java | 10 +- .../config/ConfigCategorySkin.java | 10 +- .../config/ConfigCategorySliders.java | 6 +- .../event/ClientEventHandler.java | 14 +-- .../worldhandler/event/KeyHandler.java | 4 +- .../worldhandler/gui/category/Categories.java | 2 +- .../worldhandler/gui/category/Category.java | 36 +++--- .../worldhandler/gui/content/Content.java | 30 +++-- .../worldhandler/gui/content/Contents.java | 2 +- .../gui/content/impl/ContentButcher.java | 6 +- .../content/impl/ContentButcherPresets.java | 10 +- .../content/impl/ContentButcherSettings.java | 8 +- .../gui/content/impl/ContentCommandStack.java | 12 +- .../gui/content/impl/ContentCustomItem.java | 4 +- .../gui/content/impl/ContentLocate.java | 4 +- .../gui/content/impl/ContentNoteEditor.java | 2 +- .../gui/content/impl/ContentPotions.java | 14 +-- .../impl/ContentScoreboardObjectives.java | 12 +- .../gui/content/impl/ContentSummon.java | 26 ++--- .../widget/button/LogicSliderAttribute.java | 4 +- .../usercontent/factory/WidgetFactory.java | 4 +- .../worldhandler/util/AdvancementHelper.java | 3 +- .../util/BlockPredicateParser.java | 6 +- .../util/ItemPredicateParser.java | 4 +- .../worldhandler/util/NBTHelper.java | 4 +- .../worldhandler/util/RegistryHelper.java | 2 +- .../worldhandler/util/ResourceHelper.java | 6 +- .../worldhandler/util/ScoreboardHelper.java | 6 +- .../worldhandler/util/TranslationHelper.java | 27 +++-- .../resources/META-INF/accesstransformer.cfg | 22 ++-- .../{mods.toml => neoforge.mods.toml} | 11 +- 51 files changed, 309 insertions(+), 319 deletions(-) rename src/main/resources/META-INF/{mods.toml => neoforge.mods.toml} (81%) diff --git a/build.gradle b/build.gradle index 5c7835b..5b75f14 100644 --- a/build.gradle +++ b/build.gradle @@ -1,53 +1,57 @@ plugins { id 'java' id 'eclipse' - id 'net.minecraftforge.gradle' version '[6.0.16,6.2)' + id 'net.neoforged.moddev' version '2.0.141' id 'me.hypherionmc.cursegradle' version '2.+' } -archivesBaseName = "${mod_name}-${minecraft_version}" +archivesBaseName = "${mod_name}-${minecraft_version}-neoforge" version = mod_version java.toolchain.languageVersion = JavaLanguageVersion.of(21) javadoc.options.addStringOption('Xdoclint:none', '-quiet') println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + ' (' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) -minecraft { - mappings channel: 'official', version: minecraft_version - accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') +neoForge { + version = neo_version + accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg') runs { - configureEach { - workingDirectory project.file('run') - } - client { - taskName "${project.name}Client" + client() + gameDirectory = project.file('run') + systemProperty 'neoforge.enabledGameTestNamespaces', mod_id } server { - taskName "${project.name}Server" + server() + gameDirectory = project.file('run') + programArgument '--nogui' + systemProperty 'neoforge.enabledGameTestNamespaces', mod_id } gameTestServer { - taskName "${project.name}GameTest" - property 'forge.enabledGameTestNamespaces', mod_id + type = "gameTestServer" + gameDirectory = project.file('run') + systemProperty 'neoforge.enabledGameTestNamespaces', mod_id } data { - workingDirectory project.file('run-data') - taskName "${project.name}Data" - args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') + data() + gameDirectory = project.file('run-data') + programArguments.addAll '--mod', mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath() + } + } + + mods { + "${mod_id}" { + sourceSet(sourceSets.main) } } } sourceSets.main.resources { srcDir 'src/generated/resources' } -dependencies { - minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" -} - tasks.named('jar', Jar).configure { manifest { attributes([ @@ -70,9 +74,9 @@ tasks.named('processResources', ProcessResources).configure { from sourceSets.main.resources - filesMatching(['META-INF/mods.toml']) { - expand project.properties - } + filesMatching(['META-INF/neoforge.mods.toml']) { + expand project.properties + } } tasks.withType(JavaCompile).configureEach { @@ -86,16 +90,15 @@ curseforge { changelog = file('changelog.txt').canRead() ? file('changelog.txt').text : '' changelogType = 'text' releaseType = 'release' - addGameVersion 'Forge' - forge_compatible_minecraft_versions.split(",").each { + addGameVersion 'NeoForge' + neoforge_compatible_minecraft_versions.split(",").each { addGameVersion(it) } mainArtifact(jar) { - displayName = "${minecraft_version}-${mod_version} Universal" + displayName = "${minecraft_version}-${mod_version} NeoForge" } } options { javaVersionAutoDetect = false - forgeGradleIntegration = false } } diff --git a/gradle.properties b/gradle.properties index 7229ad5..acc88f6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,15 +1,16 @@ # WorldHandler mod_id = worldhandler mod_name = WorldHandler -mod_version = 3.5.2 +mod_version = 3.5.2-neoforge minecraft_version = 1.21.1 group = exopandora.worldhandler main_class = exopandora.worldhandler.Main author = Exopandora -# Forge -forge_version = 52.1.14 -forge_compatible_minecraft_versions = 1.21.1 +# NeoForge +neo_version = 21.1.225 +loader_version_range = [4,) +neoforge_compatible_minecraft_versions = 1.21.1 # Publishing curse_project_id = 228970 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 309b4e1..9bf7bd3 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle index 63367e0..0f2b9d9 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,14 +2,14 @@ pluginManagement { repositories { gradlePluginPortal() maven { - name = 'MinecraftForge' - url = 'https://maven.minecraftforge.net/' + name = 'NeoForge' + url = 'https://maven.neoforged.net/releases' } } } plugins { - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0' + id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0' } rootProject.name = 'WorldHandler' diff --git a/src/main/java/exopandora/worldhandler/WorldHandler.java b/src/main/java/exopandora/worldhandler/WorldHandler.java index f767458..e61f3e2 100644 --- a/src/main/java/exopandora/worldhandler/WorldHandler.java +++ b/src/main/java/exopandora/worldhandler/WorldHandler.java @@ -10,26 +10,23 @@ import exopandora.worldhandler.event.ClientEventHandler; import exopandora.worldhandler.event.KeyHandler; import exopandora.worldhandler.gui.category.Category; import exopandora.worldhandler.gui.content.Content; -import exopandora.worldhandler.usercontent.UsercontentLoader; -import exopandora.worldhandler.util.AdvancementHelper; -import exopandora.worldhandler.util.CommandHelper; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.client.event.RegisterClientCommandsEvent; -import net.minecraftforge.client.event.RegisterClientReloadListenersEvent; -import net.minecraftforge.client.event.RegisterKeyMappingsEvent; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.fml.DistExecutor.SafeRunnable; -import net.minecraftforge.fml.IExtensionPoint.DisplayTest; -import net.minecraftforge.fml.ModLoadingContext; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.config.ModConfig.Type; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.fml.loading.FMLPaths; +import exopandora.worldhandler.usercontent.UsercontentLoader; +import exopandora.worldhandler.util.AdvancementHelper; +import exopandora.worldhandler.util.CommandHelper; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.ModContainer; +import net.neoforged.fml.common.Mod; +import net.neoforged.fml.config.ModConfig.Type; +import net.neoforged.neoforge.client.event.RegisterClientCommandsEvent; +import net.neoforged.neoforge.client.event.RegisterClientReloadListenersEvent; +import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; +import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; +import net.neoforged.fml.loading.FMLEnvironment; +import net.neoforged.fml.loading.FMLPaths; @Mod(Main.MODID) public class WorldHandler @@ -37,44 +34,37 @@ public class WorldHandler public static final Logger LOGGER = LogManager.getLogger(); public static final Path USERCONTENT_PATH = FMLPaths.CONFIGDIR.get().resolve(Main.MODID).resolve("usercontent"); - public WorldHandler() - { - IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); - ModLoadingContext modLoadingContext = ModLoadingContext.get(); - DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> new SafeRunnable() - { - @Override - public void run() - { - Config.setupDirectories(WorldHandler.USERCONTENT_PATH); - modLoadingContext.registerConfig(Type.CLIENT, Config.CLIENT_SPEC, Main.MODID + "/" + Main.MODID + ".toml"); - UsercontentLoader.load(WorldHandler.USERCONTENT_PATH); - modEventBus.addListener(WorldHandler.this::registerKeyMappingsEvent); - modEventBus.addListener(WorldHandler.this::registerClientReloadListeners); - modEventBus.addListener(Content::createRegistry); - modEventBus.addListener(Category::createRegistry); - modEventBus.addListener(Content::register); - modEventBus.addListener(Category::register); - } - }); - modLoadingContext.registerExtensionPoint(DisplayTest.class, () -> new DisplayTest(() -> "ANY", (remote, isServer) -> true)); - modEventBus.addListener(this::clientSetup); - modEventBus.addListener(this::commonSetup); - } + public WorldHandler(IEventBus modEventBus, ModContainer modContainer) + { + if(Dist.CLIENT.equals(FMLEnvironment.dist)) + { + Config.setupDirectories(WorldHandler.USERCONTENT_PATH); + modContainer.registerConfig(Type.CLIENT, Config.CLIENT_SPEC, Main.MODID + "/" + Main.MODID + ".toml"); + UsercontentLoader.load(WorldHandler.USERCONTENT_PATH); + modEventBus.addListener(WorldHandler.this::registerKeyMappingsEvent); + modEventBus.addListener(WorldHandler.this::registerClientReloadListeners); + modEventBus.addListener(Content::createRegistry); + modEventBus.addListener(Category::createRegistry); + modEventBus.addListener(Content::register); + modEventBus.addListener(Category::register); + } + modEventBus.addListener(this::clientSetup); + modEventBus.addListener(this::commonSetup); + } + + @SubscribeEvent + public void clientSetup(FMLClientSetupEvent event) + { + NeoForge.EVENT_BUS.addListener(KeyHandler::keyInputEvent); + NeoForge.EVENT_BUS.addListener(ClientEventHandler::renderLevelStageEvent); + NeoForge.EVENT_BUS.addListener(ClientEventHandler::clientTickEvent); + } @SubscribeEvent - public void clientSetup(FMLClientSetupEvent event) - { - MinecraftForge.EVENT_BUS.addListener(KeyHandler::keyInputEvent); - MinecraftForge.EVENT_BUS.addListener(ClientEventHandler::renderLevelStageEvent); - MinecraftForge.EVENT_BUS.addListener(ClientEventHandler::clientTickEvent); - } - - @SubscribeEvent - public void commonSetup(FMLCommonSetupEvent event) - { - MinecraftForge.EVENT_BUS.addListener(this::registerCommands); - } + public void commonSetup(FMLCommonSetupEvent event) + { + NeoForge.EVENT_BUS.addListener(this::registerCommands); + } @SubscribeEvent public void registerKeyMappingsEvent(RegisterKeyMappingsEvent event) @@ -95,4 +85,4 @@ public class WorldHandler { event.registerReloadListener(AdvancementHelper.getInstance()); } -} \ No newline at end of file +} diff --git a/src/main/java/exopandora/worldhandler/builder/argument/Arguments.java b/src/main/java/exopandora/worldhandler/builder/argument/Arguments.java index 8b97e16..913eaf3 100644 --- a/src/main/java/exopandora/worldhandler/builder/argument/Arguments.java +++ b/src/main/java/exopandora/worldhandler/builder/argument/Arguments.java @@ -1,6 +1,7 @@ package exopandora.worldhandler.builder.argument; import java.util.function.Function; +import java.util.Locale; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -262,8 +263,8 @@ public class Arguments public static PrimitiveArgument anchor() { - return PrimitiveArgument.builder(string -> EnumHelper.find(string, Anchor.values(), anchor -> anchor.name)) - .serializer(anchor -> anchor.name) + return PrimitiveArgument.builder(Anchor::getByName) + .serializer(anchor -> anchor.name().toLowerCase(Locale.ROOT)) .build(); } diff --git a/src/main/java/exopandora/worldhandler/builder/argument/BlockPredicateArgument.java b/src/main/java/exopandora/worldhandler/builder/argument/BlockPredicateArgument.java index 69dd815..177c14b 100644 --- a/src/main/java/exopandora/worldhandler/builder/argument/BlockPredicateArgument.java +++ b/src/main/java/exopandora/worldhandler/builder/argument/BlockPredicateArgument.java @@ -16,7 +16,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.Property; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public class BlockPredicateArgument extends TagArgument { @@ -38,7 +38,7 @@ public class BlockPredicateArgument extends TagArgument { if(state != null) { - this.resource = ForgeRegistries.BLOCKS.getKey(state.getBlock()); + this.resource = BuiltInRegistries.BLOCK.getKey(state.getBlock()); this.properties = propertiesToString(state.getValues()); } else diff --git a/src/main/java/exopandora/worldhandler/builder/argument/BlockStateArgument.java b/src/main/java/exopandora/worldhandler/builder/argument/BlockStateArgument.java index 051dd09..8fead4d 100644 --- a/src/main/java/exopandora/worldhandler/builder/argument/BlockStateArgument.java +++ b/src/main/java/exopandora/worldhandler/builder/argument/BlockStateArgument.java @@ -9,7 +9,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public class BlockStateArgument extends TagArgument { @@ -24,7 +24,7 @@ public class BlockStateArgument extends TagArgument { if(block != null) { - this.set(ForgeRegistries.BLOCKS.getValue(block)); + this.set(BuiltInRegistries.BLOCK.get(block)); } else { @@ -104,7 +104,7 @@ public class BlockStateArgument extends TagArgument StringBuilder builder = new StringBuilder(this.state.toString()); String block = this.state.getBlock().toString(); - builder.replace(0, block.length(), ForgeRegistries.BLOCKS.getKey(this.state.getBlock()).toString()); + builder.replace(0, block.length(), BuiltInRegistries.BLOCK.getKey(this.state.getBlock()).toString()); String nbt = super.serialize(); if(nbt != null && this.state.hasBlockEntity()) diff --git a/src/main/java/exopandora/worldhandler/builder/argument/EffectArgument.java b/src/main/java/exopandora/worldhandler/builder/argument/EffectArgument.java index 33c0d92..7d4d5d6 100644 --- a/src/main/java/exopandora/worldhandler/builder/argument/EffectArgument.java +++ b/src/main/java/exopandora/worldhandler/builder/argument/EffectArgument.java @@ -5,7 +5,7 @@ import javax.annotation.Nullable; import exopandora.worldhandler.util.ResourceHelper; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.effect.MobEffect; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public class EffectArgument implements IDeserializableArgument { @@ -25,7 +25,7 @@ public class EffectArgument implements IDeserializableArgument { if(effect != null) { - this.set(ForgeRegistries.MOB_EFFECTS.getValue(effect)); + this.set(BuiltInRegistries.MOB_EFFECT.get(effect)); } else { @@ -54,7 +54,7 @@ public class EffectArgument implements IDeserializableArgument return null; } - return ForgeRegistries.MOB_EFFECTS.getKey(this.effect).toString(); + return BuiltInRegistries.MOB_EFFECT.getKey(this.effect).toString(); } @Override diff --git a/src/main/java/exopandora/worldhandler/builder/argument/EntitySummonArgument.java b/src/main/java/exopandora/worldhandler/builder/argument/EntitySummonArgument.java index 6a563b2..d9c49a1 100644 --- a/src/main/java/exopandora/worldhandler/builder/argument/EntitySummonArgument.java +++ b/src/main/java/exopandora/worldhandler/builder/argument/EntitySummonArgument.java @@ -10,38 +10,38 @@ import exopandora.worldhandler.util.ResourceHelper; import net.minecraft.Util; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public class EntitySummonArgument implements IDeserializableArgument { private static final Map ALIASES = Util.make(new HashMap(), map -> { - map.put("RedCow", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.MOOSHROOM)); - map.put("ChickenJockey", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.CHICKEN)); - map.put("Pigman", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.PIGLIN)); - map.put("ZombiePig", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.PIGLIN)); - map.put("ZombiePigman", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.PIGLIN)); - map.put("Dog", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.WOLF)); - map.put("Dragon", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.ENDER_DRAGON)); - map.put("SnowMan", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.SNOW_GOLEM)); - map.put("LavaCube", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.MAGMA_CUBE)); - map.put("MagmaSlime", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.MAGMA_CUBE)); - map.put("LavaSlime", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.MAGMA_CUBE)); - map.put("SpiderJockey", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.SPIDER)); - map.put("VillagerGolem", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.IRON_GOLEM)); - map.put("Ozelot", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.OCELOT)); - map.put("Kitty", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.CAT)); - map.put("Kitten", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.CAT)); - map.put("TESTIFICATE", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.VILLAGER)); - map.put("Octopus", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.SQUID)); - map.put("GlowingOctopus", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.SQUID)); - map.put("Exwife", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.GHAST)); - map.put("CommandMinecart", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.COMMAND_BLOCK_MINECART)); - map.put("Wizard", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.EVOKER)); - map.put("Johnny", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.VINDICATOR)); - map.put("BabyZombie", ForgeRegistries.ENTITY_TYPES.getKey(EntityType.ZOMBIE)); + map.put("RedCow", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.MOOSHROOM)); + map.put("ChickenJockey", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.CHICKEN)); + map.put("Pigman", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.PIGLIN)); + map.put("ZombiePig", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.PIGLIN)); + map.put("ZombiePigman", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.PIGLIN)); + map.put("Dog", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.WOLF)); + map.put("Dragon", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.ENDER_DRAGON)); + map.put("SnowMan", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.SNOW_GOLEM)); + map.put("LavaCube", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.MAGMA_CUBE)); + map.put("MagmaSlime", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.MAGMA_CUBE)); + map.put("LavaSlime", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.MAGMA_CUBE)); + map.put("SpiderJockey", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.SPIDER)); + map.put("VillagerGolem", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.IRON_GOLEM)); + map.put("Ozelot", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.OCELOT)); + map.put("Kitty", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.CAT)); + map.put("Kitten", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.CAT)); + map.put("TESTIFICATE", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.VILLAGER)); + map.put("Octopus", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.SQUID)); + map.put("GlowingOctopus", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.SQUID)); + map.put("Exwife", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.GHAST)); + map.put("CommandMinecart", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.COMMAND_BLOCK_MINECART)); + map.put("Wizard", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.EVOKER)); + map.put("Johnny", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.VINDICATOR)); + map.put("BabyZombie", BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.ZOMBIE)); - ForgeRegistries.VILLAGER_PROFESSIONS.getEntries().stream().forEach(profession -> map.put(profession.getKey().location().getPath(), profession.getKey().location())); + BuiltInRegistries.VILLAGER_PROFESSION.entrySet().stream().forEach(profession -> map.put(profession.getKey().location().getPath(), profession.getKey().location())); }); private EntityType entity; @@ -67,10 +67,10 @@ public class EntitySummonArgument implements IDeserializableArgument { if(entity != null) { - EntityType type = ForgeRegistries.ENTITY_TYPES.getValue(entity); - ResourceLocation location = ForgeRegistries.ENTITY_TYPES.getKey(type); + EntityType type = BuiltInRegistries.ENTITY_TYPE.get(entity); + ResourceLocation location = BuiltInRegistries.ENTITY_TYPE.getKey(type); - if(!ForgeRegistries.ENTITY_TYPES.getDefaultKey().equals(location) || location.equals(entity)) + if(!BuiltInRegistries.ENTITY_TYPE.getDefaultKey().equals(location) || location.equals(entity)) { this.set(type); } @@ -124,7 +124,7 @@ public class EntitySummonArgument implements IDeserializableArgument return null; } - return ForgeRegistries.ENTITY_TYPES.getKey(this.entity).toString(); + return BuiltInRegistries.ENTITY_TYPE.getKey(this.entity).toString(); } @Override diff --git a/src/main/java/exopandora/worldhandler/builder/argument/ItemArgument.java b/src/main/java/exopandora/worldhandler/builder/argument/ItemArgument.java index ba73504..c5dcb20 100644 --- a/src/main/java/exopandora/worldhandler/builder/argument/ItemArgument.java +++ b/src/main/java/exopandora/worldhandler/builder/argument/ItemArgument.java @@ -7,7 +7,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import exopandora.worldhandler.util.ItemPredicateParser; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public class ItemArgument extends TagArgument { @@ -27,7 +27,7 @@ public class ItemArgument extends TagArgument { if(item != null) { - this.set(ForgeRegistries.ITEMS.getValue(item)); + this.set(BuiltInRegistries.ITEM.get(item)); } else { @@ -85,10 +85,10 @@ public class ItemArgument extends TagArgument if(tag != null) { - return ForgeRegistries.ITEMS.getKey(this.item).toString() + tag; + return BuiltInRegistries.ITEM.getKey(this.item).toString() + tag; } - return ForgeRegistries.ITEMS.getKey(this.item).toString(); + return BuiltInRegistries.ITEM.getKey(this.item).toString(); } @Override diff --git a/src/main/java/exopandora/worldhandler/builder/argument/ItemPredicateArgument.java b/src/main/java/exopandora/worldhandler/builder/argument/ItemPredicateArgument.java index 4b9fbf7..d52604b 100644 --- a/src/main/java/exopandora/worldhandler/builder/argument/ItemPredicateArgument.java +++ b/src/main/java/exopandora/worldhandler/builder/argument/ItemPredicateArgument.java @@ -7,7 +7,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import exopandora.worldhandler.util.ItemPredicateParser; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public class ItemPredicateArgument extends TagArgument { @@ -28,7 +28,7 @@ public class ItemPredicateArgument extends TagArgument { if(item != null) { - this.resource = ForgeRegistries.ITEMS.getKey(item); + this.resource = BuiltInRegistries.ITEM.getKey(item); } else { diff --git a/src/main/java/exopandora/worldhandler/builder/argument/tag/AbstractAttributeTag.java b/src/main/java/exopandora/worldhandler/builder/argument/tag/AbstractAttributeTag.java index e1c035e..d99bf02 100644 --- a/src/main/java/exopandora/worldhandler/builder/argument/tag/AbstractAttributeTag.java +++ b/src/main/java/exopandora/worldhandler/builder/argument/tag/AbstractAttributeTag.java @@ -8,11 +8,11 @@ import java.util.stream.Collectors; import net.minecraft.client.resources.language.I18n; import net.minecraft.world.entity.ai.attributes.Attribute; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public abstract class AbstractAttributeTag implements ITagProvider { - public static final List ATTRIBUTES = ForgeRegistries.ATTRIBUTES.getValues().stream() + public static final List ATTRIBUTES = BuiltInRegistries.ATTRIBUTE.stream().toList().stream() .filter(attribute -> !attribute.getDescriptionId().equals(I18n.get(attribute.getDescriptionId()))) .collect(Collectors.toList()); diff --git a/src/main/java/exopandora/worldhandler/builder/argument/tag/AbstractEffectTag.java b/src/main/java/exopandora/worldhandler/builder/argument/tag/AbstractEffectTag.java index 8030936..be32dff 100644 --- a/src/main/java/exopandora/worldhandler/builder/argument/tag/AbstractEffectTag.java +++ b/src/main/java/exopandora/worldhandler/builder/argument/tag/AbstractEffectTag.java @@ -12,7 +12,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.Tag; import net.minecraft.world.effect.MobEffect; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public abstract class AbstractEffectTag implements ITagProvider { @@ -33,7 +33,7 @@ public abstract class AbstractEffectTag implements ITagProvider CompoundTag compound = new CompoundTag(); int ticks = instance.toTicks(); - compound.putString("id", ForgeRegistries.MOB_EFFECTS.getKey(entry.getKey()).toString()); + compound.putString("id", BuiltInRegistries.MOB_EFFECT.getKey(entry.getKey()).toString()); compound.putByte("amplifier", (byte) (instance.getAmplifier() - 1)); compound.putInt("duration", ticks > 0 ? ticks : 1000000); compound.putBoolean("ambient", instance.isAmbient()); diff --git a/src/main/java/exopandora/worldhandler/builder/argument/tag/AttributeModifiersTag.java b/src/main/java/exopandora/worldhandler/builder/argument/tag/AttributeModifiersTag.java index 0aefbe8..fbc9aef 100644 --- a/src/main/java/exopandora/worldhandler/builder/argument/tag/AttributeModifiersTag.java +++ b/src/main/java/exopandora/worldhandler/builder/argument/tag/AttributeModifiersTag.java @@ -9,7 +9,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.Tag; import net.minecraft.world.entity.ai.attributes.Attribute; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public class AttributeModifiersTag extends AbstractAttributeTag { @@ -24,7 +24,7 @@ public class AttributeModifiersTag extends AbstractAttributeTag if(entry.getValue() != 0) { CompoundTag attribute = new CompoundTag(); - String id = ForgeRegistries.ATTRIBUTES.getKey(entry.getKey()).toString(); + String id = BuiltInRegistries.ATTRIBUTE.getKey(entry.getKey()).toString(); attribute.putString("AttributeName", id); attribute.putDouble("Amount", entry.getValue() / 100); diff --git a/src/main/java/exopandora/worldhandler/builder/argument/tag/AttributesTag.java b/src/main/java/exopandora/worldhandler/builder/argument/tag/AttributesTag.java index 3ed042b..0968e18 100644 --- a/src/main/java/exopandora/worldhandler/builder/argument/tag/AttributesTag.java +++ b/src/main/java/exopandora/worldhandler/builder/argument/tag/AttributesTag.java @@ -8,7 +8,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.Tag; import net.minecraft.world.entity.ai.attributes.Attribute; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public class AttributesTag extends AbstractAttributeTag { @@ -23,7 +23,7 @@ public class AttributesTag extends AbstractAttributeTag if(entry.getValue() != 0) { CompoundTag attribute = new CompoundTag(); - String id = ForgeRegistries.ATTRIBUTES.getKey(entry.getKey()).toString(); + String id = BuiltInRegistries.ATTRIBUTE.getKey(entry.getKey()).toString(); attribute.putString("Name", id); attribute.putDouble("Base", entry.getValue() / 100); diff --git a/src/main/java/exopandora/worldhandler/command/CommandWH.java b/src/main/java/exopandora/worldhandler/command/CommandWH.java index 540202d..e8a4017 100644 --- a/src/main/java/exopandora/worldhandler/command/CommandWH.java +++ b/src/main/java/exopandora/worldhandler/command/CommandWH.java @@ -22,7 +22,7 @@ import net.minecraft.commands.arguments.blocks.BlockPredicateArgument; import net.minecraft.commands.arguments.blocks.BlockStateArgument; import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public class CommandWH { @@ -58,7 +58,7 @@ public class CommandWH { BlockHelper.pos1().set(BlockHelper.getFocusedBlockPos()); BlockPos pos = BlockHelper.pos1(); - ResourceLocation block = ForgeRegistries.BLOCKS.getKey(BlockHelper.getBlock(pos)); + ResourceLocation block = BuiltInRegistries.BLOCK.getKey(BlockHelper.getBlock(pos)); CommandHelper.sendFeedback(source, "Set first position to " + pos.getX() + ", " + pos.getY() + ", " + pos.getZ() + " (" + block + ")"); return 1; } @@ -67,7 +67,7 @@ public class CommandWH { BlockHelper.pos2().set(BlockHelper.getFocusedBlockPos()); BlockPos pos = BlockHelper.pos2(); - ResourceLocation block = ForgeRegistries.BLOCKS.getKey(BlockHelper.getBlock(pos)); + ResourceLocation block = BuiltInRegistries.BLOCK.getKey(BlockHelper.getBlock(pos)); CommandHelper.sendFeedback(source, "Set second position to " + pos.getX() + ", " + pos.getY() + ", " + pos.getZ() + " (" + block + ")"); return 1; } diff --git a/src/main/java/exopandora/worldhandler/command/CommandWorldHandler.java b/src/main/java/exopandora/worldhandler/command/CommandWorldHandler.java index 140c483..f7033d3 100644 --- a/src/main/java/exopandora/worldhandler/command/CommandWorldHandler.java +++ b/src/main/java/exopandora/worldhandler/command/CommandWorldHandler.java @@ -17,8 +17,8 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.level.LevelSettings; import net.minecraft.world.level.storage.PrimaryLevelData; -import net.minecraftforge.fml.ModList; -import net.minecraftforge.fml.VersionChecker; +import net.neoforged.fml.ModList; +import net.neoforged.fml.VersionChecker; public class CommandWorldHandler { diff --git a/src/main/java/exopandora/worldhandler/config/Config.java b/src/main/java/exopandora/worldhandler/config/Config.java index 2b6097d..019c68c 100644 --- a/src/main/java/exopandora/worldhandler/config/Config.java +++ b/src/main/java/exopandora/worldhandler/config/Config.java @@ -7,16 +7,16 @@ import java.util.List; import org.apache.commons.lang3.tuple.Pair; -import net.minecraftforge.common.ForgeConfigSpec; +import net.neoforged.neoforge.common.ModConfigSpec; public class Config { - public static final ForgeConfigSpec CLIENT_SPEC; + public static final ModConfigSpec CLIENT_SPEC; public static final ClientConfig CLIENT; static { - Pair pair = new ForgeConfigSpec.Builder().configure(ClientConfig::new); + Pair pair = new ModConfigSpec.Builder().configure(ClientConfig::new); CLIENT_SPEC = pair.getRight(); CLIENT = pair.getLeft(); } @@ -28,7 +28,7 @@ public class Config private final ConfigCategorySkin skin; private final ConfigCategorySliders sliders; - public ClientConfig(ForgeConfigSpec.Builder builder) + public ClientConfig(ModConfigSpec.Builder builder) { this.settings = new ConfigCategorySettings(builder); this.butcher = new ConfigCategoryButcher(builder); @@ -77,7 +77,7 @@ public class Config return Config.CLIENT.getSliders(); } - protected static void set(ForgeConfigSpec.ConfigValue configValue, T value) + protected static void set(ModConfigSpec.ConfigValue configValue, T value) { if(configValue != null && value != null && (!value.equals(configValue.get()) || configValue.get() instanceof List)) { diff --git a/src/main/java/exopandora/worldhandler/config/ConfigCategoryButcher.java b/src/main/java/exopandora/worldhandler/config/ConfigCategoryButcher.java index 1ce22c6..cf01118 100644 --- a/src/main/java/exopandora/worldhandler/config/ConfigCategoryButcher.java +++ b/src/main/java/exopandora/worldhandler/config/ConfigCategoryButcher.java @@ -7,15 +7,15 @@ import java.util.stream.Collectors; import com.google.common.base.Predicates; import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.common.ForgeConfigSpec; -import net.minecraftforge.common.ForgeConfigSpec.ConfigValue; -import net.minecraftforge.registries.ForgeRegistries; +import net.neoforged.neoforge.common.ModConfigSpec; +import net.neoforged.neoforge.common.ModConfigSpec.ConfigValue; +import net.minecraft.core.registries.BuiltInRegistries; public class ConfigCategoryButcher { private final ConfigValue> entities; - public ConfigCategoryButcher(ForgeConfigSpec.Builder builder) + public ConfigCategoryButcher(ModConfigSpec.Builder builder) { builder.push("butcher"); @@ -63,7 +63,7 @@ public class ConfigCategoryButcher { if(string != null) { - return ForgeRegistries.ENTITY_TYPES.containsKey(ResourceLocation.tryParse(string.toString())); + return BuiltInRegistries.ENTITY_TYPE.containsKey(ResourceLocation.tryParse(string.toString())); } return false; diff --git a/src/main/java/exopandora/worldhandler/config/ConfigCategorySettings.java b/src/main/java/exopandora/worldhandler/config/ConfigCategorySettings.java index 7d5898c..7127046 100644 --- a/src/main/java/exopandora/worldhandler/config/ConfigCategorySettings.java +++ b/src/main/java/exopandora/worldhandler/config/ConfigCategorySettings.java @@ -1,10 +1,10 @@ package exopandora.worldhandler.config; import exopandora.worldhandler.util.BlockPlacingMode; -import net.minecraftforge.common.ForgeConfigSpec; -import net.minecraftforge.common.ForgeConfigSpec.BooleanValue; -import net.minecraftforge.common.ForgeConfigSpec.ConfigValue; -import net.minecraftforge.common.ForgeConfigSpec.IntValue; +import net.neoforged.neoforge.common.ModConfigSpec; +import net.neoforged.neoforge.common.ModConfigSpec.BooleanValue; +import net.neoforged.neoforge.common.ModConfigSpec.ConfigValue; +import net.neoforged.neoforge.common.ModConfigSpec.IntValue; public class ConfigCategorySettings { @@ -23,7 +23,7 @@ public class ConfigCategorySettings private final IntValue midnight; private final ConfigValue blockPlacingMode; - public ConfigCategorySettings(ForgeConfigSpec.Builder builder) + public ConfigCategorySettings(ModConfigSpec.Builder builder) { builder.push("settings"); diff --git a/src/main/java/exopandora/worldhandler/config/ConfigCategorySkin.java b/src/main/java/exopandora/worldhandler/config/ConfigCategorySkin.java index 6d986c1..4bcb721 100644 --- a/src/main/java/exopandora/worldhandler/config/ConfigCategorySkin.java +++ b/src/main/java/exopandora/worldhandler/config/ConfigCategorySkin.java @@ -1,9 +1,9 @@ package exopandora.worldhandler.config; -import net.minecraftforge.common.ForgeConfigSpec; -import net.minecraftforge.common.ForgeConfigSpec.BooleanValue; -import net.minecraftforge.common.ForgeConfigSpec.ConfigValue; -import net.minecraftforge.common.ForgeConfigSpec.IntValue; +import net.neoforged.neoforge.common.ModConfigSpec; +import net.neoforged.neoforge.common.ModConfigSpec.BooleanValue; +import net.neoforged.neoforge.common.ModConfigSpec.ConfigValue; +import net.neoforged.neoforge.common.ModConfigSpec.IntValue; public class ConfigCategorySkin { @@ -21,7 +21,7 @@ public class ConfigCategorySkin private final BooleanValue sharpEdges; private final BooleanValue drawBackground; - public ConfigCategorySkin(ForgeConfigSpec.Builder builder) + public ConfigCategorySkin(ModConfigSpec.Builder builder) { builder.push("skin"); diff --git a/src/main/java/exopandora/worldhandler/config/ConfigCategorySliders.java b/src/main/java/exopandora/worldhandler/config/ConfigCategorySliders.java index a23ee68..a16beaa 100644 --- a/src/main/java/exopandora/worldhandler/config/ConfigCategorySliders.java +++ b/src/main/java/exopandora/worldhandler/config/ConfigCategorySliders.java @@ -1,7 +1,7 @@ package exopandora.worldhandler.config; -import net.minecraftforge.common.ForgeConfigSpec; -import net.minecraftforge.common.ForgeConfigSpec.DoubleValue; +import net.neoforged.neoforge.common.ModConfigSpec; +import net.neoforged.neoforge.common.ModConfigSpec.DoubleValue; public class ConfigCategorySliders { @@ -15,7 +15,7 @@ public class ConfigCategorySliders private final DoubleValue maxPlayerPoints; private final DoubleValue maxTriggerValue; - public ConfigCategorySliders(ForgeConfigSpec.Builder builder) + public ConfigCategorySliders(ModConfigSpec.Builder builder) { builder.push("sliders"); diff --git a/src/main/java/exopandora/worldhandler/event/ClientEventHandler.java b/src/main/java/exopandora/worldhandler/event/ClientEventHandler.java index 9a38932..2a14a60 100644 --- a/src/main/java/exopandora/worldhandler/event/ClientEventHandler.java +++ b/src/main/java/exopandora/worldhandler/event/ClientEventHandler.java @@ -13,10 +13,9 @@ import net.minecraft.client.renderer.MultiBufferSource.BufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.client.event.RenderLevelStageEvent; -import net.minecraftforge.event.TickEvent; -import net.minecraftforge.event.TickEvent.ClientTickEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.neoforged.neoforge.client.event.RenderLevelStageEvent; +import net.neoforged.neoforge.client.event.ClientTickEvent; +import net.neoforged.bus.api.SubscribeEvent; public class ClientEventHandler { @@ -41,8 +40,7 @@ public class ClientEventHandler if(aabb.getCenter().distanceTo(projected) < 96) { - PoseStack matrix = new PoseStack(); - matrix.mulPose(event.getPoseStack()); + PoseStack matrix = event.getPoseStack(); matrix.pushPose(); matrix.translate(-projected.x(), -projected.y(), -projected.z()); @@ -60,9 +58,9 @@ public class ClientEventHandler } @SubscribeEvent - public static void clientTickEvent(ClientTickEvent event) + public static void clientTickEvent(ClientTickEvent.Pre event) { - if(TickEvent.Phase.START.equals(event.phase) && ClientEventHandler.openGui) + if(ClientEventHandler.openGui) { ClientEventHandler.openGui = false; ActionHelper.displayGui(); diff --git a/src/main/java/exopandora/worldhandler/event/KeyHandler.java b/src/main/java/exopandora/worldhandler/event/KeyHandler.java index a5dbb51..559f173 100644 --- a/src/main/java/exopandora/worldhandler/event/KeyHandler.java +++ b/src/main/java/exopandora/worldhandler/event/KeyHandler.java @@ -6,8 +6,8 @@ import exopandora.worldhandler.util.ActionHelper; import exopandora.worldhandler.util.BlockHelper; import net.minecraft.client.KeyMapping; import net.minecraft.client.Minecraft; -import net.minecraftforge.client.event.InputEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.neoforged.neoforge.client.event.InputEvent; +import net.neoforged.bus.api.SubscribeEvent; public class KeyHandler { diff --git a/src/main/java/exopandora/worldhandler/gui/category/Categories.java b/src/main/java/exopandora/worldhandler/gui/category/Categories.java index 0d45743..8e2bc15 100644 --- a/src/main/java/exopandora/worldhandler/gui/category/Categories.java +++ b/src/main/java/exopandora/worldhandler/gui/category/Categories.java @@ -15,7 +15,7 @@ public class Categories public static Category getRegisteredCategory(String name) { - Category category = Category.REGISTRY.getValue(ResourceLocation.fromNamespaceAndPath(Main.MODID, name)); + Category category = Category.REGISTRY.get(ResourceLocation.fromNamespaceAndPath(Main.MODID, name)); if(category == null) { diff --git a/src/main/java/exopandora/worldhandler/gui/category/Category.java b/src/main/java/exopandora/worldhandler/gui/category/Category.java index 61d2311..4898257 100644 --- a/src/main/java/exopandora/worldhandler/gui/category/Category.java +++ b/src/main/java/exopandora/worldhandler/gui/category/Category.java @@ -15,20 +15,19 @@ import exopandora.worldhandler.Main; import exopandora.worldhandler.gui.content.Content; import exopandora.worldhandler.usercontent.UsercontentConfig; import exopandora.worldhandler.usercontent.UsercontentLoader; -import exopandora.worldhandler.usercontent.model.JsonTab; -import exopandora.worldhandler.util.RegistryHelper; -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.registries.IForgeRegistry; -import net.minecraftforge.registries.NewRegistryEvent; -import net.minecraftforge.registries.RegisterEvent; -import net.minecraftforge.registries.RegistryBuilder; +import exopandora.worldhandler.usercontent.model.JsonTab; +import exopandora.worldhandler.util.RegistryHelper; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.neoforge.registries.NewRegistryEvent; +import net.neoforged.neoforge.registries.RegisterEvent; +import net.neoforged.neoforge.registries.RegistryBuilder; public class Category { - public static IForgeRegistry REGISTRY; + public static Registry REGISTRY; public static final ResourceKey> REGISTRY_KEY = ResourceKey.createRegistryKey(ResourceLocation.fromNamespaceAndPath(Main.MODID, "category")); public static final Map> DEFAULT_CATEGORIES = new CategoriesBuilder() .add("main", "main", "containers", "multiplayer") @@ -81,16 +80,13 @@ public class Category @Nullable public Content getContent(int index) { - return Content.REGISTRY.getValue(this.contents.get(index)); + return Content.REGISTRY.get(this.contents.get(index)); } - @SubscribeEvent - public static void createRegistry(NewRegistryEvent event) - { - event.create(new RegistryBuilder() - .setName(REGISTRY_KEY.location()) - .disableSaving() - .disableSync(), registry -> REGISTRY = registry); + @SubscribeEvent + public static void createRegistry(NewRegistryEvent event) + { + REGISTRY = event.create(new RegistryBuilder(REGISTRY_KEY).sync(false)); } @SubscribeEvent @@ -102,7 +98,7 @@ public class Category { RegistryHelper.register(event, REGISTRY_KEY, entry.getKey(), () -> { - var keys = entry.getValue().stream() + var keys = entry.getValue().stream() .map(key -> ResourceLocation.fromNamespaceAndPath(Main.MODID, key)) .collect(Collectors.toList()); return new Category(keys); diff --git a/src/main/java/exopandora/worldhandler/gui/content/Content.java b/src/main/java/exopandora/worldhandler/gui/content/Content.java index 82c2926..25539df 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/Content.java +++ b/src/main/java/exopandora/worldhandler/gui/content/Content.java @@ -35,28 +35,24 @@ import exopandora.worldhandler.gui.content.impl.ContentUsercontent; import exopandora.worldhandler.gui.content.impl.ContentWorldInfo; import exopandora.worldhandler.usercontent.UsercontentLoader; import exopandora.worldhandler.util.RegistryHelper; -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.registries.IForgeRegistry; -import net.minecraftforge.registries.NewRegistryEvent; -import net.minecraftforge.registries.RegisterEvent; -import net.minecraftforge.registries.RegistryBuilder; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.neoforge.registries.NewRegistryEvent; +import net.neoforged.neoforge.registries.RegisterEvent; +import net.neoforged.neoforge.registries.RegistryBuilder; public abstract class Content implements IContent { - public static IForgeRegistry REGISTRY; + public static Registry REGISTRY; public static final ResourceKey> REGISTRY_KEY = ResourceKey.createRegistryKey(ResourceLocation.fromNamespaceAndPath(Main.MODID, "content")); - @SubscribeEvent - public static void createRegistry(NewRegistryEvent event) - { - event.create(new RegistryBuilder() - .setName(REGISTRY_KEY.location()) - .disableSaving() - .disableSync(), registry -> REGISTRY = registry); - } + @SubscribeEvent + public static void createRegistry(NewRegistryEvent event) + { + REGISTRY = event.create(new RegistryBuilder(REGISTRY_KEY).sync(false)); + } @SubscribeEvent public static void register(RegisterEvent event) diff --git a/src/main/java/exopandora/worldhandler/gui/content/Contents.java b/src/main/java/exopandora/worldhandler/gui/content/Contents.java index c151539..dda881e 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/Contents.java +++ b/src/main/java/exopandora/worldhandler/gui/content/Contents.java @@ -46,7 +46,7 @@ public class Contents public static Content getRegisteredContent(String name) { - Content content = Content.REGISTRY.getValue(ResourceLocation.fromNamespaceAndPath(Main.MODID, name)); + Content content = Content.REGISTRY.get(ResourceLocation.fromNamespaceAndPath(Main.MODID, name)); if(content == null) { diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcher.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcher.java index 2d04f62..225e339 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcher.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcher.java @@ -26,7 +26,7 @@ import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.phys.AABB; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public class ContentButcher extends Content { @@ -102,7 +102,7 @@ public class ContentButcher extends Content container.addRenderableWidget(slaughter = new GuiButtonBase(x + 58, y + 48, 114, 20, Component.translatable("gui.worldhandler.butcher.slaughter"), () -> { - Collection> entities = Config.getButcher().getEntities().stream().map(ForgeRegistries.ENTITY_TYPES::getValue).filter(Predicates.notNull()).collect(Collectors.toList()); + Collection> entities = Config.getButcher().getEntities().stream().map(BuiltInRegistries.ENTITY_TYPE::get).filter(Predicates.notNull()).collect(Collectors.toList()); ContentButcher.slaughter(container.getPlayer(), entities, Integer.parseInt(this.radius)); })); slaughter.active = enabled && !Config.getButcher().getEntities().isEmpty(); @@ -132,7 +132,7 @@ public class ContentButcher extends Content { KillCommandBuilder kill = new KillCommandBuilder(); kill.targets().setSelectorType(SelectorTypes.ALL_ENTITIES); - kill.targets().setType(ForgeRegistries.ENTITY_TYPES.getKey(entity)); + kill.targets().setType(BuiltInRegistries.ENTITY_TYPE.getKey(entity)); kill.targets().setDistanceMax(radius); CommandHelper.sendCommand(username, kill, KillCommandBuilder.Label.KILL_TARGETS); } diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcherPresets.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcherPresets.java index a301483..7023f40 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcherPresets.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcherPresets.java @@ -9,7 +9,7 @@ import exopandora.worldhandler.util.ActionHelper; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.MobCategory; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public class ContentButcherPresets extends ContentChild { @@ -42,22 +42,22 @@ public class ContentButcherPresets extends ContentChild container.addRenderableWidget(new GuiButtonBase(x + 58, y, 114, 20, Component.translatable("gui.worldhandler.butcher.presets.passive_mobs"), () -> { - ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITY_TYPES.getValues().stream().filter(entity -> !MobCategory.MONSTER.equals(entity.getCategory()) && !MobCategory.MISC.equals(entity.getCategory())).collect(Collectors.toList()), this.radius); + ContentButcher.slaughter(container.getPlayer(), BuiltInRegistries.ENTITY_TYPE.stream().toList().stream().filter(entity -> !MobCategory.MONSTER.equals(entity.getCategory()) && !MobCategory.MISC.equals(entity.getCategory())).collect(Collectors.toList()), this.radius); ActionHelper.open(this.getParentContent()); })); container.addRenderableWidget(new GuiButtonBase(x + 58, y + 24, 114, 20, Component.translatable("gui.worldhandler.butcher.presets.hostile_mobs"), () -> { - ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITY_TYPES.getValues().stream().filter(entity -> MobCategory.MONSTER.equals(entity.getCategory())).collect(Collectors.toList()), this.radius); + ContentButcher.slaughter(container.getPlayer(), BuiltInRegistries.ENTITY_TYPE.stream().toList().stream().filter(entity -> MobCategory.MONSTER.equals(entity.getCategory())).collect(Collectors.toList()), this.radius); ActionHelper.open(this.getParentContent()); })); container.addRenderableWidget(new GuiButtonBase(x + 58, y + 48, 114, 20, Component.translatable("gui.worldhandler.butcher.presets.players"), () -> { - ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITY_TYPES.getValues().stream().filter(entity -> EntityType.PLAYER.equals(entity)).collect(Collectors.toList()), this.radius); + ContentButcher.slaughter(container.getPlayer(), BuiltInRegistries.ENTITY_TYPE.stream().toList().stream().filter(entity -> EntityType.PLAYER.equals(entity)).collect(Collectors.toList()), this.radius); ActionHelper.open(this.getParentContent()); })); container.addRenderableWidget(new GuiButtonBase(x + 58, y + 72, 114, 20, Component.translatable("gui.worldhandler.butcher.presets.entities"), () -> { - ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITY_TYPES.getValues().stream().filter(entity -> MobCategory.MISC.equals(entity.getCategory()) && !EntityType.PLAYER.equals(entity)).collect(Collectors.toList()), this.radius); + ContentButcher.slaughter(container.getPlayer(), BuiltInRegistries.ENTITY_TYPE.stream().toList().stream().filter(entity -> MobCategory.MISC.equals(entity.getCategory()) && !EntityType.PLAYER.equals(entity)).collect(Collectors.toList()), this.radius); ActionHelper.open(this.getParentContent()); })); } diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcherSettings.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcherSettings.java index b1c719d..0f432a2 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcherSettings.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcherSettings.java @@ -15,7 +15,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public class ContentButcherSettings extends ContentChild { @@ -24,7 +24,7 @@ public class ContentButcherSettings extends ContentChild @Override public void initGui(Container container, int x, int y) { - List> list = ForgeRegistries.ENTITY_TYPES.getValues().stream().filter(EntityType::canSummon).collect(Collectors.toList()); + List> list = BuiltInRegistries.ENTITY_TYPE.stream().toList().stream().filter(EntityType::canSummon).collect(Collectors.toList()); MenuPageList> entities = new MenuPageList>(x, y, list, 114, 20, 3, container, new ILogicPageList>() { @@ -37,13 +37,13 @@ public class ContentButcherSettings extends ContentChild @Override public MutableComponent toTooltip(EntityType item) { - return Component.literal(ForgeRegistries.ENTITY_TYPES.getKey(item).toString()); + return Component.literal(BuiltInRegistries.ENTITY_TYPE.getKey(item).toString()); } @Override public void onClick(EntityType item) { - ContentButcherSettings.this.entity = ForgeRegistries.ENTITY_TYPES.getKey(item); + ContentButcherSettings.this.entity = BuiltInRegistries.ENTITY_TYPE.getKey(item); container.initButtons(); } diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentCommandStack.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentCommandStack.java index a58274f..47583b7 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentCommandStack.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentCommandStack.java @@ -30,7 +30,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.entity.EntityType; import net.minecraft.world.level.block.Blocks; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public class ContentCommandStack extends ContentChild { @@ -59,14 +59,14 @@ public class ContentCommandStack extends ContentChild this.activatorRail.setBlockState(Blocks.ACTIVATOR_RAIL.defaultBlockState()); this.builderCommandStack.nbt().addTagProvider(this.activatorRail); - EntityTag redstoneBlock = new EntityTag(ForgeRegistries.ENTITY_TYPES.getKey(EntityType.FALLING_BLOCK)); + EntityTag redstoneBlock = new EntityTag(BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.FALLING_BLOCK)); redstoneBlock.setTime(1); redstoneBlock.setBlockState(Blocks.REDSTONE_BLOCK.defaultBlockState()); this.activatorRail.addPassenger(redstoneBlock); this.addCommand(0); - EntityTag blockRemover = new EntityTag(ForgeRegistries.ENTITY_TYPES.getKey(EntityType.COMMAND_BLOCK_MINECART)); + EntityTag blockRemover = new EntityTag(BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.COMMAND_BLOCK_MINECART)); SetBlockCommandBuilder builder = new SetBlockCommandBuilder(); builder.pos().setX(new Coordinate.Ints(Coordinate.Type.RELATIVE)); builder.pos().setY(new Coordinate.Ints(-2, Coordinate.Type.RELATIVE)); @@ -87,10 +87,10 @@ public class ContentCommandStack extends ContentChild blockRemover.setCommand(builder.toCommand(SetBlockCommandBuilder.Label.DESTROY, false)); this.activatorRail.addPassenger(blockRemover); - EntityTag entityRemover = new EntityTag(ForgeRegistries.ENTITY_TYPES.getKey(EntityType.COMMAND_BLOCK_MINECART)); + EntityTag entityRemover = new EntityTag(BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.COMMAND_BLOCK_MINECART)); KillCommandBuilder kill = new KillCommandBuilder(); kill.targets().setSelectorType(SelectorTypes.ALL_ENTITIES); - kill.targets().setType(ForgeRegistries.ENTITY_TYPES.getKey(EntityType.COMMAND_BLOCK_MINECART)); + kill.targets().setType(BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.COMMAND_BLOCK_MINECART)); kill.targets().setDistanceMax(1.0D); entityRemover.setCommand(kill.toCommand(KillCommandBuilder.Label.KILL_TARGETS, false)); this.activatorRail.addPassenger(entityRemover); @@ -246,7 +246,7 @@ public class ContentCommandStack extends ContentChild private void addCommand(int index) { - this.activatorRail.addPassenger(index + HEAD_LENGTH, new EntityTag(ForgeRegistries.ENTITY_TYPES.getKey(EntityType.COMMAND_BLOCK_MINECART))); + this.activatorRail.addPassenger(index + HEAD_LENGTH, new EntityTag(BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.COMMAND_BLOCK_MINECART))); } private void removeCommand(int index) diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentCustomItem.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentCustomItem.java index 5b7ac8c..59d6d81 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentCustomItem.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentCustomItem.java @@ -32,7 +32,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.item.enchantment.Enchantment; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public class ContentCustomItem extends Content { @@ -188,7 +188,7 @@ public class ContentCustomItem extends Content @Override public MutableComponent toTooltip(Attribute attribute) { - return Component.literal(ForgeRegistries.ATTRIBUTES.getKey(attribute).toString()); + return Component.literal(BuiltInRegistries.ATTRIBUTE.getKey(attribute).toString()); } @Override diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentLocate.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentLocate.java index 397fd7b..1d38653 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentLocate.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentLocate.java @@ -28,7 +28,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public class ContentLocate extends Content { @@ -158,7 +158,7 @@ public class ContentLocate extends Content } else if(Page.POI.equals(this.page)) { - List pois = new ArrayList(ForgeRegistries.POI_TYPES.getKeys()); + List pois = new ArrayList(BuiltInRegistries.POINT_OF_INTEREST_TYPE.keySet()); MenuPageList list = new MenuPageList(x + 118, y, pois, 114, 20, 3, container, new ILogicPageList() { @Override diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentNoteEditor.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentNoteEditor.java index c5644a9..b0bcdb4 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentNoteEditor.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentNoteEditor.java @@ -66,7 +66,7 @@ public class ContentNoteEditor extends Content if(this.isActive) { BlockPos pos = this.builderNoteEditor.pos().getBlockPos(); - SoundEvent sound = getSoundEvent(pos).getSoundEvent().get(); + SoundEvent sound = getSoundEvent(pos).getSoundEvent().value(); container.addRenderableWidget(new GuiButtonPiano(x - 3 + 15, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.g"), sound, 0.53F, Type.NORMAL, () -> this.setNote(container.getPlayer(), 1))); container.addRenderableWidget(new GuiButtonPiano(x - 3 + 15 * 2, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.a"), sound, 0.6F, Type.NORMAL, () -> this.setNote(container.getPlayer(), 3))); diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentPotions.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentPotions.java index 0de129a..f030766 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentPotions.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentPotions.java @@ -24,7 +24,7 @@ import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public class ContentPotions extends ContentChild { @@ -72,7 +72,7 @@ public class ContentPotions extends ContentChild @Override public void initGui(Container container, int x, int y) { - MenuPageList potions = new MenuPageList(x, y, new ArrayList(ForgeRegistries.MOB_EFFECTS.getValues()), 114, 20, 3, container, new ILogicPageList() + MenuPageList potions = new MenuPageList(x, y, new ArrayList(BuiltInRegistries.MOB_EFFECT.stream().toList()), 114, 20, 3, container, new ILogicPageList() { @Override public MutableComponent translate(MobEffect effect) @@ -83,7 +83,7 @@ public class ContentPotions extends ContentChild @Override public MutableComponent toTooltip(MobEffect effect) { - return Component.literal(ForgeRegistries.MOB_EFFECTS.getKey(effect).toString()); + return Component.literal(BuiltInRegistries.MOB_EFFECT.getKey(effect).toString()); } @Override @@ -163,7 +163,7 @@ public class ContentPotions extends ContentChild tag.setShowParticles(!tag.doShowParticles()); container.init(); })); - container.addRenderableWidget(new GuiSlider(x + 118, y, 114, 20, 1, Config.getSliders().getMaxPotionAmplifier(), 1, container, new LogicSliderSimple("amplifier" + ForgeRegistries.MOB_EFFECTS.getKey(effect), Component.translatable("gui.worldhandler.potions.effect.amplifier"), value -> + container.addRenderableWidget(new GuiSlider(x + 118, y, 114, 20, 1, Config.getSliders().getMaxPotionAmplifier(), 1, container, new LogicSliderSimple("amplifier" + BuiltInRegistries.MOB_EFFECT.getKey(effect), Component.translatable("gui.worldhandler.potions.effect.amplifier"), value -> { this.builderPotion.amplifier().set((byte) (value.byteValue() - 1)); tag.setAmplifier(value.byteValue()); @@ -174,17 +174,17 @@ public class ContentPotions extends ContentChild MobEffect effect = this.builderPotion.effect().getEffect(); EffectInstance tag = this.effects.getOrCreate(effect); - container.addRenderableWidget(new GuiSlider(x + 118, y, 114, 20, 0, 59, 0, container, new LogicSliderSimple("s" + ForgeRegistries.MOB_EFFECTS.getKey(effect), Component.translatable("gui.worldhandler.potion.time.seconds"), value -> + container.addRenderableWidget(new GuiSlider(x + 118, y, 114, 20, 0, 59, 0, container, new LogicSliderSimple("s" + BuiltInRegistries.MOB_EFFECT.getKey(effect), Component.translatable("gui.worldhandler.potion.time.seconds"), value -> { tag.setSeconds(value.intValue()); this.builderPotion.seconds().set(tag.toSeconds()); }))); - container.addRenderableWidget(new GuiSlider(x + 118, y + 24, 114, 20, 0, 59, 0, container, new LogicSliderSimple("m" + ForgeRegistries.MOB_EFFECTS.getKey(effect), Component.translatable("gui.worldhandler.potion.time.minutes"), value -> + container.addRenderableWidget(new GuiSlider(x + 118, y + 24, 114, 20, 0, 59, 0, container, new LogicSliderSimple("m" + BuiltInRegistries.MOB_EFFECT.getKey(effect), Component.translatable("gui.worldhandler.potion.time.minutes"), value -> { tag.setMinutes(value.intValue()); this.builderPotion.seconds().set(tag.toSeconds()); }))); - container.addRenderableWidget(new GuiSlider(x + 118, y + 48, 114, 20, 0, 99, 0, container, new LogicSliderSimple("h" + ForgeRegistries.MOB_EFFECTS.getKey(effect), Component.translatable("gui.worldhandler.potion.time.hours"), value -> + container.addRenderableWidget(new GuiSlider(x + 118, y + 48, 114, 20, 0, 99, 0, container, new LogicSliderSimple("h" + BuiltInRegistries.MOB_EFFECT.getKey(effect), Component.translatable("gui.worldhandler.potion.time.hours"), value -> { tag.setHours(value.intValue()); this.builderPotion.seconds().set(tag.toSeconds()); diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentScoreboardObjectives.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentScoreboardObjectives.java index 45bb458..1b6e8e4 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentScoreboardObjectives.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentScoreboardObjectives.java @@ -25,8 +25,8 @@ import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.stats.StatType; import net.minecraft.stats.Stats; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.IForgeRegistry; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.Registry; public class ContentScoreboardObjectives extends ContentScoreboard { @@ -63,7 +63,7 @@ public class ContentScoreboardObjectives extends ContentScoreboard if(resource != null) { - StatType type = ForgeRegistries.STAT_TYPES.getValue(resource); + StatType type = BuiltInRegistries.STAT_TYPE.get(resource); if(type != null) { @@ -144,9 +144,9 @@ public class ContentScoreboardObjectives extends ContentScoreboard @Nullable private boolean isRegistryItem(ResourceLocation resource) { - IForgeRegistry[] registries = new IForgeRegistry[] {ForgeRegistries.BLOCKS, ForgeRegistries.ITEMS, ForgeRegistries.ENTITY_TYPES}; + Registry[] registries = new Registry[] {BuiltInRegistries.BLOCK, BuiltInRegistries.ITEM, BuiltInRegistries.ENTITY_TYPE}; - for(IForgeRegistry registry : registries) + for(Registry registry : registries) { if(registry.containsKey(resource)) { @@ -154,7 +154,7 @@ public class ContentScoreboardObjectives extends ContentScoreboard } } - return ForgeRegistries.STAT_TYPES.containsKey(resource); + return BuiltInRegistries.STAT_TYPE.containsKey(resource); } }); diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentSummon.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentSummon.java index 73d2c8c..5a77ce9 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentSummon.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentSummon.java @@ -57,7 +57,7 @@ import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.npc.VillagerProfession; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public class ContentSummon extends Content { @@ -246,7 +246,7 @@ public class ContentSummon extends Content @Override public MutableComponent toTooltip(Attribute attribute) { - return Component.literal(ForgeRegistries.ATTRIBUTES.getKey(attribute).toString()); + return Component.literal(BuiltInRegistries.ATTRIBUTE.getKey(attribute).toString()); } @Override @@ -345,7 +345,7 @@ public class ContentSummon extends Content for(ResourceLocation location : this.sortedEffects()) { - MobEffect effect = ForgeRegistries.MOB_EFFECTS.getValue(location); + MobEffect effect = BuiltInRegistries.MOB_EFFECT.get(location); if(effect.equals(MobEffects.HARM) || effect.equals(MobEffects.HEAL)) { @@ -357,7 +357,7 @@ public class ContentSummon extends Content button1.active = false; } - if(this.potionPage == ForgeRegistries.MOB_EFFECTS.getKeys().size() - 3) + if(this.potionPage == BuiltInRegistries.MOB_EFFECT.keySet().size() - 3) { button2.active = false; } @@ -366,11 +366,11 @@ public class ContentSummon extends Content { EffectInstance tag = this.effects.getOrCreate(effect); - container.addRenderableWidget(new GuiSlider(x + 118, y, 114, 20, 0, Config.getSliders().getMaxSummonPotionAmplifier(), 0, container, new LogicSliderSimple("amplifier" + ForgeRegistries.MOB_EFFECTS.getKey(effect), Component.translatable(effect.getDescriptionId()), value -> + container.addRenderableWidget(new GuiSlider(x + 118, y, 114, 20, 0, Config.getSliders().getMaxSummonPotionAmplifier(), 0, container, new LogicSliderSimple("amplifier" + BuiltInRegistries.MOB_EFFECT.getKey(effect), Component.translatable(effect.getDescriptionId()), value -> { tag.setAmplifier(value.byteValue()); }))); - container.addRenderableWidget(new GuiSlider(x + 118, y + 24, 114, 20, 0, Config.getSliders().getMaxSummonPotionMinutes(), 0, container, new LogicSliderSimple("duration" + ForgeRegistries.MOB_EFFECTS.getKey(effect), Component.translatable("gui.worldhandler.potion.time.minutes"), value -> + container.addRenderableWidget(new GuiSlider(x + 118, y + 24, 114, 20, 0, Config.getSliders().getMaxSummonPotionMinutes(), 0, container, new LogicSliderSimple("duration" + BuiltInRegistries.MOB_EFFECT.getKey(effect), Component.translatable("gui.worldhandler.potion.time.minutes"), value -> { tag.setMinutes(value.intValue()); }))); @@ -449,12 +449,12 @@ public class ContentSummon extends Content } else if(EntityType.VILLAGER.equals(entity)) { - for(VillagerProfession profession : ForgeRegistries.VILLAGER_PROFESSIONS) + for(VillagerProfession profession : BuiltInRegistries.VILLAGER_PROFESSION) { if(StringUtils.equalsIgnoreCase(this.mob, profession.toString())) { CompoundTag villagerData = new CompoundTag(); - villagerData.putString("profession", ForgeRegistries.VILLAGER_PROFESSIONS.getKey(profession).toString()); + villagerData.putString("profession", BuiltInRegistries.VILLAGER_PROFESSION.getKey(profession).toString()); this.mutable.setKey("VillagerData"); this.mutable.setTag(villagerData); @@ -473,7 +473,7 @@ public class ContentSummon extends Content else if(EntityType.CHICKEN.equals(entity) && StringUtils.containsIgnoreCase(this.mob, "Jockey") && !this.entity.hasPassengers()) { ListTag list = new ListTag(); - EntityTag zombie = new EntityTag(ForgeRegistries.ENTITY_TYPES.getKey(EntityType.ZOMBIE)); + EntityTag zombie = new EntityTag(BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.ZOMBIE)); zombie.setIsBaby(true); list.add(zombie.value()); @@ -484,7 +484,7 @@ public class ContentSummon extends Content else if(EntityType.SPIDER.equals(entity) && StringUtils.containsIgnoreCase(this.mob, "Jockey") && !this.entity.hasPassengers()) { ListTag list = new ListTag(); - EntityTag skeleton = new EntityTag(ForgeRegistries.ENTITY_TYPES.getKey(EntityType.SKELETON)); + EntityTag skeleton = new EntityTag(BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.SKELETON)); skeleton.setHandItem(0, Items.BOW); list.add(skeleton.value()); @@ -503,7 +503,7 @@ public class ContentSummon extends Content { if(Page.POTIONS.equals(this.page)) { - guiGraphics.drawString(Minecraft.getInstance().font, (this.potionPage + 1) + "/" + (ForgeRegistries.MOB_EFFECTS.getKeys().size() - 2), x + 118, y - 11, Config.getSkin().getHeadlineColor(), false); + guiGraphics.drawString(Minecraft.getInstance().font, (this.potionPage + 1) + "/" + (BuiltInRegistries.MOB_EFFECT.keySet().size() - 2), x + 118, y - 11, Config.getSkin().getHeadlineColor(), false); } else if(Page.EQUIPMENT.equals(this.page)) { @@ -529,8 +529,8 @@ public class ContentSummon extends Content private List sortedEffects() { - return ForgeRegistries.MOB_EFFECTS.getKeys().stream() - .sorted((a, b) -> I18n.get(ForgeRegistries.MOB_EFFECTS.getValue(a).getDescriptionId()).compareTo(I18n.get(ForgeRegistries.MOB_EFFECTS.getValue(b).getDescriptionId()))) + return BuiltInRegistries.MOB_EFFECT.keySet().stream() + .sorted((a, b) -> I18n.get(BuiltInRegistries.MOB_EFFECT.get(a).getDescriptionId()).compareTo(I18n.get(BuiltInRegistries.MOB_EFFECT.get(b).getDescriptionId()))) .collect(Collectors.toList()); } diff --git a/src/main/java/exopandora/worldhandler/gui/widget/button/LogicSliderAttribute.java b/src/main/java/exopandora/worldhandler/gui/widget/button/LogicSliderAttribute.java index 8b04f33..f6a1d35 100644 --- a/src/main/java/exopandora/worldhandler/gui/widget/button/LogicSliderAttribute.java +++ b/src/main/java/exopandora/worldhandler/gui/widget/button/LogicSliderAttribute.java @@ -5,13 +5,13 @@ import java.util.function.Consumer; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.entity.ai.attributes.Attribute; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public class LogicSliderAttribute extends LogicSliderSimple { public LogicSliderAttribute(Attribute attribute, MutableComponent text, Consumer listener) { - super(ForgeRegistries.ATTRIBUTES.getKey(attribute).toString(), text, listener); + super(BuiltInRegistries.ATTRIBUTE.getKey(attribute).toString(), text, listener); } @Override diff --git a/src/main/java/exopandora/worldhandler/usercontent/factory/WidgetFactory.java b/src/main/java/exopandora/worldhandler/usercontent/factory/WidgetFactory.java index 880ac20..eb26345 100644 --- a/src/main/java/exopandora/worldhandler/usercontent/factory/WidgetFactory.java +++ b/src/main/java/exopandora/worldhandler/usercontent/factory/WidgetFactory.java @@ -21,7 +21,7 @@ import exopandora.worldhandler.usercontent.model.JsonWidget; import exopandora.worldhandler.util.TextUtils; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public class WidgetFactory extends AbstractWidgetFactory { @@ -54,7 +54,7 @@ public class WidgetFactory extends AbstractWidgetFactory widget.getLayout().getY() + y, widget.getLayout().getWidth(), widget.getLayout().getHeight(), - ForgeRegistries.ITEMS.getValue(ResourceLocation.parse(widget.getAttributes().getItem())), + BuiltInRegistries.ITEM.get(ResourceLocation.parse(widget.getAttributes().getItem())), this.getActionHandlerFactory().createActionHandler(content, widget.getAction(), container::getPlayer) ); } diff --git a/src/main/java/exopandora/worldhandler/util/AdvancementHelper.java b/src/main/java/exopandora/worldhandler/util/AdvancementHelper.java index 5354340..9be08e7 100644 --- a/src/main/java/exopandora/worldhandler/util/AdvancementHelper.java +++ b/src/main/java/exopandora/worldhandler/util/AdvancementHelper.java @@ -17,12 +17,11 @@ import net.minecraft.server.packs.resources.ReloadableResourceManager; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.util.Unit; import net.minecraft.util.profiling.ProfilerFiller; -import net.minecraftforge.common.crafting.conditions.ICondition.IContext; public class AdvancementHelper implements PreparableReloadListener { private static final AdvancementHelper INSTANCE = new AdvancementHelper(); - private final ServerAdvancementManager manager = new ServerAdvancementManager(RegistryHelper.registryAccess(), IContext.EMPTY); + private final ServerAdvancementManager manager = new ServerAdvancementManager(RegistryHelper.registryAccess()); @Override public CompletableFuture reload(PreparationBarrier stage, ResourceManager resourceManager, ProfilerFiller preparationsProfiler, ProfilerFiller reloadProfiler, Executor backgroundExecutor, Executor gameExecutor) diff --git a/src/main/java/exopandora/worldhandler/util/BlockPredicateParser.java b/src/main/java/exopandora/worldhandler/util/BlockPredicateParser.java index ca5ed35..69d32df 100644 --- a/src/main/java/exopandora/worldhandler/util/BlockPredicateParser.java +++ b/src/main/java/exopandora/worldhandler/util/BlockPredicateParser.java @@ -15,11 +15,11 @@ import net.minecraft.nbt.TagParser; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public class BlockPredicateParser { - private static final ResourceLocation AIR_RESOURCE_LOCATION = ForgeRegistries.BLOCKS.getKey(Blocks.AIR); + private static final ResourceLocation AIR_RESOURCE_LOCATION = BuiltInRegistries.BLOCK.getKey(Blocks.AIR); private final StringReader reader; private final Map vagueProperties = Maps.newHashMap(); private ResourceLocation block = null; @@ -157,7 +157,7 @@ public class BlockPredicateParser public Optional getBlock() { - Block block = ForgeRegistries.BLOCKS.getValue(this.block); + Block block = BuiltInRegistries.BLOCK.get(this.block); if(Blocks.AIR.equals(block) && !AIR_RESOURCE_LOCATION.equals(this.block)) { diff --git a/src/main/java/exopandora/worldhandler/util/ItemPredicateParser.java b/src/main/java/exopandora/worldhandler/util/ItemPredicateParser.java index 6033d7f..e8c65ce 100644 --- a/src/main/java/exopandora/worldhandler/util/ItemPredicateParser.java +++ b/src/main/java/exopandora/worldhandler/util/ItemPredicateParser.java @@ -15,7 +15,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public class ItemPredicateParser { @@ -77,7 +77,7 @@ public class ItemPredicateParser public Optional getItem() { - Item item = ForgeRegistries.ITEMS.getValue(this.item); + Item item = BuiltInRegistries.ITEM.get(this.item); if(Items.AIR.equals(item)) { diff --git a/src/main/java/exopandora/worldhandler/util/NBTHelper.java b/src/main/java/exopandora/worldhandler/util/NBTHelper.java index b657b92..db526be 100644 --- a/src/main/java/exopandora/worldhandler/util/NBTHelper.java +++ b/src/main/java/exopandora/worldhandler/util/NBTHelper.java @@ -15,7 +15,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public class NBTHelper { @@ -62,7 +62,7 @@ public class NBTHelper for(Item item : itemArray) { CompoundTag compound = new CompoundTag(); - compound.putString("id", ForgeRegistries.ITEMS.getKey(item).toString()); + compound.putString("id", BuiltInRegistries.ITEM.getKey(item).toString()); compound.putInt("Count", 1); list.add(compound); } diff --git a/src/main/java/exopandora/worldhandler/util/RegistryHelper.java b/src/main/java/exopandora/worldhandler/util/RegistryHelper.java index 90a8f09..95ade6f 100644 --- a/src/main/java/exopandora/worldhandler/util/RegistryHelper.java +++ b/src/main/java/exopandora/worldhandler/util/RegistryHelper.java @@ -12,7 +12,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.enchantment.Enchantment; -import net.minecraftforge.registries.RegisterEvent; +import net.neoforged.neoforge.registries.RegisterEvent; public class RegistryHelper { diff --git a/src/main/java/exopandora/worldhandler/util/ResourceHelper.java b/src/main/java/exopandora/worldhandler/util/ResourceHelper.java index cd99e55..3fc8877 100644 --- a/src/main/java/exopandora/worldhandler/util/ResourceHelper.java +++ b/src/main/java/exopandora/worldhandler/util/ResourceHelper.java @@ -5,7 +5,7 @@ import javax.annotation.Nullable; import exopandora.worldhandler.Main; import exopandora.worldhandler.config.Config; import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.registries.IForgeRegistry; +import net.minecraft.core.Registry; public class ResourceHelper { @@ -20,13 +20,13 @@ public class ResourceHelper return null; } - public static boolean isRegistered(ResourceLocation resource, IForgeRegistry registry) + public static boolean isRegistered(ResourceLocation resource, Registry registry) { return resource != null && registry != null && registry.containsKey(resource); } @Nullable - public static ResourceLocation assertRegistered(ResourceLocation resource, IForgeRegistry registry) + public static ResourceLocation assertRegistered(ResourceLocation resource, Registry registry) { if(resource != null && ResourceHelper.isRegistered(resource, registry)) { diff --git a/src/main/java/exopandora/worldhandler/util/ScoreboardHelper.java b/src/main/java/exopandora/worldhandler/util/ScoreboardHelper.java index d660e71..8ac05d0 100644 --- a/src/main/java/exopandora/worldhandler/util/ScoreboardHelper.java +++ b/src/main/java/exopandora/worldhandler/util/ScoreboardHelper.java @@ -14,7 +14,7 @@ import net.minecraft.stats.Stats; import net.minecraft.world.scores.Team.CollisionRule; import net.minecraft.world.scores.Team.Visibility; import net.minecraft.world.scores.criteria.ObjectiveCriteria; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.BuiltInRegistries; public class ScoreboardHelper { @@ -44,7 +44,7 @@ public class ScoreboardHelper this.objectives.merge("minecraft", (parent, child) -> parent + "." + child); - for(StatType type : ForgeRegistries.STAT_TYPES) + for(StatType type : BuiltInRegistries.STAT_TYPE) { if(!type.equals(Stats.CUSTOM)) { @@ -55,7 +55,7 @@ public class ScoreboardHelper entries.add(new Node(this.buildKey(key))); } - this.objectives.addNode(this.buildKey(ForgeRegistries.STAT_TYPES.getKey(type)), entries); + this.objectives.addNode(this.buildKey(BuiltInRegistries.STAT_TYPE.getKey(type)), entries); } } diff --git a/src/main/java/exopandora/worldhandler/util/TranslationHelper.java b/src/main/java/exopandora/worldhandler/util/TranslationHelper.java index 95efaa2..90802e1 100644 --- a/src/main/java/exopandora/worldhandler/util/TranslationHelper.java +++ b/src/main/java/exopandora/worldhandler/util/TranslationHelper.java @@ -11,29 +11,28 @@ import net.minecraft.world.effect.MobEffect; import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.IForgeRegistry; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.Registry; public class TranslationHelper { - private static final Map, Function> FORGE = new HashMap, Function>(); + private static final Map, Function> FORGE = new HashMap, Function>(); static { - registerRegistry(ForgeRegistries.BLOCKS, Block::getDescriptionId); - registerRegistry(ForgeRegistries.ITEMS, Item::getDescriptionId); - registerRegistry(ForgeRegistries.MOB_EFFECTS, MobEffect::getDescriptionId); - registerRegistry(ForgeRegistries.BIOMES, biome -> ForgeRegistries.BIOMES.getKey(biome).toLanguageKey("biome")); - registerRegistry(ForgeRegistries.ENTITY_TYPES, EntityType::getDescriptionId); - registerRegistry(ForgeRegistries.STAT_TYPES, stat -> "stat." + stat.toString().replace(':', '.')); - registerRegistry(ForgeRegistries.VILLAGER_PROFESSIONS, profession -> + registerRegistry(BuiltInRegistries.BLOCK, Block::getDescriptionId); + registerRegistry(BuiltInRegistries.ITEM, Item::getDescriptionId); + registerRegistry(BuiltInRegistries.MOB_EFFECT, MobEffect::getDescriptionId); + registerRegistry(BuiltInRegistries.ENTITY_TYPE, EntityType::getDescriptionId); + registerRegistry(BuiltInRegistries.STAT_TYPE, stat -> "stat." + stat.toString().replace(':', '.')); + registerRegistry(BuiltInRegistries.VILLAGER_PROFESSION, profession -> { - ResourceLocation profName = ForgeRegistries.VILLAGER_PROFESSIONS.getKey(profession); + ResourceLocation profName = BuiltInRegistries.VILLAGER_PROFESSION.getKey(profession); return EntityType.VILLAGER.getDescriptionId() + '.' + (!"minecraft".equals(profName.getNamespace()) ? profName.getNamespace() + '.' : "") + profName.getPath(); }); } - private static void registerRegistry(IForgeRegistry registry, Function mapper) + private static void registerRegistry(Registry registry, Function mapper) { FORGE.put(registry, mapper); } @@ -47,11 +46,11 @@ public class TranslationHelper return RegistryHelper.getEnchantmentDescription(RegistryHelper.getEnchantment(resource)).getString(); } - for(IForgeRegistry registry : FORGE.keySet()) + for(Registry registry : FORGE.keySet()) { if(registry.containsKey(resource)) { - return ((Function) FORGE.get(registry)).apply((T) registry.getValue(resource)); + return ((Function) FORGE.get(registry)).apply((T) registry.get(resource)); } } diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 33f612b..8272b8b 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -1,11 +1,11 @@ -public net.minecraft.commands.arguments.blocks.BlockInput f_114664_ # tag -public net.minecraft.server.MinecraftServer f_129744_ # storageSource -public net.minecraft.client.gui.screens.OptionsScreen m_96244_(Lnet/minecraft/server/packs/repository/PackRepository;)V # updatePackList -public net.minecraft.commands.arguments.EntityAnchorArgument$Anchor f_90367_ # name -public net.minecraft.commands.arguments.coordinates.LocalCoordinates m_119908_(Lcom/mojang/brigadier/StringReader;I)D # readDouble -public net.minecraft.advancements.critereon.MinMaxBounds$Doubles (Ljava/util/Optional;Ljava/util/Optional;)V # constructor -public net.minecraft.advancements.critereon.MinMaxBounds$Ints (Ljava/util/Optional;Ljava/util/Optional;)V # constructor -public net.minecraft.network.chat.MutableComponent (Lnet/minecraft/network/chat/ComponentContents;Ljava/util/List;Lnet/minecraft/network/chat/Style;)V # constructor -public net.minecraft.commands.arguments.item.ItemParser f_120991_ # ERROR_NO_TAGS_ALLOWED -public net.minecraft.world.level.storage.PrimaryLevelData f_78443_ # settings -public net.minecraft.client.gui.components.AbstractWidget m_280138_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/gui/Font;Lnet/minecraft/network/chat/Component;IIIII)V # renderScrollingString +public net.minecraft.commands.arguments.blocks.BlockInput tag +public net.minecraft.server.MinecraftServer storageSource +public net.minecraft.client.gui.screens.OptionsScreen updatePackList(Lnet/minecraft/server/packs/repository/PackRepository;)V +public net.minecraft.commands.arguments.EntityAnchorArgument$Anchor name +public net.minecraft.commands.arguments.coordinates.LocalCoordinates readDouble(Lcom/mojang/brigadier/StringReader;I)D +public net.minecraft.advancements.critereon.MinMaxBounds$Doubles (Ljava/util/Optional;Ljava/util/Optional;)V +public net.minecraft.advancements.critereon.MinMaxBounds$Ints (Ljava/util/Optional;Ljava/util/Optional;)V +public net.minecraft.network.chat.MutableComponent (Lnet/minecraft/network/chat/ComponentContents;Ljava/util/List;Lnet/minecraft/network/chat/Style;)V +public net.minecraft.commands.arguments.item.ItemParser ERROR_NO_TAGS_ALLOWED +public net.minecraft.world.level.storage.PrimaryLevelData settings +public net.minecraft.client.gui.components.AbstractWidget renderScrollingString(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/gui/Font;Lnet/minecraft/network/chat/Component;IIIII)V diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/neoforge.mods.toml similarity index 81% rename from src/main/resources/META-INF/mods.toml rename to src/main/resources/META-INF/neoforge.mods.toml index 8644b51..4051c64 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/neoforge.mods.toml @@ -1,5 +1,5 @@ modLoader="javafml" -loaderVersion="[52,)" +loaderVersion="${loader_version_range}" updateJSONURL="https://raw.githubusercontent.com/Exopandora/worldhandler/master/version.json" issueTrackerURL="https://github.com/Exopandora/WorldHandler/issues" displayURL="https://minecraft.curseforge.com/projects/world-handler-command-gui" @@ -17,7 +17,14 @@ license="GPL v3.0" [[dependencies.worldhandler]] modId="minecraft" - mandatory=true + type="required" versionRange="[1.21.1,1.21.2)" ordering="NONE" side="BOTH" + +[[dependencies.worldhandler]] + modId="neoforge" + type="required" + versionRange="[21.1.225,)" + ordering="NONE" + side="BOTH"