修复灵敏度和瞄准倍率问题
This commit is contained in:
parent
0ba0e22e82
commit
ee17468332
43 changed files with 19060 additions and 11403 deletions
|
@ -1,7 +1,6 @@
|
|||
package com.atsuishio.superbwarfare.client;
|
||||
|
||||
import com.atsuishio.superbwarfare.init.ModPerks;
|
||||
import com.atsuishio.superbwarfare.perk.AmmoPerk;
|
||||
import com.atsuishio.superbwarfare.perk.Perk;
|
||||
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
||||
import com.atsuishio.superbwarfare.tools.NBTTool;
|
||||
|
@ -24,14 +23,6 @@ public class TooltipTool {
|
|||
tooltip.add(Component.translatable("des.superbwarfare.developing").withStyle(ChatFormatting.LIGHT_PURPLE).withStyle(ChatFormatting.BOLD));
|
||||
}
|
||||
|
||||
public static double perkDamage(ItemStack stack) {
|
||||
var perk = PerkHelper.getPerkByType(NBTTool.getTag(stack), Perk.Type.AMMO);
|
||||
if (perk instanceof AmmoPerk ammoPerk) {
|
||||
return ammoPerk.damageRate;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static boolean heBullet(ItemStack stack) {
|
||||
var perk = PerkHelper.getPerkByType(NBTTool.getTag(stack), Perk.Type.AMMO);
|
||||
return perk == ModPerks.HE_BULLET.get();
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
|||
import com.atsuishio.superbwarfare.init.ModTags;
|
||||
import com.atsuishio.superbwarfare.item.gun.GunData;
|
||||
import com.atsuishio.superbwarfare.item.gun.machinegun.RpkItem;
|
||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
|
@ -18,9 +19,16 @@ import software.bernie.geckolib.model.GeoModel;
|
|||
|
||||
public class RpkItemModel extends GeoModel<RpkItem> {
|
||||
|
||||
public static float scopeY = 0.2f;
|
||||
public static float scaleZAlt = 0.74f;
|
||||
public static float posZAlt = 4.25f;
|
||||
|
||||
public static float fireRotY = 0f;
|
||||
public static float fireRotZ = 0f;
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(RpkItem animatable) {
|
||||
return Mod.loc("animations/rpk.animation.json");
|
||||
return Mod.loc("animations/ak.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -36,9 +44,11 @@ public class RpkItemModel extends GeoModel<RpkItem> {
|
|||
@Override
|
||||
public void setCustomAnimations(RpkItem animatable, long instanceId, AnimationState animationState) {
|
||||
GeoBone gun = getAnimationProcessor().getBone("bone");
|
||||
GeoBone shen = getAnimationProcessor().getBone("shen");
|
||||
GeoBone scope = getAnimationProcessor().getBone("pka");
|
||||
GeoBone scope = getAnimationProcessor().getBone("Scope1");
|
||||
GeoBone button = getAnimationProcessor().getBone("button");
|
||||
GeoBone scope2 = getAnimationProcessor().getBone("Scope2");
|
||||
// GeoBone scope3 = getAnimationProcessor().getBone("Scope3");
|
||||
// GeoBone cross3 = getAnimationProcessor().getBone("Cross3");
|
||||
GeoBone shuan = getAnimationProcessor().getBone("shuan");
|
||||
|
||||
Player player = Minecraft.getInstance().player;
|
||||
|
@ -64,35 +74,82 @@ public class RpkItemModel extends GeoModel<RpkItem> {
|
|||
double fp = ClientEventHandler.firePos;
|
||||
double fr = ClientEventHandler.fireRot;
|
||||
|
||||
gun.setPosX(1.69f * (float) zp);
|
||||
gun.setPosY(-0.33f * (float) zp - (float) (0.1f * zpz));
|
||||
gun.setPosZ(3.2f * (float) zp + (float) (0.2f * zpz));
|
||||
gun.setRotZ((float) (0.05f * zpz));
|
||||
gun.setScaleZ(1f - (0.55f * (float) zp));
|
||||
scope.setScaleZ(1f - (0.9f * (float) zp));
|
||||
button.setScaleX(1f - (0.2f * (float) zp));
|
||||
button.setScaleY(1f - (0.3f * (float) zp));
|
||||
button.setScaleZ(1f - (0.3f * (float) zp));
|
||||
|
||||
|
||||
var data = GunData.from(stack);
|
||||
var tag = data.tag();
|
||||
tag.putBoolean("HoloHidden", !(gun.getPosX() > 1.65));
|
||||
int type = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
|
||||
scopeY = Mth.lerp(times, scopeY, tag.getBoolean("ScopeAlt") ? -0.7f : 0.2f);
|
||||
scaleZAlt = Mth.lerp(times, scaleZAlt, tag.getBoolean("ScopeAlt") ? 0.45f : 0.74f);
|
||||
posZAlt = Mth.lerp(times, posZAlt, tag.getBoolean("ScopeAlt") ? 3.3f : 4.25f);
|
||||
|
||||
|
||||
float posYAlt = switch (type) {
|
||||
case 2, 3 -> 0.5f;
|
||||
default -> 0f;
|
||||
};
|
||||
float posY = switch (type) {
|
||||
case 0 -> 1.071f;
|
||||
case 1 -> -0.101f;
|
||||
case 2 -> scopeY + posYAlt;
|
||||
case 3 -> 0.099f + posYAlt;
|
||||
default -> 0f;
|
||||
};
|
||||
float scaleZ = switch (type) {
|
||||
case 0, 1 -> 0.7f;
|
||||
case 2 -> scaleZAlt;
|
||||
case 3 -> 0.78f;
|
||||
default -> 0f;
|
||||
};
|
||||
float posZ = switch (type) {
|
||||
case 0 -> 3.3f;
|
||||
case 1 -> 4.2f;
|
||||
case 2 -> posZAlt;
|
||||
case 3 -> 3.9f;
|
||||
default -> 0f;
|
||||
};
|
||||
|
||||
gun.setPosX(2.462f * (float) zp);
|
||||
gun.setPosY((posY) * (float) zp - (float) (0.2f * zpz) - posYAlt);
|
||||
gun.setPosZ(posZ * (float) zp + (float) (0.5f * zpz));
|
||||
gun.setScaleZ(1f - (scaleZ * (float) zp));
|
||||
scope.setScaleZ(1f - (0.85f * (float) zp));
|
||||
button.setScaleX(1f - (0.3f * (float) zp));
|
||||
button.setScaleY(1f - (0.3f * (float) zp));
|
||||
button.setScaleZ(1f - (0.3f * (float) zp));
|
||||
scope2.setScaleZ(1f - (0.7f * (float) zp));
|
||||
// scope3.setScaleZ(1f - (0.7f * (float) zp));
|
||||
|
||||
tag.putBoolean("HoloHidden", !(gun.getPosX() > 1.8));
|
||||
data.save();
|
||||
|
||||
shen.setPosX((float) (0.95f * ClientEventHandler.recoilHorizon * fpz * fp));
|
||||
shen.setPosY((float) (0.15f * fp + 0.18f * fr));
|
||||
shen.setPosZ((float) (0.275 * fp + 0.34f * fr + 0.65 * fpz));
|
||||
shen.setRotX((float) (0.01f * fp + 0.05f * fr + 0.01f * fpz));
|
||||
shen.setRotY((float) (0.1f * ClientEventHandler.recoilHorizon * fpz));
|
||||
shen.setRotZ((float) ((0.08f + 0.1 * fr) * ClientEventHandler.recoilHorizon));
|
||||
GeoBone shen;
|
||||
if (zt < 0.5) {
|
||||
shen = getAnimationProcessor().getBone("fireRootNormal");
|
||||
} else {
|
||||
shen = switch (type) {
|
||||
case 0 -> getAnimationProcessor().getBone("fireRoot0");
|
||||
case 1 -> getAnimationProcessor().getBone("fireRoot1");
|
||||
case 2 -> getAnimationProcessor().getBone("fireRoot2");
|
||||
case 3 -> getAnimationProcessor().getBone("fireRoot3");
|
||||
default -> getAnimationProcessor().getBone("fireRootNormal");
|
||||
};
|
||||
}
|
||||
|
||||
shen.setPosX((float) (shen.getPosX() * (1 - 0.5 * zt)));
|
||||
shen.setPosY((float) (shen.getPosY() * (-1 + 0.4 * zt)));
|
||||
fireRotY = (float) Mth.lerp(0.3f * times, fireRotY, 0.2f * ClientEventHandler.recoilHorizon * fpz);
|
||||
fireRotZ = (float) Mth.lerp(2f * times, fireRotZ, (0.4f + 0.5 * fpz) * ClientEventHandler.recoilHorizon);
|
||||
|
||||
shen.setPosX(-0.4f * (float) (ClientEventHandler.recoilHorizon * (0.5 + 0.4 * ClientEventHandler.fireSpread)));
|
||||
shen.setPosY((float) (0.15f * fp + 0.18f * fr));
|
||||
shen.setPosZ((float) (0.375 * fp + 0.44f * fr + 0.75 * fpz));
|
||||
shen.setRotX((float) (0.01f * fp + 0.08f * fr + 0.01f * fpz));
|
||||
shen.setRotY(fireRotY);
|
||||
shen.setRotZ(fireRotZ);
|
||||
|
||||
shen.setPosX((float) (shen.getPosX() * (1 - 0.4 * zt)));
|
||||
shen.setPosY((float) (shen.getPosY() * (-1 + 0.8 * zt)));
|
||||
shen.setPosZ((float) (shen.getPosZ() * (1 - 0.6 * zt)));
|
||||
shen.setRotX((float) (shen.getRotX() * (1 - 0.9 * zt)));
|
||||
shen.setRotY((float) (shen.getRotY() * (1 - 0.9 * zt)));
|
||||
shen.setRotZ((float) (shen.getRotZ() * (1 - 0.9 * zt)));
|
||||
shen.setRotY((float) (shen.getRotY() * (1 - 0.85 * zt)));
|
||||
shen.setRotZ((float) (shen.getRotZ() * (1 - 0.4 * zt)));
|
||||
|
||||
CrossHairOverlay.gunRot = shen.getRotZ();
|
||||
|
||||
|
@ -108,11 +165,11 @@ public class RpkItemModel extends GeoModel<RpkItem> {
|
|||
GeoBone camera = getAnimationProcessor().getBone("camera");
|
||||
GeoBone main = getAnimationProcessor().getBone("0");
|
||||
|
||||
float numR = (float) (1 - 0.94 * zt);
|
||||
float numP = (float) (1 - 0.8 * zt);
|
||||
float numR = (float) (1 - 0.98 * zt);
|
||||
float numP = (float) (1 - 0.92 * zt);
|
||||
|
||||
AnimationHelper.handleReloadShakeAnimation(stack, main, camera, numR, numP);
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(), Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
AnimationHelper.handleShellsAnimation(getAnimationProcessor(), 1f, 0.55f);
|
||||
// AnimationHelper.handleShellsAnimation(getAnimationProcessor(), 1f, 0.35f);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,19 +128,6 @@ public class AK47ItemRenderer extends GeoItemRenderer<AK47Item> {
|
|||
bone.setRotZ((float) (0.5 * (Math.random() - 0.5)));
|
||||
}
|
||||
}
|
||||
|
||||
if (name.equals("Mag0")) {
|
||||
bone.setHidden(GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.MAGAZINE) != 0);
|
||||
}
|
||||
|
||||
if (name.equals("Mag1")) {
|
||||
bone.setHidden(GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.MAGAZINE) != 1);
|
||||
}
|
||||
|
||||
if (name.equals("Mag2")) {
|
||||
bone.setHidden(GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.MAGAZINE) != 2);
|
||||
}
|
||||
|
||||
ItemModelHelper.handleGunAttachments(bone, itemStack, name);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.item;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||
import com.atsuishio.superbwarfare.client.ItemModelHelper;
|
||||
import com.atsuishio.superbwarfare.client.model.item.RpkItemModel;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.atsuishio.superbwarfare.init.ModTags;
|
||||
import com.atsuishio.superbwarfare.item.gun.GunData;
|
||||
import com.atsuishio.superbwarfare.item.gun.machinegun.RpkItem;
|
||||
import com.atsuishio.superbwarfare.tools.NBTTool;
|
||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -78,24 +80,69 @@ public class RpkItemRenderer extends GeoItemRenderer<RpkItem> {
|
|||
if (player == null) return;
|
||||
ItemStack itemStack = player.getMainHandItem();
|
||||
if (!itemStack.is(ModTags.Items.GUN)) return;
|
||||
var tag = GunData.from(itemStack).tag();
|
||||
|
||||
if (name.equals("holo")) {
|
||||
bone.setHidden(NBTTool.getTag(itemStack).getBoolean("HoloHidden") || !ClientEventHandler.zoom);
|
||||
bone.setHidden(tag.getBoolean("HoloHidden") || !ClientEventHandler.zoom);
|
||||
}
|
||||
if (name.equals("Cross1")) {
|
||||
bone.setHidden(tag.getBoolean("HoloHidden")
|
||||
|| !ClientEventHandler.zoom
|
||||
|| GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.SCOPE) != 1);
|
||||
}
|
||||
|
||||
if (name.equals("Cross2")) {
|
||||
bone.setHidden(tag.getBoolean("HoloHidden")
|
||||
|| !ClientEventHandler.zoom
|
||||
|| GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.SCOPE) != 2
|
||||
|| tag.getBoolean("ScopeAlt"));
|
||||
}
|
||||
|
||||
if (name.equals("CrossAlt")) {
|
||||
bone.setHidden(tag.getBoolean("HoloHidden")
|
||||
|| !ClientEventHandler.zoom
|
||||
|| GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.SCOPE) != 2
|
||||
|| !(tag.getBoolean("ScopeAlt")));
|
||||
}
|
||||
|
||||
if (name.equals("Cross3")) {
|
||||
bone.setHidden(tag.getBoolean("HoloHidden")
|
||||
|| !ClientEventHandler.zoom
|
||||
|| GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.SCOPE) != 3);
|
||||
}
|
||||
|
||||
if (name.equals("humu1")) {
|
||||
bone.setHidden(GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.GRIP) != 0);
|
||||
}
|
||||
|
||||
if (name.equals("humu2")) {
|
||||
bone.setHidden(GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.GRIP) == 0);
|
||||
}
|
||||
|
||||
if (GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.SCOPE) == 2 && !tag.getBoolean("ScopeAlt")
|
||||
&& (name.equals("glass") || name.equals("Barrel") || name.equals("humu") || name.equals("qiangguan"))) {
|
||||
bone.setHidden(!tag.getBoolean("HoloHidden") && ClientEventHandler.zoom);
|
||||
}
|
||||
|
||||
if (GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.SCOPE) == 3
|
||||
&& (name.equals("jing") || name.equals("Barrel") || name.equals("humu") || name.equals("qiangguan") || name.equals("houzhunxing"))) {
|
||||
bone.setHidden(!tag.getBoolean("HoloHidden") && ClientEventHandler.zoom);
|
||||
}
|
||||
|
||||
if (name.equals("flare")) {
|
||||
if (ClientEventHandler.firePosTimer == 0 || ClientEventHandler.firePosTimer > 0.5) {
|
||||
if (ClientEventHandler.firePosTimer == 0 || ClientEventHandler.firePosTimer > 0.5 || GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.BARREL) == 2) {
|
||||
bone.setHidden(true);
|
||||
} else {
|
||||
bone.setHidden(false);
|
||||
bone.setScaleX((float) (0.75 + 0.5 * (Math.random() - 0.5)));
|
||||
bone.setScaleY((float) (0.75 + 0.5 * (Math.random() - 0.5)));
|
||||
bone.setScaleX((float) (0.55 + 0.5 * (Math.random() - 0.5)));
|
||||
bone.setScaleY((float) (0.55 + 0.5 * (Math.random() - 0.5)));
|
||||
bone.setRotZ((float) (0.5 * (Math.random() - 0.5)));
|
||||
}
|
||||
}
|
||||
ItemModelHelper.handleGunAttachments(bone, itemStack, name);
|
||||
|
||||
if (renderingArms) {
|
||||
AnimationHelper.renderArms(mc, player, this.transformType, stack, name, bone, SCALE_RECIPROCAL, this.currentBuffer, type, packedLightIn, true, true);
|
||||
AnimationHelper.renderArms(mc, player, this.transformType, stack, name, bone, SCALE_RECIPROCAL, this.currentBuffer, type, packedLightIn, false, false);
|
||||
}
|
||||
super.renderRecursively(stack, animatable, bone, type, buffer, bufferIn, isReRender, partialTick, packedLightIn, packedOverlayIn, color);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public class ClientBocekImageTooltip extends ClientGunImageTooltip {
|
|||
slug = true;
|
||||
}
|
||||
|
||||
double total = data.damage() * TooltipTool.perkDamage(stack);
|
||||
double total = data.damage();
|
||||
|
||||
if (slug) {
|
||||
return Component.translatable("des.superbwarfare.guns.damage").withStyle(ChatFormatting.GRAY)
|
||||
|
|
|
@ -94,7 +94,7 @@ public class ClientGunImageTooltip implements ClientTooltipComponent {
|
|||
* 获取武器伤害的文本组件
|
||||
*/
|
||||
protected Component getDamageComponent() {
|
||||
double damage = data.damage() * TooltipTool.perkDamage(stack);
|
||||
double damage = data.damage();
|
||||
return Component.translatable("des.superbwarfare.guns.damage").withStyle(ChatFormatting.GRAY)
|
||||
.append(Component.literal("").withStyle(ChatFormatting.RESET))
|
||||
.append(Component.literal(FormatTool.format1D(damage) + (TooltipTool.heBullet(stack) ? " + "
|
||||
|
|
|
@ -16,7 +16,7 @@ public class ClientLauncherImageTooltip extends ClientGunImageTooltip {
|
|||
|
||||
@Override
|
||||
protected Component getDamageComponent() {
|
||||
double damage = data.damage() * TooltipTool.perkDamage(stack);
|
||||
double damage = data.damage();
|
||||
int perkLevel = PerkHelper.getItemPerkLevel(ModPerks.MICRO_MISSILE.get(), data);
|
||||
if (perkLevel > 0) damage *= 1.1f + perkLevel * 0.1f;
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.atsuishio.superbwarfare.client.tooltip;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.TooltipTool;
|
||||
import com.atsuishio.superbwarfare.client.tooltip.component.GunImageComponent;
|
||||
import com.atsuishio.superbwarfare.init.ModPerks;
|
||||
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
||||
|
@ -16,7 +15,7 @@ public class ClientSecondaryCataclysmImageTooltip extends ClientEnergyImageToolt
|
|||
|
||||
@Override
|
||||
protected Component getDamageComponent() {
|
||||
double damage = data.damage() * TooltipTool.perkDamage(stack);
|
||||
double damage = data.damage();
|
||||
int perkLevel = PerkHelper.getItemPerkLevel(ModPerks.MICRO_MISSILE.get(), data);
|
||||
if (perkLevel > 0) damage *= 1.1f + perkLevel * 0.1f;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.atsuishio.superbwarfare.client.tooltip;
|
|||
import com.atsuishio.superbwarfare.client.TooltipTool;
|
||||
import com.atsuishio.superbwarfare.client.tooltip.component.GunImageComponent;
|
||||
import com.atsuishio.superbwarfare.tools.FormatTool;
|
||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.neoforged.neoforge.capabilities.Capabilities;
|
||||
|
@ -19,15 +18,14 @@ public class ClientSentinelImageTooltip extends ClientEnergyImageTooltip {
|
|||
var cap = stack.getCapability(Capabilities.EnergyStorage.ITEM);
|
||||
|
||||
if (cap != null && cap.getEnergyStored() > 0) {
|
||||
double damage = (data.damage() + GunsTool.getGunDoubleTag(data.tag(), "ChargedDamage"))
|
||||
* TooltipTool.perkDamage(stack);
|
||||
double damage = data.damage();
|
||||
return Component.translatable("des.superbwarfare.guns.damage").withStyle(ChatFormatting.GRAY)
|
||||
.append(Component.literal("").withStyle(ChatFormatting.RESET))
|
||||
.append(Component.literal(FormatTool.format1D(damage) + (TooltipTool.heBullet(stack) ? " + " +
|
||||
FormatTool.format1D(0.8 * damage * (1 + 0.1 * TooltipTool.heBulletLevel(stack))) : ""))
|
||||
.withStyle(ChatFormatting.AQUA).withStyle(ChatFormatting.BOLD));
|
||||
} else {
|
||||
double damage = data.damage() * TooltipTool.perkDamage(stack);
|
||||
double damage = data.damage();
|
||||
return Component.translatable("des.superbwarfare.guns.damage").withStyle(ChatFormatting.GRAY)
|
||||
.append(Component.literal("").withStyle(ChatFormatting.RESET))
|
||||
.append(Component.literal(FormatTool.format1D(damage) + (TooltipTool.heBullet(stack) ?
|
||||
|
|
|
@ -25,13 +25,13 @@ public class ClientShotgunImageTooltip extends ClientGunImageTooltip {
|
|||
}
|
||||
|
||||
if (slug) {
|
||||
double damage = data.damage() * data.projectileAmount() * TooltipTool.perkDamage(stack);
|
||||
double damage = data.damage() * data.projectileAmount();
|
||||
return Component.translatable("des.superbwarfare.guns.damage").withStyle(ChatFormatting.GRAY)
|
||||
.append(Component.literal("").withStyle(ChatFormatting.RESET))
|
||||
.append(Component.literal(FormatTool.format1D(damage) + (TooltipTool.heBullet(stack) ? " + " +
|
||||
FormatTool.format1D(0.8 * damage * (1 + 0.1 * TooltipTool.heBulletLevel(stack))) : "")).withStyle(ChatFormatting.GREEN));
|
||||
} else {
|
||||
double damage = data.damage() * TooltipTool.perkDamage(stack);
|
||||
double damage = data.damage();
|
||||
return Component.translatable("des.superbwarfare.guns.damage").withStyle(ChatFormatting.GRAY)
|
||||
.append(Component.literal("").withStyle(ChatFormatting.RESET))
|
||||
.append(Component.literal(FormatTool.format1D(damage) + " * " + FormatTool.format0D(data.projectileAmount())).withStyle(ChatFormatting.GREEN));
|
||||
|
|
|
@ -1399,12 +1399,12 @@ public class ClientEventHandler {
|
|||
p = zoomPos;
|
||||
}
|
||||
|
||||
customZoom = Mth.lerp(0.6 * times, customZoom, GunsTool.getGunDoubleTag(tag, "CustomZoom"));
|
||||
var data = GunData.from(stack);
|
||||
|
||||
double zoomFov = 1.25 + customZoom;
|
||||
customZoom = Mth.lerp(0.6 * times, customZoom, data.zoom());
|
||||
|
||||
if (mc.options.getCameraType().isFirstPerson()) {
|
||||
event.setFOV(event.getFOV() / (1.0 + p * (zoomFov - 1)) * (1 - 0.4 * breathTime));
|
||||
event.setFOV(event.getFOV() / (1.0 + p * (customZoom - 1)) * (1 - 0.4 * breathTime));
|
||||
} else if (mc.options.getCameraType() == CameraType.THIRD_PERSON_BACK)
|
||||
event.setFOV(event.getFOV() / (1.0 + p * 0.01) * (1 - 0.4 * breathTime));
|
||||
fov = event.getFOV();
|
||||
|
@ -1422,7 +1422,7 @@ public class ClientEventHandler {
|
|||
|
||||
if (intelligentChipLevel > 0) {
|
||||
if (ClientEventHandler.entity == null || !entity.isAlive()) {
|
||||
ClientEventHandler.entity = SeekTool.seekLivingEntity(player, player.level(), 32 + 8 * (intelligentChipLevel - 1), 16 / zoomFov);
|
||||
ClientEventHandler.entity = SeekTool.seekLivingEntity(player, player.level(), 32 + 8 * (intelligentChipLevel - 1), 16 / customZoom);
|
||||
}
|
||||
if (entity != null && entity.isAlive()) {
|
||||
Vec3 toVec = getVec3(event, player);
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.atsuishio.superbwarfare.entity.vehicle.base.CannonEntity;
|
|||
import com.atsuishio.superbwarfare.init.ModItems;
|
||||
import com.atsuishio.superbwarfare.init.ModMobEffects;
|
||||
import com.atsuishio.superbwarfare.init.ModTags;
|
||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||
import com.atsuishio.superbwarfare.item.gun.GunData;
|
||||
import com.atsuishio.superbwarfare.tools.NBTTool;
|
||||
import net.minecraft.client.CameraType;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -166,11 +166,11 @@ public class ClientMouseHandler {
|
|||
return original;
|
||||
}
|
||||
|
||||
double zoom = 1.25 + GunsTool.getGunDoubleTag(tag, "CustomZoom");
|
||||
float customSens = (float) tag.getInt("sensitivity");
|
||||
var data = GunData.from(stack);
|
||||
float customSens = (float) data.tag().getInt("sensitivity");
|
||||
|
||||
if (!player.getMainHandItem().isEmpty() && mc.options.getCameraType() == CameraType.FIRST_PERSON) {
|
||||
return original / Math.max((1 + (0.2 * (zoom - (0.3 * customSens)) * ClientEventHandler.zoomTime)), 0.1);
|
||||
return original / Math.max((1 + (0.2 * (data.zoom() - (0.3 * customSens)) * ClientEventHandler.zoomTime)), 0.1);
|
||||
}
|
||||
|
||||
return original;
|
||||
|
|
|
@ -184,8 +184,7 @@ public class GunEventHandler {
|
|||
|
||||
if (!player.level().isClientSide()) {
|
||||
float headshot = (float) data.headshot();
|
||||
float damage = (float) (data.damage() +
|
||||
GunsTool.getGunDoubleTag(tag, "ChargedDamage")) * (float) perkDamage(tag);
|
||||
float damage = (float) data.damage();
|
||||
float velocity = (float) ((data.velocity() + GunsTool.getGunDoubleTag(tag, "CustomVelocity")) * perkSpeed(tag));
|
||||
int projectileAmount = data.projectileAmount();
|
||||
float bypassArmorRate = (float) data.bypassArmor();
|
||||
|
@ -264,14 +263,6 @@ public class GunEventHandler {
|
|||
}
|
||||
}
|
||||
|
||||
public static double perkDamage(final CompoundTag tag) {
|
||||
var perk = PerkHelper.getPerkByType(tag, Perk.Type.AMMO);
|
||||
if (perk instanceof AmmoPerk ammoPerk) {
|
||||
return ammoPerk.damageRate;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static double perkSpeed(final CompoundTag tag) {
|
||||
var perk = PerkHelper.getPerkByType(tag, Perk.Type.AMMO);
|
||||
if (perk instanceof AmmoPerk ammoPerk) {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package com.atsuishio.superbwarfare.item.gun;
|
||||
|
||||
import com.atsuishio.superbwarfare.perk.AmmoPerk;
|
||||
import com.atsuishio.superbwarfare.perk.Perk;
|
||||
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
@ -96,8 +99,20 @@ public class GunData {
|
|||
return GunsTool.gunsData.getOrDefault(id, new HashMap<>()).getOrDefault(key, defaultValue);
|
||||
}
|
||||
|
||||
public double rawDamage() {
|
||||
return getGunData("Damage");
|
||||
}
|
||||
|
||||
public double perkDamage() {
|
||||
var perk = PerkHelper.getPerkByType(tag, Perk.Type.AMMO);
|
||||
if (perk instanceof AmmoPerk ammoPerk) {
|
||||
return ammoPerk.damageRate;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public double damage() {
|
||||
return getGunData("Damage") + item.getCustomDamage(stack);
|
||||
return (rawDamage() + item.getCustomDamage(stack)) + perkDamage();
|
||||
}
|
||||
|
||||
public double explosionDamage() {
|
||||
|
@ -207,15 +222,17 @@ public class GunData {
|
|||
}
|
||||
|
||||
public double defaultZoom() {
|
||||
return getGunData("DefaultZoom", 1);
|
||||
return getGunData("DefaultZoom", 1.25);
|
||||
}
|
||||
|
||||
public double minZoom() {
|
||||
return getGunData("MinZoom", 1);
|
||||
int scopeType = GunsTool.getAttachmentType(tag, GunsTool.AttachmentType.SCOPE);
|
||||
return scopeType == 3 ? getGunData("MinZoom", 1.25) : 1.25;
|
||||
}
|
||||
|
||||
public double maxZoom() {
|
||||
return getGunData("MaxZoom", 1);
|
||||
int scopeType = GunsTool.getAttachmentType(tag, GunsTool.AttachmentType.SCOPE);
|
||||
return scopeType == 3 ? getGunData("MaxZoom", 1) : 114514;
|
||||
}
|
||||
|
||||
public double zoom() {
|
||||
|
|
|
@ -278,11 +278,7 @@ public class Trachelium extends GunItem implements GeoItem {
|
|||
@Override
|
||||
public double getCustomZoom(ItemStack stack) {
|
||||
int scopeType = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
|
||||
return switch (scopeType) {
|
||||
case 0, 1 -> 0;
|
||||
case 2 -> NBTTool.getTag(stack).getBoolean("ScopeAlt") ? 0 : 2.75;
|
||||
default -> 1;
|
||||
};
|
||||
return scopeType == 2 ? (NBTTool.getTag(stack).getBoolean("ScopeAlt") ? 0 : 2.75) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -134,9 +134,9 @@ public class Ntw20Item extends GunItem implements GeoItem {
|
|||
public double getCustomZoom(ItemStack stack) {
|
||||
int scopeType = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
|
||||
return switch (scopeType) {
|
||||
case 0, 1 -> 0;
|
||||
case 2 -> 2.25;
|
||||
default -> GunsTool.getGunDoubleTag(NBTTool.getTag(stack), "CustomZoom");
|
||||
case 3 -> GunsTool.getGunDoubleTag(NBTTool.getTag(stack), "CustomZoom");
|
||||
default -> 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.atsuishio.superbwarfare.item.gun.machinegun;
|
||||
|
||||
import com.atsuishio.superbwarfare.Mod;
|
||||
import com.atsuishio.superbwarfare.capability.ModCapabilities;
|
||||
import com.atsuishio.superbwarfare.client.renderer.item.RpkItemRenderer;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.atsuishio.superbwarfare.init.ModPerks;
|
||||
|
@ -10,20 +11,26 @@ import com.atsuishio.superbwarfare.item.gun.GunData;
|
|||
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
||||
import com.atsuishio.superbwarfare.perk.Perk;
|
||||
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||
import com.atsuishio.superbwarfare.tools.NBTTool;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
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 software.bernie.geckolib.animatable.GeoItem;
|
||||
import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache;
|
||||
import software.bernie.geckolib.animation.*;
|
||||
import software.bernie.geckolib.renderer.GeoItemRenderer;
|
||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
import java.util.Set;
|
||||
|
||||
public class RpkItem extends GunItem implements GeoItem {
|
||||
|
@ -49,30 +56,108 @@ public class RpkItem extends GunItem implements GeoItem {
|
|||
if (player == null) return PlayState.STOP;
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
||||
var data = GunData.from(stack);
|
||||
var tag = data.tag();
|
||||
|
||||
boolean drum = GunsTool.getAttachmentType(tag, GunsTool.AttachmentType.MAGAZINE) == 2;
|
||||
boolean grip = GunsTool.getAttachmentType(tag, GunsTool.AttachmentType.GRIP) == 1 || GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.GRIP) == 2;
|
||||
|
||||
if (GunData.from(stack).emptyReloading()) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.reload_empty"));
|
||||
if (drum) {
|
||||
if (grip) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.reload_empty_drum_grip"));
|
||||
} else {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.reload_empty_drum"));
|
||||
}
|
||||
} else {
|
||||
if (grip) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.reload_empty_grip"));
|
||||
} else {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.reload_empty"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (GunData.from(stack).normalReloading()) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.reload_normal"));
|
||||
if (drum) {
|
||||
if (grip) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.reload_normal_drum_grip"));
|
||||
} else {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.reload_normal_drum"));
|
||||
}
|
||||
} else {
|
||||
if (grip) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.reload_normal_grip"));
|
||||
} else {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.reload_normal"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
|
||||
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ak47.run_fast"));
|
||||
} else {
|
||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ak47.run"));
|
||||
if (grip) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.run_grip"));
|
||||
} else {
|
||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ak47.run"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (grip) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ak47.idle_grip"));
|
||||
} else {
|
||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ak47.idle"));
|
||||
}
|
||||
}
|
||||
|
||||
private PlayState editPredicate(AnimationState<RpkItem> event) {
|
||||
LocalPlayer player = Minecraft.getInstance().player;
|
||||
if (player == null) return PlayState.STOP;
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
||||
|
||||
var cap = player.getCapability(ModCapabilities.PLAYER_VARIABLE);
|
||||
if (cap != null && cap.edit) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.edit"));
|
||||
}
|
||||
|
||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ak47.idle"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
||||
var idleController = new AnimationController<>(this, "idleController", 4, this::idlePredicate);
|
||||
var idleController = new AnimationController<>(this, "idleController", 3, this::idlePredicate);
|
||||
data.add(idleController);
|
||||
var editController = new AnimationController<>(this, "editController", 1, this::editPredicate);
|
||||
data.add(editController);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCustomMagazine(ItemStack stack) {
|
||||
int magType = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.MAGAZINE);
|
||||
return switch (magType) {
|
||||
case 1 -> 20;
|
||||
case 2 -> 60;
|
||||
default -> 0;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCustomZoom(ItemStack stack) {
|
||||
int scopeType = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
|
||||
return switch (scopeType) {
|
||||
case 2 -> NBTTool.getTag(stack).getBoolean("ScopeAlt") ? 0 : 2.75;
|
||||
case 3 -> GunsTool.getGunDoubleTag(NBTTool.getTag(stack), "CustomZoom");
|
||||
default -> 0;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAdjustZoom(ItemStack stack) {
|
||||
return GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE) == 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -100,6 +185,25 @@ public class RpkItem extends GunItem implements GeoItem {
|
|||
return PerkHelper.MACHINE_GUN_PERKS.test(perk) || PerkHelper.MAGAZINE_PERKS.test(perk) || perk == ModPerks.DESPERADO.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ParametersAreNonnullByDefault
|
||||
public void inventoryTick(ItemStack stack, Level level, Entity entity, int slot, boolean selected) {
|
||||
super.inventoryTick(stack, level, entity, slot, selected);
|
||||
int gripType = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.GRIP);
|
||||
|
||||
if (gripType == 3) {
|
||||
var data = GunData.from(stack);
|
||||
CompoundTag tag = data.tag().getCompound("Attachments");
|
||||
tag.putInt("Grip", 0);
|
||||
data.save();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSwitchScope(ItemStack stack) {
|
||||
return GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE) == 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMagazineReload(ItemStack stack) {
|
||||
return true;
|
||||
|
@ -120,11 +224,46 @@ public class RpkItem extends GunItem implements GeoItem {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCustomizable(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomBarrel(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomGrip(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomMagazine(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomScope(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomStock(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEjectShell(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBipod(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAvailableFireModes() {
|
||||
return FireMode.SEMI.flag + FireMode.AUTO.flag;
|
||||
|
|
|
@ -141,9 +141,9 @@ public class AK12Item extends GunItem implements GeoItem {
|
|||
public double getCustomZoom(ItemStack stack) {
|
||||
int scopeType = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
|
||||
return switch (scopeType) {
|
||||
case 0, 1 -> 0;
|
||||
case 2 -> 2.15;
|
||||
default -> GunsTool.getGunDoubleTag(NBTTool.getTag(stack), "CustomZoom");
|
||||
case 3 -> GunsTool.getGunDoubleTag(NBTTool.getTag(stack), "CustomZoom");
|
||||
default -> 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -154,9 +154,9 @@ public class AK47Item extends GunItem implements GeoItem {
|
|||
public double getCustomZoom(ItemStack stack) {
|
||||
int scopeType = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
|
||||
return switch (scopeType) {
|
||||
case 0, 1 -> 0;
|
||||
case 2 -> 2.75;
|
||||
default -> GunsTool.getGunDoubleTag(NBTTool.getTag(stack), "CustomZoom");
|
||||
case 3 -> GunsTool.getGunDoubleTag(NBTTool.getTag(stack), "CustomZoom");
|
||||
default -> 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -144,9 +144,9 @@ public class Hk416Item extends GunItem implements GeoItem {
|
|||
public double getCustomZoom(ItemStack stack) {
|
||||
int scopeType = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
|
||||
return switch (scopeType) {
|
||||
case 0, 1 -> 0;
|
||||
case 2 -> 2.25;
|
||||
default -> GunsTool.getGunDoubleTag(NBTTool.getTag(stack), "CustomZoom");
|
||||
case 3 -> GunsTool.getGunDoubleTag(NBTTool.getTag(stack), "CustomZoom");
|
||||
default -> 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -160,9 +160,9 @@ public class M4Item extends GunItem implements GeoItem {
|
|||
public double getCustomZoom(ItemStack stack) {
|
||||
int scopeType = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
|
||||
return switch (scopeType) {
|
||||
case 0, 1 -> 0;
|
||||
case 2 -> NBTTool.getTag(stack).getBoolean("ScopeAlt") ? 0 : 2.75;
|
||||
default -> GunsTool.getGunDoubleTag(NBTTool.getTag(stack), "CustomZoom");
|
||||
case 3 -> GunsTool.getGunDoubleTag(NBTTool.getTag(stack), "CustomZoom");
|
||||
default -> 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -149,9 +149,9 @@ public class Mk14Item extends GunItem implements GeoItem {
|
|||
public double getCustomZoom(ItemStack stack) {
|
||||
int scopeType = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
|
||||
return switch (scopeType) {
|
||||
case 0, 1 -> 0;
|
||||
case 2 -> 2.25;
|
||||
default -> GunsTool.getGunDoubleTag(NBTTool.getTag(stack), "CustomZoom");
|
||||
case 3 -> GunsTool.getGunDoubleTag(NBTTool.getTag(stack), "CustomZoom");
|
||||
default -> 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -161,9 +161,9 @@ public class Qbz95Item extends GunItem implements GeoItem {
|
|||
public double getCustomZoom(ItemStack stack) {
|
||||
int scopeType = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
|
||||
return switch (scopeType) {
|
||||
case 0, 1 -> 0;
|
||||
case 2 -> 2.15;
|
||||
default -> GunsTool.getGunDoubleTag(NBTTool.getTag(stack), "CustomZoom");
|
||||
case 3 -> GunsTool.getGunDoubleTag(NBTTool.getTag(stack), "CustomZoom");
|
||||
default -> 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -131,8 +131,7 @@ public class VectorItem extends GunItem implements GeoItem {
|
|||
@Override
|
||||
public double getCustomZoom(ItemStack stack) {
|
||||
int scopeType = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
|
||||
if (scopeType == 2) return 0.75;
|
||||
return GunsTool.getGunDoubleTag(NBTTool.getTag(stack), "CustomZoom");
|
||||
return scopeType == 2 ? (NBTTool.getTag(stack).getBoolean("ScopeAlt") ? 0 : 2.75) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,11 +18,9 @@ import net.minecraft.client.player.LocalPlayer;
|
|||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.inventory.tooltip.TooltipComponent;
|
||||
import net.minecraft.world.item.ItemDisplayContext;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.neoforged.neoforge.capabilities.Capabilities;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import software.bernie.geckolib.animatable.GeoItem;
|
||||
|
@ -31,7 +29,6 @@ import software.bernie.geckolib.animation.*;
|
|||
import software.bernie.geckolib.renderer.GeoItemRenderer;
|
||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -134,21 +131,13 @@ public class SentinelItem extends GunItem implements GeoItem, EnergyStorageItem
|
|||
}
|
||||
|
||||
@Override
|
||||
@ParametersAreNonnullByDefault
|
||||
public void inventoryTick(ItemStack stack, Level world, Entity entity, int slot, boolean selected) {
|
||||
super.inventoryTick(stack, world, entity, slot, selected);
|
||||
public double getCustomDamage(ItemStack stack) {
|
||||
var data = GunData.from(stack);
|
||||
final var tag = data.tag();
|
||||
|
||||
var cap = stack.getCapability(Capabilities.EnergyStorage.ITEM);
|
||||
if (cap != null && cap.getEnergyStored() > 0) {
|
||||
cap.extractEnergy(1, false);
|
||||
GunsTool.setGunDoubleTag(tag, "ChargedDamage", 0.2857142857142857
|
||||
* GunData.from(stack).damage());
|
||||
} else {
|
||||
GunsTool.setGunDoubleTag(tag, "ChargedDamage", 0);
|
||||
return 0.2857142857142857 * data.rawDamage();
|
||||
}
|
||||
data.save();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -118,9 +118,9 @@ public class SvdItem extends GunItem implements GeoItem {
|
|||
public double getCustomZoom(ItemStack stack) {
|
||||
int scopeType = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
|
||||
return switch (scopeType) {
|
||||
case 0, 1 -> 0;
|
||||
case 2 -> 3.75;
|
||||
default -> GunsTool.getGunDoubleTag(NBTTool.getTag(stack), "CustomZoom");
|
||||
case 2 -> 2.75;
|
||||
case 3 -> GunsTool.getGunDoubleTag(NBTTool.getTag(stack), "CustomZoom");
|
||||
default -> 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ import com.atsuishio.superbwarfare.perk.AmmoPerk;
|
|||
import com.atsuishio.superbwarfare.perk.Perk;
|
||||
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||
import com.atsuishio.superbwarfare.tools.NBTTool;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
@ -106,15 +105,6 @@ public record FireMessage(int msgType) implements CustomPacketPayload {
|
|||
}
|
||||
}
|
||||
|
||||
public static double perkDamage(ItemStack stack) {
|
||||
final var tag = NBTTool.getTag(stack);
|
||||
var perk = PerkHelper.getPerkByType(tag, Perk.Type.AMMO);
|
||||
if (perk instanceof AmmoPerk ammoPerk) {
|
||||
return ammoPerk.damageRate;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static double perkSpeed(final CompoundTag tag) {
|
||||
var perk = PerkHelper.getPerkByType(tag, Perk.Type.AMMO);
|
||||
if (perk instanceof AmmoPerk ammoPerk) {
|
||||
|
@ -141,12 +131,12 @@ public record FireMessage(int msgType) implements CustomPacketPayload {
|
|||
if (zoom) {
|
||||
spread = 0.01f;
|
||||
damage = 0.08333333 * data.damage() *
|
||||
GunsTool.getGunDoubleTag(tag, "Power", 6) * perkDamage(stack);
|
||||
GunsTool.getGunDoubleTag(tag, "Power", 6);
|
||||
} else {
|
||||
spread = perk instanceof AmmoPerk ammoPerk && ammoPerk.slug ? 0.5f : 2.5f;
|
||||
damage = (perk instanceof AmmoPerk ammoPerk && ammoPerk.slug ? 0.08333333 : 0.008333333) *
|
||||
data.damage() *
|
||||
GunsTool.getGunDoubleTag(tag, "Power", 6) * perkDamage(stack);
|
||||
GunsTool.getGunDoubleTag(tag, "Power", 6);
|
||||
}
|
||||
|
||||
ProjectileEntity projectile = new ProjectileEntity(player.level())
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,104 +0,0 @@
|
|||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"parent": "builtin/entity",
|
||||
"texture_size": [
|
||||
128,
|
||||
128
|
||||
],
|
||||
"display": {
|
||||
"thirdperson_righthand": {
|
||||
"translation": [
|
||||
0,
|
||||
0.5,
|
||||
0.75
|
||||
],
|
||||
"scale": [
|
||||
0.55,
|
||||
0.55,
|
||||
0.55
|
||||
]
|
||||
},
|
||||
"thirdperson_lefthand": {
|
||||
"translation": [
|
||||
0,
|
||||
0.5,
|
||||
0.75
|
||||
],
|
||||
"scale": [
|
||||
0.55,
|
||||
0.55,
|
||||
0.55
|
||||
]
|
||||
},
|
||||
"firstperson_righthand": {
|
||||
"translation": [
|
||||
-0.25,
|
||||
-10,
|
||||
-14.25
|
||||
],
|
||||
"scale": [
|
||||
4,
|
||||
4,
|
||||
4
|
||||
]
|
||||
},
|
||||
"firstperson_lefthand": {
|
||||
"translation": [
|
||||
-1,
|
||||
3,
|
||||
2.5
|
||||
],
|
||||
"scale": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
]
|
||||
},
|
||||
"ground": {
|
||||
"translation": [
|
||||
0,
|
||||
3,
|
||||
0
|
||||
],
|
||||
"scale": [
|
||||
0.55,
|
||||
0.55,
|
||||
0.55
|
||||
]
|
||||
},
|
||||
"gui": {
|
||||
"rotation": [
|
||||
165.69,
|
||||
-39.63,
|
||||
178.66
|
||||
],
|
||||
"translation": [
|
||||
-2.75,
|
||||
-1,
|
||||
0
|
||||
],
|
||||
"scale": [
|
||||
0.6,
|
||||
0.6,
|
||||
0.6
|
||||
]
|
||||
},
|
||||
"fixed": {
|
||||
"rotation": [
|
||||
0,
|
||||
90,
|
||||
0
|
||||
],
|
||||
"translation": [
|
||||
0.5,
|
||||
-0.25,
|
||||
-1.5
|
||||
],
|
||||
"scale": [
|
||||
1.1,
|
||||
1.1,
|
||||
1.1
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "superbwarfare:displaysettings/rpk.item",
|
||||
"parent": "superbwarfare:displaysettings/ak47.item",
|
||||
"textures": {
|
||||
"layer0": "superbwarfare:item/rpk"
|
||||
}
|
||||
|
|
|
@ -682,7 +682,7 @@
|
|||
"rpk_reload_normal": {
|
||||
"sounds": [
|
||||
{
|
||||
"name": "superbwarfare:rpk/rpk_reload_normal",
|
||||
"name": "superbwarfare:ak_47/ak_47_reload_normal",
|
||||
"stream": false
|
||||
}
|
||||
]
|
||||
|
@ -690,7 +690,7 @@
|
|||
"rpk_reload_empty": {
|
||||
"sounds": [
|
||||
{
|
||||
"name": "superbwarfare:rpk/rpk_reload_empty",
|
||||
"name": "superbwarfare:ak_47/ak_47_reload_empty",
|
||||
"stream": false
|
||||
}
|
||||
]
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 54 KiB |
Binary file not shown.
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 32 KiB |
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"DefaultZoom": 0.75,
|
||||
"DefaultZoom": 2,
|
||||
"Spread": 4,
|
||||
"Headshot": 2.5,
|
||||
"Damage": 48,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"DefaultZoom": 0.75,
|
||||
"DefaultZoom": 2,
|
||||
"Spread": 5,
|
||||
"RecoilX": 0.0018,
|
||||
"RecoilY": 0.01,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"DefaultZoom": 1.75,
|
||||
"DefaultZoom": 3,
|
||||
"Spread": 5,
|
||||
"Magazine": 1,
|
||||
"Weight": 10,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"DefaultZoom": 4.75,
|
||||
"DefaultZoom": 6,
|
||||
"MinZoom": 4,
|
||||
"MaxZoom": 8,
|
||||
"Spread": 6,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"DefaultZoom": 2.25,
|
||||
"DefaultZoom": 3.5,
|
||||
"Spread": 4.8,
|
||||
"RecoilX": 0.002,
|
||||
"RecoilY": 0.063,
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
{
|
||||
"MinZoom": 1.25,
|
||||
"MaxZoom": 6,
|
||||
"Spread": 5.5,
|
||||
"RecoilX": 0.0018,
|
||||
"RecoilY": 0.012,
|
||||
"Damage": 8.75,
|
||||
"Headshot": 2,
|
||||
"Velocity": 38,
|
||||
"Magazine": 75,
|
||||
"Weight": 6,
|
||||
"Magazine": 40,
|
||||
"Weight": 7,
|
||||
"FireMode": 2,
|
||||
"NormalReloadTime": 73,
|
||||
"EmptyReloadTime": 95,
|
||||
"NormalReloadTime": 52,
|
||||
"EmptyReloadTime": 65,
|
||||
"BypassesArmor": 0.23,
|
||||
"SoundRadius": 14,
|
||||
"RPM": 600
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"DefaultZoom": 1.75,
|
||||
"DefaultZoom": 3,
|
||||
"Spread": 6,
|
||||
"RecoilX": 0.007,
|
||||
"RecoilY": 0.018,
|
||||
|
|
Loading…
Add table
Reference in a new issue