完善“滋崩”,添加激光伤害类型

This commit is contained in:
Atsuihsio 2024-12-02 20:57:55 +08:00
parent 256b235fc0
commit c2b3f29e7b
33 changed files with 146 additions and 49 deletions

View file

@ -1,10 +1,11 @@
// 1.20.1 2024-11-28T22:29:47.24523 Item Models: superbwarfare // 1.20.1 2024-12-02T20:47:31.4312883 Item Models: superbwarfare
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/aa_12_blueprint.json 13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/aa_12_blueprint.json
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/ak_12_blueprint.json 13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/ak_12_blueprint.json
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/ak_47_blueprint.json 13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/ak_47_blueprint.json
c993bddc0db9453ffbefa59f9ac9a74dba909038 assets/superbwarfare/models/item/ancient_cpu.json c993bddc0db9453ffbefa59f9ac9a74dba909038 assets/superbwarfare/models/item/ancient_cpu.json
4b8fe8fbe5e64c3449ad539317254e4ed7188411 assets/superbwarfare/models/item/ap_head.json 4b8fe8fbe5e64c3449ad539317254e4ed7188411 assets/superbwarfare/models/item/ap_head.json
984c08ca6f6893a15721a85e30118f9e32c65c7f assets/superbwarfare/models/item/barbed_wire.json 984c08ca6f6893a15721a85e30118f9e32c65c7f assets/superbwarfare/models/item/barbed_wire.json
e8f16946c6f9429989d05e9ec250a72ffc64f9e1 assets/superbwarfare/models/item/beam_test.json
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/bocek_blueprint.json 13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/bocek_blueprint.json
140e04e98d9d1c0ee790ca43cb28ad549900ab44 assets/superbwarfare/models/item/cannon_core.json 140e04e98d9d1c0ee790ca43cb28ad549900ab44 assets/superbwarfare/models/item/cannon_core.json
1e5b4637c3787516305dd3d1598f401a5e78a954 assets/superbwarfare/models/item/cemented_carbide_action.json 1e5b4637c3787516305dd3d1598f401a5e78a954 assets/superbwarfare/models/item/cemented_carbide_action.json

View file

@ -1,3 +1,3 @@
// 1.20.1 2024-09-29T01:21:56.4071846 Tags for minecraft:damage_type mod id superbwarfare // 1.20.1 2024-12-02T20:47:31.4302884 Tags for minecraft:damage_type mod id superbwarfare
ef5293b64057e0650bbb5976246839665f10a0fb data/superbwarfare/tags/damage_type/projectile.json ddb620a872e399a1733001853474cf0b7eb9dc88 data/superbwarfare/tags/damage_type/projectile.json
91f6543d0bd595a1d2b5a74872daed295650ab32 data/superbwarfare/tags/damage_type/projectile_absolute.json a14ba1399ece410382dce60dda85902fdd87bf23 data/superbwarfare/tags/damage_type/projectile_absolute.json

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "superbwarfare:item/beam_test"
}
}

View file

@ -12,6 +12,26 @@
{ {
"id": "tacz:bullet_void", "id": "tacz:bullet_void",
"required": false "required": false
},
{
"id": "virtuarealcraft:rain_crystal",
"required": false
},
{
"id": "virtuarealcraft:rain_shower_butterfly",
"required": false
},
{
"id": "virtuarealcraft:sparkle_butterfly",
"required": false
},
{
"id": "dreamaticvoyage:blood_crystal",
"required": false
},
{
"id": "dreamaticvoyage:leviy_beam",
"required": false
} }
] ]
} }

View file

@ -9,6 +9,10 @@
{ {
"id": "tacz:bullet_void_ignore_armor", "id": "tacz:bullet_void_ignore_armor",
"required": false "required": false
},
{
"id": "dreamaticvoyage:leviy_beam_absolute",
"required": false
} }
] ]
} }

View file

