Jump to content

Recommended Posts

Posted

@SubscribeEvent to RenderPlayerEvent.Pre and/or Post. Cancel rendering and render your own model.

 

Note: This will require intermediate understanding or Render.class and its sub-classes as well as general to advanced OpenGL knowledge. On a side - also pretty much everything about vanilla rendering systems.

 

What help are you expecting? What model you want to use? What you want to render? What about animations (if you have different model, you need different animations, which you need to also code)? What about rendering vanilla other stuff such as armours and other "layers"?

  Quote

1.7.10 is no longer supported by forge, you are on your own.

Posted

Currently i only want to render custom model later i will try to make animations and armor but not now

 

EDIT:

 

I writed some code :

 

public class PreRenderEvent

{

    RenderManager manager = Minecraft.getMinecraft().getRenderManager();

 

    @SubscribeEvent

    public void preRenderPlayer(RenderLivingEvent.Pre event)

    {

        if (!(event.getEntity() instanceof EntityPlayer)) return;

        event.setCanceled(true);

 

        System.out.println("I think it works");

       

    }

}

 

And registered it with:

 

MinecraftForge.EVENT_BUS.register(new PreRenderEvent());

 

and now i'm invisible

 

so where i ned to put the render code now?

 

 

Posted

In event :)

 

Pre allows you to cancel everything that happens between Pre and Post. If you cancelled it normal rendering doesn't happen (thus invisible) and you can write (where your println is) your own rendering.

 

Now - as stated before, Entities don't really have models - they have Render classes which basically render entity directly from code (or rather Model classes such as ModelBiped)

To render anything custom - you will do it from code level (GL operations) or you can make GL render some model for you (e.g: wavefront).

 

In any case - again:

  On 7/24/2016 at 9:00 AM, Ernio said:

This will require intermediate understanding or Render.class and its sub-classes as well as general to advanced OpenGL knowledge. On a side - also pretty much everything about vanilla rendering systems.

 

Notice RenderPlayer and Render#doRender method. Args passed there are entity and positioning x/y/z. You will basically need to do same shit as in Render->RenderLiving->RenderPlayer (I am not in IDE, so idk hierarchy). Other options would be writing class CustomPlayerRender and amke it extend RenderLiving or RenderPlayer. Then simply make instance of it (render classes are singletons, so global static) and use that.

 

After all this talk: Last time I had fun with renders I tried to replace player render in registry, but it didn't work, you can try it yourself.

Make Factory and custom Render class and register it using RenderingRegistry.registerEntityRenderingHandler(EntityPlayer.class, new FactoryCustomPlayer()); Note - I also don't know if it's EntityPlayer or some of its sub, like AbstractClientPlayer maybe - check that. Also note - if this way works, you no longer need events (any).

 

EDIT

Okay, let me clear it up - you either:

 

1. Worth trying:

Make CustomRender extend RenderPlayer and register it in preInit with RenderingRegistry.registerEntityRenderingHandler(EntityPlayer.class, new FactoryCustomPlayer()); where idk if EntityPlayer.class or other sub-class is valid.

 

Note: This might not work (It didn't last time I tried - for players only, for other entities it works fine).

 

2. Valid approach:

Make CustomRender extend RenderPlayer. Override #doRender to write your rendering code. Make global static field and make instance in mod's init. (Lookup how Factory class makes instances). Use that instance and call #doRender from your event (where you do println).

  Quote

1.7.10 is no longer supported by forge, you are on your own.

Posted

So i need to do:

 

public class CustomPlayerRender extends RenderPlayer {

 

public CustomPlayerRender(RenderManager renderManager) {

super(renderManager);

// TODO Auto-generated constructor stub

this.renderModel(model, color, (ItemStack)null);

}

 

}

 

is this right?

 

Posted

Remember that statement about OpenGL and vanilla rendering system knowledge? That had Java included and Java also has Programming included which also has reading included (in this case reading of vanilla source). Why don't you tell me what what you did is supposed to do?

 

You can't just randomly call some method from constructor with non-existent params and expect stuff to do anything and even not crash. So while class such as this can exist, it is not proper approach.

 

EDIT

So my answer to this is basically - learn vanilla rendering system (read code).

  Quote

1.7.10 is no longer supported by forge, you are on your own.

Posted
  On 7/24/2016 at 4:18 PM, lukas2005 said:

Ok i re-created my model in Techne and now i have model in .java

  Quote

Refresh

 

Do you still have a problem?  If so, what is it?

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/24/2016 at 12:27 PM, Ernio said:

2. Valid approach:

Make CustomRender extend RenderPlayer. Override #doRender to write your rendering code. Make global static field and make instance in mod's init. (Lookup how Factory class makes instances). Use that instance and call #doRender from your event (where you do println).

 

i followed this and i executed render() function that is in my model class

 

and some weird things sarted to happen:

 

 

but i recognize some of parts of my model

 

My code:

 

CustomPlayerRender Class:

public class CustomPlayerRender extends RenderPlayer {

 

public mycustommodel model;

 

public CustomPlayerRender(RenderManager renderManager) {

super(renderManager);

 

model = new mycustommodel();

 

}

 

 

public void doRender(AbstractClientPlayer e) {

 

model.render(e, 1, 1, e.getAge(), e.cameraYaw, e.cameraPitch, 0.1f);

 

}

 

 

}

 

mycustommodel class:

 

public class mycustommodel extends ModelBiped

{

  //fields

    ModelRenderer LegRight;

    ModelRenderer LegLeft;

    ModelRenderer LegsConnector;

    ModelRenderer Body;

    ModelRenderer Head;

    ModelRenderer ArmRightUp;

    ModelRenderer ArmRightDown;

    ModelRenderer ArmLeftUp;

    ModelRenderer ArmLeftDown;

 

  public ModelMuscleMan()

  {

    textureWidth = 64;

    textureHeight = 64;

   

      LegRight = new ModelRenderer(this, 0, 0);

      LegRight.addBox(0F, 0F, 0F, 4, 12, 4);

      LegRight.setRotationPoint(1F, 12F, 1F);

      LegRight.setTextureSize(64, 64);

      LegRight.mirror = true;

      setRotation(LegRight, 0F, 0F, 0F);

      LegLeft = new ModelRenderer(this, 0, 0);

      LegLeft.addBox(0F, 0F, 0F, 4, 12, 4);

      LegLeft.setRotationPoint(-5F, 12F, 1F);

      LegLeft.setTextureSize(64, 64);

      LegLeft.mirror = true;

      setRotation(LegLeft, 0F, 0F, 0F);

      LegsConnector = new ModelRenderer(this, 16, 0);

      LegsConnector.addBox(0F, 0F, 0F, 10, 4, 11);

      LegsConnector.setRotationPoint(-5F, 9F, -2F);

      LegsConnector.setTextureSize(64, 64);

      LegsConnector.mirror = true;

      setRotation(LegsConnector, 0.3490659F, 0F, 0F);

      Body = new ModelRenderer(this, 0, 41);

      Body.addBox(0F, 0F, 0F, 16, 11, 12);

      Body.setRotationPoint(-8F, -1F, -6F);

      Body.setTextureSize(64, 64);

      Body.mirror = true;

      setRotation(Body, 0.3490659F, 0F, 0F);

      Head = new ModelRenderer(this, 0, 25);

      Head.addBox(0F, 0F, 0F, 8, 8, 8);

      Head.setRotationPoint(-4F, -10F, -6F);

      Head.setTextureSize(64, 64);

      Head.mirror = true;

      setRotation(Head, 0.1396263F, 0F, 0F);

      ArmRightUp = new ModelRenderer(this, 32, 28);

      ArmRightUp.addBox(0F, 0F, 0F, 4, 9, 4);

      ArmRightUp.setRotationPoint(5F, 0F, 0F);

      ArmRightUp.setTextureSize(64, 64);

      ArmRightUp.mirror = true;

      setRotation(ArmRightUp, 0.0349066F, 0F, -0.7330383F);

      ArmRightDown = new ModelRenderer(this, 48, 28);

      ArmRightDown.addBox(0F, 0F, 0F, 4, 9, 4);

      ArmRightDown.setRotationPoint(10F, 3F, 1.5F);

      ArmRightDown.setTextureSize(64, 64);

      ArmRightDown.mirror = true;

      setRotation(ArmRightDown, -0.5948578F, 0F, 0F);

      ArmLeftUp = new ModelRenderer(this, 32, 28);

      ArmLeftUp.addBox(0F, 0F, 0F, 4, 9, 4);

      ArmLeftUp.setRotationPoint(-8F, -2F, 1F);

      ArmLeftUp.setTextureSize(64, 64);

      ArmLeftUp.mirror = true;

      setRotation(ArmLeftUp, 0.0349066F, 0F, 0.7330383F);

      ArmLeftDown = new ModelRenderer(this, 48, 28);

      ArmLeftDown.addBox(0F, 0F, 0F, 4, 9, 4);

      ArmLeftDown.setRotationPoint(-14F, 3F, 1.5F);

      ArmLeftDown.setTextureSize(64, 64);

      ArmLeftDown.mirror = true;

      setRotation(ArmLeftDown, -0.5948606F, 0F, 0F);

  }

 

  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)

  {

    super.render(entity, f, f1, f2, f3, f4, f5);

    setRotationAngles(f, f1, f2, f3, f4, f5, entity);

    LegRight.render(f5);

    LegLeft.render(f5);

    LegsConnector.render(f5);

    Body.render(f5);

    Head.render(f5);

    ArmRightUp.render(f5);

    ArmRightDown.render(f5);

    ArmLeftUp.render(f5);

    ArmLeftDown.render(f5);

  }

 

  private void setRotation(ModelRenderer model, float x, float y, float z)

  {

    model.rotateAngleX = x;

    model.rotateAngleY = y;

    model.rotateAngleZ = z;

  }

 

  public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)

  {

    super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);

  }

 

}

 

and PreRenderEvent class:

public class PreRenderEvent

{

    RenderManager manager = .getMinecraft().getRenderManager();

   

    @SubscribeEvent

    public void preRenderPlayer(RenderLivingEvent.Pre e)

    {

        if (!(e.getEntity() instanceof EntityPlayer)) return;

        e.setCanceled(true);

 

        gymMod.customPlayerRender.doRender((AbstractClientPlayer) e.getEntity());

       

 

    }

   

   

   

}

 

Posted

In that case you don't need to bind it to the model, but tell openGL what texture to use.

 

I'm not sure for 1.9, since, but try: manager.renderEngine.bindTexture(ResourceLocation);

 

Maybe you need to bind back the blockstexture afterwards, If you get wrong textures on everything you must do it ;-).

Posted

Holy shit. You are actually 1st person to actually get something (and show it) out of all the people who asked about replacing player renders. Not that big of an achievement but progress! :P

 

Before I can even begin to analyze anything you give us - answer me this:

You have:

public class mycustommodel extends ModelBiped

Then you have:

public ModelMuscleMan()

... as your constructor. Since it wouldn't really compile I assume you renamed it while pasting or whatever. But just humor me and post updated and cleaner code.

 

Other:

* Please use Java conventions (capital classes and all that stuff).

* Use [.code] [./code] on forum (without dot).

 

 

Now onto more general stuff:

Note: I already told you to study some vanilla!

 

* RenderPlayer extends RenderLiving extends Render.

* Going top-bottom:

1. Look RenderPlayer#doRender - it apples some stuff (quite important GL states). You pretty much need to recreate all required GL states - even if you don't understand what they mean (hold shit, you should), at least take your time and make them actually be what hey are supposed to be.

