添加SVD的高倍镜

This commit is contained in:
Atsuihsio 2025-02-28 14:47:09 +08:00
parent 9d425635ab
commit e96bbafdf4
6 changed files with 3009 additions and 10 deletions

View file

@ -43,6 +43,7 @@ public class SvdItemModel extends GeoModel<SvdItem> {
public void setCustomAnimations(SvdItem animatable, long instanceId, AnimationState animationState) {
CoreGeoBone gun = getAnimationProcessor().getBone("bone");
CoreGeoBone bolt = getAnimationProcessor().getBone("bolt");
CoreGeoBone cross3 = getAnimationProcessor().getBone("Cross3");
Player player = Minecraft.getInstance().player;
if (player == null) return;
@ -75,24 +76,28 @@ public class SvdItemModel extends GeoModel<SvdItem> {
float posX = switch (type) {
case 0, 1 -> 1.701f;
case 2 -> 1.531f;
case 3 -> 1.708f;
default -> 0f;
};
float posY = switch (type) {
case 0 -> 1.02f;
case 1 -> 0.04f;
case 2 -> 0.12f;
case 3 -> -0.13f;
default -> 0f;
};
float scaleZ = switch (type) {
case 0 -> 0.4f;
case 1 -> 0.45f;
case 2 -> 0.85f;
case 3 -> 0.95f;
default -> 0f;
};
float posZ = switch (type) {
case 0 -> 7f;
case 1 -> 7.5f;
case 2 -> 12.85f;
case 3 -> 14.08f;
default -> 0f;
};
@ -101,6 +106,8 @@ public class SvdItemModel extends GeoModel<SvdItem> {
gun.setPosZ(posZ * (float) zp + (float) (0.3f * zpz));
gun.setRotZ((float) (0.05f * zpz));
gun.setScaleZ(1f - (scaleZ * (float) zp));
cross3.setScaleX((float) (1f + (0.1 * zp)));
cross3.setScaleY((float) (1f + (0.1 * zp)));
stack.getOrCreateTag().putBoolean("HoloHidden", gun.getPosX() <= 1.4);
@ -112,6 +119,7 @@ public class SvdItemModel extends GeoModel<SvdItem> {
case 0 -> getAnimationProcessor().getBone("fireRoot0");
case 1 -> getAnimationProcessor().getBone("fireRoot1");
case 2 -> getAnimationProcessor().getBone("fireRoot2");
case 3 -> getAnimationProcessor().getBone("fireRoot3");
default -> getAnimationProcessor().getBone("fireRootNormal");
};
}

View file

@ -103,14 +103,14 @@ public class SvdItemRenderer extends GeoItemRenderer<SvdItem> {
|| GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.SCOPE) != 2);
}
if (GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.SCOPE) == 2
&& (name.equals("Hidden") || name.equals("gun") || name.equals("bolt") || name.equals("Lefthand") || name.equals("Barrel") || name.equals("bipod")) && ClientEventHandler.zoom && !itemStack.getOrCreateTag().getBoolean("HoloHidden")) {
if ((GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.SCOPE) == 2 || GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.SCOPE) == 3)
&& (name.equals("Hidden2") || name.equals("Hidden") || name.equals("gun") || name.equals("bolt") || name.equals("Lefthand") || name.equals("Barrel") || name.equals("bipod") || name.equals("mount")) && ClientEventHandler.zoom && !itemStack.getOrCreateTag().getBoolean("HoloHidden")) {
bone.setHidden(true);
renderingArms = false;
}
if (name.equals("flare")) {
if (ClientEventHandler.firePosTimer == 0 || ClientEventHandler.firePosTimer > 0.5 || GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.BARREL) == 2) {
if (ClientEventHandler.firePosTimer == 0 || ClientEventHandler.firePosTimer > 0.5 || GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.BARREL) == 2 || GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.BARREL) == 3) {
bone.setHidden(true);
} else {
if (GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.SCOPE) == 2 && ClientEventHandler.zoom && !itemStack.getOrCreateTag().getBoolean("HoloHidden")) {

View file

@ -17,7 +17,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.InteractionHand;
@ -146,11 +145,6 @@ public class SvdItem extends GunItem implements GeoItem, AnimatedItem {
int scopeType = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
int magType = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.MAGAZINE);
if (scopeType == 3) {
CompoundTag tag = stack.getOrCreateTag().getCompound("Attachments");
tag.putInt("Scope", 0);
}
int customMag = switch (magType) {
case 1 -> 10;
case 2 -> 20;
@ -163,6 +157,7 @@ public class SvdItem extends GunItem implements GeoItem, AnimatedItem {
default -> GunsTool.getGunDoubleTag(stack, "CustomZoom", 0);
};
stack.getOrCreateTag().putBoolean("CanAdjustZoomFov", scopeType == 3);
GunsTool.setGunDoubleTag(stack, "CustomZoom", customZoom);
GunsTool.setGunIntTag(stack, "CustomMagazine", customMag);
}

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View file

@ -1,4 +1,6 @@
{
"MinZoom": 4,
"MaxZoom": 8,
"Spread": 5.5,
"RecoilX": 0.004,
"RecoilY": 0.009,