移除多余键位绑定和伤害类型,修复载具撞击C
This commit is contained in:
parent
1ca260e231
commit
adc202a288
10 changed files with 14 additions and 36 deletions
|
@ -218,9 +218,6 @@ public class ClickHandler {
|
|||
ClientEventHandler.holdFire = false;
|
||||
ModUtils.PACKET_HANDLER.sendToServer(new EditModeMessage(0));
|
||||
}
|
||||
if (key == ModKeyMappings.LAUNCH.getKey().getValue()) {
|
||||
handleLaunchPress(player);
|
||||
}
|
||||
|
||||
if (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).edit) {
|
||||
if (!(stack.getItem() instanceof GunItem gunItem)) return;
|
||||
|
@ -473,11 +470,4 @@ public class ClickHandler {
|
|||
}
|
||||
ModUtils.PACKET_HANDLER.sendToServer(new PlayerStopRidingMessage(0));
|
||||
}
|
||||
|
||||
private static void handleLaunchPress(Player player) {
|
||||
ItemStack item = player.getMainHandItem();
|
||||
if (item.is(ModItems.C4_BOMB.get())) {
|
||||
item.use(player.level(),player,player.getUsedItemHand());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -268,9 +268,7 @@ public class KillMessageOverlay {
|
|||
icon = BEAST;
|
||||
} else if (record.damageType == ModDamageTypes.MINE) {
|
||||
icon = CLAYMORE;
|
||||
} else if (record.damageType == ModDamageTypes.C4) {
|
||||
icon = EXPLOSION;
|
||||
} else if (record.damageType == ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation("dreamaticvoyage", "bleeding"))) {
|
||||
} else if (record.damageType == ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation("dreamaticvoyage", "bleeding"))) {
|
||||
icon = BLEEDING;
|
||||
} else if (record.damageType == ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation("dreamaticvoyage", "blood_crystal"))) {
|
||||
icon = BLOOD_CRYSTAL;
|
||||
|
|
|
@ -270,11 +270,12 @@ public class C4Entity extends Entity implements GeoEntity, AnimatedEntity, Ownab
|
|||
}
|
||||
|
||||
private void triggerExplode(Entity target) {
|
||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||
ModDamageTypes.causeC4Damage(this.level().registryAccess(), this.getOwner()), ExplosionConfig.C4_EXPLOSION_DAMAGE.get(),
|
||||
CustomExplosion explosion = new CustomExplosion(level(), this,
|
||||
ModDamageTypes.causeProjectileBoomDamage(level().registryAccess(), getOwner(), getOwner()), ExplosionConfig.C4_EXPLOSION_DAMAGE.get(),
|
||||
target.getX(), target.getY(), target.getZ(), ExplosionConfig.C4_EXPLOSION_RADIUS.get(), ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
||||
explosion.explode();
|
||||
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(level(), explosion);
|
||||
ParticleTool.spawnHugeExplosionParticles(level(),position());
|
||||
explosion.finalizeExplosion(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,9 @@ package com.atsuishio.superbwarfare.entity;
|
|||
|
||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||
import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.FlareDecoyEntity;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.LaserEntity;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.RgoGrenadeEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.MobileVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||
|
@ -31,11 +34,13 @@ import net.minecraft.world.InteractionHand;
|
|||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.damagesource.DamageTypes;
|
||||
import net.minecraft.world.entity.AreaEffectCloud;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MoverType;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.projectile.Projectile;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
@ -460,7 +465,8 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
|
|||
var level = this.level();
|
||||
final Vec3 center = new Vec3(this.getX(), this.getY(), this.getZ());
|
||||
for (Entity target : level.getEntitiesOfClass(Entity.class, aabb, e -> true).stream().sorted(Comparator.comparingDouble(e -> e.distanceToSqr(center))).toList()) {
|
||||
if (this != target && target != null && !(target instanceof RgoGrenadeEntity)) {
|
||||
if (this != target && target != null
|
||||
&& !(target instanceof ItemEntity || target instanceof Projectile || target instanceof ProjectileEntity || target instanceof LaserEntity || target instanceof FlareDecoyEntity || target instanceof AreaEffectCloud || target instanceof C4Entity)) {
|
||||
hitEntityCrash(controller, target);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.atsuishio.superbwarfare.entity.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.entity.C4Entity;
|
||||
import com.atsuishio.superbwarfare.entity.DroneEntity;
|
||||
import com.atsuishio.superbwarfare.entity.TargetEntity;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.FlareDecoyEntity;
|
||||
|
@ -164,7 +165,7 @@ public class MobileVehicleEntity extends EnergyVehicleEntity {
|
|||
var entities = level().getEntities(EntityTypeTest.forClass(Entity.class), frontBox,
|
||||
entity -> entity != this && entity != getFirstPassenger() && entity.getVehicle() == null)
|
||||
.stream().filter(entity -> entity.isAlive()
|
||||
&& !(entity instanceof ItemEntity || entity instanceof Projectile || entity instanceof ProjectileEntity || entity instanceof LaserEntity || entity instanceof FlareDecoyEntity || entity instanceof AreaEffectCloud)
|
||||
&& !(entity instanceof ItemEntity || entity instanceof Projectile || entity instanceof ProjectileEntity || entity instanceof LaserEntity || entity instanceof FlareDecoyEntity || entity instanceof AreaEffectCloud || entity instanceof C4Entity)
|
||||
&& !(entity instanceof Player player && (player.isSpectator() || player.isCreative())))
|
||||
.toList();
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ public class ModDamageTypes {
|
|||
public static final ResourceKey<DamageType> GUN_FIRE_HEADSHOT_ABSOLUTE = ResourceKey.create(Registries.DAMAGE_TYPE, ModUtils.loc("gunfire_headshot_absolute"));
|
||||
public static final ResourceKey<DamageType> BURN = ResourceKey.create(Registries.DAMAGE_TYPE, ModUtils.loc("burn"));
|
||||
public static final ResourceKey<DamageType> MINE = ResourceKey.create(Registries.DAMAGE_TYPE, ModUtils.loc("mine"));
|
||||
public static final ResourceKey<DamageType> C4 = ResourceKey.create(Registries.DAMAGE_TYPE, ModUtils.loc("c4"));
|
||||
public static final ResourceKey<DamageType> BEAST = ResourceKey.create(Registries.DAMAGE_TYPE, ModUtils.loc("beast"));
|
||||
public static final ResourceKey<DamageType> SHOCK = ResourceKey.create(Registries.DAMAGE_TYPE, ModUtils.loc("shock"));
|
||||
public static final ResourceKey<DamageType> PROJECTILE_BOOM = ResourceKey.create(Registries.DAMAGE_TYPE, ModUtils.loc("projectile_boom"));
|
||||
|
@ -48,10 +47,6 @@ public class ModDamageTypes {
|
|||
return new DamageMessages(registryAccess.registry(Registries.DAMAGE_TYPE).get().getHolderOrThrow(MINE), entity);
|
||||
}
|
||||
|
||||
public static DamageSource causeC4Damage(RegistryAccess registryAccess, @Nullable Entity entity) {
|
||||
return new DamageMessages(registryAccess.registry(Registries.DAMAGE_TYPE).get().getHolderOrThrow(C4), entity);
|
||||
}
|
||||
|
||||
public static DamageSource causeShockDamage(RegistryAccess registryAccess, @Nullable Entity attacker) {
|
||||
return new DamageMessages(registryAccess.registry(Registries.DAMAGE_TYPE).get().getHolderOrThrow(SHOCK), attacker);
|
||||
}
|
||||
|
|
|
@ -55,7 +55,6 @@ public class ModKeyMappings {
|
|||
public static final KeyMapping SWITCH_ZOOM = new KeyMapping("key.superbwarfare.switch_zoom", GLFW.GLFW_KEY_UNKNOWN, "key.categories.superbwarfare");
|
||||
public static final KeyMapping RELEASE_DECOY = new KeyMapping("key.superbwarfare.release_decoy", GLFW.GLFW_KEY_X, "key.categories.superbwarfare");
|
||||
public static final KeyMapping MELEE = new KeyMapping("key.superbwarfare.melee", GLFW.GLFW_KEY_V, "key.categories.superbwarfare");
|
||||
public static final KeyMapping LAUNCH = new KeyMapping("key.superbwarfare.launch", GLFW.GLFW_KEY_H, "key.categories.superbwarfare");
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerKeyMappings(RegisterKeyMappingsEvent event) {
|
||||
|
@ -78,7 +77,6 @@ public class ModKeyMappings {
|
|||
event.register(SWITCH_ZOOM);
|
||||
event.register(RELEASE_DECOY);
|
||||
event.register(MELEE);
|
||||
event.register(LAUNCH);
|
||||
}
|
||||
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT)
|
||||
|
|
|
@ -340,9 +340,6 @@
|
|||
"death.attack.mine": "%1$s step on Claymore",
|
||||
"death.attack.mine.entity": "%1$s step on %2$s's Claymore",
|
||||
"death.attack.mine.item": "%1$s step on %2$s's Claymore",
|
||||
"death.attack.c4": "%1$s gasified",
|
||||
"death.attack.c4.entity": "%1$s was killed by %2$s's C4",
|
||||
"death.attack.c4.item": "%1$s was killed by %2$s's C4",
|
||||
"death.attack.shock": "%1$s was shocked",
|
||||
"death.attack.shock.entity": "%1$s was shocked by %2$s",
|
||||
"death.attack.shock.item": "%1$s was shocked by %2$s",
|
||||
|
|
|
@ -338,9 +338,6 @@
|
|||
"death.attack.mine": "%1$s不慎踩到了阔剑地雷",
|
||||
"death.attack.mine.entity": "%1$s踩到了%2$s的阔剑地雷",
|
||||
"death.attack.mine.item": "%1$s踩到了%2$s的阔剑地雷",
|
||||
"death.attack.c4": "%1$s蒸发了",
|
||||
"death.attack.c4.entity": "%1$s被%2$s的C4炸死了",
|
||||
"death.attack.c4.item": "%1$s被%2$s的C4炸死了",
|
||||
"death.attack.shock": "%1$s被电麻了",
|
||||
"death.attack.shock.entity": "%1$s被%2$s电麻了",
|
||||
"death.attack.shock.item": "%1$s被%2$s电麻了",
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"exhaustion": 0,
|
||||
"message_id": "c4",
|
||||
"scaling": "never"
|
||||
}
|
Loading…
Add table
Reference in a new issue