优化MP5,QBZ,NTW的3p

This commit is contained in:
Atsuishio 2025-06-03 13:13:47 +08:00 committed by Light_Quanta
parent 1f9818dad0
commit 227afb9e8c
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
10 changed files with 2483 additions and 336 deletions

View file

@ -45,6 +45,16 @@ public class Qbz95ItemModel extends CustomGunModel<Qbz95Item> {
return Mod.loc("textures/item/qbz_95.png");
}
@Override
public ResourceLocation getLODModelResource(Qbz95Item animatable) {
return Mod.loc("geo/lod/qbz_95.geo.json");
}
@Override
public ResourceLocation getLODTextureResource(Qbz95Item animatable) {
return Mod.loc("textures/item/lod/qbz_95.png");
}
@Override
public void setCustomAnimations(Qbz95Item animatable, long instanceId, AnimationState<Qbz95Item> animationState) {
Player player = Minecraft.getInstance().player;

View file

@ -49,16 +49,13 @@ public class Mp5ItemRenderer extends CustomGunRenderer<Mp5Item> {
if (name.equals("bashou")) {
bone.setHidden(!flag);
}
if (GunData.from(itemStack).attachment.get(AttachmentType.SCOPE) == 2 && (bone.getName().endsWith("_hide2"))) {
bone.setHidden(ClientEventHandler.zoomPos > 0.7 && ClientEventHandler.zoom);
}
AnimationHelper.handleShootFlare(name, stack, itemStack, bone, buffer, packedLightIn, 0, 0.05, 1, 0.35);
ItemModelHelper.handleGunAttachments(bone, itemStack, name);
} else {
ItemModelHelper.hideAllAttachments(bone, name);
if (name.equals("yugu")) {
bone.setHidden(true);
}
if (this.renderPerspective == ItemDisplayContext.FIRST_PERSON_RIGHT_HAND) {
if (GunData.from(itemStack).attachment.get(AttachmentType.SCOPE) == 2 && (bone.getName().endsWith("_hide2"))) {
bone.setHidden(ClientEventHandler.zoomPos > 0.7 && ClientEventHandler.zoom);
}
int scopeType = GunData.from(itemStack).attachment.get(AttachmentType.SCOPE);
@ -68,6 +65,14 @@ public class Mp5ItemRenderer extends CustomGunRenderer<Mp5Item> {
case 2 ->
AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, 0, 0.52, 14, 1.4f, 255, 0, 0, 255, "acog", true);
}
}
} else {
ItemModelHelper.hideAllAttachments(bone, name);
if (name.equals("yugu")) {
bone.setHidden(true);
}
}
} else {
ItemModelHelper.hideAllAttachments(bone, name);
if (name.equals("yugu")) {

View file

@ -41,10 +41,15 @@ public class Ntw20Renderer extends CustomGunRenderer<Ntw20Item> {
if (player == null) return;
ItemStack itemStack = player.getMainHandItem();
if (itemStack.getItem() instanceof GunItem && GeoItem.getId(itemStack) == this.getInstanceId(animatable)) {
if (this.renderPerspective == ItemDisplayContext.FIRST_PERSON_RIGHT_HAND) {
if (this.renderPerspective == ItemDisplayContext.FIRST_PERSON_RIGHT_HAND || this.renderPerspective == ItemDisplayContext.THIRD_PERSON_RIGHT_HAND) {
if (name.equals("ironSight")) {
bone.setHidden(GunData.from(itemStack).attachment.get(AttachmentType.SCOPE) != 0);
}
ItemModelHelper.handleGunAttachments(bone, itemStack, name);
AnimationHelper.handleShootFlare(name, stack, itemStack, bone, buffer, packedLightIn, 0, 0, 3.70229375, 0.8);
if (this.renderPerspective == ItemDisplayContext.FIRST_PERSON_RIGHT_HAND) {
if (GunData.from(itemStack).attachment.get(AttachmentType.SCOPE) == 2
&& (name.equals("bone1") || name.equals("zhituiqi") || name.equals("guan") || name.equals("hidden"))) {
bone.setHidden(ClientEventHandler.zoomPos > 0.7 && ClientEventHandler.zoom);
@ -53,10 +58,8 @@ public class Ntw20Renderer extends CustomGunRenderer<Ntw20Item> {
&& (name.equals("bone1") || name.equals("zhituiqi") || name.equals("guan") || name.equals("jing") || name.equals("rail") || name.equals("base2") || name.equals("guan7"))) {
bone.setHidden(ClientEventHandler.zoomPos > 0.7 && ClientEventHandler.zoom);
}
}
int scopeType = GunData.from(itemStack).attachment.get(AttachmentType.SCOPE);
switch (scopeType) {
case 1 ->
AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, 0, 0.468755, 40, 1, 255, 0, 0, 255, "eotech", false);
@ -65,14 +68,12 @@ public class Ntw20Renderer extends CustomGunRenderer<Ntw20Item> {
case 3 ->
AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, 0, 0.46875, 30, (float) ClientEventHandler.customZoom, 255, 0, 0, 255, "lpvo", true);
}
AnimationHelper.handleShootFlare(name, stack, itemStack, bone, buffer, packedLightIn, 0, 0, 3.70229375, 0.8);
ItemModelHelper.handleGunAttachments(bone, itemStack, name);
}
} else {
ItemModelHelper.hideAllAttachments(bone, name);
if (name.equals("hidden") || name.equals("jing") || name.equals("base2") || name.equals("guan7")) {
bone.setHidden(true);
}
} else {
ItemModelHelper.hideAllAttachments(bone, name);
}
if (renderingArms) {

View file

@ -41,9 +41,8 @@ public class Qbz95ItemRenderer extends CustomGunRenderer<Qbz95Item> {
if (player == null) return;
ItemStack itemStack = player.getMainHandItem();
// TODO 这里手上模型的渲染逻辑有问题
if (itemStack.getItem() instanceof GunItem && GeoItem.getId(itemStack) == this.getInstanceId(animatable)) {
if (this.renderPerspective == ItemDisplayContext.FIRST_PERSON_RIGHT_HAND) {
if (this.renderPerspective == ItemDisplayContext.FIRST_PERSON_RIGHT_HAND || this.renderPerspective == ItemDisplayContext.THIRD_PERSON_RIGHT_HAND) {
if (name.equals("tiba")) {
bone.setHidden(GunData.from(itemStack).attachment.get(AttachmentType.SCOPE) != 0);
}
@ -53,6 +52,11 @@ public class Qbz95ItemRenderer extends CustomGunRenderer<Qbz95Item> {
if (name.equals("under_rail")) {
bone.setHidden(GunData.from(itemStack).attachment.get(AttachmentType.GRIP) == 0);
}
ItemModelHelper.handleGunAttachments(bone, itemStack, name);
AnimationHelper.handleShootFlare(name, stack, itemStack, bone, buffer, packedLightIn, 0, 0.02, 1.12375, 0.3);
if (this.renderPerspective == ItemDisplayContext.FIRST_PERSON_RIGHT_HAND) {
if (GunData.from(itemStack).attachment.get(AttachmentType.SCOPE) == 2
&& (name.equals("hidden"))) {
bone.setHidden(ClientEventHandler.zoomPos > 0.7 && ClientEventHandler.zoom);
@ -61,10 +65,8 @@ public class Qbz95ItemRenderer extends CustomGunRenderer<Qbz95Item> {
&& (name.equals("hidden2") || name.equals("jimiao2"))) {
bone.setHidden(ClientEventHandler.zoomPos > 0.7 && ClientEventHandler.zoom);
}
}
int scopeType = GunData.from(itemStack).attachment.get(AttachmentType.SCOPE);
switch (scopeType) {
case 1 ->
AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, 0, 0.5363125, 16, 1, 255, 0, 0, 255, "dot", false);
@ -73,9 +75,14 @@ public class Qbz95ItemRenderer extends CustomGunRenderer<Qbz95Item> {
case 3 ->
AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, 0, 0.55, 36, 4, 255, 0, 0, 255, "sniper", true);
}
}
AnimationHelper.handleShootFlare(name, stack, itemStack, bone, buffer, packedLightIn, 0, 0.02, 1.12375, 0.3);
ItemModelHelper.handleGunAttachments(bone, itemStack, name);
} else {
ItemModelHelper.hideAllAttachments(bone, name);
if (name.equals("under_rail") || name.equals("longbow")) {
bone.setHidden(true);
}
}
} else {
ItemModelHelper.hideAllAttachments(bone, name);
if (name.equals("under_rail") || name.equals("longbow")) {

File diff suppressed because it is too large Load diff

View file

@ -28,13 +28,13 @@
"thirdperson_righthand": {
"translation": [
-1.25,
-0.5,
-1.5,
-0.75
],
"scale": [
0.6,
0.6,
0.6
0.5,
0.5,
0.5
]
},
"thirdperson_lefthand": {

View file

@ -33,13 +33,13 @@
"thirdperson_righthand": {
"translation": [
-0.75,
0,
1
-1,
-1.25
],
"scale": [
0.45,
0.45,
0.45
0.6,
0.6,
0.6
]
},
"thirdperson_lefthand": {

View file

@ -21,21 +21,59 @@
0
]
},
"gui": {
"rotation": [
165.69,
-39.63,
178.66
],
"thirdperson_righthand": {
"translation": [
-1.9,
-3.25,
-1.75,
-1.75,
0
],
"scale": [
0.18,
0.18,
0.18
0.55,
0.55,
0.55
]
},
"thirdperson_lefthand": {
"scale": [
0,
0,
0
]
},
"ground": {
"translation": [
0,
3.5,
0
],
"scale": [
0.6,
0.6,
0.6
]
},
"head": {
"translation": [
0,
6.25,
-0.5
]
},
"fixed": {
"rotation": [
0,
-90,
0
],
"translation": [
0.75,
-0.75,
-0.75
],
"scale": [
1.1,
1.1,
1.1
]
}
}

View file

@ -1,259 +0,0 @@
{
"credit": "Made with Blockbench",
"texture_size": [32, 32],
"textures": {
"0": "superbwarfare:item/lod/qbz_95",
"particle": "superbwarfare:item/lod/qbz_95"
},
"elements": [
{
"from": [6.25, 1, 2],
"to": [7.75, 2.9, 18.5],
"rotation": {"angle": 0, "axis": "y", "origin": [6, 2, 3]},
"faces": {
"north": {"uv": [6.5, 7, 7.5, 8], "texture": "#0"},
"east": {"uv": [0, 0, 8.5, 1], "texture": "#0"},
"south": {"uv": [3, 7.5, 4, 8.5], "texture": "#0"},
"west": {"uv": [0, 1, 8.5, 2], "texture": "#0"},
"up": {"uv": [1, 10.5, 0, 2], "texture": "#0"},
"down": {"uv": [2, 2, 1, 10.5], "texture": "#0"}
}
},
{
"from": [6.5, 4.25, 7],
"to": [7.5, 4.65, 12.25],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 4.45, 10.125]},
"faces": {
"north": {"uv": [9.5, 5, 10, 5.5], "texture": "#0"},
"east": {"uv": [2, 6.5, 5, 7], "texture": "#0"},
"south": {"uv": [8.5, 9.5, 9, 10], "texture": "#0"},
"west": {"uv": [5, 6.5, 8, 7], "texture": "#0"},
"up": {"uv": [2.5, 10, 2, 7], "texture": "#0"},
"down": {"uv": [3, 7, 2.5, 10], "texture": "#0"}
}
},
{
"from": [6.5, 2.76134, 13.06111],
"to": [7.5, 4.81134, 13.46111],
"rotation": {"angle": -22.5, "axis": "x", "origin": [7, 1.68634, 13.26111]},
"faces": {
"north": {"uv": [8, 6, 8.5, 7], "texture": "#0"},
"east": {"uv": [8.5, 3, 9, 4], "texture": "#0"},
"south": {"uv": [3.5, 8.5, 4, 9.5], "texture": "#0"},
"west": {"uv": [4, 8.5, 4.5, 9.5], "texture": "#0"},
"up": {"uv": [9.5, 10, 9, 9.5], "texture": "#0"},
"down": {"uv": [10, 9, 9.5, 9.5], "texture": "#0"}
}
},
{
"from": [6.5, 2.44163, 7.39616],
"to": [7.5, 4.49163, 7.79616],
"rotation": {"angle": 22.5, "axis": "x", "origin": [7, 5.56663, 7.59616]},
"faces": {
"north": {"uv": [8.5, 4, 9, 5], "texture": "#0"},
"east": {"uv": [4.5, 8.5, 5, 9.5], "texture": "#0"},
"south": {"uv": [5, 8.5, 5.5, 9.5], "texture": "#0"},
"west": {"uv": [8.5, 5, 9, 6], "texture": "#0"},
"up": {"uv": [10, 10, 9.5, 9.5], "texture": "#0"},
"down": {"uv": [10.5, 0, 10, 0.5], "texture": "#0"}
}
},
{
"from": [6.75, 2.9, 2],
"to": [7.25, 3.9, 3],
"rotation": {"angle": 0, "axis": "y", "origin": [6, 2, 2]},
"faces": {
"north": {"uv": [10, 0.5, 10.5, 1], "texture": "#0"},
"east": {"uv": [10, 1, 10.5, 1.5], "texture": "#0"},
"south": {"uv": [2, 10, 2.5, 10.5], "texture": "#0"},
"west": {"uv": [10, 2, 10.5, 2.5], "texture": "#0"},
"up": {"uv": [3, 10.5, 2.5, 10], "texture": "#0"},
"down": {"uv": [10.5, 2.5, 10, 3], "texture": "#0"}
}
},
{
"from": [6.25, -0.5, 18.5],
"to": [7.75, 3, 20],
"rotation": {"angle": 0, "axis": "y", "origin": [6, 2, 3]},
"faces": {
"north": {"uv": [4, 2, 5, 4], "texture": "#0"},
"east": {"uv": [4, 4, 5, 6], "texture": "#0"},
"south": {"uv": [5, 2, 6, 4], "texture": "#0"},
"west": {"uv": [5, 4, 6, 6], "texture": "#0"},
"up": {"uv": [8.5, 4, 7.5, 3], "texture": "#0"},
"down": {"uv": [5, 7.5, 4, 8.5], "texture": "#0"}
}
},
{
"from": [6.25, 1, 10.05],
"to": [7.75, 1.9, 11.05],
"rotation": {"angle": 22.5, "axis": "x", "origin": [6, 2, 8.75]},
"faces": {
"north": {"uv": [7, 6, 8, 6.5], "texture": "#0"},
"east": {"uv": [3, 10, 3.5, 10.5], "texture": "#0"},
"south": {"uv": [8.5, 1.5, 9.5, 2], "texture": "#0"},
"west": {"uv": [10, 3, 10.5, 3.5], "texture": "#0"},
"up": {"uv": [9.5, 6.5, 8.5, 6], "texture": "#0"},
"down": {"uv": [9.5, 6.5, 8.5, 7], "texture": "#0"}
}
},
{
"from": [6.25, 1.31418, 7.47054],
"to": [7.75, 2.21418, 8.77054],
"rotation": {"angle": 22.5, "axis": "x", "origin": [6, 2.31418, 6.47054]},
"faces": {
"north": {"uv": [8.5, 7, 9.5, 7.5], "texture": "#0"},
"east": {"uv": [3.5, 10, 4, 10.5], "texture": "#0"},
"south": {"uv": [8.5, 7.5, 9.5, 8], "texture": "#0"},
"west": {"uv": [10, 3.5, 10.5, 4], "texture": "#0"},
"up": {"uv": [9.5, 8.5, 8.5, 8], "texture": "#0"},
"down": {"uv": [9.5, 8.5, 8.5, 9], "texture": "#0"}
}
},
{
"from": [6.25, 0.51012, 8.21278],
"to": [7.75, 1.41012, 9.91278],
"rotation": {"angle": 0, "axis": "x", "origin": [6, 1.51012, 7.61278]},
"faces": {
"north": {"uv": [9, 0, 10, 0.5], "texture": "#0"},
"east": {"uv": [9, 0.5, 10, 1], "texture": "#0"},
"south": {"uv": [9, 1, 10, 1.5], "texture": "#0"},
"west": {"uv": [9, 3, 10, 3.5], "texture": "#0"},
"up": {"uv": [8.5, 5, 7.5, 4], "texture": "#0"},
"down": {"uv": [6, 7.5, 5, 8.5], "texture": "#0"}
}
},
{
"from": [6.75, -0.38988, 8.91278],
"to": [7.25, -0.28988, 11.11278],
"rotation": {"angle": 0, "axis": "x", "origin": [6, 0.11012, 8.81278]},
"faces": {
"north": {"uv": [4, 10, 4.5, 10.5], "texture": "#0"},
"east": {"uv": [9, 3.5, 10, 4], "texture": "#0"},
"south": {"uv": [10, 4, 10.5, 4.5], "texture": "#0"},
"west": {"uv": [9, 4, 10, 4.5], "texture": "#0"},
"up": {"uv": [6, 9.5, 5.5, 8.5], "texture": "#0"},
"down": {"uv": [9.5, 4.5, 9, 5.5], "texture": "#0"}
}
},
{
"from": [6.75, -0.28988, 8.91278],
"to": [7.25, 0.61012, 9.01278],
"rotation": {"angle": 0, "axis": "x", "origin": [6, -0.38988, 8.51278]},
"faces": {
"north": {"uv": [4.5, 10, 5, 10.5], "texture": "#0"},
"east": {"uv": [5, 10, 5.5, 10.5], "texture": "#0"},
"south": {"uv": [10, 5, 10.5, 5.5], "texture": "#0"},
"west": {"uv": [10, 5.5, 10.5, 6], "texture": "#0"},
"up": {"uv": [6.5, 10.5, 6, 10], "texture": "#0"},
"down": {"uv": [10.5, 6, 10, 6.5], "texture": "#0"}
}
},
{
"from": [6.25, 0.19595, 10.49224],
"to": [7.75, 1.09595, 18.49224],
"rotation": {"angle": 0, "axis": "x", "origin": [6, 1.19595, 10.49224]},
"faces": {
"north": {"uv": [9, 5.5, 10, 6], "texture": "#0"},
"east": {"uv": [2, 6, 6, 6.5], "texture": "#0"},
"south": {"uv": [8.5, 9, 9.5, 9.5], "texture": "#0"},
"west": {"uv": [6, 2, 10, 2.5], "texture": "#0"},
"up": {"uv": [3, 6, 2, 2], "texture": "#0"},
"down": {"uv": [4, 2, 3, 6], "texture": "#0"}
}
},
{
"from": [6.25, -0.30405, 17.09224],
"to": [7.75, 0.19595, 18.49224],
"rotation": {"angle": 0, "axis": "x", "origin": [6, 1.19595, 10.49224]},
"faces": {
"north": {"uv": [9.5, 1.5, 10.5, 2], "texture": "#0"},
"east": {"uv": [6.5, 10, 7, 10.5], "texture": "#0"},
"south": {"uv": [3.5, 9.5, 4.5, 10], "texture": "#0"},
"west": {"uv": [10, 6.5, 10.5, 7], "texture": "#0"},
"up": {"uv": [5.5, 10, 4.5, 9.5], "texture": "#0"},
"down": {"uv": [10.5, 4.5, 9.5, 5], "texture": "#0"}
}
},
{
"from": [6.6, -1.30405, 14.49224],
"to": [7.4, 0.19595, 16.74224],
"rotation": {"angle": 0, "axis": "x", "origin": [6, 1.19595, 10.49224]},
"faces": {
"north": {"uv": [5.5, 9.5, 6, 10.5], "texture": "#0"},
"east": {"uv": [7.5, 5, 8.5, 6], "texture": "#0"},
"south": {"uv": [9.5, 6, 10, 7], "texture": "#0"},
"west": {"uv": [7.5, 7, 8.5, 8], "texture": "#0"},
"up": {"uv": [10, 8, 9.5, 7], "texture": "#0"},
"down": {"uv": [8, 9.5, 7.5, 10.5], "texture": "#0"}
}
},
{
"from": [6.6, -2.4884, 15.35068],
"to": [7.4, 1.0116, 17.60068],
"rotation": {"angle": 22.5, "axis": "x", "origin": [6, 2.0116, 11.35068]},
"faces": {
"north": {"uv": [6.5, 8, 7, 10], "texture": "#0"},
"east": {"uv": [6, 2.5, 7, 4.5], "texture": "#0"},
"south": {"uv": [7, 8, 7.5, 10], "texture": "#0"},
"west": {"uv": [6, 4.5, 7, 6.5], "texture": "#0"},
"up": {"uv": [8.5, 10.5, 8, 9.5], "texture": "#0"},
"down": {"uv": [10, 8, 9.5, 9], "texture": "#0"}
}
},
{
"from": [6.45, -2.78778, 11.03665],
"to": [7.55, 0.11222, 12.33665],
"rotation": {"angle": -22.5, "axis": "x", "origin": [6.25, -0.71166, 10.65397]},
"faces": {
"north": {"uv": [7.5, 8, 8, 9.5], "texture": "#0"},
"east": {"uv": [8, 8, 8.5, 9.5], "texture": "#0"},
"south": {"uv": [8.5, 0, 9, 1.5], "texture": "#0"},
"west": {"uv": [3, 8.5, 3.5, 10], "texture": "#0"},
"up": {"uv": [7.5, 10.5, 7, 10], "texture": "#0"},
"down": {"uv": [10.5, 7, 10, 7.5], "texture": "#0"}
}
},
{
"from": [6.5, 1.25, -4],
"to": [7.5, 2.25, 2],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 1.75, 0.5]},
"faces": {
"north": {"uv": [10, 7.5, 10.5, 8], "texture": "#0"},
"east": {"uv": [7, 2.5, 10, 3], "texture": "#0"},
"south": {"uv": [10, 8, 10.5, 8.5], "texture": "#0"},
"west": {"uv": [3, 7, 6, 7.5], "texture": "#0"},
"up": {"uv": [7.5, 6, 7, 3], "texture": "#0"},
"down": {"uv": [6.5, 7, 6, 10], "texture": "#0"}
}
}
],
"display": {
"thirdperson_righthand": {
"translation": [-0.5, 6.25, -1.75],
"scale": [0.8, 0.8, 0.8]
},
"thirdperson_lefthand": {
"translation": [-0.5, 6.25, -1.75],
"scale": [0.8, 0.8, 0.8]
},
"ground": {
"translation": [0, 8.75, 0]
},
"head": {
"translation": [0, 13.5, -0.5]
},
"fixed": {
"rotation": [90, 45, -90],
"translation": [4.25, 5.25, -1.25]
}
},
"groups": [
{
"name": "group",
"origin": [7, 1.75, -2.5],
"color": 0,
"children": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
}
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 341 B

After

Width:  |  Height:  |  Size: 3.8 KiB