Jump to content

Recommended Posts

Posted

Ok, so, I'm trying to create a new ore and generate it in the world, but, for some reason, the Minecraft is crashing everytime.

 

OreGeneration:

 

package mod.stardev.mod1.world;

import mod.stardev.mod1.lists.blocksList;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.GenerationStage;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.OreFeatureConfig;
import net.minecraft.world.gen.placement.CountRangeConfig;
import net.minecraft.world.gen.placement.Placement;
import net.minecraftforge.registries.ForgeRegistries;

public class OreGeneration {

    public static void setupOreGeneration() {
        for (Biome biome : ForgeRegistries.BIOMES) {
            biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, blocksList.tutorial_ore.getDefaultState(), oregenConfig.tutorial_chance.get()), Placement.COUNT_RANGE, new CountRangeConfig(10, 20, 0, 100)));
        }
    }

}

 

oregenConfig:

 

package mod.stardev.mod1.world;

import net.minecraftforge.common.ForgeConfigSpec;

public class oregenConfig {

    public static ForgeConfigSpec.IntValue tutorial_chance;
    public static ForgeConfigSpec.BooleanValue generate_overworld;

    public static void init(ForgeConfigSpec.Builder server, ForgeConfigSpec.Builder client) {
        server.comment("Oregen Config");

        tutorial_chance = server
                .comment("Maximum number of ore veins of the tutorial ore that can spawn in one chunk.")
                .defineInRange("oregen.tutorial_chance", 20, 1, 1000000);

        generate_overworld = server
                .comment("Decide if you want the tutorial ore to spawn in the overworld")
                .define("oregen.generate_overworld", true);
    }
}

 

Main:

 

package mod.stardev.mod1;

import mod.stardev.mod1.lists.armorMaterialList;
import mod.stardev.mod1.lists.blocksList;
import mod.stardev.mod1.lists.itemsList;
import mod.stardev.mod1.lists.toolMaterialList;
import mod.stardev.mod1.world.OreGeneration;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.*;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

@Mod(tutorialmod.MODID)
public final class tutorialmod {
    public static final String MODID = "tutorialmod";

    public static final Logger LOGGER = LogManager.getLogger(MODID);

    public static final ItemGroup tutorial = new tutorialItemGroup();

    public tutorialmod() {
        OreGeneration.setupOreGeneration();
        LOGGER.info("Hello from TutorialMod.");
    }

    @Mod.EventBusSubscriber(modid = tutorialmod.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
    public static class ModEventSubscriber {

        @SubscribeEvent
        public static void onRegisterItens(RegistryEvent.Register<Item> event) {

            event.getRegistry().registerAll(
                itemsList.tutorial_item = new Item(new Item.Properties().group(tutorial)).setRegistryName(location("tutorial_item")),
                itemsList.tutorial_axe = new AxeItem(toolMaterialList.tutorial, -1.0f, 6.0f, new Item.Properties().group(tutorial)).setRegistryName(location("tutorial_axe")),
                itemsList.tutorial_pickaxe = new PickaxeItem(toolMaterialList.tutorial, -1,  6.0f, new Item.Properties().group(tutorial)).setRegistryName(location("tutorial_pickaxe")),
                itemsList.tutorial_shovel = new ShovelItem(toolMaterialList.tutorial, -1.0f, 6.0f, new Item.Properties().group(tutorial)).setRegistryName(location("tutorial_shovel")),
                itemsList.tutorial_hoe = new HoeItem(toolMaterialList.tutorial, 6.0f, new Item.Properties().group(tutorial)).setRegistryName(location("tutorial_hoe")),
                itemsList.tutorial_sword = new SwordItem(toolMaterialList.tutorial, 3, 6.0f, new Item.Properties().group(tutorial)).setRegistryName(location("tutorial_sword")),
                itemsList.tutorial_helmet = new ArmorItem(armorMaterialList.tutorial, EquipmentSlotType.HEAD, new Item.Properties().group(tutorial)).setRegistryName(location("tutorial_helmet")),
                itemsList.tutorial_chestplate = new ArmorItem(armorMaterialList.tutorial, EquipmentSlotType.CHEST, new Item.Properties().group(tutorial)).setRegistryName(location("tutorial_chestplate")),
                itemsList.tutorial_legging = new ArmorItem(armorMaterialList.tutorial, EquipmentSlotType.LEGS, new Item.Properties().group(tutorial)).setRegistryName(location("tutorial_legging")),
                itemsList.tutorial_boots = new ArmorItem(armorMaterialList.tutorial, EquipmentSlotType.FEET, new Item.Properties().group(tutorial)).setRegistryName(location("tutorial_boots")),

                itemsList.tutorial_block = new BlockItem(blocksList.tutorial_block, new Item.Properties().group(tutorial)).setRegistryName(blocksList.tutorial_block.getRegistryName()),
                itemsList.tutorial_ore = new BlockItem(blocksList.tutorial_ore, new Item.Properties().group(tutorial)).setRegistryName(blocksList.tutorial_ore.getRegistryName())
            );

            LOGGER.info("Items Registered");
        }

        @SubscribeEvent
        public static void onRegisterBlocks(RegistryEvent.Register<Block> event) {

            event.getRegistry().registerAll(
                    blocksList.tutorial_block = new Block(Block.Properties.create(Material.IRON).hardnessAndResistance(2.0F, 3.0F).lightValue(10).sound(SoundType.METAL)).setRegistryName(location("tutorial_block")),
                    blocksList.tutorial_ore = new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(2.0F, 3.0F).lightValue(10).sound(SoundType.METAL)).setRegistryName(location("tutorial_ore"))
            );

            LOGGER.info("Blocks Registered");

        }

        public static ResourceLocation location(String name) {
            return new ResourceLocation(MODID, name);
        }
    }
}

 

