修复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
|
||||
*/
|
||||
// TODO ?????
|
||||
public interface ICustomKnockback {
|
||||
|
||||
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.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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue