This commit is contained in:
2024-07-24 09:58:43 +02:00
commit 97c2285f77
31 changed files with 1019 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
package systems.brn.plasticgun.lib;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import java.util.ArrayList;
import static systems.brn.plasticgun.PlasticGun.MOD_ID;
public class Util {
public static Identifier id(String path) {
return Identifier.of(MOD_ID, path);
}
public static ItemStack findBulletStack(ArrayList<Item> bulletItem, ServerPlayerEntity player) {
if (bulletItem == null || bulletItem.isEmpty()) {
return ItemStack.EMPTY;
}
for (ItemStack itemStack : player.getInventory().main) {
for (Item item : bulletItem) {
if (item == itemStack.getItem()) {
return itemStack;
}
}
}
return ItemStack.EMPTY;
}
}