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
  On 10/9/2019 at 12:06 PM, diesieben07 said:

Show your code.

Expand  
	@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 (edited)
  On 10/9/2019 at 7:46 PM, 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.

Expand  

Thanks

 

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

Edited by Differentiation

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.