尝试给AK加入使味视角晃动
This commit is contained in:
parent
802b11f674
commit
359d240844
4 changed files with 93 additions and 5 deletions
|
@ -3,14 +3,26 @@ package net.mcreator.target.client.model.item;
|
|||
import net.mcreator.target.item.gun.AK47Item;
|
||||
import net.mcreator.target.network.TargetModVariables;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.client.event.ViewportEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
|
||||
import software.bernie.geckolib.core.animation.AnimationState;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class AK47ItemModel extends GeoModel<AK47Item> {
|
||||
|
||||
static float camera_pitch;
|
||||
|
||||
static float camera_yaw;
|
||||
|
||||
static float camera_roll;
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(AK47Item animatable) {
|
||||
return new ResourceLocation("target", "animations/ak.animation.json");
|
||||
|
@ -140,5 +152,24 @@ public class AK47ItemModel extends GeoModel<AK47Item> {
|
|||
|
||||
move.setRotY(1.9f * (float) yaw - (float) m);
|
||||
|
||||
CoreGeoBone camera = getAnimationProcessor().getBone("camera");
|
||||
|
||||
float camera_pitch = camera.getRotX();
|
||||
|
||||
float camera_yaw = camera.getRotY();
|
||||
|
||||
float camera_roll = camera.getRotZ();
|
||||
}
|
||||
@SubscribeEvent
|
||||
public static void computeCameraAngles(ViewportEvent.ComputeCameraAngles event) {
|
||||
|
||||
double view_pitch = event.getPitch();
|
||||
double view_yaw = event.getYaw();
|
||||
double view_roll = event.getRoll();
|
||||
// TODO 让下面仨等于上面仨
|
||||
event.setPitch((float) view_pitch + camera_pitch);
|
||||
event.setYaw((float) view_yaw + camera_yaw);
|
||||
event.setRoll((float) view_roll + camera_roll);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.mcreator.target.event;
|
|||
import net.mcreator.target.init.TargetModMobEffects;
|
||||
import net.mcreator.target.init.TargetModTags;
|
||||
import net.mcreator.target.network.TargetModVariables;
|
||||
import net.mcreator.target.client.model.item.*;
|
||||
import net.minecraft.client.CameraType;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
|
@ -455,3 +456,5 @@ public class ClientEventHandler {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -352,6 +352,7 @@
|
|||
"override_previous_animation": true
|
||||
},
|
||||
"animation.ak47.reload": {
|
||||
"loop": "hold_on_last_frame",
|
||||
"animation_length": 2.9,
|
||||
"override_previous_animation": true,
|
||||
"bones": {
|
||||
|
@ -371,7 +372,7 @@
|
|||
"easing": "easeInOutSine"
|
||||
},
|
||||
"0.4": {
|
||||
"vector": [-0.00638, -0.05195, -0.49863],
|
||||
"vector": [3.99362, -0.05195, -0.49863],
|
||||
"easing": "easeOutSine"
|
||||
},
|
||||
"0.6": {
|
||||
|
@ -436,7 +437,7 @@
|
|||
"easing": "easeInSine"
|
||||
},
|
||||
"0.4": {
|
||||
"vector": [0, -0.29, 0.22]
|
||||
"vector": [0, -0.59, 0.22]
|
||||
},
|
||||
"0.5": {
|
||||
"vector": [0, 0, -0.1],
|
||||
|
@ -457,7 +458,7 @@
|
|||
"vector": [0, -0.4, 0.3]
|
||||
},
|
||||
"1.3": {
|
||||
"vector": [0, 0.1, 0.3]
|
||||
"vector": [0, 0.3, 0.3]
|
||||
},
|
||||
"1.5": {
|
||||
"vector": [0, -0.3, 0.3],
|
||||
|
@ -610,7 +611,7 @@
|
|||
"vector": [-9, 0, 0]
|
||||
},
|
||||
"0.6": {
|
||||
"vector": [-12.62765, -2.62403, -2.08221]
|
||||
"vector": [19.37235, -2.62403, -2.08221]
|
||||
},
|
||||
"1.1": {
|
||||
"vector": [-12.62765, -2.62403, -2.08221]
|
||||
|
@ -636,7 +637,7 @@
|
|||
"vector": [0, 0, 0]
|
||||
},
|
||||
"0.6": {
|
||||
"vector": [0, -9.27, -0.9]
|
||||
"vector": [0, -11.07, 3.1]
|
||||
},
|
||||
"1.1": {
|
||||
"vector": [0, -9.27, -0.9]
|
||||
|
@ -671,6 +672,55 @@
|
|||
"vector": [0, 0, 0]
|
||||
}
|
||||
}
|
||||
},
|
||||
"camera": {
|
||||
"rotation": {
|
||||
"0.3": {
|
||||
"vector": [0, 0, 0]
|
||||
},
|
||||
"0.4": {
|
||||
"vector": [1, 0, 2],
|
||||
"easing": "easeInElastic"
|
||||
},
|
||||
"0.5": {
|
||||
"vector": [-1, 0, -2],
|
||||
"easing": "easeInElastic"
|
||||
},
|
||||
"0.7": {
|
||||
"vector": [0, 0, 0],
|
||||
"easing": "easeOutBack"
|
||||
},
|
||||
"1.1": {
|
||||
"vector": [0, 0, 0]
|
||||
},
|
||||
"1.3": {
|
||||
"vector": [0, 0, 1],
|
||||
"easing": "easeInElastic"
|
||||
},
|
||||
"1.4": {
|
||||
"vector": [-1, 0, -2],
|
||||
"easing": "easeInElastic"
|
||||
},
|
||||
"1.6": {
|
||||
"vector": [0, 0, 0],
|
||||
"easing": "easeOutBack"
|
||||
},
|
||||
"1.9": {
|
||||
"vector": [0, 0, 0]
|
||||
},
|
||||
"2.0": {
|
||||
"vector": [0, 2, 1],
|
||||
"easing": "easeInElastic"
|
||||
},
|
||||
"2.1": {
|
||||
"vector": [-1, -1, -2],
|
||||
"easing": "easeInElastic"
|
||||
},
|
||||
"2.3": {
|
||||
"vector": [0, 0, 0],
|
||||
"easing": "easeOutBack"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
"visible_bounds_offset": [0, 0, 0]
|
||||
},
|
||||
"bones": [
|
||||
{
|
||||
"name": "camera",
|
||||
"pivot": [2.57141, 4.96276, 6.77702]
|
||||
},
|
||||
{
|
||||
"name": "root",
|
||||
"pivot": [0, 0, 0]
|
||||
|
|
Loading…
Add table
Reference in a new issue