@ -51,7 +51,7 @@ public class LaserEntityRenderer extends AbstractLaserEntityRenderer<LaserEntity
float minV = 0; float minV = 0;
float maxU = minU + 16F / TEXTURE_WIDTH; float maxU = minU + 16F / TEXTURE_WIDTH;
float maxV = minV + 16F / TEXTURE_HEIGHT; float maxV = minV + 16F / TEXTURE_HEIGHT;
float size = 0.8f; float size = 0.25f;
PoseStack.Pose matrix$stack$entry = matrixStackIn.last(); PoseStack.Pose matrix$stack$entry = matrixStackIn.last();
Matrix4f matrix4f = matrix$stack$entry.pose(); Matrix4f matrix4f = matrix$stack$entry.pose();
Matrix3f matrix3f = matrix$stack$entry.normal(); Matrix3f matrix3f = matrix$stack$entry.normal();
@ -77,7 +77,7 @@ public class LaserEntityRenderer extends AbstractLaserEntityRenderer<LaserEntity
Matrix4f matrix4f = matrix$stack$entry.pose(); Matrix4f matrix4f = matrix$stack$entry.pose();
Matrix3f matrix3f = matrix$stack$entry.normal(); Matrix3f matrix3f = matrix$stack$entry.normal();
float offset = playerView ? -1 : 0; float offset = playerView ? -1 : 0;
float size = 0.6f; float size = 0.2f;
drawVertex(matrix4f, matrix3f, builder, -size, offset, 0, minU, minV, packedLightIn); drawVertex(matrix4f, matrix3f, builder, -size, offset, 0, minU, minV, packedLightIn);
drawVertex(matrix4f, matrix3f, builder, -size, length, 0, minU, maxV, packedLightIn); drawVertex(matrix4f, matrix3f, builder, -size, length, 0, minU, maxV, packedLightIn);
drawVertex(matrix4f, matrix3f, builder, size, length, 0, maxU, maxV, packedLightIn); drawVertex(matrix4f, matrix3f, builder, size, length, 0, maxU, maxV, packedLightIn);

View file

@ -43,6 +43,7 @@ public class KillMessageOverlay {
private static final ResourceLocation BLOOD_CRYSTAL = ModUtils.loc("textures/screens/damage_types/blood_crystal.png"); private static final ResourceLocation BLOOD_CRYSTAL = ModUtils.loc("textures/screens/damage_types/blood_crystal.png");
private static final ResourceLocation BURN = ModUtils.loc("textures/screens/damage_types/burn.png"); private static final ResourceLocation BURN = ModUtils.loc("textures/screens/damage_types/burn.png");
private static final ResourceLocation DRONE = ModUtils.loc("textures/screens/damage_types/drone.png"); private static final ResourceLocation DRONE = ModUtils.loc("textures/screens/damage_types/drone.png");
private static final ResourceLocation LASER = ModUtils.loc("textures/screens/damage_types/laser.png");
private static final ResourceLocation WORLD_PEACE_STAFF = ModUtils.loc("textures/gun_icon/compat/world_peace_staff.png"); private static final ResourceLocation WORLD_PEACE_STAFF = ModUtils.loc("textures/gun_icon/compat/world_peace_staff.png");
@ -275,7 +276,9 @@ public class KillMessageOverlay {
icon = BURN; icon = BURN;
} else if (record.damageType == ModDamageTypes.DRONE_HIT) { } else if (record.damageType == ModDamageTypes.DRONE_HIT) {
icon = DRONE; icon = DRONE;
}else { } else if (record.damageType == ModDamageTypes.LASER) {
icon = LASER;
} else {
icon = GENERIC; icon = GENERIC;
} }
} }

View file

@ -63,6 +63,7 @@ public class ModItemModelProvider extends ItemModelProvider {
simpleItem(ModItems.SILVER_INGOT); simpleItem(ModItems.SILVER_INGOT);
simpleItem(ModItems.CROWBAR); simpleItem(ModItems.CROWBAR);
simpleItem(ModItems.FIRING_PARAMETERS); simpleItem(ModItems.FIRING_PARAMETERS);
simpleItem(ModItems.BEAM_TEST);
simpleItem(ModItems.TUNGSTEN_ROD); simpleItem(ModItems.TUNGSTEN_ROD);
simpleItem(ModItems.IRON_BARREL); simpleItem(ModItems.IRON_BARREL);

View file

@ -246,25 +246,10 @@ public class DroneEntity extends LivingEntity implements GeoEntity {
if (controller != null) { if (controller != null) {
ItemStack stack = controller.getMainHandItem(); ItemStack stack = controller.getMainHandItem();
if (stack.getOrCreateTag().getBoolean("Using") && controller instanceof ServerPlayer serverPlayer) { if (stack.getOrCreateTag().getBoolean("Using") && controller instanceof ServerPlayer serverPlayer) {
SoundTool.playLocalSound(serverPlayer, ModSounds.DRONE_SOUND.get(), 100, 1); SoundTool.playLocalSound(serverPlayer, ModSounds.DRONE_SOUND.get(), 4, 1);
} }
controller.setYRot(controller.getYRot() - 5 * this.entityData.get(ROT_X) * Mth.abs(this.entityData.get(MOVE_Z))); controller.setYRot(controller.getYRot() - 5 * this.entityData.get(ROT_X) * Mth.abs(this.entityData.get(MOVE_Z)));
} }
float f = 0.7f;
AABB aabb = AABB.ofSize(this.getEyePosition(), f, 0.3, f);
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 instanceof LivingEntity) {
target.hurt(ModDamageTypes.causeDroneHitDamage(this.level().registryAccess(), this, controller), 1);
target.invulnerableTime = 0;
if (target instanceof Mob mobEntity) {
mobEntity.setTarget(this);
}
this.hurt(new DamageSource(level().registryAccess().registryOrThrow(Registries.DAMAGE_TYPE).getHolderOrThrow(DamageTypes.EXPLOSION), Objects.requireNonNullElse(controller, this)), 1);
}
}
} }
if (this.isInWater()) { if (this.isInWater()) {

View file

@ -72,8 +72,7 @@ public class LaserEntity extends AbstractLaserEntity {
@Override @Override
public boolean shouldRenderAtSqrDistance(double distance) { public boolean shouldRenderAtSqrDistance(double distance) {
double radius = RADIUS; return true;
return distance < (radius * radius) * 2;
} }
private void updateWithPlayer() { private void updateWithPlayer() {

View file

@ -368,7 +368,7 @@ public class ClientEventHandler {
&& (!player.isAlliedTo(lookingEntity) || lookingEntity.getTeam() == null || lookingEntity.getTeam().getName().equals("TDM")); && (!player.isAlliedTo(lookingEntity) || lookingEntity.getTeam() == null || lookingEntity.getTeam().getName().equals("TDM"));
if (canAttack) { if (canAttack) {
ModUtils.PACKET_HANDLER.sendToServer(new LaserShootMessage(stack.getOrCreateTag().getInt("FireTick") >= 14 ? 45 : 1, lookingEntity.getUUID())); ModUtils.PACKET_HANDLER.sendToServer(new LaserShootMessage(stack.getOrCreateTag().getInt("FireTick") >= 10 ? 45 : 1, lookingEntity.getUUID()));
} }
} }
} }
@ -622,11 +622,11 @@ public class ClientEventHandler {
shakeRadiusAmplitude = (float) Mth.clamp(1 - player.position().distanceTo(new Vec3(shakePos[0], shakePos[1], shakePos[2])) / shakeRadius, 0, 1); shakeRadiusAmplitude = (float) Mth.clamp(1 - player.position().distanceTo(new Vec3(shakePos[0], shakePos[1], shakePos[2])) / shakeRadius, 0, 1);
if (shakeType > 0) { if (shakeType > 0) {
event.setYaw((float) (yaw + (shakeTime * Math.sin(0.5 * Math.PI * shakeTime) * shakeAmplitude * shakeRadiusAmplitude * 0.75 * shakeType))); event.setYaw((float) (yaw + (shakeTime * Math.sin(0.5 * Math.PI * shakeTime) * shakeAmplitude * shakeRadiusAmplitude * shakeType)));
event.setPitch((float) (pitch - (shakeTime * Math.sin(0.5 * Math.PI * shakeTime) * shakeAmplitude * shakeRadiusAmplitude * shakeType))); event.setPitch((float) (pitch - (shakeTime * Math.sin(0.5 * Math.PI * shakeTime) * shakeAmplitude * shakeRadiusAmplitude * shakeType)));
event.setRoll((float) (roll - (shakeTime * Math.sin(0.5 * Math.PI * shakeTime) * shakeAmplitude * shakeRadiusAmplitude))); event.setRoll((float) (roll - (shakeTime * Math.sin(0.5 * Math.PI * shakeTime) * shakeAmplitude * shakeRadiusAmplitude)));
} else { } else {
event.setYaw((float) (yaw - (shakeTime * Math.sin(0.5 * Math.PI * shakeTime) * shakeAmplitude * shakeRadiusAmplitude * 0.75 * shakeType))); event.setYaw((float) (yaw - (shakeTime * Math.sin(0.5 * Math.PI * shakeTime) * shakeAmplitude * shakeRadiusAmplitude * shakeType)));
event.setPitch((float) (pitch + (shakeTime * Math.sin(0.5 * Math.PI * shakeTime) * shakeAmplitude * shakeRadiusAmplitude * shakeType))); event.setPitch((float) (pitch + (shakeTime * Math.sin(0.5 * Math.PI * shakeTime) * shakeAmplitude * shakeRadiusAmplitude * shakeType)));
event.setRoll((float) (roll + (shakeTime * Math.sin(0.5 * Math.PI * shakeTime) * shakeAmplitude * shakeRadiusAmplitude))); event.setRoll((float) (roll + (shakeTime * Math.sin(0.5 * Math.PI * shakeTime) * shakeAmplitude * shakeRadiusAmplitude)));
} }

View file

@ -28,6 +28,7 @@ public class ModDamageTypes {
public static final ResourceKey<DamageType> CANNON_FIRE = ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(ModUtils.MODID, "cannon_fire")); public static final ResourceKey<DamageType> CANNON_FIRE = ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(ModUtils.MODID, "cannon_fire"));
public static final ResourceKey<DamageType> CUSTOM_EXPLOSION = ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(ModUtils.MODID, "custom_explosion")); public static final ResourceKey<DamageType> CUSTOM_EXPLOSION = ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(ModUtils.MODID, "custom_explosion"));
public static final ResourceKey<DamageType> DRONE_HIT = ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(ModUtils.MODID, "drone_hit")); public static final ResourceKey<DamageType> DRONE_HIT = ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(ModUtils.MODID, "drone_hit"));
public static final ResourceKey<DamageType> LASER = ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(ModUtils.MODID, "laser"));
public static DamageSource causeGunFireDamage(RegistryAccess registryAccess, @Nullable Entity directEntity, @Nullable Entity attacker) { public static DamageSource causeGunFireDamage(RegistryAccess registryAccess, @Nullable Entity directEntity, @Nullable Entity attacker) {
return new DamageMessages(registryAccess.registry(Registries.DAMAGE_TYPE).get().getHolderOrThrow(GUN_FIRE), directEntity, attacker); return new DamageMessages(registryAccess.registry(Registries.DAMAGE_TYPE).get().getHolderOrThrow(GUN_FIRE), directEntity, attacker);
@ -73,6 +74,10 @@ public class ModDamageTypes {
return new DamageMessages(registryAccess.registry(Registries.DAMAGE_TYPE).get().getHolderOrThrow(DRONE_HIT), directEntity, attacker); return new DamageMessages(registryAccess.registry(Registries.DAMAGE_TYPE).get().getHolderOrThrow(DRONE_HIT), directEntity, attacker);
} }
public static DamageSource causeLaserDamage(RegistryAccess registryAccess, @Nullable Entity directEntity, @Nullable Entity attacker) {
return new DamageMessages(registryAccess.registry(Registries.DAMAGE_TYPE).get().getHolderOrThrow(LASER), directEntity, attacker);
}
private static class DamageMessages extends DamageSource { private static class DamageMessages extends DamageSource {
public DamageMessages(Holder.Reference<DamageType> typeReference) { public DamageMessages(Holder.Reference<DamageType> typeReference) {
super(typeReference); super(typeReference);

View file

@ -331,4 +331,7 @@ public class ModSounds {
public static final RegistryObject<SoundEvent> SHELL_CASING_50CAL = REGISTRY.register("shell_casing_50cal", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ModUtils.MODID, "shell_casing_50cal"))); public static final RegistryObject<SoundEvent> SHELL_CASING_50CAL = REGISTRY.register("shell_casing_50cal", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ModUtils.MODID, "shell_casing_50cal")));
public static final RegistryObject<SoundEvent> OPEN = REGISTRY.register("open", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ModUtils.MODID, "open"))); public static final RegistryObject<SoundEvent> OPEN = REGISTRY.register("open", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ModUtils.MODID, "open")));
public static final RegistryObject<SoundEvent> CHARGE_RIFLE_FIRE_1P = REGISTRY.register("charge_rifle_fire_1p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ModUtils.MODID, "charge_rifle_fire_1p")));
public static final RegistryObject<SoundEvent> CHARGE_RIFLE_FIRE_3P = REGISTRY.register("charge_rifle_fire_3p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ModUtils.MODID, "charge_rifle_fire_3p")));
} }

