优化NBT#ChargedDamage
This commit is contained in:
parent
ba4cadccb3
commit
645effa77b
3 changed files with 9 additions and 9 deletions
|
@ -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))
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue