修复部分错误
This commit is contained in:
parent
cc105575ff
commit
9439922828
5 changed files with 12 additions and 25 deletions
|
@ -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 {
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ public abstract class VehicleEntity extends Entity {
|
|||
@Nullable
|
||||
@Override
|
||||
public Entity getFirstPassenger() {
|
||||
return orderedPassengers.get(0);
|
||||
return orderedPassengers.getFirst();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue