Jump to content

Custom PlayerRender/ModelBiped/ArmorLayers - 1.12.2


SorenCabral

Recommended Posts

Hi,

I don't know if it is possible, but...

I want to create one full or partial customized player model, changing or creating one new ModelBiped.class vanilla copy.

This is only to adjust the LEGS and BOOTS vanilla armor position/format in my custom body.   (Using the "MorePlayerModels" mod, changing only the legs)

image.png.f67ad349823931420ec2b904dd744e59.png

To make this, I tried:

 

[1] -  Full copied In my mod src the RenderPlayer.class and package dir from Vanilla (when I run in eclipse, the game read this instead the vanilla) and add one if() in RenderPlayer.class before layers additions, kinda:

...

public RenderPlayer(RenderManager renderManager, boolean useSmallArms) {
        super(renderManager, new ModelPlayer(0.0F, useSmallArms), 0.5F);
        this.smallArms = useSmallArms;

        if (Minecraft.getMinecraft().getSession().getUsername().contains("[myPlayerName]")) {    // if me, open my new LayerBipedArmor
            this.addLayer(new LayerBipedArmorCustom(this));
        } else {                                                                                          // if not me, open the normal LayerBipedArmor
            this.addLayer(new LayerBipedArmor(this));
        }

...

[2] - Same thing in the LayerBipedArmor, but changing the name to LayerBipedArmorCustom for my exclusive use, (how viewed in the if() above), but here, hiding or showing my model/ vanilla parts:

 

package net.minecraft.client.renderer.entity.layers;  // my mod package, with same name

import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.entity.RenderLivingBase;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class LayerBipedArmorCustom extends LayerArmorBase<ModelBiped> {

    public LayerBipedArmorCustom (RenderLivingBase<?> rendererIn) {

        super(rendererIn);
    }

    protected void initArmor() {
        this.modelLeggings = new ModelBiped(0.5F);
        this.modelArmor = new ModelBiped(1.0F);
    }

    @SuppressWarnings("incomplete-switch")
    protected void setModelSlotVisible(ModelBiped equipment, EntityEquipmentSlot slotIn) {

        this.setModelVisible(equipment);

        switch (slotIn) {
        case HEAD:
            equipment.bipedHead.showModel = true;
            equipment.bipedHeadwear.showModel = true;
            break;
        case CHEST:
            equipment.bipedBody.showModel = true;
            equipment.bipedRightArm.showModel = true;
            equipment.bipedLeftArm.showModel = true;
            break;
        case LEGS:
            equipment.bipedBody.showModel = false;
            equipment.bipedRightLeg.showModel = false;
            equipment.bipedLeftLeg.showModel = false;
            equipment.leftleg.showModel = true;                // new part
            equipment.rightleg.showModel = true;             // new part
            break;
        case FEET:
            equipment.bipedRightLeg.showModel = false;
            equipment.bipedLeftLeg.showModel = false;
            equipment.leftboot.showModel = true;            // new part
            equipment.rightboot.showModel = true;          // new part
        }
    }

    protected void setModelVisible(ModelBiped model) {
        model.setVisible(false);
    }

    @Override
    protected ModelBiped getArmorModelHook(net.minecraft.entity.EntityLivingBase entity,
            net.minecraft.item.ItemStack itemStack, EntityEquipmentSlot slot, ModelBiped model) {
        return net.minecraftforge.client.ForgeHooksClient.getArmorModel(entity, itemStack, slot, model);
    }
}

 

[3] - At last, added the new models parts on the vanilla model for class above read (All in the same model), but hiding the new parts to be only used to armor generator (If not hide, all parts appear at same time, looks one monster o_O, but in this try, I don't need from the legs, because am using from the MPM mod), see a little of the changes:

 

...

public class ModelBiped extends ModelBase {
    public ModelRenderer bipedHead;
    /** The Biped's Headwear. Used for the outer layer of player skins. */
    public ModelRenderer bipedHeadwear;
    public ModelRenderer bipedBody;
    /** The Biped's Right Arm */
    public ModelRenderer bipedRightArm;
    /** The Biped's Left Arm */
    public ModelRenderer bipedLeftArm;
    /** The Biped's Right Leg */
    public ModelRenderer bipedRightLeg;
    /** The Biped's Left Leg */
    public ModelRenderer bipedLeftLeg;
    public ModelBiped.ArmPose leftArmPose;
    public ModelBiped.ArmPose rightArmPose;
    public boolean isSneak;

    public ModelRenderer rightleg;          // new part
    public ModelRenderer rightleg2;          // new part
    public ModelRenderer rightleglow;          // new part
    public ModelRenderer rightdetail;          // new part
    public ModelRenderer leftleg;          // new part
    public ModelRenderer leftleg2;          // new part
    public ModelRenderer leftleglow;          // new part
    public ModelRenderer leftdetail;          // new part
    public ModelRenderer rightboot;          // new part
    public ModelRenderer leftboot;          // new part

    public ModelRenderer rightleglowfoot;          // new part
    public ModelRenderer leftleglowfoot;          // new part

    public ModelBiped() {
        this(0.0F);
    }

....
        this.leftleg.showModel = false;
        this.rightleg.showModel = false;
        this.leftboot.showModel = false;
        this.rightboot.showModel = false;

....

------------------

These are all the changes that I made, It work, when I equip any armor in my model, it appear with new legs/foots format, but:

 > Not work in multiplayer,I join in the game:

       - In my vision, the other playes legs/foots armor, when equipped are equal mys, not the vanilla;

       - In they vision is the opposite, they see me with the vanilla armor...

 > When compiled by Forge (with 'gradlew build') and putted in game out of the eclipse, this changes in vanilla classes don't work, even with the classes in the mod.jar.

 

I ask, have one way to my idea work?   (Out of Eclipse and in Multiplayer)

To only create one new ModelBiped.class in one new non vanilla package named to call, from some way, by my player render, keeping the new legs parts name equal vanilla, to don't need to do any one more change in anywhere or from any another way.

 

Thanks a lot!

 

Link to comment
Share on other sites

Are you using MCP or Forge?

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

You can cancel the RenderPlayer event and do your own rendering. You could probably also use reflection in that event to change whatever variables you need to redirect rendering to your own class

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

3 hours ago, diesieben07 said:

Events: https://mcforge.readthedocs.io/en/latest/events/intro/.

 

Reflection is a general Java concept, look elsewhere for tutorials. Note however that due to the fact that Minecraft is obfuscated, you have to use the methods in ObfuscationReflectionHelper with SRG names to obtain your Field and Method instances.

Hi,

 

For my learning, I copied the first example event, creating one class called MyForgeEventHandler.java in any package of my mod, but nothing happen in the game/console when I pick one item...  how if it not existing:

 

package soren.skinmod.util;

import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

public class MyForgeEventHandler {
        @SubscribeEvent
        public void pickupItem(EntityItemPickupEvent event) {
            System.out.println("Item picked up!    --   Edited");
        }
}

 

These types of events need to be in one specific classe/method like in main class?

....

 public void load(FMLPreInitializationEvent event)
  {
    MinecraftForge.EVENT_BUS.register(new MyForgeEventHandler());

....

 

Thanks

Edited by SorenCabral
Link to comment
Share on other sites

37 minutes ago, diesieben07 said:

Location of event handler methods does not matter, as long as you register to the event bus, which you seem to do.

Is that load method called? It must be in your main mod class and annotated with @Mod.EventHandler to receive the preInit event.

xD

 

Think that to solve this mod,maybe I have two options:

1º> 

       |- Create one complete ModelBiped.java to my character;

       |- Maybe create one copy  of LayerBipedArmor.java or override the original CASE/SWITCH, case I add more parts to my character legs/boots;

       |- Cancel vanilla RenderPlayer.java or say to it open a CustomLayerBipedArmor.java to use in player when it is me;

       |- Make, I don't know how yet, to render my CustomModelBiped.java when it is me.

or..

2º>

       |- Only edit the base ModelBiped.java restricting my and vanilla parts building with some ifs(), getting my name with Minecraft.getMinecraft().getSession().getUsername(). and trying to adjust the feet layer (that is different in the first try, because armor texture mapping limitations).

 

Have you one trigger to offer for me?

 

Thanks to be patient and  for trying to help!

Edited by SorenCabral
Link to comment
Share on other sites

11 minutes ago, diesieben07 said:

How is this in any way related to your event handler?

Sorry again..

Is because I don't know how say exactly, is a lot hard without one base and few knowledge.

For example, when I cancel the PlayerRender even, what I do call one custom?  For the same way? (creating another BUS or @SubscribeEvent).

How I say to the program run one new class?

Edited by SorenCabral
Link to comment
Share on other sites

In your RenderPlayerEvent event handler call

event.setCanceled(true);

, then add your code for rendering the player.

 

Also, please use the < > button to insert code.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

5 minutes ago, DavidM said:

In your RenderPlayerEvent event handler call


event.setCanceled(true);

, then add your code for rendering the player.

 

Also, please use the < > button to insert code.

Hi,

How can I simulate that have added new parts to ModelBiped and edited the switch from LayerBipedArmor only with forge events?

And the code come in the same handler that have canceled the first?

 

Thanks

Link to comment
Share on other sites

1 hour ago, DavidM said:

In your RenderPlayerEvent event handler call


event.setCanceled(true);

, then add your code for rendering the player.

 

Also, please use the < > button to insert code.

After be studying more, maybe I only need create some ifs in the ModelBiped with the forge way.

How can I override/replace some functions in this class during all game run using forge? (I only replacing the base code for test and study how it works, but need to make this changes using forge)

I need to create some ModelRenderes too, for my parts:

..

    public ModelrRenderer bipedRightLeg2;

    public ModelrRenderer bipedRightLegLow;

    and others

..

 

Example (only part of the code, have more ifs() below)

package net.minecraft.client.model;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class ModelBiped extends ModelBase {
	public ModelRenderer bipedHead;
	/** The Biped's Headwear. Used for the outer layer of player skins. */
	public ModelRenderer bipedHeadwear;
	public ModelRenderer bipedBody;
	/** The Biped's Right Arm */
	public ModelRenderer bipedRightArm;
	/** The Biped's Left Arm */
	public ModelRenderer bipedLeftArm;
	/** The Biped's Right Leg */
	public ModelRenderer bipedRightLeg;
	/** The Biped's Left Leg */
	public ModelRenderer bipedLeftLeg;
	public ModelBiped.ArmPose leftArmPose;
	public ModelBiped.ArmPose rightArmPose;
	public boolean isSneak;

//	public ModelRenderer bipedRightLeg;
	public ModelRenderer bipedRightLeg2;
	public ModelRenderer bipedRightLeglow;
//	public ModelRenderer bipedLeftLeg;
	public ModelRenderer bipedLeftLeg2;
	public ModelRenderer bipedLeftLeglow;
	public ModelRenderer rightboot;
	public ModelRenderer leftboot;

	public ModelBiped() {
		this(0.0F);
	}

	public ModelBiped(float modelSize) {
		this(modelSize, 0.0F, 64, 32);
	}

	public ModelBiped(float modelSize, float p_i1149_2_, int textureWidthIn, int textureHeightIn) {
		this.leftArmPose = ModelBiped.ArmPose.EMPTY;
		this.rightArmPose = ModelBiped.ArmPose.EMPTY;
		this.textureWidth = textureWidthIn;
		this.textureHeight = textureHeightIn;
		this.bipedHead = new ModelRenderer(this, 0, 0);
		this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, modelSize);
		this.bipedHead.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F);
		this.bipedHeadwear = new ModelRenderer(this, 32, 0);
		this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, modelSize + 0.5F);
		this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F);
		this.bipedBody = new ModelRenderer(this, 16, 16);
		this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, modelSize);
		this.bipedBody.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F);
		this.bipedRightArm = new ModelRenderer(this, 40, 16);
		this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, modelSize);
		this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + p_i1149_2_, 0.0F);
		this.bipedLeftArm = new ModelRenderer(this, 40, 16);
		this.bipedLeftArm.mirror = true;
		this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, modelSize);
		this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + p_i1149_2_, 0.0F);
		if (!Minecraft.getMinecraft().getSession().getUsername().contains("yRaposa")) { // Not is me
		this.bipedRightLeg = new ModelRenderer(this, 0, 16);
		this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, modelSize);
		this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F + p_i1149_2_, 0.0F);
		this.bipedLeftLeg = new ModelRenderer(this, 0, 16);
		this.bipedLeftLeg.mirror = true;
		this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, modelSize);
		this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F + p_i1149_2_, 0.0F);
		}

		// RED Armor //
		if (Minecraft.getMinecraft().getSession().getUsername().contains("yRaposa")) { // Is me
//		this.bipedRightLeg = new ModelRenderer(this, 20, 22);
		this.bipedRightLeg = new ModelRenderer(this, 40, 25);
//		this.bipedRightLeg.addBox(-2.25F, -0.53F, -2.23F, 5, 5, 5, modelSize + 0.01F);
		this.bipedRightLeg.addBox(-2.25F, -0.53F, -2.23F, 5, 5, 5, modelSize + 0.01F);
		this.bipedRightLeg.setRotationPoint(-1.99F, 10.0F, 0.01F);
		setRotation(this.bipedRightLeg, 0.25F, 0.0F, 0.0F);

//		this.bipedRightLeg2 = new ModelRenderer(this, 0, 16);
		this.bipedRightLeg2 = new ModelRenderer(this, 40, 25);
		this.bipedRightLeg2.addBox(-2.24F, -0.88F, -1.95F, 4, 5, 4, modelSize);
		this.bipedRightLeg2.setRotationPoint(0.0F, 4.3F, 0.0F);
		setRotation(this.bipedRightLeg2, 0.75F, 0.0F, 0.0F);
		this.bipedRightLeg.addChild(this.bipedRightLeg2);

//		this.bipedRightLeglow = new ModelRenderer(this, 0, 16);
		this.bipedRightLeglow = new ModelRenderer(this, 0, 16);
//		this.bipedRightLeglow.addBox(-2.25F, -2.025F, -4.025F, 4, 8, 4, modelSize);
		this.bipedRightLeglow.addBox(-2.25F, 1.0F, -4.025F, 4, 5, 4, modelSize);
		this.bipedRightLeglow.setRotationPoint(0.0F, 5.0F, 0.0F);
		setRotation(this.bipedRightLeglow, -1.25F, 0.0F, 0.0F);
		this.bipedRightLeg2.addChild(this.bipedRightLeglow);
/*
		this.rightdetail = new ModelRenderer(this, 0, 20);
		this.rightdetail.addBox(0.0F, 0.0F, 0.0F, 1, 1, 5, modelSize - 0.001F);
		this.rightdetail.setRotationPoint(1.75F, 3.5F, -2.25F);
		setRotation(this.rightdetail, 0.0F, 0.0F, 0.0F);
		this.bipedRightLeg.addChild(this.rightdetail);
*/
//		this.bipedLeftLeg = new ModelRenderer(this, 20, 22);
		this.bipedLeftLeg = new ModelRenderer(this, 40, 25);
		this.bipedLeftLeg.mirror = true;
//		this.bipedLeftLeg.addBox(-2.75F, -0.53F, -2.23F, 5, 5, 5, modelSize + 0.01F);
		this.bipedLeftLeg.addBox(-2.75F, -0.53F, -2.23F, 5, 5, 5, modelSize + 0.01F);
		this.bipedLeftLeg.setRotationPoint(2.01F, 10.0F, 0.0F);
		setRotation(this.bipedLeftLeg, 0.25F, 0.0F, 0.0F);

//		this.bipedLeftLeg2 = new ModelRenderer(this, 0, 16);
		this.bipedLeftLeg2 = new ModelRenderer(this, 40, 25);
		this.bipedLeftLeg2.mirror = true;
		this.bipedLeftLeg2.addBox(-1.76F, -0.88F, -1.95F, 4, 5, 4, modelSize);
		this.bipedLeftLeg2.setRotationPoint(0.0F, 4.3F, 0.0F);
		setRotation(this.bipedLeftLeg2, 0.75F, 0.0F, 0.0F);
		this.bipedLeftLeg.addChild(this.bipedLeftLeg2);

//		this.bipedLeftLeglow = new ModelRenderer(this, 0, 16);
		this.bipedLeftLeglow = new ModelRenderer(this, 0, 16);
		this.bipedLeftLeglow.mirror = true;
//		this.bipedLeftLeglow.addBox(-1.75F, -2.025F, -4.025F, 4, 8, 4, modelSize);
		this.bipedLeftLeglow.addBox(-1.75F, 1.0F, -4.025F, 4, 5, 4, modelSize);
		this.bipedLeftLeglow.setRotationPoint(0.0F, 5.0F, 0.0F);
		setRotation(this.bipedLeftLeglow, -1.25F, 0.0F, 0.0F);
		this.bipedLeftLeg2.addChild(this.bipedLeftLeglow);
/*
		this.leftdetail = new ModelRenderer(this, 0, 20);
		this.leftdetail.mirror = true;
		this.leftdetail.addBox(0.0F, 0.0F, 0.0F, 1, 1, 5, modelSize - 0.001F);
		this.leftdetail.setRotationPoint(-2.75F, 3.5F, -2.25F);
		setRotation(this.leftdetail, 0.0F, 0.0F, 0.0F);
		this.bipedLeftLeg.addChild(this.leftdetail);
*/
		this.rightboot = new ModelRenderer(this, 0, 16);
		this.rightboot.addBox(-2.25F, 1.75F, 2.85F, 4, 10, 4, modelSize + 0.01F);
		this.rightboot.setRotationPoint(-2.0F, 10.0F, 0.01F);
		setRotation(this.rightboot, -0.25F, 0.0F, 0.0F);

		this.leftboot = new ModelRenderer(this, 0, 16);
		this.leftboot.mirror = true;
		this.leftboot.addBox(-1.75F, 1.75F, 2.85F, 4, 10, 4, modelSize + 0.01F);
		this.leftboot.setRotationPoint(2.0F, 10.0F, 0.0F);
		setRotation(this.leftboot, -0.25F, 0.0F, 0.0F);

		this.bipedLeftLeg.showModel = false;
		this.bipedRightLeg.showModel = false;
		this.leftboot.showModel = false;
		this.rightboot.showModel = false;
		}
		// ------ //

	}

	/**
	 * Sets the models various rotation angles then renders the model.
	 */
	public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw,
			float headPitch, float scale) {
		this.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn);
		GlStateManager.pushMatrix();

		if (this.isChild) {
			float f = 2.0F;
			GlStateManager.scale(0.75F, 0.75F, 0.75F);
			GlStateManager.translate(0.0F, 16.0F * scale, 0.0F);
			this.bipedHead.render(scale);
			GlStateManager.popMatrix();
			GlStateManager.pushMatrix();
			GlStateManager.scale(0.5F, 0.5F, 0.5F);
			GlStateManager.translate(0.0F, 24.0F * scale, 0.0F);
			this.bipedBody.render(scale);
			this.bipedRightArm.render(scale);
			this.bipedLeftArm.render(scale);
			if (!Minecraft.getMinecraft().getSession().getUsername().contains("yRaposa")) { // Not is me
			this.bipedRightLeg.render(scale);
			this.bipedLeftLeg.render(scale);
			}
			this.bipedHeadwear.render(scale);
			
			if (Minecraft.getMinecraft().getSession().getUsername().contains("yRaposa")) { // Is me
			this.bipedRightLeg.render(scale);
			this.bipedLeftLeg.render(scale);
			this.rightboot.render(scale);
			this.leftboot.render(scale);
			}
		} else {
			if (entityIn.isSneaking()) {
				GlStateManager.translate(0.0F, 0.2F, 0.0F);
			}

			this.bipedHead.render(scale);
			this.bipedBody.render(scale);
			this.bipedRightArm.render(scale);
			this.bipedLeftArm.render(scale);
			if (!Minecraft.getMinecraft().getSession().getUsername().contains("yRaposa")) { // Not is me
			this.bipedRightLeg.render(scale);
			this.bipedLeftLeg.render(scale);
			}
			this.bipedHeadwear.render(scale);
			
			if (Minecraft.getMinecraft().getSession().getUsername().contains("yRaposa")) { // Is me
			this.bipedRightLeg.render(scale);
			this.bipedLeftLeg.render(scale);
			this.rightboot.render(scale);
			this.leftboot.render(scale);
			}
		}

		GlStateManager.popMatrix();
	}

 

