Add utility method to check if entity is holding a wrench.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package li.cil.oc2.common.integration;
|
||||
|
||||
import li.cil.oc2.common.tags.ItemTags;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -14,4 +15,14 @@ public final class Wrenches {
|
||||
public static boolean isWrench(final Item item) {
|
||||
return item.isIn(ItemTags.WRENCHES);
|
||||
}
|
||||
|
||||
public static boolean isHoldingWrench(final Entity entity) {
|
||||
for (final ItemStack stack : entity.getHeldEquipment()) {
|
||||
if (isWrench(stack.getItem())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user