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