Edited by SorenCabral
Link to comment
Share on other sites

I receive null error only for try one RenderPlayerEvent

 

public class RenderPlayerRed {
	   
		@SubscribeEvent
	    public void thisPlayer(RenderPlayerEvent event) {
			event.setCanceled(true);
	    	System.out.println("-- No more player! --");
	    }
 public void load(FMLPreInitializationEvent ev)
  {
	    MinecraftForge.EVENT_BUS.register(new RenderPlayerRed());

 

Link to comment
Share on other sites

Use

RenderPlayerEvent.Pre

.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

 

2 hours ago, DavidM said:

Use


RenderPlayerEvent.Pre

.

One ask, is possible do to one player run one class/java and the other another?

Example:

 

Player 1 run ModelBiped_1.java

Player 2 run ModelBiped_2.java

(Both are equal, only with minor adjusts)

 

I am asking it because after make the two in same class, the change no have effect in multiplayer...  One see both normal, and other see both modified.

public class ModelBipedAlt
  extends ModelBiped
{
  private Map<EnumParts, List<ModelScaleRenderer>> map = new HashMap();
  
  public ModelBipedAlt(float scale)
  {
	super(scale);

    this.bipedLeftArm = createScale(this.bipedLeftArm, EnumParts.ARM_LEFT);
    this.bipedRightArm = createScale(this.bipedRightArm, EnumParts.ARM_RIGHT);
    .
    .
    .
	if(Minecraft.getMinecraft().getSession().getUsername().contains("yRaposa")) {
		this.bipedLeftLeg.rotationPointZ = 3.0F;
	    this.bipedRightLeg.rotationPointZ = 3.0F;
		System.out.println("RedArmor");
	}

 

Or have me forgot of anything?

Edited by SorenCabral
Link to comment
Share on other sites

15 minutes ago, SorenCabral said:

 


	if(Minecraft.getMinecraft().getSession().getUsername().contains("yRaposa")) {
		this.bipedLeftLeg.rotationPointZ = 3.0F;
	    this.bipedRightLeg.rotationPointZ = 3.0F;
		System.out.println("RedArmor");
	}

 

 

You are basically saying "if the player's name is 'yRaposa', render all player models on his client differently".

NO, you want to change the model of the player "yRaposa", not to change all player models on the client whose player name is "yRaposa".

 

You need to put the if statement inside your RenderPlayerEvent handler, and only cancel the event as well as add custom rendering when the player's name is "yRaposa".

Edited by DavidM
  • Like 1

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

I'm passing for problems during the new model creation, with the extends and others...

I made one copy of the ModelPlayer, ModelBiped and RenderPlayer to edit how i want, but I can't make this work.

When I change the class names, appear some issue...

 

Doing this looks be so hard..   : (

Edited by SorenCabral
Link to comment
Share on other sites

You have to change the file name as well as all the references to the class when you change the class name. Your IDE should tell you what you need to do.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

8 hours ago, DavidM said:

You have to change the file name as well as all the references to the class when you change the class name. Your IDE should tell you what you need to do.

I'm now lost how do one new player rendering, how do to initialize one new with my changes?

I want all equal to normal player, changing only he legs for an correct armor generation

Edited by SorenCabral
Link to comment
Share on other sites

I found this example in web, would be like this with me too?

public class RenderCustomPlayerEvent
{
    RenderHoverClaws render = new RenderHoverClaws(Minecraft.getMinecraft().getRenderManager(), new ModelHoverClaws(), 1F);

    @Subscribe
    public void renderCustomPlayer(RenderPlayerEvent.Pre pre)
    {
        pre.setCanceled(true);
        render.doRender((EntityLiving) pre.getEntityLiving(), 0D, -1.625, 0D, 0F, 0.0625F);
}

}

 

Link to comment
Share on other sites

You’ve got to know java to make a mod. Why are you posting events yourself?

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

You have an invalid constructor. Check your parameters.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

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



×
×
  • Create New...

Important Information

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