Jump to content

[1.14.4] How to get Minecraft Horse model/texture to make a custom unicorn?


DragonITA

Recommended Posts

2 hours ago, DragonITA said:

Ok, thx, but i want make a horse, with horse animations and horse gui and etc. and i dont want write the code of AbstractHorse, i can copy, ok, but then?

ModelUnicorn should extend ModelHorse. Everything else you want will come from your UnicornEntity class extending EntityHorse.

  • Thanks 1
Link to comment
Share on other sites

15 minutes ago, salvestrom said:

ModelUnicorn should extend ModelHorse. Everything else you want will come from your UnicornEntity class extending EntityHorse.

No, you have said that i should make that modelUnicorn extends ModelEntity and not ModelHorse, but i need the AbstractHorseEntity, else the gui, animations and etc. wont work and i should rewrite the code.

New in Modding? == Still learning!

Link to comment
Share on other sites

2 hours ago, DragonITA said:

No, you have said that i should make that modelUnicorn extends ModelEntity and not ModelHorse, but i need the AbstractHorseEntity, else the gui, animations and etc. wont work and i should rewrite the code.

I did not say at any point that your model should extend model entity.

 

This requires three classes. Your entity class should extend HorseEntity giving you access to all of the GUI, saddling and taming. Your render class should be adjusted to not be using the superfluous classy created, as I previously mentioned. Your model class needs to extend HorseModel – this is how you will inherit the animations and bulk of the model.

 

Note that AbstractHorseEntity does not have all of the code for horses, only the shared code between the various horse entities.

Edited by salvestrom
Additional information.
  • Like 1
Link to comment
Share on other sites

8 hours ago, salvestrom said:

I did not say at any point that your model should extend model entity.

 

This requires three classes. Your entity class should extend HorseEntity giving you access to all of the GUI, saddling and taming. Your render class should be adjusted to not be using the superfluous classy created, as I previously mentioned. Your model class needs to extend HorseModel – this is how you will inherit the animations and bulk of the model.

 

Note that AbstractHorseEntity does not have all of the code for horses, only the shared code between the various horse entities.

Sorry, ok thx i want test it

New in Modding? == Still learning!

Link to comment
Share on other sites

17 hours ago, salvestrom said:

I did not say at any point that your model should extend model entity.

 

This requires three classes. Your entity class should extend HorseEntity giving you access to all of the GUI, saddling and taming. Your render class should be adjusted to not be using the superfluous classy created, as I previously mentioned. Your model class needs to extend HorseModel – this is how you will inherit the animations and bulk of the model.

 

Note that AbstractHorseEntity does not have all of the code for horses, only the shared code between the various horse entities.

Ok, but i need to add the corn, then i should make a sort of my personalized model, or not? I have copied the HorseModel, changed his Name and added the corn.

New in Modding? == Still learning!

Link to comment
Share on other sites

On 12/9/2019 at 8:56 PM, Lea9ue said:

There is literally zero reasons for you to be using Tabula or BlockBench to add a horn to a horse. You already have Horsemodel. You already have a texture file for a horse that you can add texture to make the horn.  I have a feeling that you are just lost.  You should then add a box like I said before to your model class.


  this.corn.addBox(.....);

 Then right here is the coordinates of the texture on the png.


this.corn = new RendererModel(this, number, number);

The 2 numbers tell exactly where the texture is located on png.

 

 

Who i should add this code(i arleady added it, but i think i added it to the wrong place)

New in Modding? == Still learning!

Link to comment
Share on other sites

package net.batonfack.fantasymod.client.renders;

import net.batonfack.fantasymod.FantasyMod;
import net.batonfack.fantasymod.client.models.ModelUnicornWitoutAbstracHorse;
import net.batonfack.fantasymod.entities.UnicornEntity;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.entity.MobRenderer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.client.registry.IRenderFactory;

@OnlyIn(Dist.CLIENT)
public class UnicornEntityRender extends MobRenderer<UnicornEntity, ModelUnicornWitoutAbstracHorse<UnicornEntity>>
{
	//public UnicornEntityRender(EntityRendererManager manager) {
	//	super(manager, new UnicornEntityModel(0), 0f);
	//}
	
	private static ModelUnicornWitoutAbstracHorse<UnicornEntity> UnicornModel;
	private static float shadowOpaque = 0.0f;
	
	public UnicornEntityRender(EntityRendererManager manager, ModelUnicornWitoutAbstracHorse<UnicornEntity> UnicornModel, float p_i50961_3_) {
		super(manager, UnicornModel, p_i50961_3_);
	}