View file

@ -1,11 +1,16 @@
package com.atsuishio.superbwarfare.item; package com.atsuishio.superbwarfare.item;
import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.capability.LaserCapability; import com.atsuishio.superbwarfare.capability.LaserCapability;
import com.atsuishio.superbwarfare.capability.LaserHandler; import com.atsuishio.superbwarfare.capability.LaserHandler;
import com.atsuishio.superbwarfare.capability.ModCapabilities; import com.atsuishio.superbwarfare.capability.ModCapabilities;
import com.atsuishio.superbwarfare.entity.projectile.LaserEntity; import com.atsuishio.superbwarfare.entity.projectile.LaserEntity;
import com.atsuishio.superbwarfare.init.ModSounds; import com.atsuishio.superbwarfare.init.ModSounds;
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
import net.minecraft.network.protocol.game.ClientboundStopSoundPacket;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.InteractionResultHolder;
@ -15,6 +20,10 @@ import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraftforge.network.PacketDistributor;
import net.minecraftforge.registries.ForgeRegistries;
import java.util.Set;
public class BeamTest extends Item { public class BeamTest extends Item {
@ -29,6 +38,11 @@ public class BeamTest extends Item {
player.getCapability(ModCapabilities.LASER_CAPABILITY).ifPresent(capability -> { player.getCapability(ModCapabilities.LASER_CAPABILITY).ifPresent(capability -> {
player.startUsingItem(hand); player.startUsingItem(hand);
SoundEvent sound1p = ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(ModUtils.MODID, "charge_rifle_fire_1p"));
if (sound1p != null) {
player.playSound(sound1p, 1f, 1);
}
if (!level.isClientSide) { if (!level.isClientSide) {
double px = player.getX(); double px = player.getX();
double py = player.getY() + player.getBbHeight() * 0.6F; double py = player.getY() + player.getBbHeight() * 0.6F;
@ -42,6 +56,11 @@ public class BeamTest extends Item {
if (!stack.getOrCreateTag().getBoolean("LaserFiring") && !(player.getCooldowns().isOnCooldown(stack.getItem()))) { if (!stack.getOrCreateTag().getBoolean("LaserFiring") && !(player.getCooldowns().isOnCooldown(stack.getItem()))) {
stack.getOrCreateTag().putBoolean("LaserFiring", true); stack.getOrCreateTag().putBoolean("LaserFiring", true);
} }
SoundEvent sound3p = ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(ModUtils.MODID, "charge_rifle_fire_3p"));
if (sound3p != null) {
player.playSound(sound3p, 4, 1f);
}
} }
}); });
@ -52,15 +71,8 @@ public class BeamTest extends Item {
public void inventoryTick(ItemStack stack, Level world, Entity entity, int slot, boolean selected) { public void inventoryTick(ItemStack stack, Level world, Entity entity, int slot, boolean selected) {
super.inventoryTick(stack, world, entity, slot, selected); super.inventoryTick(stack, world, entity, slot, selected);
if (stack.getOrCreateTag().getBoolean("LaserFiring")) { if (stack.getOrCreateTag().getBoolean("LaserFiring")) {
entity.playSound(ModSounds.MINIGUN_ROT.get(), 2, 1);
stack.getOrCreateTag().putInt("FireTick", stack.getOrCreateTag().getInt("FireTick") + 1); stack.getOrCreateTag().putInt("FireTick", stack.getOrCreateTag().getInt("FireTick") + 1);
} }
if (stack.getOrCreateTag().getInt("FireTick") >= 14) {
if (entity instanceof ServerPlayer serverPlayer) {
serverPlayer.level().playSound(null, serverPlayer.getOnPos(), ModSounds.SENTINEL_CHARGE_FIRE_3P.get(), SoundSource.PLAYERS, 1, 1);
}
}
} }
@Override @Override
@ -69,25 +81,44 @@ public class BeamTest extends Item {
player.getCapability(ModCapabilities.LASER_CAPABILITY).ifPresent(LaserCapability.ILaserCapability::stop); player.getCapability(ModCapabilities.LASER_CAPABILITY).ifPresent(LaserCapability.ILaserCapability::stop);
stack.getOrCreateTag().putBoolean("LaserFiring", false); stack.getOrCreateTag().putBoolean("LaserFiring", false);
stack.getOrCreateTag().putInt("FireTick", 0); stack.getOrCreateTag().putInt("FireTick", 0);
player.getCooldowns().addCooldown(stack.getItem(), 5); player.getCooldowns().addCooldown(stack.getItem(), 20);
} }
if (stack.getOrCreateTag().getInt("FireTick") < 10 && livingEntity instanceof ServerPlayer serverPlayer && stack.getItem() instanceof BeamTest beamTest) {
stopGunChargeSound(serverPlayer,beamTest);
}
super.releaseUsing(stack, level, livingEntity, timeCharged); super.releaseUsing(stack, level, livingEntity, timeCharged);
} }
private static void stopGunChargeSound(ServerPlayer player, BeamTest beamTest) {
beamTest.getChargeSound().forEach(sound -> {
var clientboundstopsoundpacket = new ClientboundStopSoundPacket(sound.getLocation(), SoundSource.PLAYERS);
player.connection.send(clientboundstopsoundpacket);
});
}
public Set<SoundEvent> getChargeSound() {
return Set.of(ModSounds.CHARGE_RIFLE_FIRE_1P.get(), ModSounds.CHARGE_RIFLE_FIRE_3P.get());
}
@Override @Override
public ItemStack finishUsingItem(ItemStack pStack, Level pLevel, LivingEntity pLivingEntity) { public ItemStack finishUsingItem(ItemStack pStack, Level pLevel, LivingEntity pLivingEntity) {
if (pLivingEntity instanceof Player player) { if (pLivingEntity instanceof Player player) {
player.getCapability(ModCapabilities.LASER_CAPABILITY).ifPresent(LaserCapability.ILaserCapability::stop); player.getCapability(ModCapabilities.LASER_CAPABILITY).ifPresent(LaserCapability.ILaserCapability::stop);
pStack.getOrCreateTag().putBoolean("LaserFiring", false); pStack.getOrCreateTag().putBoolean("LaserFiring", false);
pStack.getOrCreateTag().putInt("FireTick", 0); pStack.getOrCreateTag().putInt("FireTick", 0);
player.getCooldowns().addCooldown(pStack.getItem(), 5); if (player instanceof ServerPlayer serverPlayer) {
ModUtils.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> serverPlayer), new ShakeClientMessage(30,10,20, serverPlayer.getX(), serverPlayer.getEyeY(), serverPlayer.getZ()));
}
player.getCooldowns().addCooldown(pStack.getItem(), 20);
} }
return super.finishUsingItem(pStack, pLevel, pLivingEntity); return super.finishUsingItem(pStack, pLevel, pLivingEntity);
} }
@Override @Override
public int getUseDuration(ItemStack stack) { public int getUseDuration(ItemStack stack) {
return 15; return 11;
} }
@Override @Override

