版本信息
你使用的IDE:IntelliJ IDEA
你使用的IDE版本:2019.3.2.0
Forge版本:forge-1.15.2-31.1.0
Minecraft版本:1.15.2
错误情况简述
为什么我按照教程写了一个实体,但是为什么在召唤实体的时候显示的是一个黑色的方块?
而且文件的路径也没错啊?我是完完全全地按照教程来做的。
报错日志
请在两个「```」之间贴入你的日志信息(来自console)
相关代码
实体的渲染文件代码<SuicideBomberRenderer.class>
package com.specialitem.specialitem.entity;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.entity.MobRenderer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
public class SuicideBomberRenderer extends MobRenderer<SuicideBomber, SuicideBomberModel> {
private static final ResourceLocation TEXTURE = new ResourceLocation("textures/entity/suicide_bomber.png");
public SuicideBomberRenderer(EntityRendererManager manager) {
super(manager, new SuicideBomberModel(), 0.5f);
}
protected void func_225620_a_(SuicideBomber p_225620_1_, MatrixStack p_225620_2_, float p_225620_3_) {
float f = p_225620_1_.getCreeperFlashIntensity(p_225620_3_);
float f1 = 1.0F + MathHelper.sin(f * 100.0F) * f * 0.01F;
f = MathHelper.clamp(f, 0.0F, 1.0F);
f = f * f;
f = f * f;
float f2 = (1.0F + f * 0.4F) * f1;
float f3 = (1.0F + f * 0.1F) / f1;
p_225620_2_.func_227862_a_(f2, f3, f2);
}
protected float func_225625_b_(SuicideBomber p_225625_1_, float p_225625_2_) {
float f = p_225625_1_.getCreeperFlashIntensity(p_225625_2_);
return (int)(f * 10.0F) % 2 == 0 ? 0.0F : MathHelper.clamp(f, 0.5F, 1.0F);
}
public ResourceLocation getEntityTexture(SuicideBomber entity) {
return TEXTURE;
}
}
实体的模型文件<SuicideBomberModel.class>
package com.specialitem.specialitem.entity;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import net.minecraft.client.renderer.model.ModelRenderer;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
public class SuicideBomberModel extends net.minecraft.client.renderer.entity.model.EntityModel<SuicideBomber> {
public ModelRenderer body;
public SuicideBomberModel(){
body = new ModelRenderer(this, 0, 0);
body.func_228300_a_(-3, -3, -3, 6, 6, 6);
}
@Override
public void func_225597_a_(SuicideBomber p_225597_1_, float p_225597_2_, float p_225597_3_, float p_225597_4_, float p_225597_5_, float p_225597_6_) {
}
@Override
public void func_225598_a_(MatrixStack p_225598_1_, IVertexBuilder p_225598_2_, int p_225598_3_, int p_225598_4_, float p_225598_5_, float p_225598_6_, float p_225598_7_, float p_225598_8_) {
body.func_228309_a_(p_225598_1_,p_225598_2_,p_225598_3_,p_225598_4_,p_225598_5_,p_225598_6_,p_225598_7_,p_225598_8_);
}
@Override
public void setLivingAnimations(SuicideBomber entityIn, float limbSwing, float limbSwingAmount, float partialTick) {
super.setLivingAnimations(entityIn, limbSwing, limbSwingAmount, partialTick);
}
}
注册信息:
@SubscribeEvent
public static void onEntityRegistry(final RegistryEvent.Register<EntityType<?>> Event){
Event.getRegistry().register(EntityType.Builder.create(SuicideBomber::new, EntityClassification.CREATURE)
.size(0.6F,1.95F)
.setShouldReceiveVelocityUpdates(false)
.build("suicide_bomber")
.setRegistryName(SpecialItem.MODID,"suicide_bomber"));
}
附上相关的图片(床上的那个黑色东西就是):