diff --git a/src/main/java/com/atsuishio/superbwarfare/client/ClickHandler.java b/src/main/java/com/atsuishio/superbwarfare/client/ClickHandler.java index 7d5bd1d33..ef131393c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/ClickHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/ClickHandler.java @@ -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 { diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/VehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/VehicleEntity.java index 14272e735..743989f1f 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/VehicleEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/VehicleEntity.java @@ -161,7 +161,7 @@ public abstract class VehicleEntity extends Entity { @Nullable @Override public Entity getFirstPassenger() { - return orderedPassengers.get(0); + return orderedPassengers.getFirst(); } /** diff --git a/src/main/java/com/atsuishio/superbwarfare/event/ClientEventHandler.java b/src/main/java/com/atsuishio/superbwarfare/event/ClientEventHandler.java index 8822ca160..836a1af28 100644 --- a/src/main/java/com/atsuishio/superbwarfare/event/ClientEventHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/event/ClientEventHandler.java @@ -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) { diff --git a/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java b/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java index fb0c3ddb1..9ea77ffac 100644 --- a/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java @@ -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)); diff --git a/src/main/java/com/atsuishio/superbwarfare/event/TACZGunEventHandler.java b/src/main/java/com/atsuishio/superbwarfare/event/TACZGunEventHandler.java deleted file mode 100644 index 0a385696e..000000000 --- a/src/main/java/com/atsuishio/superbwarfare/event/TACZGunEventHandler.java +++ /dev/null @@ -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); - } - } -}