Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

  • Author
@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());
	}
}

 

  • Author

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

  • Author

Hmm, it is a problem with using the parrot model itself. The same entity with a different model will not have the issue.

  • Author

Ok, turns out that I needed to override handleRotationFloat in my render class like vanilla did to it's parrot.

  • Author

Getting the parrot to work properly on the player's shoulder is probably not possible, looks like the parrot is hardcoded in several places.

  • 7 months later...
On 6/18/2018 at 9:02 AM, laton95 said:

Getting the parrot to work properly on the player's shoulder is probably not possible, looks like the parrot is hardcoded in several places.

Well I believe Ice and Fire does it, you could check their code.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.