Jump to content

[1.16.5] Failed to load texture


ioqwert

Recommended Posts

Hello, i'm trying to create a custom entity, the model works, but the texture doesn't.

I get this error:

image.png.8ee1807e0e432d7da3b7108abbafd319.png

image.png.f760718ea75b22327739f59b23022c2c.png

image.png.6ced7e1130b463eb2ac4b7c2be2ca180.png

 

This is my code:

The model:

package com.ioqwert.perry.client.model;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;

import net.minecraft.client.renderer.entity.model.EntityModel;
import net.minecraft.client.renderer.model.ModelRenderer;
import net.minecraft.entity.Entity;

public class PerryModel<T extends Entity> extends EntityModel<T> {
	private final ModelRenderer bb_main;
	private final ModelRenderer cube_r1;
	private final ModelRenderer cube_r2;

	public PerryModel() {
		texWidth = 64;
		texHeight = 64;

		bb_main = new ModelRenderer(this);
		setRotationAngle(bb_main, 0.0F, 24.0F, 0.0F);
		bb_main.texOffs(0, 0).addBox(-3.0F, -7.0F, -6.0F, 5.0F, 5.0F, 12.0F, 0.0F, false);
		bb_main.texOffs(8, 4).addBox(0.6F, -2.0F, -3.4F, 1.0F, 2.0F, 1.0F, 0.0F, false);
		bb_main.texOffs(7, 10).addBox(0.6F, -1.0F, -4.4F, 1.0F, 1.0F, 1.0F, 0.0F, false);
		bb_main.texOffs(3, 10).addBox(-2.5F, -1.0F, -4.4F, 1.0F, 1.0F, 1.0F, 0.0F, false);
		bb_main.texOffs(7, 7).addBox(-2.5F, -2.0F, -3.4F, 1.0F, 2.0F, 1.0F, 0.0F, false);
		bb_main.texOffs(0, 9).addBox(-2.5F, -1.0F, 2.9F, 1.0F, 1.0F, 1.0F, 0.0F, false);
		bb_main.texOffs(3, 7).addBox(-2.5F, -2.0F, 3.9F, 1.0F, 2.0F, 1.0F, 0.0F, false);
		bb_main.texOffs(8, 0).addBox(0.6F, -1.0F, 2.9F, 1.0F, 1.0F, 1.0F, 0.0F, false);
		bb_main.texOffs(4, 4).addBox(0.6F, -2.0F, 3.9F, 1.0F, 2.0F, 1.0F, 0.0F, false);
		bb_main.texOffs(0, 0).addBox(-2.0F, -4.2F, -8.0F, 3.0F, 2.0F, 2.0F, 0.0F, false);
		bb_main.texOffs(22, 0).addBox(-3.5F, -6.4F, -5.1F, 6.0F, 2.0F, 2.0F, 0.0F, false);
		bb_main.texOffs(16, 17).addBox(-1.0F, -5.0F, 6.0F, 1.0F, 2.0F, 7.0F, 0.0F, false);

		cube_r1 = new ModelRenderer(this);
		setRotationAngle(cube_r1, 0.0F, -1.9F, 12.5F);
		bb_main.addChild(cube_r1);
		setRotationAngle(cube_r1, 0.1745F, 0.0F, 0.0F);
		cube_r1.texOffs(0, 17).addBox(-1.0F, -5.0F, -6.0F, 1.0F, 2.0F, 7.0F, 0.0F, false);

		cube_r2 = new ModelRenderer(this);
		setRotationAngle(cube_r2, 0.0F, 1.0F, -4.3F);
		bb_main.addChild(cube_r2);
		setRotationAngle(cube_r2, -0.5672F, 0.0F, 0.0F);
		cube_r2.texOffs(0, 4).addBox(-2.0F, -5.0F, -5.0F, 3.0F, 3.0F, 1.0F, 0.0F, false);
	}

	public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
		modelRenderer.xRot = x;
		modelRenderer.yRot = y;
		modelRenderer.zRot = z;
	}

	@Override
	public void setupAnim(Entity p_225597_1_, float p_225597_2_, float p_225597_3_, float p_225597_4_,
			float p_225597_5_, float p_225597_6_) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void renderToBuffer(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay,
			float p_225598_5_, float p_225598_6_, float p_225598_7_, float p_225598_8_) {
		bb_main.render(matrixStack, buffer, packedLight, packedOverlay);
		
	}
}

 

The render

package com.ioqwert.perry.client.render;

import com.ioqwert.perry.PerryMod;
import com.ioqwert.perry.client.model.PerryModel;
import com.ioqwert.perry.common.entity.PerryEntity;

import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.entity.MobRenderer;
import net.minecraft.util.ResourceLocation;

public class PerryRender extends MobRenderer<PerryEntity, PerryModel<PerryEntity>>{

	public PerryRender(EntityRendererManager manager) {
		super(manager, new PerryModel<PerryEntity>(), 0.3F);
	}

	@Override
	public ResourceLocation getTextureLocation(PerryEntity p_110775_1_) {
		return new ResourceLocation(PerryMod.MODID, "/textures/entity/perry_mob.png");
	}
}

 

The entity:

package com.ioqwert.perry.common.entity;

import net.minecraft.entity.AgeableEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.entity.ai.goal.LookAtGoal;
import net.minecraft.entity.ai.goal.LookRandomlyGoal;
import net.minecraft.entity.ai.goal.PanicGoal;
import net.minecraft.entity.ai.goal.SwimGoal;
import net.minecraft.entity.ai.goal.WaterAvoidingRandomWalkingGoal;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;

public class PerryEntity extends AnimalEntity{

	public PerryEntity(EntityType<? extends PerryEntity> entityType, World world) {
		super(entityType, world);
	}

	@Override
	public PerryEntity getBreedOffspring(ServerWorld world, AgeableEntity entity) {
		return (PerryEntity) getType().create(world);
	}

	@Override
	protected void registerGoals() {
		this.goalSelector.addGoal(0, new SwimGoal(this));
		this.goalSelector.addGoal(1, new PanicGoal(this, 1.25D));
		this.goalSelector.addGoal(6, new WaterAvoidingRandomWalkingGoal(this, 1.0D));
		this.goalSelector.addGoal(7, new LookAtGoal(this, PlayerEntity.class, 6.0F));
		this.goalSelector.addGoal(8, new LookRandomlyGoal(this));
	}

	public static AttributeModifierMap.MutableAttribute createAttributes() {
		return MobEntity.createMobAttributes()
				.add(Attributes.MAX_HEALTH, 30.0D)
				.add(Attributes.MOVEMENT_SPEED, 0.6D);
	}
}

 

Edited by ioqwert
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.



×
×
  • Create New...

Important Information

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