	@Override
	protected ResourceLocation getEntityTexture(UnicornEntity entity) {
		return FantasyMod.location("textures/entity/unicorn_entity.png");
	}
	
	public static class RenderFactory implements IRenderFactory<UnicornEntity>
	{

		@Override
		public EntityRenderer<? super UnicornEntity> createRenderFor(EntityRendererManager manager) {
			return new UnicornEntityRender(manager, UnicornModel, shadowOpaque);
		}
	}
}

 

New in Modding? == Still learning!

Link to comment
Share on other sites

package net.batonfack.fantasymod.entities;

import net.batonfack.fantasymod.init.FantasyModEntities;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.passive.horse.HorseEntity;
import net.minecraft.world.World;

public class UnicornEntity extends HorseEntity
{

	@SuppressWarnings("unchecked")
	public UnicornEntity(EntityType<? extends HorseEntity> type, World worldIn)
	{
		super((EntityType<? extends HorseEntity>) FantasyModEntities.UNICORN_ENTITY, worldIn);
	}
	
}

 

New in Modding? == Still learning!

Link to comment
Share on other sites

package net.batonfack.fantasymod.client.models;

import net.minecraft.client.renderer.entity.model.EntityModel;
import net.minecraft.client.renderer.entity.model.RendererModel;
import net.minecraft.client.renderer.model.ModelBox;
import net.minecraft.entity.LivingEntity;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

@OnlyIn(Dist.CLIENT)
public class ModelUnicornWitoutAbstracHorse<T extends LivingEntity> extends EntityModel<T> {
   protected final RendererModel field_217127_a;
   protected final RendererModel field_217128_b;
   private final RendererModel CornGroup;
   private final RendererModel Corn1;
   private final RendererModel Corn2;
   private final RendererModel Corn3;

   public ModelUnicornWitoutAbstracHorse(float p_i51065_1_) {
	      this.field_217127_a = null;
		  this.field_217128_b = null;
		  this.textureWidth = 128;
	      this.textureHeight = 64;
	      
	      
	      CornGroup = new RendererModel(this);
	      CornGroup.setRotationPoint(0.0F, 0.0F, 0.0F);
		  Corn1 = new RendererModel(this, 64, 0);
		  Corn1.setRotationPoint(1.5F, -5.0F, -15.0F);
		  this.Corn1.setRotationPoint(0.5409F, 0.0F, 0.0F);
		  CornGroup.addChild(Corn1);
		  Corn1.cubeList.add(new ModelBox(Corn1, 52, 57, -3.0F, -3.0F, -4.0F, 3, 4, 3, 0.0F, true));
		  
		  Corn2 = new RendererModel(this, 64, 28);
		  Corn2.setRotationPoint(1.5F, -5.0F, -15.0F);
		  this.Corn2.setRotationPoint(0.5409F, 0.0F, 0.0F);
		  CornGroup.addChild(Corn2);
		  Corn2.cubeList.add(new ModelBox(Corn2, 0, 0, -2.4F, -5.3F, -3.6F, 2, 3, 2, 0.0F, true));
		  
		  Corn3 = new RendererModel(this, 96, 32);
		  Corn3.setRotationPoint(1.5F, -5.0F, -15.0F);
		  this.Corn3.setRotationPoint(0.5409F, 0.0F, 0.0F);
		  CornGroup.addChild(Corn3);
		  Corn3.cubeList.add(new ModelBox(Corn3, 0, 0, -1.8F, -8.1F, -3.2F, 1, 3, 1, 0.0F, true));
   }

   protected void func_199047_a(RendererModel p_199047_1_) {
      RendererModel renderermodel = new RendererModel(this, 19, 16);
      renderermodel.addBox(0.55F, -13.0F, 4.0F, 2, 3, 1, -0.001F);
      RendererModel renderermodel1 = new RendererModel(this, 19, 16);
      renderermodel1.addBox(-2.55F, -13.0F, 4.0F, 2, 3, 1, -0.001F);
      p_199047_1_.addChild(renderermodel);
      p_199047_1_.addChild(renderermodel1);
   }
}

 

New in Modding? == Still learning!

Link to comment
Share on other sites

i think whoever's bugging me in the HorseEntity Class is, here:

  private static final String[] HORSE_TEXTURES = new String[]{"textures/entity/horse/horse_white.png", "textures/entity/horse/horse_creamy.png", "textures/entity/horse/horse_chestnut.png", "textures/entity/horse/horse_brown.png", "textures/entity/horse/horse_black.png", "textures/entity/horse/horse_gray.png", "textures/entity/horse/horse_darkbrown.png"};

 

