修改perk nbt逻辑
This commit is contained in:
parent
b5563dcaa4
commit
33fa1bae26
1 changed files with 3 additions and 3 deletions
|
@ -229,15 +229,15 @@ public abstract class GunItem extends Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
var compound = stack.getOrCreateTag().getCompound("PerkData");
|
var compound = stack.getOrCreateTag().getCompound("PerkData");
|
||||||
|
|
||||||
for (String t : tag) {
|
for (String t : tag) {
|
||||||
if (!compound.contains(t)) {
|
if (!compound.contains(t)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getInt(t) > 0) {
|
if (compound.getInt(t) > 0) {
|
||||||
stack.getOrCreateTag().putInt(t, Math.max(0, stack.getOrCreateTag().getInt(t) - 1));
|
compound.putInt(t, Math.max(0, compound.getInt(t) - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stack.addTagElement("PerkData", compound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue