添加M4的部分配件
This commit is contained in:
parent
8f1d5f82e2
commit
0cc4352302
28 changed files with 21571 additions and 6573 deletions
|
@ -1,4 +1,4 @@
|
|||
// 1.20.1 2024-10-24T18:54:05.6703834 Tags for minecraft:item mod id superbwarfare
|
||||
// 1.20.1 2024-10-25T16:43:38.148877 Tags for minecraft:item mod id superbwarfare
|
||||
cf8d49a8d2872286d1a9c3d4a7e1c2b7690db0b8 data/forge/tags/items/dusts.json
|
||||
0fa06c2ff83bf09797e3ddff90f62d1124e645b4 data/forge/tags/items/dusts/coal_coke.json
|
||||
295ddf906b7133a0558d03e9a60eea18281fe430 data/forge/tags/items/dusts/iron.json
|
||||
|
@ -27,12 +27,12 @@ af6fd64b4a685c353f243763db268f7b2304c009 data/forge/tags/items/storage_blocks/le
|
|||
3743c2790deca7e779d3e4b82f092de39b446988 data/forge/tags/items/storage_blocks/steel.json
|
||||
144e54d908121dee498b2ebba3b24b09fd6f18d9 data/forge/tags/items/storage_blocks/tungsten.json
|
||||
4d4dfd25a2a749e000e1bb742c2f984d4e094e5d data/superbwarfare/tags/items/cannot_reload.json
|
||||
73b1b24e00ea24b494900d06c03c03368f9433ff data/superbwarfare/tags/items/can_apply_barrel.json
|
||||
5e4b48e22d53f009abdfe557e5911c728ba5f715 data/superbwarfare/tags/items/can_apply_grip.json
|
||||
73b1b24e00ea24b494900d06c03c03368f9433ff data/superbwarfare/tags/items/can_apply_magazine.json
|
||||
73b1b24e00ea24b494900d06c03c03368f9433ff data/superbwarfare/tags/items/can_apply_scope.json
|
||||
73b1b24e00ea24b494900d06c03c03368f9433ff data/superbwarfare/tags/items/can_apply_stock.json
|
||||
73b1b24e00ea24b494900d06c03c03368f9433ff data/superbwarfare/tags/items/can_custom_gun.json
|
||||
ecfe91ca11cdcac5134558e08c51d5736e577f5b data/superbwarfare/tags/items/can_apply_barrel.json
|
||||
56f03b913ace71b71b3e927ff55af1819371ca13 data/superbwarfare/tags/items/can_apply_grip.json
|
||||
ecfe91ca11cdcac5134558e08c51d5736e577f5b data/superbwarfare/tags/items/can_apply_magazine.json
|
||||
ecfe91ca11cdcac5134558e08c51d5736e577f5b data/superbwarfare/tags/items/can_apply_scope.json
|
||||
ecfe91ca11cdcac5134558e08c51d5736e577f5b data/superbwarfare/tags/items/can_apply_stock.json
|
||||
ecfe91ca11cdcac5134558e08c51d5736e577f5b data/superbwarfare/tags/items/can_custom_gun.json
|
||||
dff9ff6d6637951191906cb55a210ae5a3ad5cd6 data/superbwarfare/tags/items/extra_one_ammo.json
|
||||
52598e22974c8da0d2852defe4c9005e1d67744b data/superbwarfare/tags/items/gun.json
|
||||
62eb408544731ce4cfcd119d8a6cc74731189ac0 data/superbwarfare/tags/items/handgun.json
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"values": [
|
||||
"superbwarfare:ak_12",
|
||||
"superbwarfare:ak_47"
|
||||
"superbwarfare:ak_47",
|
||||
"superbwarfare:m_4"
|
||||
]
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"values": [
|
||||
"superbwarfare:ak_12"
|
||||
"superbwarfare:ak_12",
|
||||
"superbwarfare:m_4"
|
||||
]
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"values": [
|
||||
"superbwarfare:ak_12",
|
||||
"superbwarfare:ak_47"
|
||||
"superbwarfare:ak_47",
|
||||
"superbwarfare:m_4"
|
||||
]
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"values": [
|
||||
"superbwarfare:ak_12",
|
||||
"superbwarfare:ak_47"
|
||||
"superbwarfare:ak_47",
|
||||
"superbwarfare:m_4"
|
||||
]
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"values": [
|
||||
"superbwarfare:ak_12",
|
||||
"superbwarfare:ak_47"
|
||||
"superbwarfare:ak_47",
|
||||
"superbwarfare:m_4"
|
||||
]
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"values": [
|
||||
"superbwarfare:ak_12",
|
||||
"superbwarfare:ak_47"
|
||||
"superbwarfare:ak_47",
|
||||
"superbwarfare:m_4"
|
||||
]
|
||||
}
|
|
@ -127,6 +127,7 @@ public class ModUtils {
|
|||
addNetworkMessage(DrawClientMessage.class, DrawClientMessage::encode, DrawClientMessage::decode, DrawClientMessage::handle, Optional.of(NetworkDirection.PLAY_TO_CLIENT));
|
||||
addNetworkMessage(EditModeMessage.class, EditModeMessage::encode, EditModeMessage::decode, EditModeMessage::handler);
|
||||
addNetworkMessage(EditMessage.class, EditMessage::encode, EditMessage::decode, EditMessage::handler);
|
||||
addNetworkMessage(SwitchScopeMessage.class, SwitchScopeMessage::encode, SwitchScopeMessage::decode, SwitchScopeMessage::handler);
|
||||
|
||||
event.enqueueWork(() -> BrewingRecipeRegistry.addRecipe(Ingredient.of(PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.WATER)),
|
||||
Ingredient.of(Items.LIGHTNING_ROD), PotionUtils.setPotion(new ItemStack(Items.POTION), ModPotion.SHOCK.get())));
|
||||
|
|
|
@ -133,7 +133,10 @@ public class ClickHandler {
|
|||
|
||||
if (stack.is(ModTags.Items.GUN) && player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).zoom) {
|
||||
var tag = stack.getOrCreateTag();
|
||||
if (tag.getBoolean("CanAdjustZoomFov")) {
|
||||
if (tag.getBoolean("CanSwitchScope")) {
|
||||
ModUtils.PACKET_HANDLER.sendToServer(new SwitchScopeMessage(scroll));
|
||||
}
|
||||
else if (tag.getBoolean("CanAdjustZoomFov")) {
|
||||
ModUtils.PACKET_HANDLER.sendToServer(new AdjustZoomFovMessage(scroll));
|
||||
}
|
||||
event.setCanceled(true);
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
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.M4Item;
|
||||
import net.mcreator.superbwarfare.client.AnimationHelper;
|
||||
import net.mcreator.superbwarfare.tools.GunsTool;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
|
@ -14,6 +15,8 @@ import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
|
|||
import software.bernie.geckolib.core.animation.AnimationState;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
import static net.mcreator.superbwarfare.event.PlayerEventHandler.isProne;
|
||||
|
||||
public class M4ItemModel extends GeoModel<M4Item> {
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(M4Item animatable) {
|
||||
|
@ -34,6 +37,13 @@ public class M4ItemModel extends GeoModel<M4Item> {
|
|||
public void setCustomAnimations(M4Item animatable, long instanceId, AnimationState animationState) {
|
||||
CoreGeoBone gun = getAnimationProcessor().getBone("bone");
|
||||
CoreGeoBone shen = getAnimationProcessor().getBone("shen");
|
||||
CoreGeoBone scope = getAnimationProcessor().getBone("Scope1");
|
||||
CoreGeoBone scope2 = getAnimationProcessor().getBone("Scope2");
|
||||
CoreGeoBone cross1 = getAnimationProcessor().getBone("Cross1");
|
||||
CoreGeoBone cross2 = getAnimationProcessor().getBone("Cross2");
|
||||
CoreGeoBone crossAlt = getAnimationProcessor().getBone("CrossAlt");
|
||||
CoreGeoBone sight1fold = getAnimationProcessor().getBone("sight1fold");
|
||||
CoreGeoBone sight2fold = getAnimationProcessor().getBone("sight2fold");
|
||||
|
||||
Player player = Minecraft.getInstance().player;
|
||||
if (player == null) return;
|
||||
|
@ -57,32 +67,79 @@ public class M4ItemModel extends GeoModel<M4Item> {
|
|||
double fp = ClientEventHandler.firePos;
|
||||
double fr = ClientEventHandler.fireRot;
|
||||
|
||||
int type = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
|
||||
|
||||
// float posYAlt = switch (type) {
|
||||
// case 2 -> 0.45f;
|
||||
// case 3 -> 0.5f;
|
||||
// default -> 0f;
|
||||
// };
|
||||
//
|
||||
// float posX = switch (type) {
|
||||
// case 0, 1, 3 -> 1.962f;
|
||||
// case 2 -> 1.852f;
|
||||
// default -> 0f;
|
||||
// };
|
||||
float posY = switch (type) {
|
||||
case 0, 3 -> 0.65f;
|
||||
case 1 -> 0.2225f;
|
||||
case 2 -> stack.getOrCreateTag().getBoolean("ScopeAlt")? -0.6875f : 0.5625f;
|
||||
default -> 0f;
|
||||
};
|
||||
float scaleZ = switch (type) {
|
||||
case 0 -> 0.2f;
|
||||
case 1 -> 0.4f;
|
||||
case 2 -> stack.getOrCreateTag().getBoolean("ScopeAlt")? 0.4f : 0.88f;
|
||||
case 3 -> 0.78f;
|
||||
default -> 0f;
|
||||
};
|
||||
float posZ = switch (type) {
|
||||
case 0 -> 3f;
|
||||
case 1 -> 3.5f;
|
||||
case 2 -> stack.getOrCreateTag().getBoolean("ScopeAlt")? 5.5f : 7.6f;
|
||||
case 3 -> 3.9f;
|
||||
default -> 0f;
|
||||
};
|
||||
|
||||
sight1fold.setRotX((type == 0 ? 0 : 90) * Mth.DEG_TO_RAD);
|
||||
sight2fold.setRotX((type == 0 ? 0 : 90) * Mth.DEG_TO_RAD);
|
||||
|
||||
gun.setPosX(2.935f * (float) zp);
|
||||
|
||||
gun.setPosY(0.65f * (float) zp - (float) (0.2f * zpz));
|
||||
|
||||
gun.setPosZ(3f * (float) zp + (float) (0.2f * zpz));
|
||||
|
||||
gun.setScaleZ(1f - (0.2f * (float) zp));
|
||||
|
||||
gun.setPosY(posY * (float) zp - (float) (0.2f * zpz));
|
||||
gun.setPosZ(posZ * (float) zp + (float) (0.2f * zpz));
|
||||
gun.setScaleZ(1f - (scaleZ * (float) zp));
|
||||
gun.setRotZ((float) (0.05f * zpz));
|
||||
scope.setScaleZ(1f - (0.4f * (float) zp));
|
||||
scope2.setScaleZ(1f - (0.1f * (float) zp));
|
||||
|
||||
shen.setPosX((float) (0.95f * ClientEventHandler.recoilHorizon * fpz * fp));
|
||||
stack.getOrCreateTag().putBoolean("HoloHidden", !(gun.getPosX() > 2.385));
|
||||
|
||||
shen.setPosX((float) (1.35f * 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.setPosZ((float) (0.345 * fp + 0.44f * fr + 0.75 * fpz));
|
||||
shen.setRotX((float) (0.01f * fp + 0.05f * fr + 0.01f * fpz));
|
||||
shen.setRotY((float) (0.04f * ClientEventHandler.recoilHorizon * fpz));
|
||||
shen.setRotY((float) (0.07f * ClientEventHandler.recoilHorizon * fpz));
|
||||
shen.setRotZ((float) ((0.08f + 0.1 * fr) * ClientEventHandler.recoilHorizon));
|
||||
cross1.setPosY(-0.75f * (float) fpz);
|
||||
cross2.setPosY(-0.1f * (float) fpz);
|
||||
crossAlt.setPosY(-0.2f * (float) fpz);
|
||||
|
||||
shen.setPosX((float) (shen.getPosX() * (1 - 0.5 * zt)));
|
||||
shen.setPosY((float) (shen.getPosY() * (-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.setRotX((float) (shen.getRotX() * (1 - (type == 1 ? 0.4 : 0.9) * zt)));
|
||||
shen.setRotY((float) (shen.getRotY() * (1 - 0.9 * zt)));
|
||||
shen.setRotZ((float) (shen.getRotZ() * (1 - 0.9 * zt)));
|
||||
|
||||
shen.setPosX(0.2f * (float) (ClientEventHandler.recoilHorizon * (0.5 + 0.4 * ClientEventHandler.fireSpread)));
|
||||
|
||||
CoreGeoBone l = getAnimationProcessor().getBone("l");
|
||||
CoreGeoBone r = getAnimationProcessor().getBone("r");
|
||||
if (isProne(player)) {
|
||||
l.setRotX(-90 * Mth.DEG_TO_RAD);
|
||||
r.setRotX(-90 * Mth.DEG_TO_RAD);
|
||||
}
|
||||
|
||||
CoreGeoBone root = getAnimationProcessor().getBone("root");
|
||||
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
|
||||
root.setPosY((float) (swayY + movePosY - 40 * ClientEventHandler.drawTime - 2f * vY));
|
||||
|
@ -93,8 +150,8 @@ public class M4ItemModel extends GeoModel<M4Item> {
|
|||
CoreGeoBone camera = getAnimationProcessor().getBone("camera");
|
||||
CoreGeoBone main = getAnimationProcessor().getBone("0");
|
||||
|
||||
float numR = (float) (1 - 0.8 * zt);
|
||||
float numP = (float) (1 - 0.65 * zt);
|
||||
float numR = (float) (1 - 0.97 * zt);
|
||||
float numP = (float) (1 - 0.92 * zt);
|
||||
|
||||
if (stack.getOrCreateTag().getInt("gun_reloading_time") > 0) {
|
||||
main.setRotX(numR * main.getRotX());
|
||||
|
|
|
@ -142,7 +142,7 @@ public class AK47ItemRenderer extends GeoItemRenderer<AK47Item> {
|
|||
if (this.transformType.firstPerson() && renderingArms) {
|
||||
AbstractClientPlayer localPlayer = mc.player;
|
||||
|
||||
if (player == null) {
|
||||
if (localPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,10 +2,12 @@ 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.M4Layer;
|
||||
import net.mcreator.superbwarfare.client.model.item.M4ItemModel;
|
||||
import net.mcreator.superbwarfare.item.gun.rifle.M4Item;
|
||||
import net.mcreator.superbwarfare.client.AnimationHelper;
|
||||
import net.mcreator.superbwarfare.tools.GunsTool;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.PlayerModel;
|
||||
import net.minecraft.client.player.AbstractClientPlayer;
|
||||
|
@ -17,6 +19,7 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemDisplayContext;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import software.bernie.geckolib.cache.object.BakedGeoModel;
|
||||
import software.bernie.geckolib.cache.object.GeoBone;
|
||||
import software.bernie.geckolib.renderer.GeoItemRenderer;
|
||||
|
@ -93,14 +96,80 @@ public class M4ItemRenderer extends GeoItemRenderer<M4Item> {
|
|||
}
|
||||
}
|
||||
|
||||
if (this.transformType.firstPerson() && renderingArms) {
|
||||
AbstractClientPlayer player = mc.player;
|
||||
Player player = mc.player;
|
||||
if (player != null) {
|
||||
ItemStack itemStack = player.getMainHandItem();
|
||||
|
||||
if (player == null) {
|
||||
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("Cross2")) {
|
||||
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) != 2
|
||||
|| itemStack.getOrCreateTag().getBoolean("ScopeAlt"));
|
||||
}
|
||||
|
||||
if (name.equals("CrossAlt")) {
|
||||
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) != 2
|
||||
|| !(itemStack.getOrCreateTag().getBoolean("ScopeAlt")));
|
||||
}
|
||||
//
|
||||
// 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) == 2 && !itemStack.getOrCreateTag().getBoolean("ScopeAlt") && (name.equals("hidden"))) {
|
||||
bone.setHidden(!itemStack.getOrCreateTag().getBoolean("HoloHidden") && GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS);
|
||||
}
|
||||
//
|
||||
// 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(!itemStack.getOrCreateTag().getBoolean("HoloHidden") && GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS);
|
||||
// }
|
||||
|
||||
if (name.equals("flare")) {
|
||||
if (itemStack.getOrCreateTag().getDouble("flash_time") == 0 || GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.BARREL) == 2) {
|
||||
bone.setHidden(true);
|
||||
} else {
|
||||
bone.setHidden(false);
|
||||
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)));
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
}
|
||||
|
||||
if (this.transformType.firstPerson() && renderingArms) {
|
||||
AbstractClientPlayer localPlayer = mc.player;
|
||||
|
||||
if (localPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerRenderer playerRenderer = (PlayerRenderer) mc.getEntityRenderDispatcher().getRenderer(player);
|
||||
PlayerRenderer playerRenderer = (PlayerRenderer) mc.getEntityRenderDispatcher().getRenderer(localPlayer);
|
||||
PlayerModel<AbstractClientPlayer> model = playerRenderer.getModel();
|
||||
stack.pushPose();
|
||||
RenderUtils.translateMatrixToBone(stack, bone);
|
||||
|
@ -108,7 +177,7 @@ public class M4ItemRenderer extends GeoItemRenderer<M4Item> {
|
|||
RenderUtils.rotateMatrixAroundBone(stack, bone);
|
||||
RenderUtils.scaleMatrixForBone(stack, bone);
|
||||
RenderUtils.translateAwayFromPivotPoint(stack, bone);
|
||||
ResourceLocation loc = player.getSkinTextureLocation();
|
||||
ResourceLocation loc = localPlayer.getSkinTextureLocation();
|
||||
VertexConsumer armBuilder = this.currentBuffer.getBuffer(RenderType.entitySolid(loc));
|
||||
VertexConsumer sleeveBuilder = this.currentBuffer.getBuffer(RenderType.entityTranslucent(loc));
|
||||
if (name.equals("Lefthand")) {
|
||||
|
|
|
@ -112,17 +112,17 @@ public class ModItemTagProvider extends ItemTagsProvider {
|
|||
|
||||
this.tag(ModTags.Items.MILITARY_ARMOR).add(ModItems.RU_CHEST_6B43.get(), ModItems.US_CHEST_IOTV.get());
|
||||
|
||||
this.tag(ModTags.Items.CAN_CUSTOM_GUN).add(ModItems.AK_12.get(), ModItems.AK_47.get());
|
||||
this.tag(ModTags.Items.CAN_CUSTOM_GUN).add(ModItems.AK_12.get(), ModItems.AK_47.get(), ModItems.M_4.get());
|
||||
|
||||
this.tag(ModTags.Items.CAN_APPLY_BARREL).add(ModItems.AK_12.get(), ModItems.AK_47.get());
|
||||
this.tag(ModTags.Items.CAN_APPLY_BARREL).add(ModItems.AK_12.get(), ModItems.AK_47.get(), ModItems.M_4.get());
|
||||
|
||||
this.tag(ModTags.Items.CAN_APPLY_GRIP).add(ModItems.AK_12.get());
|
||||
this.tag(ModTags.Items.CAN_APPLY_GRIP).add(ModItems.AK_12.get(), ModItems.M_4.get());
|
||||
|
||||
this.tag(ModTags.Items.CAN_APPLY_SCOPE).add(ModItems.AK_12.get(), ModItems.AK_47.get());
|
||||
this.tag(ModTags.Items.CAN_APPLY_SCOPE).add(ModItems.AK_12.get(), ModItems.AK_47.get(), ModItems.M_4.get());
|
||||
|
||||
this.tag(ModTags.Items.CAN_APPLY_MAGAZINE).add(ModItems.AK_12.get(), ModItems.AK_47.get());
|
||||
this.tag(ModTags.Items.CAN_APPLY_MAGAZINE).add(ModItems.AK_12.get(), ModItems.AK_47.get(), ModItems.M_4.get());
|
||||
|
||||
this.tag(ModTags.Items.CAN_APPLY_STOCK).add(ModItems.AK_12.get(), ModItems.AK_47.get());
|
||||
this.tag(ModTags.Items.CAN_APPLY_STOCK).add(ModItems.AK_12.get(), ModItems.AK_47.get(), ModItems.M_4.get());
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ public class ModKeyMappings {
|
|||
public static final KeyMapping EDIT_MAGAZINE = new KeyMapping("key.superbwarfare.edit_magazine", GLFW.GLFW_KEY_DOWN, "key.categories.superbwarfare");
|
||||
public static final KeyMapping EDIT_STOCK = new KeyMapping("key.superbwarfare.edit_stock", GLFW.GLFW_KEY_RIGHT, "key.categories.superbwarfare");
|
||||
public static final KeyMapping EDIT_GRIP = new KeyMapping("key.superbwarfare.edit_grip", KeyConflictContext.IN_GAME,
|
||||
KeyModifier.SHIFT, InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_LEFT, "key.categories.superbwarfare");
|
||||
KeyModifier.SHIFT, InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_DOWN, "key.categories.superbwarfare");
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerKeyMappings(RegisterKeyMappingsEvent event) {
|
||||
|
|
|
@ -115,10 +115,14 @@ public class ModSounds {
|
|||
|
||||
public static final RegistryObject<SoundEvent> M_4_FIRE_1P = REGISTRY.register("m_4_fire_1p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ModUtils.MODID, "m_4_fire_1p")));
|
||||
public static final RegistryObject<SoundEvent> M_4_FIRE_3P = REGISTRY.register("m_4_fire_3p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ModUtils.MODID, "m_4_fire_3p")));
|
||||
public static final RegistryObject<SoundEvent> M_4_FIRE_1P_S = REGISTRY.register("m_4_fire_1p_s", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ModUtils.MODID, "m_4_fire_1p_s")));
|
||||
public static final RegistryObject<SoundEvent> M_4_FIRE_3P_S = REGISTRY.register("m_4_fire_3p_s", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ModUtils.MODID, "m_4_fire_3p_s")));
|
||||
public static final RegistryObject<SoundEvent> M_4_FAR = REGISTRY.register("m_4_far", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ModUtils.MODID, "m_4_far")));
|
||||
public static final RegistryObject<SoundEvent> M_4_VERYFAR = REGISTRY.register("m_4_veryfar", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ModUtils.MODID, "m_4_veryfar")));
|
||||
public static final RegistryObject<SoundEvent> M_4_RELOAD_NORMAL = REGISTRY.register("m_4_reload_normal", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ModUtils.MODID, "m_4_reload_normal")));
|
||||
public static final RegistryObject<SoundEvent> M_4_RELOAD_EMPTY = REGISTRY.register("m_4_reload_empty", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ModUtils.MODID, "m_4_reload_empty")));
|
||||
public static final RegistryObject<SoundEvent> M_4_FAR_S = REGISTRY.register("m_4_far_s", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ModUtils.MODID, "ak_12_far_s")));
|
||||
public static final RegistryObject<SoundEvent> M_4_VERYFAR_S = REGISTRY.register("m_4_veryfar_s", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ModUtils.MODID, "ak_12_veryfar_s")));
|
||||
|
||||
public static final RegistryObject<SoundEvent> AA_12_FIRE_1P = REGISTRY.register("aa_12_fire_1p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ModUtils.MODID, "aa_12_fire_1p")));
|
||||
public static final RegistryObject<SoundEvent> AA_12_FIRE_3P = REGISTRY.register("aa_12_fire_3p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ModUtils.MODID, "aa_12_fire_3p")));
|
||||
|
|
|
@ -81,28 +81,51 @@ public class AK12Item extends GunItem implements GeoItem, AnimatedItem {
|
|||
ItemStack stack = player.getMainHandItem();
|
||||
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
||||
|
||||
boolean drum = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.MAGAZINE) == 2;
|
||||
boolean grip = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.GRIP) == 1 || GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.GRIP) == 2;
|
||||
|
||||
if (stack.getOrCreateTag().getBoolean("is_empty_reloading")) {
|
||||
if (grip) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak12.reload_empty_grip"));
|
||||
} else {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak12.reload_empty"));
|
||||
}
|
||||
}
|
||||
|
||||
if (stack.getOrCreateTag().getBoolean("is_normal_reloading")) {
|
||||
if (GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.MAGAZINE) == 2) {
|
||||
if (drum) {
|
||||
if (grip) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak12.reload_normal_drum_grip"));
|
||||
} else {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak12.reload_normal_drum"));
|
||||
}
|
||||
} else {
|
||||
if (grip) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak12.reload_normal_grip"));
|
||||
} else {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak12.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.ak12.run_fast"));
|
||||
} else {
|
||||
if (grip) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak12.run_grip"));
|
||||
} else {
|
||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ak12.run"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (grip) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ak12.idle_grip"));
|
||||
} else {
|
||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ak12.idle"));
|
||||
}
|
||||
}
|
||||
|
||||
private PlayState editPredicate(AnimationState<AK12Item> event) {
|
||||
LocalPlayer player = Minecraft.getInstance().player;
|
||||
|
@ -110,6 +133,8 @@ public class AK12Item extends GunItem implements GeoItem, AnimatedItem {
|
|||
ItemStack stack = player.getMainHandItem();
|
||||
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
||||
|
||||
boolean grip = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.GRIP) == 1 || GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.GRIP) == 2;
|
||||
|
||||
if (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).edit) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak12.edit"));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.mcreator.superbwarfare.item.gun.rifle;
|
||||
|
||||
import net.mcreator.superbwarfare.ModUtils;
|
||||
import net.mcreator.superbwarfare.client.PoseTool;
|
||||
import net.mcreator.superbwarfare.client.renderer.item.M4ItemRenderer;
|
||||
import net.mcreator.superbwarfare.event.ClientEventHandler;
|
||||
import net.mcreator.superbwarfare.init.ModItems;
|
||||
|
@ -8,10 +9,10 @@ import net.mcreator.superbwarfare.init.ModSounds;
|
|||
import net.mcreator.superbwarfare.init.ModTags;
|
||||
import net.mcreator.superbwarfare.item.AnimatedItem;
|
||||
import net.mcreator.superbwarfare.item.gun.GunItem;
|
||||
import net.mcreator.superbwarfare.network.ModVariables;
|
||||
import net.mcreator.superbwarfare.perk.Perk;
|
||||
import net.mcreator.superbwarfare.perk.PerkHelper;
|
||||
import net.mcreator.superbwarfare.tools.GunsTool;
|
||||
import net.mcreator.superbwarfare.client.PoseTool;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.HumanoidModel;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
|
@ -20,11 +21,13 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.Item;
|
||||
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 net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
||||
import software.bernie.geckolib.animatable.GeoItem;
|
||||
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
|
||||
|
@ -74,21 +77,71 @@ public class M4Item extends GunItem implements GeoItem, AnimatedItem {
|
|||
ItemStack stack = player.getMainHandItem();
|
||||
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
||||
|
||||
boolean drum = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.MAGAZINE) == 2;
|
||||
boolean grip = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.GRIP) == 1 || GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.GRIP) == 2;
|
||||
|
||||
if (stack.getOrCreateTag().getBoolean("is_empty_reloading")) {
|
||||
if (drum) {
|
||||
if (grip) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.reload_empty_drum_grip"));
|
||||
} else {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.reload_empty_drum"));
|
||||
}
|
||||
} else {
|
||||
if (grip) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.reload_empty_grip"));
|
||||
} else {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.reload_empty"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (stack.getOrCreateTag().getBoolean("is_normal_reloading")) {
|
||||
if (drum) {
|
||||
if (grip) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.reload_normal_drum_grip"));
|
||||
} else {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.reload_normal_drum"));
|
||||
}
|
||||
} else {
|
||||
if (grip) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.reload_normal_grip"));
|
||||
} else {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.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.m4.run_fast"));
|
||||
} else {
|
||||
if (grip) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.run_grip"));
|
||||
} else {
|
||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m4.run"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (grip) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m4.idle_grip"));
|
||||
} else {
|
||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m4.idle"));
|
||||
}
|
||||
}
|
||||
|
||||
private PlayState editPredicate(AnimationState<M4Item> 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;
|
||||
|
||||
boolean grip = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.GRIP) == 1 || GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.GRIP) == 2;
|
||||
|
||||
if (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).edit) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.edit"));
|
||||
}
|
||||
|
||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m4.idle"));
|
||||
}
|
||||
|
@ -97,6 +150,8 @@ public class M4Item extends GunItem implements GeoItem, AnimatedItem {
|
|||
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
||||
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
|
||||
|
@ -119,6 +174,36 @@ public class M4Item extends GunItem implements GeoItem, AnimatedItem {
|
|||
public void setAnimationProcedure(String procedure) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inventoryTick(ItemStack stack, Level world, Entity entity, int slot, boolean selected) {
|
||||
super.inventoryTick(stack, world, entity, slot, selected);
|
||||
|
||||
int scopeType = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
|
||||
int barrelType = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.BARREL);
|
||||
int magType = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.MAGAZINE);
|
||||
int stockType = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.STOCK);
|
||||
|
||||
int customMag = switch (magType) {
|
||||
case 1 -> 15;
|
||||
case 2 -> 30;
|
||||
default -> 0;
|
||||
};
|
||||
|
||||
double customZoom = switch (scopeType) {
|
||||
case 0, 1 -> 0;
|
||||
case 2 -> stack.getOrCreateTag().getBoolean("ScopeAlt")? 0 : 2.75;
|
||||
default -> stack.getOrCreateTag().getDouble("CustomZoom");
|
||||
};
|
||||
|
||||
stack.getOrCreateTag().putBoolean("CanSwitchScope", scopeType == 2);
|
||||
|
||||
stack.getOrCreateTag().putBoolean("CanAdjustZoomFov", scopeType == 3);
|
||||
|
||||
stack.getOrCreateTag().putDouble("CustomZoom", customZoom);
|
||||
|
||||
stack.getOrCreateTag().putInt("customMag", customMag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getGunIcon() {
|
||||
return new ResourceLocation(ModUtils.MODID, "textures/gun_icon/m4_icon.png");
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package net.mcreator.superbwarfare.network.message;
|
||||
|
||||
import net.mcreator.superbwarfare.init.ModTags;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.network.NetworkEvent;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class SwitchScopeMessage {
|
||||
private final double scroll;
|
||||
|
||||
public SwitchScopeMessage(double scroll) {
|
||||
this.scroll = scroll;
|
||||
}
|
||||
|
||||
public static void encode(SwitchScopeMessage message, FriendlyByteBuf byteBuf) {
|
||||
byteBuf.writeDouble(message.scroll);
|
||||
}
|
||||
|
||||
public static SwitchScopeMessage decode(FriendlyByteBuf byteBuf) {
|
||||
return new SwitchScopeMessage(byteBuf.readDouble());
|
||||
}
|
||||
|
||||
public static void handler(SwitchScopeMessage message, Supplier<NetworkEvent.Context> context) {
|
||||
context.get().enqueueWork(() -> {
|
||||
ServerPlayer player = context.get().getSender();
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
if (!stack.is(ModTags.Items.GUN)) {
|
||||
return;
|
||||
}
|
||||
var tag = stack.getOrCreateTag();
|
||||
|
||||
tag.putBoolean("ScopeAlt", !tag.getBoolean("ScopeAlt"));
|
||||
|
||||
});
|
||||
context.get().setPacketHandled(true);
|
||||
}
|
||||
|
||||
}
|
|
@ -56,22 +56,24 @@
|
|||
},
|
||||
"Righthand": {
|
||||
"rotation": {
|
||||
"vector": [1.90371, -57.62597, -9.69366],
|
||||
"easing": "easeInElastic"
|
||||
"vector": ["easeInElastic", "easeInElastic", "easeInElastic"]
|
||||
},
|
||||
"position": {
|
||||
"vector": [9.7, -12.5, 17],
|
||||
"easing": "easeInElastic"
|
||||
"vector": ["easeInElastic", "easeInElastic", "easeInElastic"]
|
||||
},
|
||||
"scale": {
|
||||
"vector": [0, 0, 0]
|
||||
}
|
||||
},
|
||||
"Lefthand": {
|
||||
"rotation": {
|
||||
"vector": [-20.80188, -23.88158, -14.35972],
|
||||
"easing": "easeInElastic"
|
||||
"vector": ["easeInElastic", "easeInElastic", "easeInElastic"]
|
||||
},
|
||||
"position": {
|
||||
"vector": [-4, -10, 20],
|
||||
"easing": "easeInElastic"
|
||||
"vector": ["easeInElastic", "easeInElastic", "easeInElastic"]
|
||||
},
|
||||
"scale": {
|
||||
"vector": [0, 0, 0]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -407,6 +407,14 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"m_4_fire_1p_s": {
|
||||
"sounds": [
|
||||
{
|
||||
"name": "superbwarfare:m_4/m_4_fire_1p_s",
|
||||
"stream": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"m_4_fire_3p": {
|
||||
"sounds": [
|
||||
{
|
||||
|
@ -415,6 +423,14 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"m_4_fire_3p_s": {
|
||||
"sounds": [
|
||||
{
|
||||
"name": "superbwarfare:m_4/m_4_fire_3p_s",
|
||||
"stream": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"m_4_far": {
|
||||
"sounds": [
|
||||
{
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 78 KiB |
Binary file not shown.
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 16 KiB |
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
"MinZoom": 1.25,
|
||||
"MaxZoom": 6,
|
||||
"spread": 4,
|
||||
"recoil_x": 0.0015,
|
||||
"recoil_y": 0.011,
|
||||
|
|
Loading…
Add table
Reference in a new issue