清理代码
This commit is contained in:
parent
2106135c2c
commit
60c402cf21
1 changed files with 17 additions and 25 deletions
|
@ -3,19 +3,15 @@ package net.mcreator.target.client.model.item;
|
||||||
import net.mcreator.target.item.gun.AK47Item;
|
import net.mcreator.target.item.gun.AK47Item;
|
||||||
import net.mcreator.target.network.TargetModVariables;
|
import net.mcreator.target.network.TargetModVariables;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.multiplayer.ClientLevel;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
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.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
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.animatable.model.CoreGeoBone;
|
||||||
import software.bernie.geckolib.core.animation.AnimationState;
|
import software.bernie.geckolib.core.animation.AnimationState;
|
||||||
import software.bernie.geckolib.model.GeoModel;
|
import software.bernie.geckolib.model.GeoModel;
|
||||||
|
|
||||||
public class AK47ItemModel extends GeoModel<AK47Item> {
|
public class AK47ItemModel extends GeoModel<AK47Item> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getAnimationResource(AK47Item animatable) {
|
public ResourceLocation getAnimationResource(AK47Item animatable) {
|
||||||
return new ResourceLocation("target", "animations/ak.animation.json");
|
return new ResourceLocation("target", "animations/ak.animation.json");
|
||||||
|
@ -39,13 +35,16 @@ public class AK47ItemModel extends GeoModel<AK47Item> {
|
||||||
CoreGeoBone shuan = getAnimationProcessor().getBone("shuan");
|
CoreGeoBone shuan = getAnimationProcessor().getBone("shuan");
|
||||||
|
|
||||||
Player player = Minecraft.getInstance().player;
|
Player player = Minecraft.getInstance().player;
|
||||||
|
|
||||||
|
if (player == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
|
|
||||||
double p = 0;
|
double p = player.getPersistentData().getDouble("zoom_pos");
|
||||||
p = player.getPersistentData().getDouble("zoom_pos");
|
|
||||||
|
|
||||||
double zp = 0;
|
double zp = player.getPersistentData().getDouble("zoom_pos_z");
|
||||||
zp = player.getPersistentData().getDouble("zoom_pos_z");
|
|
||||||
|
|
||||||
gun.setPosX(2.11f * (float) p);
|
gun.setPosX(2.11f * (float) p);
|
||||||
|
|
||||||
|
@ -69,8 +68,7 @@ public class AK47ItemModel extends GeoModel<AK47Item> {
|
||||||
holo.setScaleY(0);
|
holo.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
double fp = 0;
|
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||||
fp = player.getPersistentData().getDouble("fire_pos");
|
|
||||||
|
|
||||||
|
|
||||||
if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming) {
|
if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming) {
|
||||||
|
@ -105,13 +103,11 @@ public class AK47ItemModel extends GeoModel<AK47Item> {
|
||||||
|
|
||||||
CoreGeoBone root = getAnimationProcessor().getBone("root");
|
CoreGeoBone root = getAnimationProcessor().getBone("root");
|
||||||
|
|
||||||
float PosX = (float)player.getPersistentData().getDouble("gun_move_posX");
|
float PosX = (float) player.getPersistentData().getDouble("gun_move_posX");
|
||||||
float PosY = (float)player.getPersistentData().getDouble("gun_move_posY");
|
float PosY = (float) player.getPersistentData().getDouble("gun_move_posY");
|
||||||
|
|
||||||
double y = 0;
|
double y = player.getPersistentData().getDouble("y");
|
||||||
double x = 0;
|
double x = player.getPersistentData().getDouble("x");
|
||||||
y = player.getPersistentData().getDouble("y");
|
|
||||||
x = player.getPersistentData().getDouble("x");
|
|
||||||
|
|
||||||
root.setPosX(PosX);
|
root.setPosX(PosX);
|
||||||
|
|
||||||
|
@ -123,17 +119,13 @@ public class AK47ItemModel extends GeoModel<AK47Item> {
|
||||||
|
|
||||||
CoreGeoBone move = getAnimationProcessor().getBone("move");
|
CoreGeoBone move = getAnimationProcessor().getBone("move");
|
||||||
|
|
||||||
double m = 0;
|
double m = player.getPersistentData().getDouble("move");
|
||||||
m = player.getPersistentData().getDouble("move");
|
|
||||||
|
|
||||||
double yaw = 0;
|
double yaw = player.getPersistentData().getDouble("yaw");
|
||||||
yaw = player.getPersistentData().getDouble("yaw");
|
|
||||||
|
|
||||||
double pit = 0;
|
double pit = player.getPersistentData().getDouble("gun_pitch");
|
||||||
pit = player.getPersistentData().getDouble("gun_pitch");
|
|
||||||
|
|
||||||
double vy = 0;
|
double vy = player.getPersistentData().getDouble("vy");
|
||||||
vy = player.getPersistentData().getDouble("vy");
|
|
||||||
|
|
||||||
move.setPosY(-0.95f * (float) vy);
|
move.setPosY(-0.95f * (float) vy);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue