重制泰瑟木仓,微调动画

This commit is contained in:
Atsuihsio 2024-06-08 17:57:53 +08:00
parent 37d6ddaee1
commit 05b064d45c
34 changed files with 446 additions and 319 deletions

View file

@ -91,7 +91,7 @@ public class JumpPadBlock extends Block {
entity.setDeltaMovement(new Vec3(0.7 * entity.getDeltaMovement().x(), 1.7, 0.7 * entity.getDeltaMovement().z()));
}
if (!zooming) entity.getPersistentData().putDouble("vy", 0.8);
if (!level.isClientSide()) {
level.playSound(null, BlockPos.containing(pos.getX(), pos.getY(), pos.getZ()), TargetModSounds.JUMP.get(), SoundSource.BLOCKS, 1, 1);

View file

@ -2,6 +2,7 @@ package net.mcreator.target.client;
import com.mojang.blaze3d.platform.InputConstants;
import net.mcreator.target.TargetMod;
import net.mcreator.target.init.TargetModMobEffects;
import net.mcreator.target.init.TargetModTags;
import net.mcreator.target.network.message.FireMessage;
import net.mcreator.target.network.message.SensitivityMessage;
@ -48,12 +49,43 @@ public class ClickHandler {
if (player == null) return;
int button = event.getButton();
if (button == GLFW.GLFW_MOUSE_BUTTON_LEFT && player.getMainHandItem().is(TargetModTags.Items.GUN)) {
if (button == GLFW.GLFW_MOUSE_BUTTON_LEFT) {
if (Minecraft.getInstance().player.hasEffect(TargetModMobEffects.SHOCK.get())) {
event.setCanceled(true);
return;
}
if (player.getMainHandItem().is(TargetModTags.Items.GUN)) {
event.setCanceled(true);
TargetMod.PACKET_HANDLER.sendToServer(new FireMessage(0));
}
}
if (button == GLFW.GLFW_MOUSE_BUTTON_RIGHT) {
if (Minecraft.getInstance().player.hasEffect(TargetModMobEffects.SHOCK.get())) {
event.setCanceled(true);
}
}
if (button == GLFW.GLFW_MOUSE_BUTTON_MIDDLE) {
if (Minecraft.getInstance().player.hasEffect(TargetModMobEffects.SHOCK.get())) {
event.setCanceled(true);
}
}
}
@SubscribeEvent
public static void onMouseScrolling(InputEvent.MouseScrollingEvent event) {
if (notInGame()) return;
Player player = Minecraft.getInstance().player;
if (player == null) return;
if (Minecraft.getInstance().player.hasEffect(TargetModMobEffects.SHOCK.get())) {
event.setCanceled(true);
}
}
private static void setKeyState(int key, int state) {
Player player = Minecraft.getInstance().player;
if (player == null) return;

View file

@ -140,7 +140,7 @@ public class AK47ItemModel extends GeoModel<AK47Item> {
move.setPosX(9.3f * (float) m);
move.setPosY(-0.95f * (float) vy);
move.setPosY(-2 * (float) vy);
double xRot = player.getPersistentData().getDouble("xRot");
@ -148,7 +148,7 @@ public class AK47ItemModel extends GeoModel<AK47Item> {
double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(0.7f * Mth.DEG_TO_RAD * (float) xRot);
move.setRotX(0.7f * Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(0.7f * Mth.DEG_TO_RAD * (float) yRot);

View file

@ -117,7 +117,7 @@ public class Aa12ItemModel extends GeoModel<Aa12Item> {
move.setPosX(9.3f * (float) m);
move.setPosY(-0.95f * (float) vy);
move.setPosY(-2f * (float) vy);
double xRot = player.getPersistentData().getDouble("xRot");
@ -125,7 +125,7 @@ public class Aa12ItemModel extends GeoModel<Aa12Item> {
double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(Mth.DEG_TO_RAD * (float) xRot);
move.setRotX(Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(Mth.DEG_TO_RAD * (float) yRot);

View file

@ -102,7 +102,7 @@ public class AbekiriItemModel extends GeoModel<Abekiri> {
move.setPosX(9.3f * (float) m);
move.setPosY(-0.95f * (float) vy);
move.setPosY(-2f * (float) vy);
double xRot = player.getPersistentData().getDouble("xRot");
@ -110,7 +110,7 @@ public class AbekiriItemModel extends GeoModel<Abekiri> {
double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(Mth.DEG_TO_RAD * (float) xRot);
move.setRotX(Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(Mth.DEG_TO_RAD * (float) yRot);

View file

@ -661,7 +661,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
move.setPosX(9.3f * (float) m);
move.setPosY(-1.2f * (float) vy);
move.setPosY(-2 * (float) vy);
double xRot = player.getPersistentData().getDouble("xRot");
@ -669,7 +669,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(1.8f * Mth.DEG_TO_RAD * (float) xRot);
move.setRotX(1.8f * Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(1.6f * Mth.DEG_TO_RAD * (float) yRot);

View file

@ -128,7 +128,7 @@ public class Hk416ItemModel extends GeoModel<Hk416Item> {
move.setPosX(9.3f * (float) m);
move.setPosY(-1.2f * (float) vy);
move.setPosY(2f * (float) vy);
double xRot = player.getPersistentData().getDouble("xRot");
@ -136,7 +136,7 @@ public class Hk416ItemModel extends GeoModel<Hk416Item> {
double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(0.75f * Mth.DEG_TO_RAD * (float) xRot);
move.setRotX(0.75f * Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(0.75f * Mth.DEG_TO_RAD * (float) yRot);

View file

@ -103,7 +103,7 @@ public class HuntingRifleItemModel extends GeoModel<HuntingRifle> {
move.setPosX(9.3f * (float) m);
move.setPosY(-0.95f * (float) vy);
move.setPosY(-2f * (float) vy);
double xRot = player.getPersistentData().getDouble("xRot");
@ -111,7 +111,7 @@ public class HuntingRifleItemModel extends GeoModel<HuntingRifle> {
double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(Mth.DEG_TO_RAD * (float) xRot);
move.setRotX(Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(Mth.DEG_TO_RAD * (float) yRot);

View file

@ -127,7 +127,7 @@ public class KraberItemModel extends GeoModel<Kraber> {
move.setPosX(9.3f * (float) m);
move.setPosY(-0.8f * (float) vy);
move.setPosY(-2f * (float) vy);
double xRot = player.getPersistentData().getDouble("xRot");
@ -135,7 +135,7 @@ public class KraberItemModel extends GeoModel<Kraber> {
double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(0.8f * Mth.DEG_TO_RAD * (float) xRot);
move.setRotX(0.8f * Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(0.6f * Mth.DEG_TO_RAD * (float) yRot);

View file

@ -118,7 +118,7 @@ public class M4ItemModel extends GeoModel<M4Item> {
move.setPosX(9.3f * (float) m);
move.setPosY(-1.0f * (float) vy);
move.setPosY(-2f * (float) vy);
double xRot = player.getPersistentData().getDouble("xRot");
@ -126,7 +126,7 @@ public class M4ItemModel extends GeoModel<M4Item> {
double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(0.65f * Mth.DEG_TO_RAD * (float) xRot);
move.setRotX(0.65f * Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(0.65f * Mth.DEG_TO_RAD * (float) yRot);

View file

@ -161,7 +161,7 @@ public class M60ItemModel extends GeoModel<M60Item> {
move.setPosX(9.3f * (float) m);
move.setPosY(-1.6f * (float) vy);
move.setPosY(-2f * (float) vy);
double xRot = player.getPersistentData().getDouble("xRot");
@ -169,7 +169,7 @@ public class M60ItemModel extends GeoModel<M60Item> {
double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(Mth.DEG_TO_RAD * (float) xRot);
move.setRotX(Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(Mth.DEG_TO_RAD * (float) yRot);

View file

@ -116,7 +116,7 @@ public class M79ItemModel extends GeoModel<M79Item> {
move.setPosX(9.3f * (float) m);
move.setPosY(-0.95f * (float) vy);
move.setPosY(-2f * (float) vy);
double xRot = player.getPersistentData().getDouble("xRot");
@ -124,7 +124,7 @@ public class M79ItemModel extends GeoModel<M79Item> {
double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(Mth.DEG_TO_RAD * (float) xRot);
move.setRotX(Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(Mth.DEG_TO_RAD * (float) yRot);

View file

@ -129,7 +129,7 @@ public class M870ItemModel extends GeoModel<M870Item> {
move.setPosX(9.3f * (float) m);
move.setPosY(-0.95f * (float) vy);
move.setPosY(-2f * (float) vy);
double xRot = player.getPersistentData().getDouble("xRot");
@ -137,7 +137,7 @@ public class M870ItemModel extends GeoModel<M870Item> {
double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(Mth.DEG_TO_RAD * (float) xRot);
move.setRotX(Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(Mth.DEG_TO_RAD * (float) yRot);

View file

@ -135,7 +135,7 @@ public class M98bItemModel extends GeoModel<M98bItem> {
move.setPosX(9.3f * (float) m);
move.setPosY(-0.95f * (float) vy);
move.setPosY(-2f * (float) vy);
double xRot = player.getPersistentData().getDouble("xRot");
@ -143,7 +143,7 @@ public class M98bItemModel extends GeoModel<M98bItem> {
double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(Mth.DEG_TO_RAD * (float) xRot);
move.setRotX(Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(Mth.DEG_TO_RAD * (float) yRot);

View file

@ -108,7 +108,7 @@ public class MarlinItemModel extends GeoModel<MarlinItem> {
move.setPosX(9.3f * (float) m);
move.setPosY(-0.95f * (float) vy);
move.setPosY(-2f * (float) vy);
double xRot = player.getPersistentData().getDouble("xRot");
@ -116,7 +116,7 @@ public class MarlinItemModel extends GeoModel<MarlinItem> {
double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(Mth.DEG_TO_RAD * (float) xRot);
move.setRotX(Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(Mth.DEG_TO_RAD * (float) yRot);

View file

@ -112,7 +112,7 @@ public class MinigunItemModel extends GeoModel<Minigun> {
move.setPosX(9.3f * (float) m);
move.setPosY(-0.95f * (float) vy);
move.setPosY(-2f * (float) vy);
double xRot = player.getPersistentData().getDouble("xRot");
@ -120,7 +120,7 @@ public class MinigunItemModel extends GeoModel<Minigun> {
double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(Mth.DEG_TO_RAD * (float) xRot);
move.setRotX(Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(Mth.DEG_TO_RAD * (float) yRot);

View file

@ -148,7 +148,7 @@ public class Mk14ItemModel extends GeoModel<Mk14Item> {
move.setPosX(9.3f * (float) m);
move.setPosY(-0.95f * (float) vy);
move.setPosY(-2f * (float) vy);
double xRot = player.getPersistentData().getDouble("xRot");
@ -156,7 +156,7 @@ public class Mk14ItemModel extends GeoModel<Mk14Item> {
double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(1.6f * Mth.DEG_TO_RAD * (float) xRot);
move.setRotX(1.6f * Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(1.6f * Mth.DEG_TO_RAD * (float) yRot);

View file

@ -123,7 +123,7 @@ public class RpgItemModel extends GeoModel<RpgItem> {
move.setPosX(9.3f * (float) m);
move.setPosY(-0.95f * (float) vy);
move.setPosY(-2f * (float) vy);
double xRot = player.getPersistentData().getDouble("xRot");
@ -131,7 +131,7 @@ public class RpgItemModel extends GeoModel<RpgItem> {
double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(Mth.DEG_TO_RAD * (float) xRot);
move.setRotX(Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(Mth.DEG_TO_RAD * (float) yRot);

View file

@ -149,7 +149,7 @@ public class RpkItemModel extends GeoModel<RpkItem> {
move.setPosX(9.3f * (float) m);
move.setPosY(-0.95f * (float) vy);
move.setPosY(-2f * (float) vy);
double xRot = player.getPersistentData().getDouble("xRot");
@ -157,7 +157,7 @@ public class RpkItemModel extends GeoModel<RpkItem> {
double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(0.6f * Mth.DEG_TO_RAD * (float) xRot);
move.setRotX(0.6f * Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(0.6f * Mth.DEG_TO_RAD * (float) yRot);

View file

@ -146,7 +146,7 @@ public class SentinelItemModel extends GeoModel<SentinelItem> {
move.setPosX(9.3f * (float) m);
move.setPosY(-0.95f * (float) vy);
move.setPosY(-2f * (float) vy);
double xRot = player.getPersistentData().getDouble("xRot");
@ -154,7 +154,7 @@ public class SentinelItemModel extends GeoModel<SentinelItem> {
double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(1.4f * Mth.DEG_TO_RAD * (float) xRot);
move.setRotX(1.4f * Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(1.4f * Mth.DEG_TO_RAD * (float) yRot);

View file

@ -134,7 +134,7 @@ public class SksItemModel extends GeoModel<SksItem> {
move.setPosX(9.3f * (float) m);
move.setPosY(-0.95f * (float) vy);
move.setPosY(-2f * (float) vy);
double xRot = player.getPersistentData().getDouble("xRot");
@ -142,7 +142,7 @@ public class SksItemModel extends GeoModel<SksItem> {
double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(Mth.DEG_TO_RAD * (float) xRot);
move.setRotX(Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(Mth.DEG_TO_RAD * (float) yRot);

View file

@ -156,7 +156,7 @@ public class SvdItemModel extends GeoModel<SvdItem> {
move.setPosX(9.3f * (float) m);
move.setPosY(-0.95f * (float) vy);
move.setPosY(-2f * (float) vy);
double xRot = player.getPersistentData().getDouble("xRot");
@ -164,7 +164,7 @@ public class SvdItemModel extends GeoModel<SvdItem> {
double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(Mth.DEG_TO_RAD * (float) xRot);
move.setRotX(Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(Mth.DEG_TO_RAD * (float) yRot);

View file

@ -36,27 +36,12 @@ public class TaserItemModel extends GeoModel<Taser> {
double fp = player.getPersistentData().getDouble("fire_pos");
double fr = player.getPersistentData().getDouble("fire_rot");
if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming) {
shen.setPosY(0.02f * (float) (fp + 2 * fr));
shen.setPosZ(0.5f * (float) (fp + 0.54f * fr));
shen.setRotX(0.02f * (float) (fp + fr));
shen.setRotZ(0f);
if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).recoilHorizon > 0) {
shen.setRotY(0.0025f * (float) fr);
} else {
shen.setRotY(-0.0025f * (float) fr);
}
} else {
shen.setPosY(0.03f * (float) (fp + 2 * fr));
shen.setPosZ(0.7f * (float) (fp + 0.54f * fr));
shen.setRotX(0.03f * (float) (0.18f * fp + fr));
shen.setRotZ(-0.001f * (float) (fp + 1.3 * fr));
if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).recoilHorizon > 0) {
shen.setRotY(0.0045f * (float) fr);
} else {
shen.setRotY(-0.0045f * (float) fr);
}
}
shen.setPosX(-0.05f * (float) (fp + 0.2 * fr));
shen.setPosY(0.1f * (float) (fp + 2 * fr));
shen.setPosZ(1.2f * (float) (1.3 * fp + 0.54f * fr));
shen.setRotX(0.04f * (float) (1.28f * fp + fr));
shen.setRotY(0.02f * (float) fr);
shen.setRotZ(-0.02f * (float) (fp + 1.3 * fr));
double p = 0;
p = player.getPersistentData().getDouble("zoom_pos");
@ -64,9 +49,9 @@ public class TaserItemModel extends GeoModel<Taser> {
double zp = 0;
zp = player.getPersistentData().getDouble("zoom_pos_z");
gun.setPosX(2.6f * (float) p);
gun.setPosX(1.82f * (float) p);
gun.setPosY(1.2f * (float) p - (float) (0.6f * zp));
gun.setPosY(1.3f * (float) p - (float) (0.3f * zp));
gun.setPosZ((float) p + (float) (0.5f * zp));
@ -82,14 +67,14 @@ public class TaserItemModel extends GeoModel<Taser> {
y = player.getPersistentData().getDouble("y");
x = player.getPersistentData().getDouble("x");
float RotZ = (float) player.getPersistentData().getDouble("gun_move_rotZ");
root.setPosX(PosX);
root.setPosY((float) y + PosY);
root.setRotX((float) x);
float RotZ = (float) player.getPersistentData().getDouble("gun_move_rotZ");
root.setRotY(0.2f * PosX);
root.setRotZ(0.2f * PosX + RotZ);
@ -102,7 +87,7 @@ public class TaserItemModel extends GeoModel<Taser> {
move.setPosX(9.3f * (float) m);
move.setPosY(-0.95f * (float) vy);
move.setPosY(-2 * (float) vy);
double xRot = player.getPersistentData().getDouble("xRot");
@ -110,11 +95,18 @@ public class TaserItemModel extends GeoModel<Taser> {
double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(Mth.DEG_TO_RAD * (float) xRot);
move.setRotX(Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(Mth.DEG_TO_RAD * (float) yRot);
move.setRotZ(2.7f * (float) m + Mth.DEG_TO_RAD * (float) zRot);
CoreGeoBone camera = getAnimationProcessor().getBone("camera");
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
}
}

View file

@ -103,7 +103,7 @@ public class TracheliumItemModel extends GeoModel<Trachelium> {
move.setPosX(9.3f * (float) m);
move.setPosY(-0.95f * (float) vy);
move.setPosY(-2f * (float) vy);
double xRot = player.getPersistentData().getDouble("xRot");
@ -111,7 +111,7 @@ public class TracheliumItemModel extends GeoModel<Trachelium> {
double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(Mth.DEG_TO_RAD * (float) xRot);
move.setRotX(Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(Mth.DEG_TO_RAD * (float) yRot);

View file

@ -122,7 +122,7 @@ public class VectorItemModel extends GeoModel<VectorItem> {
move.setPosX(9.3f * (float) m);
move.setPosY(-1.2f * (float) vy);
move.setPosY(-2f * (float) vy);
double xRot = player.getPersistentData().getDouble("xRot");
@ -130,7 +130,7 @@ public class VectorItemModel extends GeoModel<VectorItem> {
double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(0.7f * Mth.DEG_TO_RAD * (float) xRot);
move.setRotX(0.7f * Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(0.7f * Mth.DEG_TO_RAD * (float) yRot);

View file

@ -20,6 +20,7 @@ import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.network.NetworkHooks;
@ -132,4 +133,12 @@ public class TaserBulletProjectileEntity extends ThrowableItemProjectile {
this.discard();
}
}
@Override
protected void onHitBlock(BlockHitResult result) {
if (!level().isClientSide) {
this.setDeltaMovement(this.getDeltaMovement().multiply(0, 0, 0));
this.setNoGravity(true);
}
}
}

View file

@ -101,7 +101,7 @@ public class ClientEventHandler {
data.putDouble("sway_time", data.getDouble("sway_time") + 0.015 * times);
data.putDouble("x", (pose * -0.008 * Math.sin(data.getDouble("sway_time")) * (1 - 0.95 * data.getDouble("zoom_time"))));
data.putDouble("y", (pose * 0.125 * Math.sin(data.getDouble("sway_time") - 1.585) * (1 - 0.95 * data.getDouble("zoom_time"))));
data.putDouble("y", (pose * 0.125 * Math.sin(data.getDouble("sway_time") - 1.585) * (1 - 0.95 * data.getDouble("zoom_time"))) - 3 * data.getDouble("gun_move_rotZ"));
}
}
@ -340,8 +340,8 @@ public class ClientEventHandler {
private static void handleShockCamera(ViewportEvent.ComputeCameraAngles event, LivingEntity entity) {
if (entity.hasEffect(TargetModMobEffects.SHOCK.get()) && Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON) {
event.setYaw(Minecraft.getInstance().gameRenderer.getMainCamera().getYRot());
event.setPitch(Minecraft.getInstance().gameRenderer.getMainCamera().getXRot());
event.setYaw(Minecraft.getInstance().gameRenderer.getMainCamera().getYRot() + (float) Mth.nextDouble(RandomSource.create(), -3, 3));
event.setPitch(Minecraft.getInstance().gameRenderer.getMainCamera().getXRot() + (float) Mth.nextDouble(RandomSource.create(), -3, 3));
event.setRoll((float) Mth.nextDouble(RandomSource.create(), 8, 12));
}
}

View file

@ -187,7 +187,7 @@ public class Taser extends GunItem implements GeoItem, AnimatedItem {
}
if (stack.getOrCreateTag().getBoolean("reloading")) {
if (stack.getOrCreateTag().getDouble("reload_time") == 55) {
if (stack.getOrCreateTag().getDouble("reload_time") == 54) {
player.getPersistentData().putDouble("id", id);
if (!player.level().isClientSide()) {

View file

@ -4,8 +4,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.Input;
import net.minecraft.client.player.KeyboardInput;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@ -14,13 +12,6 @@ import net.mcreator.target.init.TargetModMobEffects;
@Mixin(KeyboardInput.class)
public abstract class KeyMappingMixin extends Input {
@Unique
private static long virtuarealcraft$counter = 0;
@Shadow
private static float calculateImpulse(boolean pInput, boolean pOtherInput) {
return 0;
}
// 按键修改mixin
@Inject(method = "tick", at = @At("RETURN"))
@ -29,20 +20,13 @@ public abstract class KeyMappingMixin extends Input {
|| Minecraft.getInstance().player.isSpectator()) {
return;
}
var moveKeyDown = this.up | this.down | this.left | this.right;
this.up = false;
this.down = false;
virtuarealcraft$counter++;
var reserveLeftAndRight = virtuarealcraft$counter % 3 == 0;
this.left &= reserveLeftAndRight;
this.right &= reserveLeftAndRight;
this.left = false;
this.right = false;
this.shiftKeyDown = false;
this.forwardImpulse = Math.min(calculateImpulse(moveKeyDown, false) + 0.6f, 1);
this.leftImpulse *= 0.3f;
this.forwardImpulse = 0;
this.leftImpulse = 0;
this.jumping = false;
}
}

View file

@ -1,5 +1,6 @@
package net.mcreator.target.mixins;
import net.mcreator.target.init.TargetModMobEffects;
import net.mcreator.target.init.TargetModTags;
import net.mcreator.target.network.TargetModVariables;
import net.minecraft.client.CameraType;
@ -32,6 +33,7 @@ public class MouseHandlerMixin {
ItemStack stack = mc.player.getMainHandItem();
boolean flag = false;
boolean shock = false;
float sens = 0.2f;
float fov = (float) player.getPersistentData().getDouble("fov");
float custom_sens = (float) stack.getOrCreateTag().getInt("sensitivity");
@ -50,6 +52,11 @@ public class MouseHandlerMixin {
return original;
}
}
return original * additionalAdsSensitivity * (1.0 - sens * (flag ? 1 : 0));
if (Minecraft.getInstance().player.hasEffect(TargetModMobEffects.SHOCK.get()) && !Minecraft.getInstance().player.isSpectator()) {
shock = true;
}
return original * additionalAdsSensitivity * (1.0 - sens * (flag ? 1 : 0)) * (shock ? 0 : 1);
}
}

View file

@ -29,20 +29,8 @@ public class ShockMobEffect extends MobEffect {
@Override
public void applyEffectTick(LivingEntity entity, int amplifier) {
// entity.setDeltaMovement(new Vec3(0, (entity.getDeltaMovement().y()), 0));
// if (!entity.level().isClientSide()) {
// entity.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 10, 10));
// }
entity.setYRot((float) (entity.getYRot() + Mth.nextDouble(RandomSource.create(), -15, 15)));
entity.setXRot((float) Mth.nextDouble(RandomSource.create(), -20, -23));
entity.setYBodyRot(entity.getYRot());
entity.setYHeadRot(entity.getYRot());
entity.yRotO = entity.getYRot();
entity.setXRot((float) Mth.nextDouble(RandomSource.create(), -23, -36));
entity.xRotO = entity.getXRot();
entity.yBodyRotO = entity.getYRot();
entity.yHeadRotO = entity.getYRot();
}
@Override

View file

@ -6,10 +6,11 @@
"animation_length": 2
},
"animation.taser.fire": {
"animation_length": 0.04167
"animation_length": 0.0417
},
"animation.taser.reload": {
"animation_length": 2.5,
"loop": "hold_on_last_frame",
"animation_length": 2.75,
"override_previous_animation": true,
"bones": {
"0": {
@ -17,34 +18,50 @@
"0.0": {
"vector": [0, 0, 0]
},
"0.125": {
"vector": [0, -7.5, -15],
"easing": "easeInOutQuart"
"0.0833": {
"vector": [2.5, -4.08, 1.84]
},
"0.3333": {
"vector": [0.25, -7.5, -15],
"easing": "easeInElastic"
},
"0.4167": {
"vector": [0, -7.5, -15],
"easing": "easeInQuad"
"vector": [-7.25, -7.5, -15],
"easing": "easeInElastic"
},
"0.8333": {
"vector": [2.23908, -21.98443, -16.43478]
"0.5": {
"vector": [-5.25, -7.51, -15]
},
"1.5833": {
"vector": [-6.38143, -40.34825, -17.46108],
"easing": "easeInOutQuart"
"0.625": {
"vector": [-0.85, -8.89, -4.1],
"easing": "easeInOutSine"
},
"1.875": {
"vector": [-13.00432, -36.76626, -8.7001]
"0.9167": {
"vector": [-7.23, -11.05, -8.02]
},
"2.0417": {
"vector": [-7.23837, -29.77408, -13.27127]
"1.25": {
"vector": [-1.46, -26.71, -16.61]
},
"2.125": {
"vector": [-1.72334, -30.128, -11.30744]
"1.6667": {
"vector": [-11.38143, -25.34825, -17.46108],
"easing": "easeInElastic"
},
"2.2083": {
"vector": [-6.92021, -24.81214, -13.96446]
"1.9167": {
"vector": [-23.00432, -21.76626, -8.7001]
},
"2.5": {
"2.0": {
"vector": [-19.73837, -24.77408, -13.27127]
},
"2.0833": {
"vector": [-11.72334, -30.128, -11.30744]
},
"2.3333": {
"vector": [-0.11112, -2.35652, 10.98841]
},
"2.4583": {
"vector": [-0.0016, -0.13105, -1.38954]
},
"2.5833": {
"vector": [0, 0, 0],
"easing": "easeInOutQuad"
}
@ -53,109 +70,121 @@
"0.0": {
"vector": [0, 0, 0]
},
"0.125": {
"vector": [0, 0.25, 2],
"easing": "easeInOutQuart"
},
"0.4167": {
"vector": [0, 0.25, 2],
"easing": "easeInSine"
"vector": [0, 0.25, 3.25],
"easing": "easeInElastic"
},
"0.5": {
"vector": [0.1, 0.05, 2],
"easing": "easeOutCubic"
"0.4583": {
"vector": [-0.03, 0.43, 0.64],
"easing": "easeOutSine"
},
"0.6667": {
"vector": [-0.5, 0.25, 2],
"easing": "easeOutQuart"
"0.5417": {
"vector": [-0.06, 0.56, 2.21016]
},
"1.0833": {
"vector": [-0.6, 0.25, 2],
"easing": "easeInOutQuart"
"0.75": {
"vector": [-0.29, 0.3, 2.09],
"easing": "easeInOutSine"
},
"1.5833": {
"vector": [-0.9, 0.35, 2]
"1.0417": {
"vector": [-0.6, 0.53, 1.95]
},
"1.875": {
"vector": [-1, 0.35, 2]
"1.4167": {
"vector": [-0.9, 0.70547, 2]
},
"2.0417": {
"vector": [-1, 0.3, 2]
"1.9167": {
"vector": [-1, 0.35, 1.5]
},
"2.125": {
"vector": [-1.1, 0.15, 2.3]
"2.0": {
"vector": [-0.92461, 0.40317, 1.28968]
},
"2.2083": {
"vector": [-1, 0.3, 2]
"2.0833": {
"vector": [-1.31413, 0.00682, 2.2102]
},
"2.5": {
"vector": [0, 0, 0],
"easing": "easeInOutQuad"
"2.2917": {
"vector": [0, 0, -1]
},
"2.375": {
"vector": [0, 0, 0.93]
},
"2.5833": {
"vector": [0, 0, 0]
}
}
},
"Lefthand": {
"rotation": {
"0.0": {
"0.0833": {
"vector": [0, 0, 0]
},
"0.2083": {
"vector": [6.19201, -13.67009, -16.55029]
"0.4583": {
"vector": [-20.90869, -15.21456, -16.89238],
"easing": "easeOutBack"
},
"0.375": {
"vector": [-30, 0, 0]
"0.5833": {
"vector": [-17.89, -13.29, -10.54],
"easing": "easeInOutSine"
},
"0.4167": {
"vector": [-30, 0, 0]
"0.7083": {
"vector": [-16.88, -7.03, -16.89]
},
"1.0": {
"vector": [-30, 0, 0]
"0.9167": {
"vector": [-19.00328, -3.7608, -32.92722]
},
"1.0417": {
"vector": [-51, 0, 0]
"1.4583": {
"vector": [-20.90869, -15.21456, -16.89238],
"easing": "easeOutBack"
},
"1.9167": {
"vector": [-20.90869, -15.21456, -16.89238],
"easing": "easeOutBack"
},
"2.0833": {
"vector": [-51, 0, 0]
},
"2.1667": {
"vector": [-56, 0, 0]
"vector": [-20.90869, -15.21456, -16.89238],
"easing": "easeOutBack"
},
"2.25": {
"vector": [-51, 0, 0]
"vector": [-20.90869, -15.21456, -16.89238],
"easing": "easeOutBack"
},
"2.375": {
"vector": [6.19201, -13.67009, -16.55029]
},
"2.5": {
"2.4167": {
"vector": [0, 0, 0]
}
},
"position": {
"0.0": {
"0.0833": {
"vector": [0, 0, 0]
},
"0.375": {
"vector": [0.5, -3.2, -9.8]
},
"0.4167": {
"vector": [0.5, -3.2, -9.8]
"vector": [-0.19579, -2.08768, -5.4753],
"easing": "easeOutBack"
},
"1.0": {
"vector": [0.5, -3.2, -9.8]
"0.5417": {
"vector": [0, -1.82, -10.4],
"easing": "easeInCirc"
},
"1.0417": {
"vector": [-0.9, -4.4, -13.9]
"0.6667": {
"vector": [0.6, -1.87, -9.4]
},
"0.9167": {
"vector": [7.55491, -9.57868, 6.1249]
},
"1.4583": {
"vector": [10, -9.37, 7.72],
"easing": "easeInOutBack"
},
"1.9167": {
"vector": [0, -1.9, -10],
"easing": "easeInOutExpo"
},
"2.0833": {
"vector": [-0.9, -4.4, -13.9]
},
"2.1667": {
"vector": [-0.9, -4.4, -14.7]
"vector": [0, -1.9, -6.75],
"easing": "easeInElastic"
},
"2.25": {
"vector": [-0.9, -4.4, -13.9]
"vector": [0, -1.9, -6.75],
"easing": "easeOutBack"
},
"2.5": {
"2.4167": {
"vector": [0, 0, 0]
}
}
@ -165,93 +194,160 @@
"0.0": {
"vector": [0, 0, 0]
},
"0.5": {
"0.4167": {
"vector": [0, 0, 0]
},
"0.8333": {
"vector": [-1.60817, -2.47216, 1.985]
"1.25": {
"vector": [-380, 0, 0]
},
"1.4583": {
"vector": [-30.68206, -27.03402, 52.54628]
},
"2.0": {
"1.9167": {
"vector": [0, 0, 0]
},
"2.5": {
"vector": [0, 0, 0]
}
},
"position": {
"0.0": {
"vector": [0, 0, 0]
},
"0.4167": {
"vector": [0, 0, 0]
},
"0.5": {
"vector": [0, 0, -2],
"easing": "easeOutCubic"
},
"0.8333": {
"vector": [6, -9.75, 5],
"easing": "easeInQuart"
},
"1.4583": {
"vector": [10, -9, 13]
},
"1.875": {
"vector": [1.34, 0.6, -1.88]
},
"2.0": {
"vector": [0, 0, -1],
"easing": "easeInOutQuint"
},
"2.0833": {
"vector": [0, 0, 0]
}
}
},
"gun": {
"rotation": {
"0.0": {
"vector": [0, 0, 0]
},
"0.125": {
"vector": [0, -10, 0]
},
"0.375": {
"vector": [0, -10, 0]
},
"0.4167": {
"vector": [-4.5, -10, 0]
},
"0.5": {
"vector": [2.70033, -10.08384, 2.53747],
"easing": "easeOutQuad"
},
"0.6667": {
"vector": [-6.8707, -10.01954, 0.59135]
},
"2.1667": {
"vector": [0, -10, 0]
},
"2.5": {
"vector": [0, 0, 0]
}
},
"position": {
"0.0": {
"vector": [0, 0, 0]
},
"0.4167": {
"vector": [0.0441, 0.16396, -0.02671]
},
"0.4583": {
"vector": [0.26827, 0.95056, -1.6981]
},
"0.5": {
"vector": [-0.36805, 1.03264, -6.9702]
},
"0.5417": {
"vector": [-1.4502, 0.88538, -14.51111]
},
"0.5833": {
"vector": [-3.04715, 1.19976, -21.54721]
},
"0.625": {
"vector": [-4.25545, 0.3486, -27.45078]
},
"0.6667": {
"vector": [-5.50466, -2.79569, -33.3676]
},
"0.7083": {
"vector": [-6.97396, -6.91091, -39.16939]
},
"0.75": {
"vector": [-8.75181, -12.66452, -44.72621],
"easing": "linear"
},
"0.7917": {
"vector": [-10.84411, -20.08928, -49.88713]
},
"0.8333": {
"vector": [-13.34003, -29.71342, -54.55761]
},
"0.875": {
"vector": [-16.22188, -40.6649, -58.75257]
},
"0.9167": {
"vector": [-19.65388, -53.69834, -62.25089]
},
"0.9583": {
"vector": [-26.60318, -67.42803, -66.09012]
},
"1.0": {
"vector": [-35.3251, -86.10628, -69.13573]
},
"1.0417": {
"vector": [-45.47726, -106.73784, -71.55172]
},
"1.0833": {
"vector": [-57.82789, -132.39146, -73.01751]
},
"1.125": {
"vector": [-72.39921, -162.95675, -73.13111]
},
"1.1667": {
"vector": [-89.34055, -197.99001, -72.07032]
},
"1.2083": {
"vector": [-109.12621, -239.05802, -69.27181]
},
"1.4583": {
"vector": [10, -9, 13]
},
"1.9167": {
"vector": [0, 0, -2.09375],
"easing": "easeInOutExpo"
},
"2.0833": {
"vector": [0, 0, 0],
"easing": "easeInElastic"
}
}
},
"camera": {
"rotation": {
"0.0": {
"vector": [0, 0, 0]
},
"0.3333": {
"vector": [0, 0, -2],
"easing": "easeInElastic",
"easingArgs": [2]
},
"0.4167": {
"vector": [1, 1, 1],
"easing": "linear"
},
"0.5417": {
"vector": [-0.5, -1, -1],
"easing": "linear"
},
"0.6667": {
"vector": [0.25, 0, -2],
"easing": "linear"
},
"1.1667": {
"vector": [0.59, 0, -0.82]
},
"1.625": {
"vector": [0.33, 0.67, -1.2]
},
"2.0": {
"vector": [0, 1, -1.3]
},
"2.0417": {
"vector": [-1, -2, 1],
"easing": "linear"
},
"2.125": {
"vector": [1, 1, 0.2],
"easing": "linear"
},
"2.1667": {
"vector": [0.5, -1, 0.8],
"easing": "linear"
},
"2.3333": {
"vector": [-0.125, 0, -0.5]
},
"2.5833": {
"vector": [0, 0, 0]
}
}
}
},
"sound_effects": {
"0.0": {
"effect": "taserreload"
}
}
},
"animation.taser.draw": {
"animation_length": 0.58333,
"animation_length": 0.5833,
"bones": {
"0": {
"rotation": {
@ -285,12 +381,30 @@
"vector": [0, 0, 0]
}
}
},
"camera": {
"rotation": {
"0.0": {
"vector": [0, 0, 0]
},
"0.2083": {
"vector": [0, 0, 0]
},
"0.2917": {
"vector": [0.25, -0.5, 0.5],
"easing": "easeInSine"
},
"0.4167": {
"vector": [0, 0, 0],
"easing": "easeOutSine"
}
}
}
}
},
"animation.taser.run": {
"loop": true,
"animation_length": 0.79167,
"animation_length": 0.7917,
"bones": {
"0": {
"rotation": {
@ -336,20 +450,27 @@
"easing": "easeOutSine"
}
}
},
"camera": {
"rotation": {
"0.0": {
"vector": [-0.3, -0.3, 0.3]
},
"0.2083": {
"vector": [0.3, 0, -0.3]
},
"0.4167": {
"vector": [-0.3, 0.3, 0.3]
},
"0.5833": {
"vector": [0.3, 0, -0.3]
},
"0.7917": {
"vector": [-0.3, -0.3, 0.3]
}
}
}
}
},
"animation.taser.fire2": {
"animation_length": 0.04167
},
"animation.taser.fire3": {
"animation_length": 0.04167
},
"animation.taser.fire4": {
"animation_length": 0.04167
},
"animation.taser.fire5": {
"animation_length": 0.04167
}
},
"geckolib_format_version": 2

View file

@ -11,6 +11,10 @@
"visible_bounds_offset": [0, 0.5, 0]
},
"bones": [
{
"name": "camera",
"pivot": [2.27141, 4.01276, 9.57702]
},
{
"name": "root",
"pivot": [0, -1, -1]
@ -35,34 +39,9 @@
"parent": "bone",
"pivot": [0, 0, 0]
},
{
"name": "Righthand",
"parent": "0",
"pivot": [-2.4, -2.9, 11.5],
"rotation": [83.35832, -7.15102, 2.26708],
"cubes": [
{
"origin": [-4.4, -2.9, 9.5],
"size": [4, 12, 4],
"uv": {
"north": {"uv": [1.25, 30], "uv_size": [-1.25, 2]},
"east": {"uv": [1.25, 30], "uv_size": [-1.25, 2]},
"south": {"uv": [1.25, 30], "uv_size": [-1.25, 2]},
"west": {"uv": [1.25, 30], "uv_size": [-1.25, 2]},
"up": {"uv": [0, 32], "uv_size": [1.25, -2]},
"down": {"uv": [0, 32], "uv_size": [1.25, -2]}
}
}
]
},
{
"name": "gun",
"parent": "0",
"pivot": [-0.00238, 0.35352, 0.03753]
},
{
"name": "head",
"parent": "gun",
"parent": "0",
"pivot": [0, 0.32257, -5.37042],
"cubes": [
{
@ -185,9 +164,29 @@
}
]
},
{
"name": "Righthand",
"parent": "0",
"pivot": [-2.4, -2.9, 11.5],
"rotation": [83.35832, -7.15102, 2.26708],
"cubes": [
{
"origin": [-4.4, -2.9, 9.5],
"size": [4, 12, 4],
"uv": {
"north": {"uv": [1.25, 30], "uv_size": [-1.25, 2]},
"east": {"uv": [1.25, 30], "uv_size": [-1.25, 2]},
"south": {"uv": [1.25, 30], "uv_size": [-1.25, 2]},
"west": {"uv": [1.25, 30], "uv_size": [-1.25, 2]},
"up": {"uv": [0, 32], "uv_size": [1.25, -2]},
"down": {"uv": [0, 32], "uv_size": [1.25, -2]}
}
}
]
},
{
"name": "Lefthand",
"parent": "head",
"parent": "0",
"pivot": [2, -6.3, 10],
"rotation": [72.10193, 11.91276, -3.81397],
"cubes": [
@ -205,6 +204,11 @@
}
]
},
{
"name": "gun",
"parent": "0",
"pivot": [-0.00238, 0.35352, 0.03753]
},
{
"name": "bone2",
"parent": "gun",

View file

@ -23,9 +23,9 @@
},
"firstperson_righthand": {
"translation": [
1.5,
-4,
-22.75
-1.75,
-4.75,
-20.75
],
"scale": [
4,
@ -34,20 +34,10 @@
]
},
"firstperson_lefthand": {
"rotation": [
90,
45,
-90
],
"translation": [
0.5,
-0.5,
0
],
"scale": [
0,
0,
0
-5.75,
4.25,
2
]
},
"gui": {
@ -62,9 +52,9 @@
0
],
"scale": [
0,
0,
0
1.5,
1.5,
1.5
]
},
"head": {