版本信息
你使用的系统:win764位
你是用的JDK: jdk1.8.0_202 64bit
你使用的IDE:IntelliJ IDEA
你使用的IDE版本:2020.2.2
Minecraft版本: 1.15.2
错误情况简述
制作了一个叫“翔翔(飞翔的翔)”的投掷物,但是这个实体渲染的时候会是一个雪球,继承鸡蛋就会变成鸡蛋,继承ProjectItemEntity的时候会变成一个猪
相关代码
FlyingShitEntity.java
public class FlyingShitEntity extends SnowballEntity {
public static final ScoreCriteria FLYING_SHIT = new ScoreCriteria("flying_shit");
public FlyingShitEntity(EntityType<? extends SnowballEntity> p_i50159_1_, World p_i50159_2_) {
super(p_i50159_1_, p_i50159_2_);
}
public FlyingShitEntity(World worldIn, LivingEntity throwerIn) {
super(worldIn, throwerIn);
}
public FlyingShitEntity(World worldIn, double x, double y, double z) {
super(worldIn, x, y, z);
}
protected void onImpact(RayTraceResult result) {
if (result.getType() == RayTraceResult.Type.ENTITY) {
Entity entity = ((EntityRayTraceResult) result).getEntity();
entity.attackEntityFrom(ModDamageTypes.STINKY,6);
}
if (!this.world.isRemote) {
this.world.setEntityState(this, (byte) 3);
this.remove();
}
}
}
FlyingShitRenderer.java
@OnlyIn(Dist.CLIENT)
public class FlyingShitRenderer extends SpriteRenderer<FlyingShitEntity> {
public FlyingShitRenderer(EntityRendererManager renderManagerIn) {
super(renderManagerIn, Minecraft.getInstance().getItemRenderer());
}
}
ModRenders.java
public class ModRenders {
public static void register() {
RenderingRegistry.registerEntityRenderingHandler(ModEntities.FEATHERED_SHEEP_ENTITY_ENTITY_TYPE, FeatheredSheepRenderer::new);
RenderingRegistry.registerEntityRenderingHandler(ModEntities.FLYING_SHIT_ENTITY_ENTITY_TYPE, FlyingShitRenderer::new);
ModLemon.LOGGER.info("fuzzy");//这一行被调用了
}
}
ModLemon.java
@Mod("cnmb_nmsl")
@Mod.EventBusSubscriber
public class ModLemon {
public static final String MOD_ID = "cnmb_nmsl";
public static final String MOD_NAME = "Lemons are ripen";
public static final ItemGroup LEMON_GROUP = new LemonCreativeTab();
public static final Logger LOGGER = LogManager.getLogger(MOD_NAME);
public ModLemon(){
......//有一些无关的东西所以省略了
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);
}
@OnlyIn(Dist.CLIENT)
private void doClientStuff(final FMLClientSetupEvent event) {
ModRenders.register();
}
}
查到的资料
没查到,我完全照ChromeBall抄的,但是还是不对劲