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




×
×
  • Create New...

Important Information

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