2. We have this piece of code (mentioned before):

            GlStateManager.enableBlendProfile(GlStateManager.Profile.PLAYER_SKIN);
            super.doRender(entity, x, d0, z, entityYaw, partialTicks);
            GlStateManager.disableBlendProfile(GlStateManager.Profile.PLAYER_SKIN);

Which pretty much sets up states and goes down to RenderLiving which actually sets up EVERYTHING for you and just calls model#render.

3. Boom! If you look well enough you will notice that everything you actually have to do is return different model and different texture in #getMainModel() and #getEntityTexture(...) and/or MAYBE do some other magic - generally speaking. The code as it is now (trust me it is beautiful compared to what I had when I was working with renders), meaning 1.10 (probably similar/same as 1.9) is VERY CLEAR. You just have to follow line by line and recreate same behaviour while on the way inserting your model and your texture calls.

4. No point getting any further with this.

 

Please - spend some time studying.

  Quote

1.7.10 is no longer supported by forge, you are on your own.

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

    • my game keeps crashing right before launching the game before full screen and keeps poping up this error message "error code 1 " The game crashed: rendering overlay Error: java.lang.IllegalAccessError: failed to access class com.mojang.blaze3d.platform.GlStateManager$TextureState from class net.coderbot.iris.gl.IrisRenderSystem$DSAARB (com.mojang.blaze3d.platform.GlStateManager$TextureState is in module minecraft@1.18.2 of loader 'TRANSFORMER' @d919544; net.coderbot.iris.gl.IrisRenderSystem$DSAARB is in module oculus@1.6.4 of loader 'TRANSFORMER' @d919544)
    • removing oculus or any of ETF or EMF or even embeddium doesn't change anything it just crashes again with error -1  https://gist.github.com/Tikalian-coconut/d49e8fb83bf57d5e04eb042522046786 this time i removed all 4 at same time and that gave it something is wrong with the game seriously..
    • crash report -> https://gist.github.com/Tikalian-coconut/18c41f97bdacef54725e5141f57697d7 from what i see it seems like Entity Texture Features doesn't like Oculus doing something or invert.. not sure it's why everything is all black textured but that causes a -1 error
    • well that's bad, cuz there's no crash report at all (the last crash report is from previous replies) it's probably another issue that doesn't fit in this bug report, the game works fine except that everything is black, no texture except the sky and skin, everything else is just black i've tried reloading the textures in game, see for drivers updates but it did nothing, seems like an issue with Embeddium or Oculus i think, but i know nothing compared to you i can still send the latest debug and latest.log files.. edit: it seems that when i re-add rechiseled (1.1.6-1.20.1) it crashes as error 1 (i can't remove it off from the modpack cuz that'll break all my builds on some maps) lemme start the game and get it to crash to get a crash report done)
    • If you've fallen victim to a crypto scam, you're not alone and thankfully, you're not without options. I highly recommend iBolt Cyber Hacker Company for anyone seeking professional and effective assistance in recovering scammed cryptocurrency. After extensive research and hearing from multiple satisfied clients, it's clear that iBolt stands out in a crowded and often unreliable market. Their team of experienced cyber experts and blockchain analysts uses advanced tracking techniques to follow stolen funds across the blockchain and engage with crypto exchanges when possible. They’re not just tech-savvy—they’re strategic and persistent. WHY CHOOSE iBOLT CYBER HACKER COMPANY? (1) Proven success in crypto asset recovery (2) Fast, professional, and discreet service (3) Skilled in blockchain forensics and cyber investigation (4) Committed to fighting online fraud and supporting victims Don’t give up. I strongly recommend reaching out to iBolt Cyber Hacker Company. ENQUIRIES: info @ iboltcyberhack . org/ www . iboltcyberhack. org/ +39. 351. 105. 3619.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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