View file

@ -25,7 +25,8 @@ public class LivingEntityMixin {
private double modifyApplyKnockbackArgs(double original) { private double modifyApplyKnockbackArgs(double original) {
if (this.target$source.is(ModDamageTypes.GUN_FIRE) || this.target$source.is(ModDamageTypes.GUN_FIRE_HEADSHOT) if (this.target$source.is(ModDamageTypes.GUN_FIRE) || this.target$source.is(ModDamageTypes.GUN_FIRE_HEADSHOT)
|| this.target$source.is(ModDamageTypes.SHOCK) || this.target$source.is(ModDamageTypes.GUN_FIRE_ABSOLUTE) || this.target$source.is(ModDamageTypes.SHOCK) || this.target$source.is(ModDamageTypes.GUN_FIRE_ABSOLUTE)
|| this.target$source.is(ModDamageTypes.GUN_FIRE_HEADSHOT_ABSOLUTE) || this.target$source.is(ModDamageTypes.BURN)) { || this.target$source.is(ModDamageTypes.GUN_FIRE_HEADSHOT_ABSOLUTE) || this.target$source.is(ModDamageTypes.BURN)
|| this.target$source.is(ModDamageTypes.LASER)) {
return 0.05 * original; return 0.05 * original;
} }
return original; return original;

View file

@ -55,13 +55,12 @@ public class LaserShootMessage {
Entity entity = EntityFindUtil.findEntity(level, String.valueOf(uuid)); Entity entity = EntityFindUtil.findEntity(level, String.valueOf(uuid));
if (entity != null) { if (entity != null) {
entity.hurt(ModDamageTypes.causeGunFireDamage(level.registryAccess(), player, player), (float) damage); entity.hurt(ModDamageTypes.causeLaserDamage(level.registryAccess(), player, player), (float) damage);
entity.invulnerableTime = 0; entity.invulnerableTime = 0;
if (player instanceof ServerPlayer serverPlayer) { if (player instanceof ServerPlayer serverPlayer) {
player.level().playSound(null, player.blockPosition(), ModSounds.INDICATION.get(), SoundSource.VOICE, 0.1f, 1); player.level().playSound(null, player.blockPosition(), ModSounds.INDICATION.get(), SoundSource.VOICE, 0.1f, 1);
ModUtils.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> serverPlayer), new ClientIndicatorMessage(0, 5)); ModUtils.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> serverPlayer), new ClientIndicatorMessage(0, 5));
} }
} }
} }
} }

View file

@ -170,7 +170,7 @@ public class CustomExplosion extends Explosion {
xDistance /= distance; xDistance /= distance;
yDistance /= distance; yDistance /= distance;
zDistance /= distance; zDistance /= distance;
double seenPercent = Mth.clamp(getSeenPercent(position, entity), 0.25, Double.POSITIVE_INFINITY); double seenPercent = Mth.clamp(getSeenPercent(position, entity), 0.125, Double.POSITIVE_INFINITY);
double damagePercent = (1.0D - distanceRate) * seenPercent; double damagePercent = (1.0D - distanceRate) * seenPercent;
double damageFinal = (damagePercent * damagePercent + damagePercent) / 2.0D * damage; double damageFinal = (damagePercent * damagePercent + damagePercent) / 2.0D * damage;

View file

@ -325,6 +325,9 @@
"death.attack.drone_hit": "%1$s被无人机叶片切碎了", "death.attack.drone_hit": "%1$s被无人机叶片切碎了",
"death.attack.drone_hit.entity": "%1$s被%2$s用无人机叶片切碎了", "death.attack.drone_hit.entity": "%1$s被%2$s用无人机叶片切碎了",
"death.attack.drone_hit.item": "%1$s被%2$s用无人机叶片切碎了", "death.attack.drone_hit.item": "%1$s被%2$s用无人机叶片切碎了",
"death.attack.laser": "%1$s被激光射穿了",
"death.attack.laser.entity": "%1$s被%2$s用激光射穿了",
"death.attack.laser.item": "%1$s被%2$s用激光射穿了",
"gui.superbwarfare.mortar_gui.button_set": "Confirm", "gui.superbwarfare.mortar_gui.button_set": "Confirm",

View file

@ -325,6 +325,9 @@
"death.attack.drone_hit": "%1$s被无人机叶片切碎了", "death.attack.drone_hit": "%1$s被无人机叶片切碎了",
"death.attack.drone_hit.entity": "%1$s被%2$s用无人机叶片切碎了", "death.attack.drone_hit.entity": "%1$s被%2$s用无人机叶片切碎了",
"death.attack.drone_hit.item": "%1$s被%2$s用无人机叶片切碎了", "death.attack.drone_hit.item": "%1$s被%2$s用无人机叶片切碎了",
"death.attack.laser": "%1$s被激光射穿了",
"death.attack.laser.entity": "%1$s被%2$s用激光射穿了",
"death.attack.laser.item": "%1$s被%2$s用激光射穿了",
"gui.superbwarfare.mortar_gui.button_set": "确认", "gui.superbwarfare.mortar_gui.button_set": "确认",

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "superbwarfare:item/perk/butterfly_bullet"
}
}

