使波赛克正确消耗弹药
This commit is contained in:
parent
6594313b6d
commit
2daffca47b
1 changed files with 6 additions and 3 deletions
|
@ -23,7 +23,10 @@ import net.minecraft.sounds.SoundSource;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.inventory.tooltip.TooltipComponent;
|
import net.minecraft.world.inventory.tooltip.TooltipComponent;
|
||||||
import net.minecraft.world.item.*;
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.ItemDisplayContext;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.Rarity;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.neoforged.neoforge.network.PacketDistributor;
|
import net.neoforged.neoforge.network.PacketDistributor;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
@ -178,8 +181,8 @@ public class BocekItem extends GunItem implements GeoItem, ReleaseSpecialWeapon
|
||||||
player.getCooldowns().addCooldown(stack.getItem(), 7);
|
player.getCooldowns().addCooldown(stack.getItem(), 7);
|
||||||
GunsTool.setGunIntTag(tag, "ArrowEmpty", 7);
|
GunsTool.setGunIntTag(tag, "ArrowEmpty", 7);
|
||||||
|
|
||||||
if (!InventoryTool.hasCreativeAmmoBox(player) && !player.isCreative()) {
|
if (!InventoryTool.hasCreativeAmmoBox(player)) {
|
||||||
player.getInventory().clearOrCountMatchingItems(p -> Items.ARROW == p.getItem(), 1, player.inventoryMenu.getCraftSlots());
|
data.consumeAmmo(player, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue