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'm trying to make new types of parrots for 1.12 to enjoy some diversity. I've tried looking at the original code for parrots, which gave me some sense of the direction to go into, but currently, it changes the textures pretty much every time I restart the game/world or chunks are reloaded.

 

Not sure how to fix it at this point. 

 

Here is the GitHub link: https://github.com/DecentChicken/ExtendedParrots

And here is the relevant code:

Entity:

 
 
 
 
Spoiler

package chicken.chicken.extendedparrots.entity;

import java.util.Random;

import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.passive.EntityParrot;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.World;

public class EntityLovebird extends EntityParrot 
{
	private static int VARIANTS_AMNT = 2;
	Random rand = new Random();
	public int rndTexture = rand.nextInt(VARIANTS_AMNT);

	public EntityLovebird(World worldIn) {
		super(worldIn);
	}
}

 

Renderer:

 
 
 
 
Spoiler

package chicken.chicken.extendedparrots.entity.render;

import chicken.chicken.extendedparrots.entity.EntityLovebird;
import chicken.chicken.extendedparrots.entity.model.ModelLovebird;
import chicken.chicken.extendedparrots.util.Reference;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;

public class RenderLovebird extends RenderLiving<EntityLovebird>
{
	public static final ResourceLocation[] TEXTURES = new ResourceLocation[] {new ResourceLocation(Reference.MOD_ID + ":textures/entity/lovebird_fischeri.png"), new ResourceLocation(Reference.MOD_ID + ":textures/entity/lovebird_personata_azul.png")};
	public RenderLovebird(RenderManager manager) {
		super(manager, new ModelLovebird(), 0.2f);
	}

	@Override
	protected ResourceLocation getEntityTexture(EntityLovebird entity) {
		return TEXTURES[entity.rndTexture];
	}

	@Override
	protected float handleRotationFloat(EntityLovebird livingBase, float partialTicks) {
		return getCustomBob(livingBase, partialTicks);
	}
	
	private float getCustomBob(EntityLovebird lovebird, float nr)
	{
		float f = lovebird.oFlap + (lovebird.flap - lovebird.oFlap) * nr;
        float f1 = lovebird.oFlapSpeed + (lovebird.flapSpeed - lovebird.oFlapSpeed) * nr;
        return (MathHelper.sin(f) + 1.0F) * f1;
	}
}

 

Screenshots attached for testing reference. It does happen in the RegentParakeet classes as well, but that code is identical, therefore not included.

 

1.jpg

2.jpg

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.