Hello, everyone
I want to destroy (so that it will drop itself and its contents) a minecart with hopper that got under a certain chest.
My code I wrote so far (I'm using the skript-mirror add-on):
only shows the minecart's position (which at least is the sign proving that most of the code works properly) and I know exactly why this happens (or at least I think I do).
The local variable {_minecart} is an instance of org.bukkit.inventory.InventoryHolder, which inherits the getLocation() method from org.bukkit.entity.Entity.
In order to call the setDamage(int) method on that variable, it should be cast to org.bukkit.entity.minecart.HopperMinecart or org.bukkit.entity.Minecart. And this is my question. How can I cast {_minecart} to one of the above-mentioned interfaces? Skript does not recognize either the standard Java way of doing it or the Skipt native parsed as expression. Any ideas?
I want to destroy (so that it will drop itself and its contents) a minecart with hopper that got under a certain chest.
My code I wrote so far (I'm using the skript-mirror add-on):
Code:
import:
org.bukkit.event.inventory.InventoryMoveItemEvent
org.bukkit.event.inventory.InventoryType
on InventoryMoveItemEvent:
if event.getDestination().getType() is InventoryType.HOPPER:
...
set {_minecart} to event.getDestination().getHolder()
send "%{_minecart}'s location%" to all players
{_minecart}.setDamage(50)
The local variable {_minecart} is an instance of org.bukkit.inventory.InventoryHolder, which inherits the getLocation() method from org.bukkit.entity.Entity.
In order to call the setDamage(int) method on that variable, it should be cast to org.bukkit.entity.minecart.HopperMinecart or org.bukkit.entity.Minecart. And this is my question. How can I cast {_minecart} to one of the above-mentioned interfaces? Skript does not recognize either the standard Java way of doing it or the Skipt native parsed as expression. Any ideas?