Log:

 

[10jul2020 16:26:15.251] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--gameDir, ., --launchTarget, fmluserdevclient, --fml.mcpVersion, 20190829.143755, --fml.mcVersion, 1.14.4, --fml.forgeGroup, net.minecraftforge, --fml.forgeVersion, 28.2.0, --version, MOD_DEV, --assetIndex, 1.14, --assetsDir, C:\Users\ferna\.gradle\caches\forge_gradle\assets, --username, Dev, --accessToken, ❄❄❄❄❄❄❄❄, --userProperties, {}]
[10jul2020 16:26:15.254] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 4.1.0+62+5bfa59b starting: java version 1.8.0_251 by Oracle Corporation
[10jul2020 16:26:15.760] [main/INFO] [net.minecraftforge.fml.loading.FixSSL/CORE]: Added Lets Encrypt root certificates as additional trust
[10jul2020 16:26:16.663] [main/INFO] [cpw.mods.modlauncher.LaunchServiceHandler/MODLAUNCHER]: Launching target 'fmluserdevclient' with arguments [--version, MOD_DEV, --gameDir, ., --assetsDir, C:\Users\ferna\.gradle\caches\forge_gradle\assets, --assetIndex, 1.14, --username, Dev, --accessToken, ❄❄❄❄❄❄❄❄, --userProperties, {}]
[10jul2020 16:26:18.468] [Client thread/INFO] [net.minecraft.client.Minecraft/]: Setting user: Dev
[10jul2020 16:26:29.512] [Client thread/WARN] [net.minecraft.client.GameSettings/]: Skipping bad option: lastServer:
[10jul2020 16:26:29.534] [Client thread/INFO] [net.minecraft.client.Minecraft/]: LWJGL Version: 3.2.2 build 10
[10jul2020 16:26:30.364] [modloading-worker-9/INFO] [net.minecraftforge.common.ForgeMod/FORGEMOD]: Forge mod loading, version 28.2.0, for MC 1.14.4 with MCP 20190829.143755
[10jul2020 16:26:30.364] [modloading-worker-9/INFO] [net.minecraftforge.common.MinecraftForge/FORGE]: MinecraftForge v28.2.0 Initialized
[10jul2020 16:26:30.366] [modloading-worker-2/ERROR] [net.minecraftforge.fml.javafmlmod.FMLModContainer/LOADING]: Failed to create mod instance. ModID: tutorialmod, class mod.stardev.mod1.tutorialmod
java.lang.NullPointerException: null
    at mod.stardev.mod1.world.OreGeneration.setupOreGeneration(OreGeneration.java:16) ~[?:?]
    at mod.stardev.mod1.tutorialmod.<init>(tutorialmod.java:29) ~[?:?]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_251]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_251]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_251]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_251]
    at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_251]
    at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:131) ~[?:28.2]
    at java.util.function.Consumer.lambda$andThen$0(Consumer.java:65) ~[?:1.8.0_251]
    at java.util.function.Consumer.lambda$andThen$0(Consumer.java:65) ~[?:1.8.0_251]
    at net.minecraftforge.fml.ModContainer.transitionState(ModContainer.java:112) ~[?:?]
    at net.minecraftforge.fml.ModList.lambda$null$10(ModList.java:134) ~[?:?]
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) [?:1.8.0_251]
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382) [?:1.8.0_251]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) [?:1.8.0_251]
    at java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:291) [?:1.8.0_251]
    at java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:731) [?:1.8.0_251]
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) [?:1.8.0_251]
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) [?:1.8.0_251]
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) [?:1.8.0_251]
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) [?:1.8.0_251]
[10jul2020 16:26:30.511] [Client thread/FATAL] [net.minecraftforge.fml.ModLoader/LOADING]: Failed to complete lifecycle event CONSTRUCT, 1 errors found
[10jul2020 16:26:30.511] [Client thread/FATAL] [net.minecraftforge.eventbus.EventBus/EVENTBUS]: EventBus 0 shutting down - future events will not be posted.
java.lang.Exception: stacktrace
    at net.minecraftforge.eventbus.EventBus.shutdown(EventBus.java:278) ~[eventbus-1.0.0-service.jar:?]
    at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$5(ClientModLoader.java:115) ~[forge-1.14.4-28.2.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?]
    at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:97) ~[forge-1.14.4-28.2.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?]
    at net.minecraft.client.Minecraft.init(Minecraft.java:457) ~[forge-1.14.4-28.2.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:365) ~[forge-1.14.4-28.2.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?]
    at net.minecraft.client.main.Main.main(Main.java:128) ~[forge-1.14.4-28.2.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_251]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_251]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_251]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_251]
    at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.14.4-28.2.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?]
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-4.1.0.jar:?]
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-4.1.0.jar:?]
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-4.1.0.jar:?]
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-4.1.0.jar:?]
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-4.1.0.jar:?]
    at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:102) [forge-1.14.4-28.2.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?]
