Jump to content

Recommended Posts

Posted

If you subscribe to EntityJoinWorldEvent, then you should be able to access the entity through the event and change it however you want to.

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

Posted
6 hours ago, SerpentDagger said:

If you subscribe to EntityJoinWorldEvent, then you should be able to access the entity through the event and change it however you want to.

I tried to do this with LivingSpawnEvent and having zombies spawn with a certain item only 1/10000 chance but it's still very frequent...

Posted
1 hour ago, diesieben07 said:

Show your code.

	@SubscribeEvent
    public static void onLivingSpawn(LivingSpawnEvent event) 
	{
		EntityLivingBase entityliving = event.getEntityLiving();
		Random rand = entityliving.world.rand;
		EnumDifficulty difficulty = entityliving.world.getDifficulty();
		
		if (entityliving instanceof EntityZombie)
		{
			int i = rand.nextInt(difficulty == difficulty.EASY ? 20000 : difficulty == difficulty.NORMAL ? 15000 : 10000);
			int j = rand.nextInt(difficulty == difficulty.EASY ? 20000 : difficulty == difficulty.NORMAL ? 15000 : 10000);
			
			if (i < 1 && entityliving.getHeldItemMainhand().isEmpty())
			{
				entityliving.setHeldItem(EnumHand.MAIN_HAND, new ItemStack(DinocraftItems.LEAFERANG));
			}
        }
	}

For some reason I see a zombie spawning with this item once in 3-ish nights. What is the chance that they spawn with Iron or Diamond swords and stuff?

Posted
5 hours ago, diesieben07 said:

LivingSpawnEvent is a parent event for several sub-events. Subscribing to just LivingSpawnEvent subscribes you to all sub-events, which is not meaningful in any way.

So... EntityJoinWorldEvent is the better way out?

Posted (edited)
12 minutes ago, diesieben07 said:

No. EntityJoinWorldEvent fires every time an entity enters a world. Regardless of if it's a newly spawned one or one that's loaded from disk.

You probably want LivingSpawnEvent.SpecialSpawn, which is used to initialize newly spawned entities.

Thanks

 

Also, do you happen to know in what class MC spawns mobs with armor and what are the chances?

Edited by Differentiation
Posted (edited)
5 hours ago, Differentiation said:

Thanks

 

Also, do you happen to know in what class MC spawns mobs with armor and what are the chances?

Do you mean about line1000 - 1200 in EntityLiving?

Edited by poopoodice

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.