添加AK12的三级镜子
This commit is contained in:
parent
88a9401003
commit
3cee01f240
4 changed files with 3199 additions and 749 deletions
|
@ -1,10 +1,10 @@
|
|||
package net.mcreator.superbwarfare.client.model.item;
|
||||
|
||||
import net.mcreator.superbwarfare.ModUtils;
|
||||
import net.mcreator.superbwarfare.client.AnimationHelper;
|
||||
import net.mcreator.superbwarfare.event.ClientEventHandler;
|
||||
import net.mcreator.superbwarfare.init.ModTags;
|
||||
import net.mcreator.superbwarfare.item.gun.rifle.AK12Item;
|
||||
import net.mcreator.superbwarfare.client.AnimationHelper;
|
||||
import net.mcreator.superbwarfare.tools.GunsTool;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
@ -37,6 +37,8 @@ public class AK12ItemModel extends GeoModel<AK12Item> {
|
|||
CoreGeoBone gun = getAnimationProcessor().getBone("bone");
|
||||
CoreGeoBone shen = getAnimationProcessor().getBone("shen");
|
||||
CoreGeoBone scope1 = getAnimationProcessor().getBone("Scope1");
|
||||
CoreGeoBone scope3 = getAnimationProcessor().getBone("Scope3");
|
||||
CoreGeoBone cross3 = getAnimationProcessor().getBone("Cross3");
|
||||
CoreGeoBone shuan = getAnimationProcessor().getBone("shuan");
|
||||
|
||||
Player player = Minecraft.getInstance().player;
|
||||
|
@ -64,22 +66,30 @@ public class AK12ItemModel extends GeoModel<AK12Item> {
|
|||
int type = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
|
||||
|
||||
float posY = switch (type) {
|
||||
case 0, 2, 3 -> 0.781f;
|
||||
case 0, 2 -> 0.781f;
|
||||
case 1 -> 0.351f;
|
||||
case 3 -> -0.01f;
|
||||
default -> 0f;
|
||||
};
|
||||
float scaleZ = switch (type) {
|
||||
case 0, 2, 3 -> 0.55f;
|
||||
case 0, 2 -> 0.55f;
|
||||
case 1 -> 0.4f;
|
||||
case 3 -> 0.78f;
|
||||
default -> 0f;
|
||||
};
|
||||
float posZ = switch (type) {
|
||||
case 0, 1, 2 -> 2.8f;
|
||||
case 3 -> 4.3f;
|
||||
default -> 0f;
|
||||
};
|
||||
|
||||
gun.setPosX(1.97f * (float) zp);
|
||||
gun.setPosX(1.96f * (float) zp);
|
||||
|
||||
gun.setPosY(posY * (float) zp - (float) (0.2f * zpz));
|
||||
gun.setPosZ(2.8f * (float) zp + (float) (0.5f * zpz));
|
||||
gun.setPosZ(posZ * (float) zp + (float) (0.5f * zpz));
|
||||
gun.setScaleZ(1f - (scaleZ * (float) zp));
|
||||
scope1.setScaleZ(1f - (0.4f * (float) zp));
|
||||
scope3.setScaleZ(1f - (0.7f * (float) zp));
|
||||
|
||||
stack.getOrCreateTag().putBoolean("HoloHidden", !(gun.getPosX() > 1.8));
|
||||
|
||||
|
@ -99,6 +109,9 @@ public class AK12ItemModel extends GeoModel<AK12Item> {
|
|||
|
||||
shuan.setPosZ(2.4f * (float) fp);
|
||||
|
||||
cross3.setRotZ(0.01f * (float) (ClientEventHandler.recoilHorizon * fp));
|
||||
cross3.setPosY(-0.23f * (float) (fp + 2.3 * fr));
|
||||
|
||||
CoreGeoBone root = getAnimationProcessor().getBone("root");
|
||||
|
||||
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
|
||||
|
|
|
@ -2,11 +2,11 @@ package net.mcreator.superbwarfare.client.renderer.item;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import net.mcreator.superbwarfare.client.AnimationHelper;
|
||||
import net.mcreator.superbwarfare.client.ItemModelHelper;
|
||||
import net.mcreator.superbwarfare.client.layer.AK12Layer;
|
||||
import net.mcreator.superbwarfare.client.model.item.AK12ItemModel;
|
||||
import net.mcreator.superbwarfare.item.gun.rifle.AK12Item;
|
||||
import net.mcreator.superbwarfare.client.AnimationHelper;
|
||||
import net.mcreator.superbwarfare.tools.GunsTool;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.PlayerModel;
|
||||
|
@ -84,12 +84,23 @@ public class AK12ItemRenderer extends GeoItemRenderer<AK12Item> {
|
|||
if (player != null) {
|
||||
ItemStack itemStack = player.getMainHandItem();
|
||||
|
||||
if (name.equals("holo")) {
|
||||
if (name.equals("Cross1")) {
|
||||
bone.setHidden(itemStack.getOrCreateTag().getBoolean("HoloHidden")
|
||||
|| GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) != GLFW.GLFW_PRESS
|
||||
|| GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.SCOPE) != 1);
|
||||
}
|
||||
|
||||
if (name.equals("Cross3")) {
|
||||
bone.setHidden(itemStack.getOrCreateTag().getBoolean("HoloHidden")
|
||||
|| GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) != GLFW.GLFW_PRESS
|
||||
|| GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.SCOPE) != 3);
|
||||
}
|
||||
|
||||
if (GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.SCOPE) == 3
|
||||
&& (name.equals("jing") || name.equals("Barrel") || name.equals("humu") || name.equals("qiangguan") || name.equals("houzhunxing") || name.equals("flare"))) {
|
||||
bone.setHidden(!itemStack.getOrCreateTag().getBoolean("HoloHidden") && GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS);
|
||||
}
|
||||
|
||||
if (name.equals("flare")) {
|
||||
if (GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.BARREL) == 1) {
|
||||
bone.setPosZ(2.25f);
|
||||
|
|
File diff suppressed because it is too large
Load diff
Binary file not shown.
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 73 KiB |
Loading…
Add table
Reference in a new issue