[10jul2020 16:26:33.370] [Client thread/INFO] [com.mojang.text2speech.NarratorWindows/]: Narrator library for x64 successfully loaded
[10jul2020 16:26:33.577] [Server-Worker-1/ERROR] [net.minecraftforge.fml.ModLoader/LOADING]: Skipping lifecycle event SETUP, 1 errors found.
[10jul2020 16:26:33.577] [Server-Worker-1/FATAL] [net.minecraftforge.fml.ModLoader/LOADING]: Failed to complete lifecycle event SETUP, 1 errors found
[10jul2020 16:26:33.577] [Server-Worker-1/FATAL] [net.minecraftforge.eventbus.EventBus/EVENTBUS]: EventBus 0 shutting down - future events will not be posted.
java.lang.Exception: stacktrace
    at net.minecraftforge.eventbus.EventBus.shutdown(EventBus.java:278) ~[eventbus-1.0.0-service.jar:?]
    at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$5(ClientModLoader.java:115) ~[?:?]
    at net.minecraftforge.fml.client.ClientModLoader.startModLoading(ClientModLoader.java:123) ~[?:?]
    at net.minecraftforge.fml.client.ClientModLoader.lambda$onreload$3(ClientModLoader.java:105) ~[?:?]
    at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$5(ClientModLoader.java:113) ~[?:?]
    at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1640) [?:1.8.0_251]
    at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1632) [?:1.8.0_251]
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) [?:1.8.0_251]
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) [?:1.8.0_251]
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) [?:1.8.0_251]
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) [?:1.8.0_251]
[10jul2020 16:26:33.579] [Thread-1/FATAL] [net.minecraftforge.common.ForgeConfig/CORE]: Forge config just got changed on the file system!
[10jul2020 16:26:36.932] [Server-Worker-7/ERROR] [net.minecraftforge.fml.ModLoader/LOADING]: Skipping lifecycle event ENQUEUE_IMC, 1 errors found.
[10jul2020 16:26:36.948] [Server-Worker-7/FATAL] [net.minecraftforge.fml.ModLoader/LOADING]: Failed to complete lifecycle event ENQUEUE_IMC, 1 errors found
[10jul2020 16:26:36.948] [Server-Worker-7/FATAL] [net.minecraftforge.eventbus.EventBus/EVENTBUS]: EventBus 0 shutting down - future events will not be posted.
java.lang.Exception: stacktrace
    at net.minecraftforge.eventbus.EventBus.shutdown(EventBus.java:278) ~[eventbus-1.0.0-service.jar:?]
    at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$5(ClientModLoader.java:115) ~[?:?]
    at net.minecraftforge.fml.client.ClientModLoader.finishModLoading(ClientModLoader.java:136) ~[?:?]
    at net.minecraftforge.fml.client.ClientModLoader.lambda$onreload$4(ClientModLoader.java:107) ~[?:?]
    at java.util.concurrent.CompletableFuture.uniRun(CompletableFuture.java:719) [?:1.8.0_251]
    at java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:701) [?:1.8.0_251]
    at java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:457) [?:1.8.0_251]
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) [?:1.8.0_251]
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) [?:1.8.0_251]
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) [?:1.8.0_251]
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) [?:1.8.0_251]
[10jul2020 16:26:36.968] [Client thread/WARN] [net.minecraft.client.GameSettings/]: Skipping bad option: lastServer:
[10jul2020 16:26:38.620] [Client thread/INFO] [net.minecraft.client.audio.SoundSystem/]: OpenAL initialized.
[10jul2020 16:26:38.622] [Client thread/INFO] [net.minecraft.client.audio.SoundEngine/SOUNDS]: Sound engine started
[10jul2020 16:26:39.192] [Client thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 512x512 textures-atlas
[10jul2020 16:26:39.997] [Client thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 256x256 textures/particle-atlas
[10jul2020 16:26:40.013] [Client thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 256x256 textures/painting-atlas
[10jul2020 16:26:40.015] [Client thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 128x128 textures/mob_effect-atlas
 

Posted

Looks like you're trying to setup ore generation in your constructor, which is before any registry stuff has happened, so your ore doesn't exist.

 

Try moving ore generation setup into FMLCommonSetupEvent

 

Also, you should update to 1.15.2, as 1.14.4 is going to be out of support once there is a RB for 1.16.x.

  • Thanks 1
Posted
  On 7/10/2020 at 8:16 PM, Ugdhar said:

Looks like you're trying to setup ore generation in your constructor, which is before any registry stuff has happened, so your ore doesn't exist.

 

Try moving ore generation setup into FMLCommonSetupEvent

 

Also, you should update to 1.15.2, as 1.14.4 is going to be out of support once there is a RB for 1.16.x.

Expand  

There was many new stuff in the 1.15.2 compared to 1.14.4? Also, it worked, thanks a lot.

Posted

I believe that CommonSetup is too early, use FMLLoadCompleteEvent .

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
  On 7/11/2020 at 2:37 AM, ChampionAsh5357 said:

I thought LoadComplete was supposed to be avoided for modders.

Expand  

The javadoc says:

  Quote

* This is a mostly internal event fired to mod containers that indicates that loading is complete. Mods should not

* in general override or otherwise attempt to implement this event.

Expand  

"Implement" and "Override" are specific keywords that have specific meanings in programming and if the intent was that mods should not listen for the event, then it would (or should) say "don't" use or "don't listen for" or be marked as deprecated.

 

A search of both the git repo and the forums return no results of anyone of any authority saying anything about the event.

 

I'm more than happy to be wrong, but my reading says nothing about not using the event.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted (edited)
  On 7/11/2020 at 2:02 AM, Draco18s said:

I believe that CommonSetup is too early, use FMLLoadCompleteEvent .

Expand  

Can you cite a source on that?

I'm almost positive I've seen it advised to do stuff in CommonSetup (using DeferredWorkQueue for thread safety which I forgot to mention above)

 

*edit: also, was just looking at Tropicraft, and it does the ore generation setup in FLMCommonSetupEvent (https://github.com/Tropicraft/Tropicraft/blob/17bcace66cbcbe1535e52a50bab48ccdd533ab9a/src/main/java/net/tropicraft/Tropicraft.java#L125)

 

Thanks! :)

Edited by Ugdhar
Posted

Looked at the load order, for some reason I thought CommonSetup was called sooner.

    ERROR(null),
    VALIDATE(null),
    CONSTRUCT(null),
    CREATE_REGISTRIES(null),
    LOAD_REGISTRIES(null),
    COMMON_SETUP(()-> FMLCommonSetupEvent::new),
    SIDED_SETUP(SidedProvider.SIDED_SETUP_EVENT::get),
    ENQUEUE_IMC(()-> InterModEnqueueEvent::new),
    PROCESS_IMC(()-> InterModProcessEvent::new),
    COMPLETE(()-> FMLLoadCompleteEvent::new),
    DONE(null),
    GATHERDATA(ModLoader.get()::getDataGeneratorEvent);

 

  • Thanks 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • https://mclo.gs/9y5ciD2 anyone ever had this issue?  Internal exception illegal argument exception: unable to fit 3194354 into 3
    • Hi! I'm trying to add my custom models/textures renderer like this: public class PonyPlayerWrapperRenderer extends EntityRenderer<Player> { // wrapper class under my LivingEntityRenderer class implementation private final PonyPlayerRenderer innerRenderer; private final PonyPlayerRenderer innerSlimRenderer; public PonyPlayerWrapperRenderer(final EntityRendererProvider.Context context) { super(context); System.out.println("creating new PonyPlayerWrapperRenderer"); this.innerRenderer = new PonyPlayerRenderer(context, false); this.innerSlimRenderer = new PonyPlayerRenderer(context, true); } @Override public void render(final Player entity, final float yaw, final float partialTicks, final PoseStack poseStack, final MultiBufferSource bufferSource, final int packedLight) { System.out.println("PonyPlayerWrapperRenderer render: " + entity.toString()); if (entity instanceof AbstractClientPlayer clientPlayer) { if (clientPlayer.getModelName().contains("slim")) { innerSlimRenderer.render(clientPlayer, yaw, partialTicks, poseStack, bufferSource, packedLight); } else { innerRenderer.render(clientPlayer, yaw, partialTicks, poseStack, bufferSource, packedLight); } } } @Override public ResourceLocation getTextureLocation(final Player player) { System.out.println("PonyPlayerWrapperRenderer getTextureLocation"); if (player instanceof AbstractClientPlayer clientPlayer) { return clientPlayer.getSkinTextureLocation(); } System.out.println("player instanceof AbstractClientPlayer is false"); return getDefaultSkin(player.getUUID()); } } public class PonyPlayerRenderer extends LivingEntityRenderer<AbstractClientPlayer, PlayerModel<AbstractClientPlayer>> { private final PlayerModel<AbstractClientPlayer> earthModel; private final PlayerModel<AbstractClientPlayer> pegasusModel; private final PlayerModel<AbstractClientPlayer> unicornModel; public PonyPlayerRenderer(final EntityRendererProvider.Context context, final boolean slim) { super( context, slim ? new PonyModelSlim(context.bakeLayer(PonyModelSlim.LAYER_LOCATION)) : new PonyModel(context.bakeLayer(PonyModel.LAYER_LOCATION)), 0.5f ); System.out.println("creating new PonyPlayerRenderer"); this.earthModel = slim ? new PonyModelSlim(context.bakeLayer(PonyModelSlim.LAYER_LOCATION)) : new PonyModel(context.bakeLayer(PonyModel.LAYER_LOCATION)); this.pegasusModel = new PegasusModel(context.bakeLayer(PegasusModel.LAYER_LOCATION)); this.unicornModel = new UnicornModel(context.bakeLayer(UnicornModel.LAYER_LOCATION)); } @Override public void render(final AbstractClientPlayer player, final float entityYaw, final float partialTicks, final PoseStack poseStack, final MultiBufferSource buffer, final int packedLight) { final PonyRace race = player.getCapability(PONY_DATA) .map(data -> ofNullable(data.getRace()).orElse(PonyRace.EARTH)) .orElse(PonyRace.EARTH); this.model = switch (race) { case PEGASUS -> pegasusModel; case UNICORN -> unicornModel; case EARTH -> earthModel; }; super.render(player, entityYaw, partialTicks, poseStack, buffer, packedLight); } @Override public ResourceLocation getTextureLocation(final AbstractClientPlayer player) { final PonyRace race = player.getCapability(PONY_DATA) .map(data -> ofNullable(data.getRace()).orElse(PonyRace.EARTH)) .orElse(PonyRace.EARTH); return switch (race) { case EARTH -> fromNamespaceAndPath(MODID, "textures/entity/earth_pony.png"); case PEGASUS -> fromNamespaceAndPath(MODID, "textures/entity/pegasus.png"); case UNICORN -> fromNamespaceAndPath(MODID, "textures/entity/unicorn.png"); }; } } @Mod.EventBusSubscriber(modid = MODID, bus = MOD, value = CLIENT) public class ClientRenderers { // mod bus render registration config @SubscribeEvent public static void onRegisterLayerDefinitions(final EntityRenderersEvent.RegisterLayerDefinitions event) { event.registerLayerDefinition(PonyModel.LAYER_LOCATION, PonyModel::createBodyLayer); event.registerLayerDefinition(PonyModelSlim.LAYER_LOCATION, PonyModelSlim::createBodyLayer); event.registerLayerDefinition(PegasusModel.LAYER_LOCATION, PegasusModel::createBodyLayer); event.registerLayerDefinition(UnicornModel.LAYER_LOCATION, UnicornModel::createBodyLayer); event.registerLayerDefinition(InnerPonyArmorModel.LAYER_LOCATION, InnerPonyArmorModel::createBodyLayer); event.registerLayerDefinition(OuterPonyArmorModel.LAYER_LOCATION, OuterPonyArmorModel::createBodyLayer); } @SubscribeEvent public static void onRegisterRenderers(final EntityRenderersEvent.RegisterRenderers event) { event.registerEntityRenderer(EntityType.PLAYER, PonyPlayerWrapperRenderer::new); System.out.println("onRegisterRenderers end"); } } Method onRegisterRenderers() is called and I can see it being logged. But when I enter the world, my PonyWrapperRenderer render() method doesn't ever seem to be called. I also tried to put my renderer to EntityRenderDispatcher's playerRenderers via reflection: @Mod.EventBusSubscriber(modid = MODID, bus = MOD, value = CLIENT) public class ClientRenderers { @SubscribeEvent public static void onRegisterLayerDefinitions(final EntityRenderersEvent.RegisterLayerDefinitions event) { event.registerLayerDefinition(PonyModel.LAYER_LOCATION, PonyModel::createBodyLayer); event.registerLayerDefinition(PonyModelSlim.LAYER_LOCATION, PonyModelSlim::createBodyLayer); event.registerLayerDefinition(PegasusModel.LAYER_LOCATION, PegasusModel::createBodyLayer); event.registerLayerDefinition(UnicornModel.LAYER_LOCATION, UnicornModel::createBodyLayer); event.registerLayerDefinition(InnerPonyArmorModel.LAYER_LOCATION, InnerPonyArmorModel::createBodyLayer); event.registerLayerDefinition(OuterPonyArmorModel.LAYER_LOCATION, OuterPonyArmorModel::createBodyLayer); } @SubscribeEvent public static void onClientSetup(final FMLClientSetupEvent event) { event.enqueueWork(() -> { try { final EntityRenderDispatcher dispatcher = Minecraft.getInstance().getEntityRenderDispatcher(); final Field renderersField = getEntityRenderDispatcherField("playerRenderers"); final Field itemInHandRenderer = getEntityRenderDispatcherField("itemInHandRenderer"); @SuppressWarnings("unchecked") final Map<String, EntityRenderer<? extends Player>> playerRenderers = (Map<String, EntityRenderer<? extends Player>>)renderersField.get(dispatcher); final PonyPlayerWrapperRenderer renderer = new PonyPlayerWrapperRenderer( new EntityRendererProvider.Context( dispatcher, Minecraft.getInstance().getItemRenderer(), Minecraft.getInstance().getBlockRenderer(), (ItemInHandRenderer)itemInHandRenderer.get(dispatcher), Minecraft.getInstance().getResourceManager(), Minecraft.getInstance().getEntityModels(), Minecraft.getInstance().font ) ); playerRenderers.put("default", renderer); playerRenderers.put("slim", renderer); System.out.println("Player renderers replaced"); } catch (final Exception e) { throw new RuntimeException("Failed to replace player renderers", e); } }); } private static Field getEntityRenderDispatcherField(final String fieldName) throws NoSuchFieldException { final Field field = EntityRenderDispatcher.class.getDeclaredField(fieldName); field.setAccessible(true); return field; } } But I receive the error before Minecraft Client appears (RuntimeException: Failed to replace player renderers - from ClientRenderers onClientSetup() method - and its cause below): java.lang.IllegalArgumentException: No model for layer anotherlittlepony:earth_pony#main at net.minecraft.client.model.geom.EntityModelSet.bakeLayer(EntityModelSet.java:18) ~[forge-1.20.1-47.4.0_mapped_official_1.20.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.entity.EntityRendererProvider$Context.bakeLayer(EntityRendererProvider.java:69) ~[forge-1.20.1-47.4.0_mapped_official_1.20.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at com.thuggeelya.anotherlittlepony.client.renderer.pony.PonyPlayerRenderer.<init>(PonyPlayerRenderer.java:32) ~[main/:?] {re:classloading} at com.thuggeelya.anotherlittlepony.client.renderer.pony.PonyPlayerWrapperRenderer.<init>(PonyPlayerWrapperRenderer.java:24) ~[main/:?] {re:classloading} at com.thuggeelya.anotherlittlepony.client.renderer.ClientRenderers.lambda$onClientSetup$0(ClientRenderers.java:79) ~[main/:?] {re:classloading} ... 33 more Problem appears when EntityRendererProvider context tries to bakeLayer with my model layer location: new PonyModel(context.bakeLayer(PonyModel.LAYER_LOCATION)); // PonyPlayerRenderer.java:32 public class PonyModel extends PlayerModel<AbstractClientPlayer> { // the model class itself public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation( ResourceLocation.fromNamespaceAndPath(MODID, "earth_pony"), "main" ); public PonyModel(final ModelPart root) { super(root, false); } public static LayerDefinition createBodyLayer() { // some CubeListBuilder stuff for model appearance } } Textures PNGs are placed at: resources/assets/[my mod id]/textures/entity. My forge version is 1.20.1. Would appreciate any help.
    • Well, a bit more information about what you're trying to do would be helpful. e.g. why you're trying to use "INVOKE_ASSIGN" instead of "INVOKE". "INVOKE_ASSIGN" calls your code after the "target" is called and its value is stored, if applicable. "INVOKE" calls your code before the target is called. "target" expects a fully qualified name, as per the SpongePowered docs, if that name is going to be remapped (which it will be if your injecting into Minecraft itself and not another mod). For more information on fully qualified names versus canonical names, see the Java specifications. Here's an example of a working "@At" from my own code that targets the "getClosestsVulnerablePlayerToEntity" call inside a mob's logic: @At(value = "INVOKE_ASSIGN", target = "net.minecraft.world.World.getClosestVulnerablePlayerToEntity(Lnet/minecraft/entity/Entity;D)Lnet/minecraft/entity/player/EntityPlayer;") Hope this helps!
    • Ran it one more time just to check, and there's no errors this time on the log??? Log : https://mclo.gs/LnuaAiu I tried allocating more memory to the modpack, around 8000MB and it's still the same; stopping at "LOAD_REGISTRIES". Are some of the mods clashing, maybe? I have no clue what to do LOL
    • Tried removing some biome generation mods and test ran it again, but it's still the same; still not responding as soon as it gets to "LOAD_REGISTRIES". This time with more errors though. Log : https://mclo.gs/uygZzD8 Is there too little memory allocated to the modpack maybe? Can someone help please.    (T.T)💔
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.