New in Modding? == Still learning!

Link to comment
Share on other sites

5 hours ago, DragonITA said:

private static ModelUnicornWitoutAbstracHorse<UnicornEntity> UnicornModel; 

Remove this and put this in the constructor super "new UnicornModel<>(0)". The model file has to extend HorseModel Or you will not get the animations.

In the renderer Create:    

Quote

public static final ResourceLocation unicorn= new ResourceLocation("[Your mod ID]:"textures/entity/unicorn_entity.png"

 And return "unicorn" in getEntityTexture.

");

  • Like 1
Link to comment
Share on other sites

package net.batonfack.fantasymod.client.renders;

import net.batonfack.fantasymod.FantasyMod;
import net.batonfack.fantasymod.client.models.ModelUnicornWithAbstracHorse;
import net.batonfack.fantasymod.client.models.ModelUnicornWitoutAbstracHorse;
import net.batonfack.fantasymod.entities.UnicornEntity;
import net.minecraft.client.renderer.entity.AbstractHorseRenderer;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.entity.MobRenderer;
import net.minecraft.entity.passive.horse.AbstractHorseEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.client.registry.IRenderFactory;

@OnlyIn(Dist.CLIENT)
public class UnicornEntityRender extends AbstractHorseRenderer<UnicornEntity, ModelUnicornWithAbstracHorse<AbstractHorseEntity>> // <<---The Line with the error
 {
	//public UnicornEntityRender(EntityRendererManager manager) {
	//	super(manager, new UnicornEntityModel(0), 0f);
	//}
	
	//private static ModelUnicornWitoutAbstracHorse<UnicornEntity> UnicornModel;
	public static final ResourceLocation unicorn = new ResourceLocation("fantasymod:" + "textures/entity/unicorn_entity.png");
	private static float shadowOpaque = 0.0f;
	
	public UnicornEntityRender(EntityRendererManager manager, ModelUnicornWithAbstracHorse<AbstractHorseEntity> UnicornModel, float p_i50961_3_) {
		super(manager, new ModelUnicornWithAbstracHorse<>(0.0f), p_i50961_3_);
	}

	@Override
	protected ResourceLocation getEntityTexture(UnicornEntity entity) {
		return unicorn;
	}
	
	public static class RenderFactory implements IRenderFactory<UnicornEntity>
	{

		@Override
		public EntityRenderer<? super UnicornEntity> createRenderFor(EntityRendererManager manager) {
			return new UnicornEntityRender(manager, new ModelUnicornWithAbstracHorse<>(0.0f), shadowOpaque);
		}
	}
}

 

Edited by DragonITA

New in Modding? == Still learning!

Link to comment
Share on other sites

46 minutes ago, DragonITA said:



public class UnicornEntityRender extends AbstractHorseRenderer<UnicornEntity, ModelUnicornWithAbstracHorse<AbstractHorseEntity>> // <<---The Line with the error
 

 

What is the error if you use unicorn entity instead of AbstractHorseEntity?

Please post the code for registering your renderer.

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




  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I have no idea how a UI mod crashed a whole world but HUGE props to you man, just saved me +2 months of progress!  
    • So i know for a fact this has been asked before but Render stuff troubles me a little and i didnt find any answer for recent version. I have a custom nausea effect. Currently i add both my nausea effect and the vanilla one for the effect. But the problem is that when I open the inventory, both are listed, while I'd only want mine to show up (both in the inv and on the GUI)   I've arrived to the GameRender (on joined/net/minecraft/client) and also found shaders on client-extra/assets/minecraft/shaders/post and client-extra/assets/minecraft/shaders/program but I'm lost. I understand that its like a regular screen, where I'd render stuff "over" the game depending on data on the server, but If someone could point to the right client and server classes that i can read to see how i can manage this or any tip would be apreciated
    • Let me try and help you with love spells, traditional healing, native healing, fortune telling, witchcraft, psychic readings, black magic, voodoo, herbalist healing, or any other service your may desire within the realm of african native healing, the spirits and the ancestors. I am a sangoma and healer. I could help you to connect with the ancestors , interpret dreams, diagnose illness through divination with bones, and help you heal both physical and spiritual illness. We facilitate the deepening of your relationship to the spirit world and the ancestors. Working in partnership with one\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’s ancestors is a gift representing a close link with the spirit realm as a mediator between the worlds.*   Witchdoctors, or sorcerers, are often purveyors of mutis and charms that cause harm to people. we believe that we are here for only one purpose, to heal through love and compassion.*   African people share a common understanding of the importance of ancestors in daily life. When they have lost touch with their ancestors, illness may result or bad luck. Then a traditional healer, or sangoma, is sought out who may prescribe herbs, changes in lifestyle, a career change, or changes in relationships. The client may also be told to perform a ceremony or purification ritual to appease the ancestors.*   Let us solve your problems using powerful African traditional methods. We believe that our ancestors and spirits give us enlightenment, wisdom, divine guidance, enabling us to overcome obstacles holding your life back. Our knowledge has been passed down through centuries, being refined along the way from generation to generation. We believe in the occult, the paranormal, the spirit world, the mystic world.*   The services here are based on the African Tradition Value system/religion,where we believe the ancestors and spirits play a very important role in society. The ancestors and spirits give guidance and counsel in society. They could enable us to see into the future and give solutions to the problems affecting us. We use rituals, divination, spells, chants and prayers to enable us tackle the task before us.*   I have experience in helping and guiding many people from all over the world. My psychic abilities may help you answer and resolve many unanswered questions
    • Let me try and help you with love spells, traditional healing, native healing, fortune telling, witchcraft, psychic readings, black magic, voodoo, herbalist healing, or any other service your may desire within the realm of african native healing, the spirits and the ancestors. I am a sangoma and healer. I could help you to connect with the ancestors , interpret dreams, diagnose illness through divination with bones, and help you heal both physical and spiritual illness. We facilitate the deepening of your relationship to the spirit world and the ancestors. Working in partnership with one\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’s ancestors is a gift representing a close link with the spirit realm as a mediator between the worlds.*   Witchdoctors, or sorcerers, are often purveyors of mutis and charms that cause harm to people. we believe that we are here for only one purpose, to heal through love and compassion.*   African people share a common understanding of the importance of ancestors in daily life. When they have lost touch with their ancestors, illness may result or bad luck. Then a traditional healer, or sangoma, is sought out who may prescribe herbs, changes in lifestyle, a career change, or changes in relationships. The client may also be told to perform a ceremony or purification ritual to appease the ancestors.*   Let us solve your problems using powerful African traditional methods. We believe that our ancestors and spirits give us enlightenment, wisdom, divine guidance, enabling us to overcome obstacles holding your life back. Our knowledge has been passed down through centuries, being refined along the way from generation to generation. We believe in the occult, the paranormal, the spirit world, the mystic world.*   The services here are based on the African Tradition Value system/religion,where we believe the ancestors and spirits play a very important role in society. The ancestors and spirits give guidance and counsel in society. They could enable us to see into the future and give solutions to the problems affecting us. We use rituals, divination, spells, chants and prayers to enable us tackle the task before us.*   I have experience in helping and guiding many people from all over the world. My psychic abilities may help you answer and resolve many unanswered questions
    • Let me try and help you with love spells, traditional healing, native healing, fortune telling, witchcraft, psychic readings, black magic, voodoo, herbalist healing, or any other service your may desire within the realm of african native healing, the spirits and the ancestors. I am a sangoma and healer. I could help you to connect with the ancestors , interpret dreams, diagnose illness through divination with bones, and help you heal both physical and spiritual illness. We facilitate the deepening of your relationship to the spirit world and the ancestors. Working in partnership with one\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’s ancestors is a gift representing a close link with the spirit realm as a mediator between the worlds.*   Witchdoctors, or sorcerers, are often purveyors of mutis and charms that cause harm to people. we believe that we are here for only one purpose, to heal through love and compassion.*   African people share a common understanding of the importance of ancestors in daily life. When they have lost touch with their ancestors, illness may result or bad luck. Then a traditional healer, or sangoma, is sought out who may prescribe herbs, changes in lifestyle, a career change, or changes in relationships. The client may also be told to perform a ceremony or purification ritual to appease the ancestors.*   Let us solve your problems using powerful African traditional methods. We believe that our ancestors and spirits give us enlightenment, wisdom, divine guidance, enabling us to overcome obstacles holding your life back. Our knowledge has been passed down through centuries, being refined along the way from generation to generation. We believe in the occult, the paranormal, the spirit world, the mystic world.*   The services here are based on the African Tradition Value system/religion,where we believe the ancestors and spirits play a very important role in society. The ancestors and spirits give guidance and counsel in society. They could enable us to see into the future and give solutions to the problems affecting us. We use rituals, divination, spells, chants and prayers to enable us tackle the task before us.*   I have experience in helping and guiding many people from all over the world. My psychic abilities may help you answer and resolve many unanswered questions
  • Topics

×
×
  • Create New...

Important Information

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