Jump to content

Recommended Posts

Posted

Hello there! It's been a decent time since I've worked on my mod, seeing as the changes in 1.12 broke almost everything in it. At this point, I was ecstatic as it seemed I had gotten it running again! However, I've been encountering a game-breaking issue that I can't wrap my head around enough to solve.

Whenever I start my mod within a server- even a server with only my mod- it crashes with a java.lang.NoClassDefFoundError. From what I have seen in the crash report (https://pastebin.com/ru6U5zhH) and from what I have seen browsing for an answer here on the Forge Forums, it seems as though I have made a mistake by rendering my entities server-side rather than client-side. Though I've seen that I need to render my own entities through the client proxy, I can't seem to find out exactly how I am supposed to do so due to the changes to coding in 1.12 and my own taking a break which has made me rusty. 

 

All I am asking for is some advice on what I am doing wrong, or what I should do. I am by no means "new" to coding, and I've coded this mod much further before, but I am terribly rusty and need help trying to figure out this error. 

 

The class that's giving the error according to the log is as follows.

package riley.fallenstars.utils.handlers;

import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraftforge.fml.client.registry.IRenderFactory;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import riley.fallenstars.entities.EntityChinchilla;
import riley.fallenstars.entities.EntityFox;
import riley.fallenstars.entities.EntityShepherd;
import riley.fallenstars.entities.render.RenderChinchilla;
import riley.fallenstars.entities.render.RenderFox;
import riley.fallenstars.entities.render.RenderShepherd;

public class RenderHandler
{
    public static void registerEntityRenders()
    {
        RenderingRegistry.registerEntityRenderingHandler(EntityFox.class, new IRenderFactory<EntityFox>()
        {
            @Override
            public Render<? super EntityFox> createRenderFor(RenderManager renderManager)
            {
                return new RenderFox(renderManager);
            }
        });
        RenderingRegistry.registerEntityRenderingHandler(EntityChinchilla.class, new IRenderFactory<EntityChinchilla>()
        {
            @Override
            public Render<? super EntityChinchilla> createRenderFor(RenderManager renderManager)
            {
                return new RenderChinchilla(renderManager);
            }
        });
        RenderingRegistry.registerEntityRenderingHandler(EntityShepherd.class, new IRenderFactory<EntityShepherd>()
        {
            @Override
            public Render<? super EntityShepherd> createRenderFor(RenderManager renderManager)
            {
                return new RenderShepherd(renderManager);
            }
        });
    }
}

If there is anything else I should link according to the crash report or other needed info; I am more than willing to do so. A huge thank you for any help in advance, and I look forward to finding an answer so that I may finally work on restoring my little mod to it's former state.

Posted

And where do you call this code from?

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 3/12/2018 at 5:33 PM, Draco18s said:

And where do you call this code from?

Expand  

Apologies. I call the RenderHandler from my Registry Handler here:
 

package riley.fallenstars.utils.handlers;

import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import riley.fallenstars.init.FallenStarsBlocks;
import riley.fallenstars.init.FallenStarsEntities;
import riley.fallenstars.init.FallenStarsItems;
import riley.fallenstars.utils.IHasModel;

@Mod.EventBusSubscriber
public class RegistryHandler
{
    @SubscribeEvent
    public static void onItemRegister(RegistryEvent.Register<Item> event)
    {
        event.getRegistry().registerAll(FallenStarsItems.ITEMS.toArray(new Item[0]));
    }

    @SubscribeEvent
    public static void onBlockRegister(RegistryEvent.Register<Block> event)
    {
        event.getRegistry().registerAll(FallenStarsBlocks.BLOCKS.toArray(new Block[0]));
    }

    @SubscribeEvent
    public static void onModelRegister(ModelRegistryEvent event)
    {
        for (Item item : FallenStarsItems.ITEMS)
        {
            if (item instanceof IHasModel)
            {
                ((IHasModel)item).registerModels();
            }
        }

        for (Block block : FallenStarsBlocks.BLOCKS)
        {
            if (block instanceof IHasModel)
            {
                ((IHasModel)block).registerModels();;
            }
        }
    }

    public static void preInitRegistries()
    {
        FallenStarsEntities.registerEntities();
        RenderHandler.registerEntityRenders();
    }

    public static void initRegistries()
    {
        SoundsHandler.registerSounds();
    }
}

 

Which the "preInitRegistries()" method is then called from my main class under it's preInit. Here's the main class as well, just in case:
 

package riley.fallenstars;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import riley.fallenstars.init.FallenStarsTab;
import riley.fallenstars.proxy.CommonProxy;
import riley.fallenstars.utils.Reference;
import riley.fallenstars.utils.handlers.RegistryHandler;

@Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION)
public class FallenStars
{
    @Mod.Instance
    public static FallenStars instance;

