Posted October 9, 20196 yr Hey, I was wondering if there's any way to make any entity spawn holding/wearing an item from my mod. any help appreciated. Thanks Edited October 9, 20196 yr by Differentiation
October 9, 20196 yr 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.
October 9, 20196 yr Author 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...
October 9, 20196 yr Author 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?
October 9, 20196 yr Author 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?
October 9, 20196 yr Author 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 October 9, 20196 yr by Differentiation
October 10, 20196 yr 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 October 10, 20196 yr 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.