修复部分错误

This commit is contained in:
Light_Quanta 2025-03-29 05:27:15 +08:00
parent cc105575ff
commit 9439922828
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
5 changed files with 12 additions and 25 deletions

View file

@ -41,6 +41,7 @@ import org.lwjgl.glfw.GLFW;
import static com.atsuishio.superbwarfare.event.ClientEventHandler.cantFireTime;
import static com.atsuishio.superbwarfare.event.ClientEventHandler.drawTime;
// TODO 发送亿堆网络包
@EventBusSubscriber(bus = EventBusSubscriber.Bus.GAME, value = Dist.CLIENT)
public class ClickHandler {

View file

@ -161,7 +161,7 @@ public abstract class VehicleEntity extends Entity {
@Nullable
@Override
public Entity getFirstPassenger() {
return orderedPassengers.get(0);
return orderedPassengers.getFirst();
}
/**

View file

@ -338,10 +338,10 @@ public class ClientEventHandler {
if (stack.is(ModItems.LUNGE_MINE.get()) && ((lungeAttack >= 18 && lungeAttack <= 21) || lungeSprint > 0)) {
Entity lookingEntity = TraceTool.findLookingEntity(player, player.entityInteractionRange() + 1.5);
BlockHitResult result = player.level().clip(new ClipContext(player.getEyePosition(), player.getEyePosition().add(player.getLookAngle().scale(player.getBlockReach() + 0.5)),
BlockHitResult result = player.level().clip(new ClipContext(player.getEyePosition(), player.getEyePosition().add(player.getLookAngle().scale(player.entityInteractionRange() + 0.5)),
ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, player));
Vec3 looking = Vec3.atLowerCornerOf(player.level().clip(new ClipContext(player.getEyePosition(), player.getEyePosition().add(player.getLookAngle().scale(player.getBlockReach() + 0.5)), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, player)).getBlockPos());
Vec3 looking = Vec3.atLowerCornerOf(player.level().clip(new ClipContext(player.getEyePosition(), player.getEyePosition().add(player.getLookAngle().scale(player.entityInteractionRange() + 0.5)), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, player)).getBlockPos());
BlockState blockState = player.level().getBlockState(BlockPos.containing(looking.x(), looking.y(), looking.z()));
if (lookingEntity != null) {

View file

@ -16,9 +16,6 @@ import com.atsuishio.superbwarfare.event.events.PreKillEvent;
import com.atsuishio.superbwarfare.init.*;
import com.atsuishio.superbwarfare.item.gun.GunItem;
import com.atsuishio.superbwarfare.network.message.receive.ClientIndicatorMessage;
import com.atsuishio.superbwarfare.perk.AmmoPerk;
import com.atsuishio.superbwarfare.perk.Perk;
import com.atsuishio.superbwarfare.perk.PerkHelper;
import com.atsuishio.superbwarfare.tools.*;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
@ -40,7 +37,6 @@ import net.minecraft.world.entity.projectile.Projectile;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.block.entity.HopperBlockEntity;
import net.minecraftforge.event.entity.living.*;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.common.util.TriState;
@ -132,18 +128,20 @@ public class LivingEventHandler {
double damage = amount;
ItemStack stack = sourceEntity instanceof LivingEntity living ? living.getMainHandItem() : ItemStack.EMPTY;
var perk = PerkHelper.getPerkByType(stack, Perk.Type.AMMO);
// TODO perk
// var perk = PerkHelper.getPerkByType(stack, Perk.Type.AMMO);
// 距离衰减
if (DamageTypeTool.isGunDamage(source)) {
double distance = entity.position().distanceTo(sourceEntity.position());
if (stack.is(ModTags.Items.USE_SHOTGUN_AMMO)) {
if (perk instanceof AmmoPerk ammoPerk && ammoPerk.slug) {
damage = reduceDamageByDistance(amount, distance, 0.015, 30);
} else {
// if (perk instanceof AmmoPerk ammoPerk && ammoPerk.slug) {
// damage = reduceDamageByDistance(amount, distance, 0.015, 30);
// } else {
damage = reduceDamageByDistance(amount, distance, 0.05, 15);
}
// }
} else if (stack.is(ModTags.Items.USE_SNIPER_AMMO)) {
damage = reduceDamageByDistance(amount, distance, 0.001, 150);
} else if (stack.is(ModTags.Items.USE_HEAVY_AMMO)) {
@ -161,7 +159,7 @@ public class LivingEventHandler {
ItemStack armor = entity.getItemBySlot(EquipmentSlot.CHEST);
var tag = NBTTool.getTag(armor);
if (armor != ItemStack.EMPTY && tag != null && tag.contains("ArmorPlate")) {
if (armor != ItemStack.EMPTY && tag.contains("ArmorPlate")) {
double armorValue;
armorValue = tag.getDouble("ArmorPlate");
tag.putDouble("ArmorPlate", Math.max(tag.getDouble("ArmorPlate") - damage, 0));

View file

@ -1,12 +0,0 @@
package com.atsuishio.superbwarfare.event;
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
import com.tacz.guns.api.event.common.EntityHurtByGunEvent;
public class TACZGunEventHandler {
public static void entityHurtByTACZGun(EntityHurtByGunEvent.Pre event) {
if (event.getHurtEntity() instanceof VehicleEntity) {
event.setHeadshot(false);
}
}
}