diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/ICustomKnockback.java b/src/main/java/com/atsuishio/superbwarfare/entity/ICustomKnockback.java index cec15480c..a2fb4e274 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/ICustomKnockback.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/ICustomKnockback.java @@ -5,7 +5,6 @@ import net.minecraft.world.entity.LivingEntity; /** * Codes Based On @TACZ */ -// TODO ????? public interface ICustomKnockback { static ICustomKnockback getInstance(LivingEntity entity) { diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java index e93c2d5e4..8f90d0483 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java @@ -4,6 +4,7 @@ import com.atsuishio.superbwarfare.block.BarbedWireBlock; import com.atsuishio.superbwarfare.component.ModDataComponents; import com.atsuishio.superbwarfare.config.server.MiscConfig; import com.atsuishio.superbwarfare.config.server.ProjectileConfig; +import com.atsuishio.superbwarfare.entity.ICustomKnockback; import com.atsuishio.superbwarfare.entity.TargetEntity; import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.init.*; @@ -573,10 +574,10 @@ public class ProjectileEntity extends Projectile implements IEntityWithComplexSp living.addDeltaMovement(vec3.scale(knockback)); performDamage(entity, damage, headshot); } else { -// ICustomKnockback iCustomKnockback = ICustomKnockback.getInstance(living); -// iCustomKnockback.superbWarfare$setKnockbackStrength(knockback); + ICustomKnockback iCustomKnockback = ICustomKnockback.getInstance(living); + iCustomKnockback.superbWarfare$setKnockbackStrength(knockback); performDamage(entity, damage, headshot); -// iCustomKnockback.superbWarfare$resetKnockbackStrength(); + iCustomKnockback.superbWarfare$resetKnockbackStrength(); } } else { performDamage(entity, damage, headshot); diff --git a/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java b/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java index 9f7ce3c33..89aa1fc12 100644 --- a/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java @@ -5,6 +5,7 @@ import com.atsuishio.superbwarfare.capability.player.PlayerVariable; import com.atsuishio.superbwarfare.config.common.GameplayConfig; import com.atsuishio.superbwarfare.config.server.MiscConfig; import com.atsuishio.superbwarfare.config.server.VehicleConfig; +import com.atsuishio.superbwarfare.entity.ICustomKnockback; import com.atsuishio.superbwarfare.entity.TargetEntity; import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity; import com.atsuishio.superbwarfare.entity.vehicle.LaserTowerEntity; @@ -302,14 +303,10 @@ public class LivingEventHandler { } if (!sourceEntity.level().isClientSide() && sourceEntity instanceof ServerPlayer player) { - // TODO pre kill event - if (false -// NeoForge.EVENT_BUS.post( -// new PreKillEvent.Indicator(player, source, event.getEntity()) -// ) - ) { - return; - } + // TODO 判断 pre kill event 结果 +// if (NeoForge.EVENT_BUS.post(new PreKillEvent.Indicator(player, source, event.getEntity()))) { +// return; +// } SoundTool.playLocalSound(player, ModSounds.TARGET_DOWN.get(), 3f, 1f); PacketDistributor.sendToPlayer(player, new ClientIndicatorMessage(2, 8)); @@ -843,10 +840,10 @@ public class LivingEventHandler { @SubscribeEvent public static void onKnockback(LivingKnockBackEvent event) { -// ICustomKnockback knockback = ICustomKnockback.getInstance(event.getEntity()); -// if (knockback.superbWarfare$getKnockbackStrength() >= 0) { -// event.setStrength((float) knockback.superbWarfare$getKnockbackStrength()); -// } + ICustomKnockback knockback = ICustomKnockback.getInstance(event.getEntity()); + if (knockback.superbWarfare$getKnockbackStrength() >= 0) { + event.setStrength((float) knockback.superbWarfare$getKnockbackStrength()); + } } @SubscribeEvent diff --git a/src/main/java/com/atsuishio/superbwarfare/mixins/CameraMixin.java b/src/main/java/com/atsuishio/superbwarfare/mixins/CameraMixin.java index 15d7e42ad..5920f5bdb 100644 --- a/src/main/java/com/atsuishio/superbwarfare/mixins/CameraMixin.java +++ b/src/main/java/com/atsuishio/superbwarfare/mixins/CameraMixin.java @@ -148,7 +148,6 @@ public abstract class CameraMixin { return transform.transform(new Vector4f(x, y, z, 1)); } - // TODO camera mixin, maybe use CalculateDetachedCameraDistanceEvent instead? @Inject(method = "setup", at = @At("TAIL")) public void superbWarfare$setup(BlockGetter area, Entity entity, boolean thirdPerson, boolean inverseView, float tickDelta, CallbackInfo ci) { if (Minecraft.getInstance().options.getCameraType() == CameraType.THIRD_PERSON_BACK diff --git a/src/main/java/com/atsuishio/superbwarfare/mixins/MinecraftMixin.java b/src/main/java/com/atsuishio/superbwarfare/mixins/MinecraftMixin.java index c86395acd..f77cf7fb0 100644 --- a/src/main/java/com/atsuishio/superbwarfare/mixins/MinecraftMixin.java +++ b/src/main/java/com/atsuishio/superbwarfare/mixins/MinecraftMixin.java @@ -70,7 +70,7 @@ public class MinecraftMixin { if (!options.keyShift.isDown() && weaponVehicle.hasWeapon(seatIndex) && weaponVehicle.getWeaponIndex(seatIndex) != index) { - PacketDistributor.sendToServer(new SwitchVehicleWeaponMessage(seatIndex, index, true)); + PacketDistributor.sendToServer(new SwitchVehicleWeaponMessage(seatIndex, index, false)); } } } diff --git a/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java b/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java index bbb3aaf19..adacd3ce0 100644 --- a/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java +++ b/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java @@ -9,12 +9,14 @@ import org.spongepowered.asm.mixin.Mixin; @Mixin(MouseHandler.class) public class MouseHandlerMixin { - private static double x; - private static double y; +// @Unique +// private static double sbw121$x; +// @Unique +// private static double sbw121$y; - // TODO what are these??? -// @ModifyVariable(method = "turnPlayer()V", at = @At(value = "STORE", opcode = Opcodes.DSTORE), ordinal = 5) -// private double modifyD2(double d) { + // TODO 正确实现视角计算 +// @ModifyVariable(method = "turnPlayer(D)V", at = @At(value = "STORE", opcode = Opcodes.DSTORE), ordinal = 3) +// private double modifyD0(double d) { // Minecraft mc = Minecraft.getInstance(); // Player player = mc.player; // @@ -22,7 +24,7 @@ public class MouseHandlerMixin { // if (mc.options.getCameraType() != CameraType.FIRST_PERSON) return d; // // if (player.getVehicle() instanceof VehicleEntity vehicle) { -// x = d; +// sbw121$x = d; // // double i = 0; // @@ -36,13 +38,13 @@ public class MouseHandlerMixin { // i *= (1 - (Mth.abs(vehicle.getRoll()) - 90) / 90); // } // -// return (1 - (Mth.abs(vehicle.getRoll()) / 90)) * d + ((Mth.abs(vehicle.getRoll()) / 90)) * y * i; +// return (1 - (Mth.abs(vehicle.getRoll()) / 90)) * d + ((Mth.abs(vehicle.getRoll()) / 90)) * sbw121$y * i; // } // return d; // } // -// @ModifyVariable(method = "turnPlayer()V", at = @At(value = "STORE", opcode = Opcodes.DSTORE), ordinal = 6) -// private double modifyD3(double d) { +// @ModifyVariable(method = "turnPlayer(D)V", at = @At(value = "STORE", opcode = Opcodes.DSTORE), ordinal = 4) +// private double modifyD1(double d) { // Minecraft mc = Minecraft.getInstance(); // Player player = mc.player; // @@ -50,8 +52,8 @@ public class MouseHandlerMixin { // if (mc.options.getCameraType() != CameraType.FIRST_PERSON) return d; // // if (player.getVehicle() instanceof VehicleEntity vehicle) { -// y = d; -// return (1 - (Mth.abs(vehicle.getRoll()) / 90)) * d + ((Mth.abs(vehicle.getRoll()) / 90)) * x * (vehicle.getRoll() < 0 ? -1 : 1); +// sbw121$y = d; +// return (1 - (Mth.abs(vehicle.getRoll()) / 90)) * d + ((Mth.abs(vehicle.getRoll()) / 90)) * sbw121$x * (vehicle.getRoll() < 0 ? -1 : 1); // } // // return d; diff --git a/src/main/templates/META-INF/neoforge.mods.toml b/src/main/templates/META-INF/neoforge.mods.toml index 07b6e5405..9f97d5192 100644 --- a/src/main/templates/META-INF/neoforge.mods.toml +++ b/src/main/templates/META-INF/neoforge.mods.toml @@ -11,6 +11,9 @@ logoFile = "../../resources/logo.png" description = "${mod_description}" enumExtensions = "META-INF/enumextensions.json" +[[mixins]] +config = "mixins.superbwarfare.json" + [[dependencies.superbwarfare]] modId = "neoforge" #mandatory mandatory = true #mandatory