1
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:
TheBusyBiscuit 2020-09-30 20:29:21 +02:00 committed by GitHub
commit 4c41650d4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<>();