Why is your remove statement so complicated? Why not simply:
event.drops.remove(Items.coal);
More importantly, I don't think you have to handle the event at all -- you just need to remove the drop from the entity once. It seems that the Entity class has a capturedDrops which is a public ArrayList of items. So I think you just have to remove the drop once directly from the entity, rather than try to remove it every time the event is called.
Edit: Actually I inspected the code and you're right -- you should do the drops modification inside the LivingDropsEvent because the drops list is updated right before that event (since some entities have complicated drops due to having dynamic inventory). In other words, if you edited the drops (actually the public capturedDrops list) in some other place like when the entity spawns it will get overwritten when the drop actually occurs.
I successfully changed the EntitySheep to drop nothing by using event.drops.clear() and also could change their drops to 5 apples with:
Why is your remove statement so complicated? Why not simply:
event.drops.remove(Items.coal);
More importantly, I don't think you have to handle the event at all -- you just need to remove the drop from the entity once. It seems that the Entity class has a capturedDrops which is a public ArrayList of items. So I think you just have to remove the drop once directly from the entity, rather than try to remove it every time the event is called.
Edit: Actually I inspected the code and you're right -- you should do the drops modification inside the LivingDropsEvent because the drops list is updated right before that event (since some entities have complicated drops due to having dynamic inventory). In other words, if you edited the drops (actually the public capturedDrops list) in some other place like when the entity spawns it will get overwritten when the drop actually occurs.
I successfully changed the EntitySheep to drop nothing by using event.drops.clear() and also could change their drops to 5 apples with:
I tried that code, and the Wither Skeleton still drops coal and regular bones. I cannot seem to remove those drops for the life of me.
Rollback Post to RevisionRollBack
I just took the Minecraft Noob test! Check out what I scored. Think you can beat me?!
To take the test, check out https://minecraftnoobtest.com/test.php
Minecraft uses java.util$List to hold all the drops as ItemStacks. So after entity checking try. e.drops.remove(new ItemStack(Items.coal)). If that doesn't work you may need to iterate the list and find the instance of the coal itemstack yourself and remove it using e.drops.remove(index) of the offending itemstack drops.
Minecraft uses java.util$List to hold all the drops as ItemStacks. So after entity checking try. e.drops.remove(new ItemStack(Items.coal)). If that doesn't work you may need to iterate the list and find the instance of the coal itemstack yourself and remove it using e.drops.remove(index) of the offending itemstack drops.
Edit:
You tricked me reviving and old post >.<
Is there a specific list where the drops are stored? I don't think I know the index of the coal drop.
Nvm, tested out the iterator and it works perfectly. Thank you.
I just took the Minecraft Noob test! Check out what I scored. Think you can beat me?!
To take the test, check out https://minecraftnoobtest.com/test.php
Just do e.drops.remove(new ItemStack(Items.coal)). If that doesn't work or if there is more than one ItemStack drop for coal. Iterate through it and remove it manually.
Rollback Post to RevisionRollBack
My Mods:
Working on updating Little Maid Mod to 1.12 with my own twist. I am a Japanese anime fan :3 Teasers here
Blood Baubles - An addon for BloodMagic that adds related Baubles to the game. (Currently on hold)
Blood Magic Wiki - A Blood Mages Choice Encylopedia (Currently on hold)
LazyModder- A libary that makes modding easier. Currently being developed for 1.12)
Deobfuscator - A program used to deobfuscate obfuscated mods.
@SubscribeEvent
public void dropEvent(LivingDropsEvent e){
if(e.entityLiving instanceof EntitySkeleton){
e.drops.remove(new EntityItem(e.entityLiving.worldObj, e.entityLiving.posX, e.entityLiving.posY,
e.entityLiving.posZ, new ItemStack(Items.coal)));
}
}
I just don't know how to tweak it to a wither skeleton, instead of a regular one.
Thanks!
More importantly, I don't think you have to handle the event at all -- you just need to remove the drop from the entity once. It seems that the Entity class has a capturedDrops which is a public ArrayList of items. So I think you just have to remove the drop once directly from the entity, rather than try to remove it every time the event is called.Edit: Actually I inspected the code and you're right -- you should do the drops modification inside the LivingDropsEvent because the drops list is updated right before that event (since some entities have complicated drops due to having dynamic inventory). In other words, if you edited the drops (actually the public capturedDrops list) in some other place like when the entity spawns it will get overwritten when the drop actually occurs.
I successfully changed the EntitySheep to drop nothing by using event.drops.clear() and also could change their drops to 5 apples with:
I tried that code, and the Wither Skeleton still drops coal and regular bones. I cannot seem to remove those drops for the life of me.
I just took the Minecraft Noob test! Check out what I scored. Think you can beat me?!


To take the test, check out
https://minecraftnoobtest.com/test.php
Don't click this link, HE is haunting it...
Minecraft uses java.util$List to hold all the drops as ItemStacks. So after entity checking try. e.drops.remove(new ItemStack(Items.coal)). If that doesn't work you may need to iterate the list and find the instance of the coal itemstack yourself and remove it using e.drops.remove(index) of the offending itemstack drops.
Edit:
You tricked me reviving an old post >.<
My Mods:
- Happy Coding
-
Is there a specific list where the drops are stored? I don't think I know the index of the coal drop.
Nvm, tested out the iterator and it works perfectly. Thank you.
I just took the Minecraft Noob test! Check out what I scored. Think you can beat me?!


To take the test, check out
https://minecraftnoobtest.com/test.php
Don't click this link, HE is haunting it...
Just do e.drops.remove(new ItemStack(Items.coal)). If that doesn't work or if there is more than one ItemStack drop for coal. Iterate through it and remove it manually.
My Mods:
- Happy Coding
-