修复手臂渲染问题,修复物品模型加载问题

This commit is contained in:
17146 2025-06-07 21:50:48 +08:00 committed by Light_Quanta
parent d2dc2c2aeb
commit 254cdf32b2
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
3 changed files with 20 additions and 4 deletions

View file

@ -1,6 +1,7 @@
package com.atsuishio.superbwarfare.client; package com.atsuishio.superbwarfare.client;
import com.atsuishio.superbwarfare.Mod; import com.atsuishio.superbwarfare.Mod;
import com.atsuishio.superbwarfare.client.renderer.CustomGunRenderer;
import com.atsuishio.superbwarfare.client.renderer.ModRenderTypes; import com.atsuishio.superbwarfare.client.renderer.ModRenderTypes;
import com.atsuishio.superbwarfare.data.gun.GunData; import com.atsuishio.superbwarfare.data.gun.GunData;
import com.atsuishio.superbwarfare.data.gun.value.AttachmentType; import com.atsuishio.superbwarfare.data.gun.value.AttachmentType;
@ -18,6 +19,7 @@ import net.minecraft.client.renderer.entity.player.PlayerRenderer;
import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.entity.player.PlayerModelPart;
import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import org.joml.Matrix4f; import org.joml.Matrix4f;
@ -189,7 +191,14 @@ public class AnimationHelper {
RenderUtil.translateAwayFromPivotPoint(stack, bone); RenderUtil.translateAwayFromPivotPoint(stack, bone);
ResourceLocation loc = localPlayer.getSkin().texture(); ResourceLocation loc = localPlayer.getSkin().texture();
if (name.equals("Lefthand")) { if (name.equals("Lefthand")) {
stack.translate(-1.0f * SCALE_RECIPROCAL, 2.0f * SCALE_RECIPROCAL, 0.0f); if (!model.leftArm.visible) {
model.leftArm.visible = true;
}
if (!model.leftSleeve.visible && mc.options.isModelPartEnabled(PlayerModelPart.LEFT_SLEEVE)) {
model.leftSleeve.visible = true;
}
stack.translate(-1.0f * CustomGunRenderer.SCALE_RECIPROCAL, 2.0f * CustomGunRenderer.SCALE_RECIPROCAL, 0.0f);
if (useOldHandRender) { if (useOldHandRender) {
AnimationHelper.renderPartOverBone(model.leftArm, bone, stack, currentBuffer.getBuffer(RenderType.entitySolid(loc)), packedLightIn, OverlayTexture.NO_OVERLAY); AnimationHelper.renderPartOverBone(model.leftArm, bone, stack, currentBuffer.getBuffer(RenderType.entitySolid(loc)), packedLightIn, OverlayTexture.NO_OVERLAY);
AnimationHelper.renderPartOverBone(model.leftSleeve, bone, stack, currentBuffer.getBuffer(RenderType.entityTranslucent(loc)), packedLightIn, OverlayTexture.NO_OVERLAY); AnimationHelper.renderPartOverBone(model.leftSleeve, bone, stack, currentBuffer.getBuffer(RenderType.entityTranslucent(loc)), packedLightIn, OverlayTexture.NO_OVERLAY);
@ -198,7 +207,14 @@ public class AnimationHelper {
AnimationHelper.renderPartOverBone2(model.leftSleeve, bone, stack, currentBuffer.getBuffer(RenderType.entityTranslucent(loc)), packedLightIn, OverlayTexture.NO_OVERLAY); AnimationHelper.renderPartOverBone2(model.leftSleeve, bone, stack, currentBuffer.getBuffer(RenderType.entityTranslucent(loc)), packedLightIn, OverlayTexture.NO_OVERLAY);
} }
} else { } else {
stack.translate(SCALE_RECIPROCAL, 2.0f * SCALE_RECIPROCAL, 0.0f); if (!model.rightArm.visible) {
model.rightArm.visible = true;
}
if (!model.rightSleeve.visible && mc.options.isModelPartEnabled(PlayerModelPart.RIGHT_SLEEVE)) {
model.rightSleeve.visible = true;
}
stack.translate(CustomGunRenderer.SCALE_RECIPROCAL, 2.0f * CustomGunRenderer.SCALE_RECIPROCAL, 0.0f);
if (useOldHandRender) { if (useOldHandRender) {
AnimationHelper.renderPartOverBoneR(model.leftArm, bone, stack, currentBuffer.getBuffer(RenderType.entitySolid(loc)), packedLightIn, OverlayTexture.NO_OVERLAY); AnimationHelper.renderPartOverBoneR(model.leftArm, bone, stack, currentBuffer.getBuffer(RenderType.entitySolid(loc)), packedLightIn, OverlayTexture.NO_OVERLAY);
AnimationHelper.renderPartOverBoneR(model.leftSleeve, bone, stack, currentBuffer.getBuffer(RenderType.entityTranslucent(loc)), packedLightIn, OverlayTexture.NO_OVERLAY); AnimationHelper.renderPartOverBoneR(model.leftSleeve, bone, stack, currentBuffer.getBuffer(RenderType.entityTranslucent(loc)), packedLightIn, OverlayTexture.NO_OVERLAY);

View file

@ -70,6 +70,6 @@
} }
}, },
"textures": { "textures": {
"particle": "item/homemade_shotgun" "particle": "superbwarfare:item/homemade_shotgun"
} }
} }

View file

@ -109,6 +109,6 @@
} }
}, },
"textures": { "textures": {
"particle": "item/tm_62" "particle": "superbwarfare:item/tm_62"
} }
} }