View file

@ -2357,5 +2357,21 @@
"stream": false "stream": false
} }
] ]
},
"charge_rifle_fire_1p": {
"sounds": [
{
"name": "superbwarfare:charge_rifle/charge_rifle_fire_1p",
"stream": false
}
]
},
"charge_rifle_fire_3p": {
"sounds": [
{
"name": "superbwarfare:charge_rifle/charge_rifle_fire_3p",
"stream": false
}
]
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

View file

@ -3,6 +3,7 @@
"values": [ "values": [
"superbwarfare:projectile_boom", "superbwarfare:projectile_boom",
"superbwarfare:custom_explosion", "superbwarfare:custom_explosion",
"superbwarfare:cannon_fire" "superbwarfare:cannon_fire",
"superbwarfare:laser"
] ]
} }

View file

@ -4,6 +4,7 @@
"superbwarfare:gunfire_absolute", "superbwarfare:gunfire_absolute",
"superbwarfare:gunfire_headshot_absolute", "superbwarfare:gunfire_headshot_absolute",
"superbwarfare:shock", "superbwarfare:shock",
"superbwarfare:cannon_fire" "superbwarfare:cannon_fire",
"superbwarfare:laser"
] ]
} }

View file

@ -4,6 +4,7 @@
"superbwarfare:gunfire_absolute", "superbwarfare:gunfire_absolute",
"superbwarfare:gunfire_headshot_absolute", "superbwarfare:gunfire_headshot_absolute",
"superbwarfare:shock", "superbwarfare:shock",
"superbwarfare:cannon_fire" "superbwarfare:cannon_fire",
"superbwarfare:laser"
] ]
} }

View file

@ -4,6 +4,7 @@
"superbwarfare:gunfire_absolute", "superbwarfare:gunfire_absolute",
"superbwarfare:gunfire_headshot_absolute", "superbwarfare:gunfire_headshot_absolute",
"superbwarfare:shock", "superbwarfare:shock",
"superbwarfare:cannon_fire" "superbwarfare:cannon_fire",
"superbwarfare:laser"
] ]
} }

View file

@ -4,6 +4,7 @@
"superbwarfare:gunfire_absolute", "superbwarfare:gunfire_absolute",
"superbwarfare:gunfire_headshot_absolute", "superbwarfare:gunfire_headshot_absolute",
"superbwarfare:shock", "superbwarfare:shock",
"superbwarfare:cannon_fire" "superbwarfare:cannon_fire",
"superbwarfare:laser"
] ]
} }

View file

@ -2,6 +2,7 @@
"replace": false, "replace": false,
"values": [ "values": [
"superbwarfare:projectile_boom", "superbwarfare:projectile_boom",
"superbwarfare:custom_explosion" "superbwarfare:custom_explosion",
"superbwarfare:laser"
] ]
} }

View file

@ -0,0 +1,5 @@
{
"exhaustion": 0,
"message_id": "laser",
"scaling": "never"
}