Want a better Minecraft server? Read about SpigotMC here!
Separate names with a comma.
Discussion in 'Spigot Plugin Development' started by Creepermanthe3rd, Apr 24, 2017.
Help! ^Title how do I stop lava from burning the items.
I'm not at my computer but check for me if there is a entity damage event? Or entity destroy event? Cause if there is you could try cancelling the damage?
Listen for EntityDamageEvent. If the entity is instanceof Item, and the DamageCause is LAVA. Then cancel the event.
The events all worked I tested with debugging but e.setCancled didnt stop the item from burning. Any other solutions
Cast the entity of the event to an Item, and drop that Item's ItemStack wherever you want the item to go.
I'm not entirely sure what you're trying to achieve - do you want the item to just sit on top of the lava rather than being destroyed by it?
Because if you can't cancel the event, you'll have have to keep respawning the item until a player (somehow) picks it up.
Im recreating a plugin similar to CosmicPvP's where Lava does not destory Mob spawners.
Does lava even destroy mob spawners in the first place?
Lava destorys every dropable item
It kills any item when dropped*
Send us your current code, I think i know what the problem is
Doing this is more complex than using event.setCancelled().
Minecraft won't stop destroying items that fall in lava.
In order to make this work you should create a new Field for exemple Field isInvulnerableItem;
And also take into account that you only want items not to be burned when there's an explosion event involved.
Use also ItemSpawnEvent to spawn again the items that were protected from invulnerability.
C-can't we just make the Item entity invulnerable? Isn't that a thing anymore?
I used to do this back when I played with just commandblocks, but I admit I've never tried with Spigot.
Yes, that works. Though I think it may not work with lava.. not sure. I do both- on item spawn, set the Item entity to invulnerable, but also catch damage events and cancel them. Seems to work for me.