mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Merge pull request #2368 from poma123/fix/goldpan
Fixed GoldPan entity interaction
This commit is contained in:
commit
4c41650d4a
@ -15,6 +15,7 @@ import io.github.thebusybiscuit.cscorelib2.collections.RandomizedSet;
|
||||
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
|
||||
import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
|
||||
import io.github.thebusybiscuit.slimefun4.core.handlers.EntityInteractHandler;
|
||||
import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
@ -47,6 +48,7 @@ public class GoldPan extends SimpleSlimefunItem<ItemUseHandler> implements Recip
|
||||
|
||||
drops.addAll(getGoldPanDrops());
|
||||
addItemSetting(drops.toArray(new GoldPanDrop[0]));
|
||||
addItemHandler(onEntityInteract());
|
||||
}
|
||||
|
||||
protected Material getInput() {
|
||||
@ -115,6 +117,16 @@ public class GoldPan extends SimpleSlimefunItem<ItemUseHandler> implements Recip
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* This method cancels {@link EntityInteractHandler} to prevent interacting {@link GoldPan}
|
||||
* with entities.
|
||||
*
|
||||
* @return the {@link EntityInteractHandler} of this {@link SlimefunItem}
|
||||
*/
|
||||
public EntityInteractHandler onEntityInteract() {
|
||||
return (e, item, offHand) -> e.setCancelled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDisplayRecipes() {
|
||||
List<ItemStack> recipes = new LinkedList<>();
|
||||
|
Loading…
Reference in New Issue
Block a user