diff --git a/src/main/java/com/atsuishio/superbwarfare/client/tooltip/ClientSentinelImageTooltip.java b/src/main/java/com/atsuishio/superbwarfare/client/tooltip/ClientSentinelImageTooltip.java index e92943411..0e5802840 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/tooltip/ClientSentinelImageTooltip.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/tooltip/ClientSentinelImageTooltip.java @@ -2,7 +2,6 @@ package com.atsuishio.superbwarfare.client.tooltip; import com.atsuishio.superbwarfare.client.tooltip.component.GunImageComponent; import com.atsuishio.superbwarfare.tools.GunsTool; -import com.atsuishio.superbwarfare.tools.ItemNBTTool; import com.atsuishio.superbwarfare.tools.TooltipTool; import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; @@ -27,7 +26,7 @@ public class ClientSentinelImageTooltip extends ClientEnergyImageTooltip { if (flag.get()) { double damage = (GunsTool.getGunDoubleTag(stack, "Damage", 0) + - ItemNBTTool.getDouble(stack, "sentinelChargeDamage", 0)) + GunsTool.getGunDoubleTag(stack, "ChargedDamage", 0)) * TooltipTool.perkDamage(stack); return Component.translatable("des.superbwarfare.tips.damage").withStyle(ChatFormatting.GRAY) .append(Component.literal("").withStyle(ChatFormatting.RESET)) diff --git a/src/main/java/com/atsuishio/superbwarfare/event/GunEventHandler.java b/src/main/java/com/atsuishio/superbwarfare/event/GunEventHandler.java index 5c2244d4a..593b4e2bd 100644 --- a/src/main/java/com/atsuishio/superbwarfare/event/GunEventHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/event/GunEventHandler.java @@ -187,7 +187,8 @@ public class GunEventHandler { if (!player.level().isClientSide()) { float headshot = (float) GunsTool.getGunDoubleTag(stack, "Headshot", 0); - float damage = (float) (GunsTool.getGunDoubleTag(stack, "Damage", 0) + stack.getOrCreateTag().getDouble("sentinelChargeDamage")) * (float) perkDamage(stack); + float damage = (float) (GunsTool.getGunDoubleTag(stack, "Damage", 0) + + GunsTool.getGunDoubleTag(stack, "ChargedDamage", 0)) * (float) perkDamage(stack); float velocity = (float) ((GunsTool.getGunDoubleTag(stack, "Velocity", 0) + GunsTool.getGunDoubleTag(stack, "CustomVelocity", 0)) * perkSpeed(stack)); int projectileAmount = GunsTool.getGunIntTag(stack, "ProjectileAmount", 1); float bypassArmorRate = (float) GunsTool.getGunDoubleTag(stack, "BypassesArmor", 0); diff --git a/src/main/java/com/atsuishio/superbwarfare/item/gun/sniper/SentinelItem.java b/src/main/java/com/atsuishio/superbwarfare/item/gun/sniper/SentinelItem.java index 117c192e0..d64c87a27 100644 --- a/src/main/java/com/atsuishio/superbwarfare/item/gun/sniper/SentinelItem.java +++ b/src/main/java/com/atsuishio/superbwarfare/item/gun/sniper/SentinelItem.java @@ -177,18 +177,18 @@ public class SentinelItem extends GunItem implements GeoItem, AnimatedItem { } @Override - public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) { - super.inventoryTick(itemStack, world, entity, slot, selected); + public void inventoryTick(ItemStack stack, Level world, Entity entity, int slot, boolean selected) { + super.inventoryTick(stack, world, entity, slot, selected); - var tag = itemStack.getOrCreateTag(); - itemStack.getCapability(ForgeCapabilities.ENERGY).ifPresent( + stack.getCapability(ForgeCapabilities.ENERGY).ifPresent( energy -> { int energyStored = energy.getEnergyStored(); if (energyStored > 0) { energy.extractEnergy(1, false); - tag.putDouble("sentinelChargeDamage", 0.2857142857142857 * GunsTool.getGunDoubleTag(itemStack, "Damage", 0)); + GunsTool.setGunDoubleTag(stack, "ChargedDamage", 0.2857142857142857 + * GunsTool.getGunDoubleTag(stack, "Damage", 0)); } else { - tag.putDouble("sentinelChargeDamage", 0); + GunsTool.setGunDoubleTag(stack, "ChargedDamage", 0); } } );