    public static final CreativeTabs fallenstarstab = new FallenStarsTab("fallenstarstab");

    @SidedProxy(clientSide = Reference.CLIENT, serverSide = Reference.COMMON)
    public static CommonProxy proxy;

    @Mod.EventHandler
    public static void preInit(FMLPreInitializationEvent event)
    {
        RegistryHandler.preInitRegistries();
    }

    @Mod.EventHandler
    public static void init(FMLInitializationEvent event)
    {
        RegistryHandler.initRegistries();
    }

    @Mod.EventHandler
    public static void postInit(FMLPostInitializationEvent event) {}
}

 

I've been following some videos to somewhat refresh myself and to learn the changes in forge different from 1.10.2. So apologies if it's at all wrong. That's why I'm here to see, I assume I did something wrong here and I kinda understand what I did wrong but am unsure how to fix it.

Posted (edited)

You call this from common code:

  On 3/12/2018 at 5:44 PM, RileyTheFox said:

RegistryHandler.preInitRegistries();

Expand  

This calls:

  On 3/12/2018 at 5:44 PM, RileyTheFox said:

RenderHandler.registerEntityRenders();

Expand  

This calls

  On 3/12/2018 at 5:12 PM, RileyTheFox said:

RenderingRegistry.registerEntityRenderingHandler(EntityFox.class, new IRenderFactory<EntityFox>()

Expand  

which is a class located at

  On 3/12/2018 at 5:12 PM, RileyTheFox said:

import net.minecraftforge.fml.client.registry.RenderingRegistry;

Expand  

Oops, that's client side only. Server has crashed.

Edited by Draco18s

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 3/12/2018 at 5:46 PM, Draco18s said:

You call this from common code:

This calls:

This calls

which is a class located at

Oops, that's client side only. Server has crashed.

Expand  

Alright, thank you so much. That actually helps me understand it a whole lot better than I was. So to fix it, would I have to change the fact that in the main class it's calling for common proxy? Or is there a better solution to this?

Posted

I'm very sorry for the double post. I tried fixing the issue by calling it from my ClientProxy instead though now I am met with this crash:
https://pastebin.com/bnfCpfNj

My client proxy looks like this now:

package riley.fallenstars.proxy;

import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.ModelLoader;
import riley.fallenstars.utils.handlers.RenderHandler;

public class ClientProxy implements CommonProxy
{
    @Override
    public void registerItemRenderer(Item item, int meta, String id)
    {
        ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), id));
    }

    @Override
    public void init()
    {
        RenderHandler.registerEntityRenders();
    }
}

 

I moved the RenderHandler.registerEntityRenders() from the RegistryHandler (which from what I understand from your response was being called to the common rather than to the client) to the ClientProxy instead. I'm still unsure and am baffled as to what I'm doing wrong as I referenced my old code from 1.10 this time just to try and get an idea. I feel like that idea is wrong, unless I'm getting closer? I really can't tell at this point. 

 

Again, apologies for double-posting. Just wanted to update on what I did/tried.

Posted

No, that is correct.

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

Yes! I looked up the issue I'm having now and stupid me, I had my CommonProxy abstract by mistake! It's working perfectly now. Thank you so much for explaining it to me Draco. It was probably a stupid error on my part but it really was a lot of help.

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

    • Hey guys, i'm currently developping a mod with forge 1.12.2 2860 and i'm using optifine and gradle 4.9. The thing is i'm trying to figure out how to show the player's body in first person. So far everything's going well since i've try to use a shader. The player's body started to blink dark when using a shader. I've try a lot of shader like chocapic, zeus etc etc but still the same issue. So my question is : How should i apply the current shader to the body ? At the same time i'm also drawing a HUD so maybe it could be the problem?   Here is the issue :    And here is the code where i'm trying to display the body :    private static void renderFirstPersonBody(EntityPlayerSP player, float partialTicks) { Minecraft mc = Minecraft.getMinecraft(); GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); try { // Préparation OpenGL GlStateManager.enableDepth(); GlStateManager.depthMask(true); GlStateManager.enableAlpha(); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // Éclairage correct pour shaders GlStateManager.enableLighting(); RenderHelper.enableStandardItemLighting(); GlStateManager.enableRescaleNormal(); // Active la lightmap pour les shaders mc.entityRenderer.enableLightmap(); // Position de rendu interpolée double px = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks; double py = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks; double pz = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks; GlStateManager.translate( px - mc.getRenderManager().viewerPosX, py - mc.getRenderManager().viewerPosY, pz - mc.getRenderManager().viewerPosZ ); // Rendu du joueur sans la tête Render<?> render = mc.getRenderManager().getEntityRenderObject(player); if (render instanceof RenderPlayer) { RenderPlayer renderPlayer = (RenderPlayer) render; boolean oldHeadHidden = renderPlayer.getMainModel().bipedHead.isHidden; boolean oldHeadwearHidden = renderPlayer.getMainModel().bipedHeadwear.isHidden; renderPlayer.getMainModel().bipedHead.isHidden = true; renderPlayer.getMainModel().bipedHeadwear.isHidden = true; setArmorHeadVisibility(renderPlayer, false); renderPlayer.doRender(player, 0, 0, 0, player.rotationYaw, partialTicks); renderPlayer.getMainModel().bipedHead.isHidden = oldHeadHidden; renderPlayer.getMainModel().bipedHeadwear.isHidden = oldHeadwearHidden; setArmorHeadVisibility(renderPlayer, !oldHeadwearHidden); } // Nettoyage post rendu mc.entityRenderer.disableLightmap(); GlStateManager.disableRescaleNormal(); } catch (Exception e) { // silent fail } finally { GlStateManager.popAttrib(); GlStateManager.popMatrix(); } }   Ty for your help. 
    • Item successfully registered, but there was a problem with the texture of the item, it did not insert and has just the wrong texture.     
    • Keep on using the original Launcher Run Vanilla 1.12.2 once and close the game Download Optifine and run optifine as installer (click on the optifine jar) Start the launcher and make sure the Optifine profile is selected - then test it again  
    • Hi everyone, I’m hoping to revisit an old version of Minecraft — specifically around Beta 1.7.3 — for nostalgia’s sake. I’ve heard you can do this through the official Minecraft Launcher, but I’m unsure how to do it safely without affecting my current installation or save files. Are there any compatibility issues I should watch out for when switching between versions? Would really appreciate any tips or advice from anyone who’s done this before! – Adam
    • hello! i was trying to recreate item-in-hand feature for my custom mob. i figured out that my mob needs a custom iteminhandlayer. i created it - but the main problem is.. well.. you can see all on screenshots any idea how i can fix that? is there any implemented method to render the item perfect to hand? public void render(@NotNull PoseStack pPoseStack, @NotNull MultiBufferSource pBufferSource, int pPackedLight, @NotNull TuneGolemRenderState pRenderState, float pYRot, float pXRot) { ItemStackRenderState item = pRenderState.heldItem; if (!item.isEmpty()) { pPoseStack.pushPose(); ModelPart leftArm = this.getParentModel().leftArm; pPoseStack.translate(0.35,0.5,-1.25); pPoseStack.mulPose(Axis.XP.rotationDegrees(180.0F)); pPoseStack.mulPose(Axis.YP.rotationDegrees(90.0F)); leftArm.translateAndRotate(pPoseStack); // pPoseStack.translate(0,0,0); leftArm.translateAndRotate(pPoseStack); if (TuneGolemRenderState.hornPlaying) { pPoseStack.translate(0, -0.5, 0.65); pPoseStack.scale(1.25F,1.25F,1.25F); } // Minecraft.getInstance().player.displayClientMessage(Component.literal(leftArm.xRot + " " + leftArm.yRot + " " + leftArm.zRot), true); item.render(pPoseStack, pBufferSource, pPackedLight, OverlayTexture.NO_OVERLAY); pPoseStack.popPose(); // -1.0F, -2.0F, -3.0F } }  
  • Topics

×
×
  • Create New...

Important Information

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