添加智慧芯片的翻译/贴图/描述,扩大智慧芯片能应用的武器种类,优化智慧芯片的锁定目标

This commit is contained in:
Atsuihsio 2024-12-01 20:06:20 +08:00
parent b0913c422d
commit 38cd812f4f
10 changed files with 44 additions and 16 deletions

View file

@ -91,7 +91,7 @@ public class RgoGrenadeEntity extends ThrowableItemProjectile implements GeoEnti
ModUtils.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> player), new ClientIndicatorMessage(0, 5)); ModUtils.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> player), new ClientIndicatorMessage(0, 5));
} }
} }
if (entity instanceof DroneEntity) { if (!(entity instanceof DroneEntity)) {
ProjectileTool.causeCustomExplode(this, 100f, 4f, 1.2f); ProjectileTool.causeCustomExplode(this, 100f, 4f, 1.2f);
} }
break; break;

View file

@ -354,7 +354,7 @@ public class ClientEventHandler {
Entity lookingEntity = TraceTool.laserfindLookingEntity(player, 512); Entity lookingEntity = TraceTool.laserfindLookingEntity(player, 512);
if (player.isCrouching()) { if (player.isCrouching()) {
Entity seekingEntity = SeekTool.seekEntity(player, player.level(), 64, 32); Entity seekingEntity = SeekTool.seekLivingEntity(player, player.level(), 64, 32);
if (seekingEntity != null && seekingEntity.isAlive()) { if (seekingEntity != null && seekingEntity.isAlive()) {
player.lookAt(EntityAnchorArgument.Anchor.EYES, seekingEntity.getEyePosition()); player.lookAt(EntityAnchorArgument.Anchor.EYES, seekingEntity.getEyePosition());
} }
@ -1123,7 +1123,7 @@ public class ClientEventHandler {
&& !player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).edit) { && !player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).edit) {
int level = PerkHelper.getItemPerkLevel(ModPerks.INTELLIGENT_CHIP.get(), stack); int level = PerkHelper.getItemPerkLevel(ModPerks.INTELLIGENT_CHIP.get(), stack);
if (level > 0) { if (level > 0) {
Entity seekingEntity = SeekTool.seekEntity(player, player.level(), 32 + 8 * (level - 1), 25 / zoomFov); Entity seekingEntity = SeekTool.seekLivingEntity(player, player.level(), 32 + 8 * (level - 1), 25 / zoomFov);
if (seekingEntity != null && seekingEntity.isAlive()) { if (seekingEntity != null && seekingEntity.isAlive()) {
player.lookAt(EntityAnchorArgument.Anchor.EYES, seekingEntity.getEyePosition()); player.lookAt(EntityAnchorArgument.Anchor.EYES, seekingEntity.getEyePosition());
} }

View file

@ -3,17 +3,17 @@ package com.atsuishio.superbwarfare.item.gun.machinegun;
import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.client.renderer.item.MinigunItemRenderer; import com.atsuishio.superbwarfare.client.renderer.item.MinigunItemRenderer;
import com.atsuishio.superbwarfare.event.ClientEventHandler; import com.atsuishio.superbwarfare.event.ClientEventHandler;
import com.atsuishio.superbwarfare.perk.Perk;
import com.atsuishio.superbwarfare.tools.GunsTool;
import com.atsuishio.superbwarfare.tools.ItemNBTTool;
import com.atsuishio.superbwarfare.tools.ParticleTool;
import com.atsuishio.superbwarfare.tools.RarityTool;
import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.init.ModParticleTypes; import com.atsuishio.superbwarfare.init.ModParticleTypes;
import com.atsuishio.superbwarfare.init.ModPerks; import com.atsuishio.superbwarfare.init.ModPerks;
import com.atsuishio.superbwarfare.init.ModTags; import com.atsuishio.superbwarfare.init.ModTags;
import com.atsuishio.superbwarfare.item.AnimatedItem; import com.atsuishio.superbwarfare.item.AnimatedItem;
import com.atsuishio.superbwarfare.item.gun.GunItem; import com.atsuishio.superbwarfare.item.gun.GunItem;
import com.atsuishio.superbwarfare.perk.Perk;
import com.atsuishio.superbwarfare.tools.GunsTool;
import com.atsuishio.superbwarfare.tools.ItemNBTTool;
import com.atsuishio.superbwarfare.tools.ParticleTool;
import com.atsuishio.superbwarfare.tools.RarityTool;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.player.LocalPlayer;
@ -208,7 +208,7 @@ public class MinigunItem extends GunItem implements GeoItem, AnimatedItem {
public boolean canApplyPerk(Perk perk) { public boolean canApplyPerk(Perk perk) {
return switch (perk.type) { return switch (perk.type) {
case AMMO -> true; case AMMO -> true;
case FUNCTIONAL -> perk == ModPerks.FIELD_DOCTOR.get(); case FUNCTIONAL -> perk == ModPerks.FIELD_DOCTOR.get() || perk == ModPerks.INTELLIGENT_CHIP.get();
case DAMAGE -> perk == ModPerks.MONSTER_HUNTER.get() || perk == ModPerks.KILLING_TALLY.get(); case DAMAGE -> perk == ModPerks.MONSTER_HUNTER.get() || perk == ModPerks.KILLING_TALLY.get();
}; };
} }

View file

@ -160,7 +160,7 @@ public class BocekItem extends GunItem implements GeoItem, AnimatedItem {
public boolean canApplyPerk(Perk perk) { public boolean canApplyPerk(Perk perk) {
return switch (perk.type) { return switch (perk.type) {
case AMMO -> !perk.descriptionId.equals("butterfly_bullet"); case AMMO -> !perk.descriptionId.equals("butterfly_bullet");
case FUNCTIONAL -> perk == ModPerks.FIELD_DOCTOR.get(); case FUNCTIONAL -> perk == ModPerks.FIELD_DOCTOR.get() || perk == ModPerks.INTELLIGENT_CHIP.get();
case DAMAGE -> perk == ModPerks.MONSTER_HUNTER.get() || perk == ModPerks.KILLING_TALLY.get(); case DAMAGE -> perk == ModPerks.MONSTER_HUNTER.get() || perk == ModPerks.KILLING_TALLY.get();
}; };
} }

View file

@ -1,20 +1,20 @@
package com.atsuishio.superbwarfare.item.gun.special; package com.atsuishio.superbwarfare.item.gun.special;
import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.client.PoseTool;
import com.atsuishio.superbwarfare.client.renderer.item.TaserItemRenderer; import com.atsuishio.superbwarfare.client.renderer.item.TaserItemRenderer;
import com.atsuishio.superbwarfare.client.tooltip.component.EnergyImageComponent;
import com.atsuishio.superbwarfare.energy.ItemEnergyProvider; import com.atsuishio.superbwarfare.energy.ItemEnergyProvider;
import com.atsuishio.superbwarfare.event.ClientEventHandler; import com.atsuishio.superbwarfare.event.ClientEventHandler;
import com.atsuishio.superbwarfare.perk.Perk;
import com.atsuishio.superbwarfare.perk.PerkHelper;
import com.atsuishio.superbwarfare.tools.GunsTool;
import com.atsuishio.superbwarfare.client.PoseTool;
import com.atsuishio.superbwarfare.client.tooltip.component.EnergyImageComponent;
import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.init.ModPerks; import com.atsuishio.superbwarfare.init.ModPerks;
import com.atsuishio.superbwarfare.init.ModSounds; import com.atsuishio.superbwarfare.init.ModSounds;
import com.atsuishio.superbwarfare.init.ModTags; import com.atsuishio.superbwarfare.init.ModTags;
import com.atsuishio.superbwarfare.item.AnimatedItem; import com.atsuishio.superbwarfare.item.AnimatedItem;
import com.atsuishio.superbwarfare.item.gun.GunItem; import com.atsuishio.superbwarfare.item.gun.GunItem;
import com.atsuishio.superbwarfare.perk.Perk;
import com.atsuishio.superbwarfare.perk.PerkHelper;
import com.atsuishio.superbwarfare.tools.GunsTool;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.player.LocalPlayer;
@ -223,7 +223,7 @@ public class TaserItem extends GunItem implements GeoItem, AnimatedItem {
public boolean canApplyPerk(Perk perk) { public boolean canApplyPerk(Perk perk) {
return switch (perk.type) { return switch (perk.type) {
case AMMO -> perk == ModPerks.LONGER_WIRE.get(); case AMMO -> perk == ModPerks.LONGER_WIRE.get();
case FUNCTIONAL -> perk == ModPerks.SUPER_RECHARGE.get() || perk == ModPerks.POWERFUL_ATTRACTION.get(); case FUNCTIONAL -> perk == ModPerks.SUPER_RECHARGE.get() || perk == ModPerks.POWERFUL_ATTRACTION.get() || perk == ModPerks.INTELLIGENT_CHIP.get();
case DAMAGE -> perk == ModPerks.VOLT_OVERLOAD.get(); case DAMAGE -> perk == ModPerks.VOLT_OVERLOAD.get();
}; };
} }

View file

@ -1,6 +1,8 @@
package com.atsuishio.superbwarfare.tools; package com.atsuishio.superbwarfare.tools;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.ClipContext;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.HitResult;
@ -22,6 +24,22 @@ public class SeekTool {
}).min(Comparator.comparingDouble(e -> calculateAngle(e, entity))).orElse(null); }).min(Comparator.comparingDouble(e -> calculateAngle(e, entity))).orElse(null);
} }
public static Entity seekLivingEntity(Entity entity, Level level, double seekRange, double seekAngle) {
return StreamSupport.stream(EntityFindUtil.getEntities(level).getAll().spliterator(), false)
.filter(e -> {
if (e.distanceTo(entity) <= seekRange && calculateAngle(e, entity) < seekAngle
&& e != entity
&& e.isAlive()
&& e instanceof LivingEntity
&& !(e instanceof Player player && (player.isCreative() || player.isSpectator()))
&& (!e.isAlliedTo(entity) || e.getTeam() == null || e.getTeam().getName().equals("TDM"))) {
return level.clip(new ClipContext(entity.getEyePosition(), e.getEyePosition(),
ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, entity)).getType() != HitResult.Type.BLOCK;
}
return false;
}).min(Comparator.comparingDouble(e -> calculateAngle(e, entity))).orElse(null);
}
private static double calculateAngle(Entity entityA, Entity entityB) { private static double calculateAngle(Entity entityA, Entity entityB) {
Vec3 start = new Vec3(entityA.getX() - entityB.getX(), entityA.getY() - entityB.getY(), entityA.getZ() - entityB.getZ()); Vec3 start = new Vec3(entityA.getX() - entityB.getX(), entityA.getY() - entityB.getY(), entityA.getZ() - entityB.getZ());
Vec3 end = entityB.getLookAngle(); Vec3 end = entityB.getLookAngle();

View file

@ -273,6 +273,8 @@
"des.superbwarfare.turbo_charger": "Reduces auto fire spin-up time for compatible weapons", "des.superbwarfare.turbo_charger": "Reduces auto fire spin-up time for compatible weapons",
"item.superbwarfare.powerful_attraction": "Powerful Attraction", "item.superbwarfare.powerful_attraction": "Powerful Attraction",
"des.superbwarfare.powerful_attraction": "Transfer items and experience dropped by killed targets to your inventory", "des.superbwarfare.powerful_attraction": "Transfer items and experience dropped by killed targets to your inventory",
"item.superbwarfare.intelligent_chip": "Intelligent Chip",
"des.superbwarfare.intelligent_chip": "自动瞄准敌人请勿在PVP环境下使用此模组",
"item.superbwarfare.kill_clip": "Kill Clip", "item.superbwarfare.kill_clip": "Kill Clip",
"des.superbwarfare.kill_clip": "Increases the damage of weapon after dealing a final blow", "des.superbwarfare.kill_clip": "Increases the damage of weapon after dealing a final blow",

View file

@ -273,6 +273,8 @@
"des.superbwarfare.turbo_charger": "装配后减少武器自动射击所需的缓冲时间", "des.superbwarfare.turbo_charger": "装配后减少武器自动射击所需的缓冲时间",
"item.superbwarfare.powerful_attraction": "强力吸引", "item.superbwarfare.powerful_attraction": "强力吸引",
"des.superbwarfare.powerful_attraction": "击杀目标后掉落的物品和经验会直接转移到自身", "des.superbwarfare.powerful_attraction": "击杀目标后掉落的物品和经验会直接转移到自身",
"item.superbwarfare.intelligent_chip": "智慧芯片",
"des.superbwarfare.intelligent_chip": "自动瞄准敌人请勿在PVP环境下使用此模组",
"item.superbwarfare.kill_clip": "杀戮弹匣", "item.superbwarfare.kill_clip": "杀戮弹匣",
"des.superbwarfare.kill_clip": "完成击杀后填装可提升武器伤害", "des.superbwarfare.kill_clip": "完成击杀后填装可提升武器伤害",

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 729 B