Jump to content

[1.12.2] Entity Model Drifting Away From Entity (SOLVED)


laton95

Recommended Posts

I am having an issue where the model of my entity is drifting away from the actual entity, in the image you can see that the bounding box is where the entity actually is while it's model is falling through the floor. The entity is a simple parrot copy that extends EntityParrot and not much else.

 

The model keeps the same x and z coordinates of the actual entity, but keeps descending.

 

I suspect that this is the result of an issue syncing between client and server but I am not sure exactly where the problem is.

 

My entity class

Spoiler

public class EntityZombieParrot extends EntityParrot
{
	public EntityZombieParrot(World worldIn)
	{
		super(worldIn);
	}
	
	@Override
	public boolean processInteract(EntityPlayer player, EnumHand hand)
	{
		if (!this.world.isRemote && !this.isFlying() && this.isTamed() && this.isOwner(player))
		{
			this.aiSit.setSitting(!this.isSitting());
		}
		
		return true;
	}
	
	@Nullable
	@Override
	public SoundEvent getAmbientSound()
	{
		return SoundEvents.E_PARROT_IM_ZOMBIE;
	}
	
	@Nullable
	@Override
	protected SoundEvent getDeathSound()
	{
		return SoundEvents.ENTITY_ZOMBIE_DEATH;
	}
	
	@Nullable
	@Override
	protected SoundEvent getHurtSound(DamageSource damageSourceIn)
	{
		return SoundEvents.ENTITY_ZOMBIE_HURT;
	}
}

 

 

My render class:

Spoiler

public class RenderZombieParrot extends RenderLiving
{
	public RenderZombieParrot(RenderManager rendermanagerIn, ModelBase modelbaseIn, float shadowsizeIn)
	{
		super(rendermanagerIn, modelbaseIn, shadowsizeIn);
	}
	
	@Nullable
	@Override
	protected ResourceLocation getEntityTexture(Entity entity)
	{
		return new ResourceLocation("mod:textures/entity/zombie_parrot/zombie_parrot.png");
	}
}

 

 

I am registering my render in my client proxy on preInit, and registering the entity on the RegistryEvent.Register<EntityEntry> event.

RenderingRegistry.registerEntityRenderingHandler(EntityZombieParrot.class, renderManager -> new RenderZombieParrot(renderManager, new ModelParrot(), 0.5f));

createBuilder("zombie_parrot").entity(EntityZombieParrot.class).tracker(64, 3, false).build();

2018-06-18_16.48.34.png

Edited by laton95
Link to comment
Share on other sites

@Mod.EventBusSubscriber
public class ModEntities
{
	private static int entityID = 0;
	
	@SubscribeEvent
	public static void registerEntities(RegistryEvent.Register<EntityEntry> event)
	{
		LogHelper.info("Registering entities");
		
		EntityEntry[] entries = {
				createBuilder("spell_projectile_bouncing").entity(EntityProjectileSpellBouncing.class).tracker(64, 20, true).build(),
				createBuilder("spell_projectile_damage").entity(EntityProjectileSpellDamage.class).tracker(64, 20, true).build(),
				createBuilder("spell_projectile_explosive").entity(EntityProjectileSpellExplosive.class).tracker(64, 20, true).build(),
				createBuilder("spell_projectile_following").entity(EntityProjectileSpellFollowing.class).tracker(64, 1, true).build(),
				createBuilder("spell_projectile_teleport_basic").entity(EntityProjectileSpellTeleportBasic.class).tracker(64, 20, true).build(),
				createBuilder("zombie_parrot").entity(EntityZombieParrot.class).tracker(64, 1, true).build()
		};
		
		event.getRegistry().registerAll(entries);
		
	}
	
	private static <E extends Entity> EntityEntryBuilder<E> createBuilder(final String name)
	{
		final EntityEntryBuilder<E> builder = EntityEntryBuilder.create();
		final ResourceLocation registryName = new ResourceLocation(ModReference.MOD_ID, name);
		return builder.id(registryName, entityID++).name(registryName.toString());
	}
}

 

Link to comment
Share on other sites

Well thanks anyway. I'll keep at it, I've made it it's own entity now instead of extending parrot and removed it's ability to fly to check if that was causing the issue. Oddly enough the model still falls slowly like a chicken even though it shouldn't be able to. The actual entity falls like a normal mob.

Edited by laton95
Link to comment
Share on other sites

  • 7 months later...

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.