修复波塞克弹药显示bug,规范化命名迫击炮UI按钮,调整动画,修复望远镜实体测距副手不起作用bug,调整先辈脑袋高度,加入打腿判定

This commit is contained in:
Atsuihsio 2024-06-04 12:04:07 +08:00
parent 01ae132521
commit 791bab7409
14 changed files with 114 additions and 101 deletions

View file

@ -21,12 +21,12 @@ public class MortarGUIScreen extends AbstractContainerScreen<MortarGUIMenu> {
private final static HashMap<String, Object> GUI_STATE = MortarGUIMenu.GUI_STATE; private final static HashMap<String, Object> GUI_STATE = MortarGUIMenu.GUI_STATE;
private final int x, y, z; private final int x, y, z;
private final Player entity; private final Player entity;
Button button_zeng_da_yang_jiao; Button button_angle_add_1;
Button button_empty; Button button_angle_reduce_1;
Button button_10; Button button_angle_add_10;
Button button_101; Button button_angle_reduce_10;
Button button_05; Button button_angle_reduce_05;
Button button_051; Button button_angle_add_05;
public MortarGUIScreen(MortarGUIMenu container, Inventory inventory, Component text) { public MortarGUIScreen(MortarGUIMenu container, Inventory inventory, Component text) {
super(container, inventory, text); super(container, inventory, text);
@ -97,41 +97,41 @@ public class MortarGUIScreen extends AbstractContainerScreen<MortarGUIMenu> {
@Override @Override
public void init() { public void init() {
super.init(); super.init();
button_zeng_da_yang_jiao = Button.builder(Component.translatable("gui.target.mortar_gui.button_zeng_da_yang_jiao"), e -> { button_angle_add_1 = Button.builder(Component.translatable("gui.target.mortar_gui.button_angle_add_1"), e -> {
TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(0, x, y, z)); TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(0, x, y, z));
MortarGUIButtonMessage.handleButtonAction(entity, 0); MortarGUIButtonMessage.handleButtonAction(entity, 0);
}).bounds(this.leftPos + 42, this.topPos + 124, 29, 20).build(); }).bounds(this.leftPos + 42, this.topPos + 124, 29, 20).build();
GUI_STATE.put("button:button_zeng_da_yang_jiao", button_zeng_da_yang_jiao); GUI_STATE.put("button:button_angle_add_1", button_angle_add_1);
this.addRenderableWidget(button_zeng_da_yang_jiao); this.addRenderableWidget(button_angle_add_1);
button_empty = Button.builder(Component.translatable("gui.target.mortar_gui.button_empty"), e -> { button_angle_reduce_1 = Button.builder(Component.translatable("gui.target.mortar_gui.button_angle_reduce_1"), e -> {
TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(1, x, y, z)); TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(1, x, y, z));
MortarGUIButtonMessage.handleButtonAction(entity, 1); MortarGUIButtonMessage.handleButtonAction(entity, 1);
}).bounds(this.leftPos - 73, this.topPos + 124, 30, 20).build(); }).bounds(this.leftPos - 73, this.topPos + 124, 30, 20).build();
GUI_STATE.put("button:button_empty", button_empty); GUI_STATE.put("button:button_angle_reduce_1", button_angle_reduce_1);
this.addRenderableWidget(button_empty); this.addRenderableWidget(button_angle_reduce_1);
button_10 = Button.builder(Component.translatable("gui.target.mortar_gui.button_10"), e -> { button_angle_add_10 = Button.builder(Component.translatable("gui.target.mortar_gui.button_angle_add_10"), e -> {
TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(2, x, y, z)); TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(2, x, y, z));
MortarGUIButtonMessage.handleButtonAction(entity, 2); MortarGUIButtonMessage.handleButtonAction(entity, 2);
}).bounds(this.leftPos + 43, this.topPos + 151, 28, 20).build(); }).bounds(this.leftPos + 43, this.topPos + 151, 28, 20).build();
GUI_STATE.put("button:button_10", button_10); GUI_STATE.put("button:button_angle_add_10", button_angle_add_10);
this.addRenderableWidget(button_10); this.addRenderableWidget(button_angle_add_10);
button_101 = Button.builder(Component.translatable("gui.target.mortar_gui.button_101"), e -> { button_angle_reduce_10 = Button.builder(Component.translatable("gui.target.mortar_gui.button_angle_reduce_10"), e -> {
TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(3, x, y, z)); TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(3, x, y, z));
MortarGUIButtonMessage.handleButtonAction(entity, 3); MortarGUIButtonMessage.handleButtonAction(entity, 3);
}).bounds(this.leftPos - 73, this.topPos + 151, 30, 20).build(); }).bounds(this.leftPos - 73, this.topPos + 151, 30, 20).build();
GUI_STATE.put("button:button_101", button_101); GUI_STATE.put("button:button_angle_reduce_10", button_angle_reduce_10);
this.addRenderableWidget(button_101); this.addRenderableWidget(button_angle_reduce_10);
button_05 = Button.builder(Component.translatable("gui.target.mortar_gui.button_05"), e -> { button_angle_reduce_05 = Button.builder(Component.translatable("gui.target.mortar_gui.button_angle_reduce_05"), e -> {
TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(4, x, y, z)); TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(4, x, y, z));
MortarGUIButtonMessage.handleButtonAction(entity, 4); MortarGUIButtonMessage.handleButtonAction(entity, 4);
}).bounds(this.leftPos - 73, this.topPos + 97, 30, 20).build(); }).bounds(this.leftPos - 73, this.topPos + 97, 30, 20).build();
GUI_STATE.put("button:button_05", button_05); GUI_STATE.put("button:button_angle_reduce_05", button_angle_reduce_05);
this.addRenderableWidget(button_05); this.addRenderableWidget(button_angle_reduce_05);
button_051 = Button.builder(Component.translatable("gui.target.mortar_gui.button_051"), e -> { button_angle_add_05 = Button.builder(Component.translatable("gui.target.mortar_gui.button_angle_add_05"), e -> {
TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(5, x, y, z)); TargetMod.PACKET_HANDLER.sendToServer(new MortarGUIButtonMessage(5, x, y, z));
MortarGUIButtonMessage.handleButtonAction(entity, 5); MortarGUIButtonMessage.handleButtonAction(entity, 5);
}).bounds(this.leftPos + 42, this.topPos + 97, 29, 20).build(); }).bounds(this.leftPos + 42, this.topPos + 97, 29, 20).build();
GUI_STATE.put("button:button_051", button_051); GUI_STATE.put("button:button_angle_add_05", button_angle_add_05);
this.addRenderableWidget(button_051); this.addRenderableWidget(button_angle_add_05);
} }
} }

View file

@ -66,8 +66,8 @@ public class M870ItemModel extends GeoModel<M870Item> {
if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming) { if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming) {
shen.setPosY(0.4f * (float) (fp + 2 * fr)); shen.setPosY(0.4f * (float) (fp + 2 * fr));
shen.setPosZ(3.6f * (float) (fp + 0.54f * fr)); shen.setPosZ(5.6f * (float) (fp + 0.54f * fr));
shen.setRotX(0.12f * (float) (fp + fr)); shen.setRotX(0.28f * (float) (fp + fr));
shen.setRotZ(0f); shen.setRotZ(0f);
if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).recoilHorizon > 0) { if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).recoilHorizon > 0) {
shen.setRotY(0.025f * (float) fr); shen.setRotY(0.025f * (float) fr);
@ -76,8 +76,8 @@ public class M870ItemModel extends GeoModel<M870Item> {
} }
} else { } else {
shen.setPosY(0.7f * (float) (fp + 2 * fr)); shen.setPosY(0.7f * (float) (fp + 2 * fr));
shen.setPosZ(4.2f * (float) (fp + 0.54f * fr)); shen.setPosZ(6.2f * (float) (fp + 0.54f * fr));
shen.setRotX(0.15f * (float) (0.18f * fp + fr)); shen.setRotX(0.3f * (float) (0.18f * fp + fr));
shen.setRotZ(-0.01f * (float) (fp + 1.3 * fr)); shen.setRotZ(-0.01f * (float) (fp + 1.3 * fr));
if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).recoilHorizon > 0) { if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).recoilHorizon > 0) {
shen.setRotY(0.045f * (float) fr); shen.setRotY(0.045f * (float) fr);

View file

@ -41,7 +41,7 @@ public class M98bItemModel extends GeoModel<M98bItem> {
if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming) { if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming) {
shen.setPosY(0.4f * (float) (fp + 2 * fr)); shen.setPosY(0.4f * (float) (fp + 2 * fr));
shen.setPosZ(3.6f * (float) (fp + 0.54f * fr)); shen.setPosZ(3.6f * (float) (fp + 0.54f * fr));
shen.setRotX(0.12f * (float) (fp + fr)); shen.setRotX(0.18f * (float) (fp + fr));
shen.setRotZ(0f); shen.setRotZ(0f);
if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).recoilHorizon > 0) { if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).recoilHorizon > 0) {
shen.setRotY(0.025f * (float) fr); shen.setRotY(0.025f * (float) fr);
@ -51,7 +51,7 @@ public class M98bItemModel extends GeoModel<M98bItem> {
} else { } else {
shen.setPosY(0.7f * (float) (fp + 2 * fr)); shen.setPosY(0.7f * (float) (fp + 2 * fr));
shen.setPosZ(4.2f * (float) (fp + 0.54f * fr)); shen.setPosZ(4.2f * (float) (fp + 0.54f * fr));
shen.setRotX(0.15f * (float) (0.18f * fp + fr)); shen.setRotX(0.25f * (float) (0.18f * fp + fr));
shen.setRotZ(-0.01f * (float) (fp + 1.3 * fr)); shen.setRotZ(-0.01f * (float) (fp + 1.3 * fr));
if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).recoilHorizon > 0) { if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).recoilHorizon > 0) {
shen.setRotY(0.045f * (float) fr); shen.setRotY(0.045f * (float) fr);

View file

@ -160,18 +160,21 @@ public class AmmoBarOverlay {
return (player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo; return (player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo;
} }
if (stack.getItem() == TargetModItems.BOCEK.get()) {
return stack.getOrCreateTag().getInt("max_ammo");
}
return stack.getOrCreateTag().getInt("ammo"); return stack.getOrCreateTag().getInt("ammo");
} }
private static String getPlayerAmmoCount(Player player) { private static String getPlayerAmmoCount(Player player) {
ItemStack stack = player.getMainHandItem(); ItemStack stack = player.getMainHandItem();
if (stack.getItem() == TargetModItems.MINIGUN.get()) { if (stack.getItem() == TargetModItems.MINIGUN.get() || stack.getItem() == TargetModItems.BOCEK.get()) {
return ""; return "";
} }
if (stack.getItem() == TargetModItems.BOCEK.get() || stack.getItem() == TargetModItems.M_79.get() if (stack.getItem() == TargetModItems.M_79.get() || stack.getItem() == TargetModItems.RPG.get() || stack.getItem() == TargetModItems.TASER.get()) {
|| stack.getItem() == TargetModItems.RPG.get() || stack.getItem() == TargetModItems.TASER.get()) {
return "" + stack.getOrCreateTag().getInt("max_ammo"); return "" + stack.getOrCreateTag().getInt("max_ammo");
} }

View file

@ -22,7 +22,7 @@ public class SpyglassRangeOverlay {
int w = event.getWindow().getGuiScaledWidth(); int w = event.getWindow().getGuiScaledWidth();
int h = event.getWindow().getGuiScaledHeight(); int h = event.getWindow().getGuiScaledHeight();
Player player = Minecraft.getInstance().player; Player player = Minecraft.getInstance().player;
if (player != null && player.getMainHandItem().getItem() == Items.SPYGLASS && player.isUsingItem()) { if (player != null && (player.getMainHandItem().getItem() == Items.SPYGLASS || player.getOffhandItem().getItem() == Items.SPYGLASS ) && player.isUsingItem()) {
event.getGuiGraphics().drawString( event.getGuiGraphics().drawString(
Minecraft.getInstance().font, Minecraft.getInstance().font,
getDistanceString(player), getDistanceString(player),

View file

@ -207,30 +207,10 @@ public class ClaymoreEntity extends TamableAnimal implements GeoEntity, Animated
if (!this.level().isClientSide()) this.discard(); if (!this.level().isClientSide()) this.discard();
} }
if (data.getDouble("def") >= 100) {
if (!this.level().isClientSide()) this.discard();
if (!level.isClientSide()) {
level.playSound(null, BlockPos.containing(x, y, z), SoundEvents.SHIELD_BREAK, SoundSource.PLAYERS, 1, 1);
} else {
level.playLocalSound(x, y, z, SoundEvents.SHIELD_BREAK, SoundSource.PLAYERS, 1, 1, false);
}
if (level instanceof ServerLevel server) {
ItemEntity entityToSpawn = new ItemEntity(server, x, y, z, new ItemStack(TargetModItems.CLAYMORE_MINE.get()));
entityToSpawn.setPickUpDelay(10);
server.addFreshEntity(entityToSpawn);
}
}
this.removeAllEffects(); this.removeAllEffects();
this.clearFire(); this.clearFire();
if (data.getInt("trigger") <= 60) { if (this.tickCount >= 40) {
data.putInt("trigger", data.getInt("trigger") + 1);
}
if (data.getInt("trigger") >= 40) {
final Vec3 center = new Vec3(x + 1.5 * this.getLookAngle().x, y + 1.5 * this.getLookAngle().y, z + 1.5 * this.getLookAngle().z); final Vec3 center = new Vec3(x + 1.5 * this.getLookAngle().x, y + 1.5 * this.getLookAngle().y, z + 1.5 * this.getLookAngle().z);
for (Entity target : level.getEntitiesOfClass(Entity.class, new AABB(center, center).inflate(2.5 / 2d), e -> true).stream().sorted(Comparator.comparingDouble(e -> e.distanceToSqr(center))).toList()) { for (Entity target : level.getEntitiesOfClass(Entity.class, new AABB(center, center).inflate(2.5 / 2d), e -> true).stream().sorted(Comparator.comparingDouble(e -> e.distanceToSqr(center))).toList()) {
var condition = this.getOwner() != target var condition = this.getOwner() != target

View file

@ -54,6 +54,7 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
protected int shooterId; protected int shooterId;
private float damage = 1f; private float damage = 1f;
private float headShot = 1f; private float headShot = 1f;
private float legShot = 0.4f;
private boolean beast = false; private boolean beast = false;
public ProjectileEntity(EntityType<? extends ProjectileEntity> p_i50159_1_, Level p_i50159_2_) { public ProjectileEntity(EntityType<? extends ProjectileEntity> p_i50159_1_, Level p_i50159_2_) {
@ -83,6 +84,11 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
return this; return this;
} }
public ProjectileEntity legShot(float legShot) {
this.legShot = legShot;
return this;
}
public ProjectileEntity beast() { public ProjectileEntity beast() {
this.beast = true; this.beast = true;
return this; return this;
@ -93,6 +99,7 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
Vec3 hitVec = null; Vec3 hitVec = null;
Entity hitEntity = null; Entity hitEntity = null;
boolean headshot = false; boolean headshot = false;
boolean legshot = false;
List<Entity> entities = this.level() List<Entity> entities = this.level()
.getEntities(this, .getEntities(this,
this.getBoundingBox() this.getBoundingBox()
@ -118,9 +125,10 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
hitEntity = entity; hitEntity = entity;
closestDistance = distanceToHit; closestDistance = distanceToHit;
headshot = result.isHeadshot(); headshot = result.isHeadshot();
legshot = result.isLegshot();
} }
} }
return hitEntity != null ? new EntityResult(hitEntity, hitVec, headshot) : null; return hitEntity != null ? new EntityResult(hitEntity, hitVec, headshot, legshot) : null;
} }
@Nullable @Nullable
@ -180,12 +188,17 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
} }
Vec3 hitBoxPos = hitPos.subtract(entity.position()); Vec3 hitBoxPos = hitPos.subtract(entity.position());
boolean headshot = false; boolean headshot = false;
boolean legshot = false;
float eyeHeight = entity.getEyeHeight(); float eyeHeight = entity.getEyeHeight();
if ((eyeHeight - 0.35) < hitBoxPos.y && hitBoxPos.y < (eyeHeight + 0.35)) { float BodyHeight = entity.getBbHeight();
if ((eyeHeight - 0.3) < hitBoxPos.y && hitBoxPos.y < (eyeHeight + 0.4)) {
headshot = true; headshot = true;
} }
if (hitBoxPos.y < (0.33 * BodyHeight)) {
legshot = true;
}
return new EntityResult(entity, hitPos, headshot); return new EntityResult(entity, hitPos, headshot, legshot);
} }
@Override @Override
@ -298,12 +311,12 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
} }
} }
this.onHitEntity(entity, entityHitResult.isHeadshot()); this.onHitEntity(entity, entityHitResult.isHeadshot(), entityHitResult.isLegshot());
entity.invulnerableTime = 0; entity.invulnerableTime = 0;
} }
} }
protected void onHitEntity(Entity entity, boolean headshot) { protected void onHitEntity(Entity entity, boolean headshot, boolean legshot) {
if (entity == null) return; if (entity == null) return;
if (entity instanceof PartEntity<?> part) { if (entity instanceof PartEntity<?> part) {
@ -350,7 +363,16 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
TargetMod.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> player), new ClientIndicatorMessage(1, 5)); TargetMod.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> player), new ClientIndicatorMessage(1, 5));
} }
entity.hurt(TargetModDamageTypes.causeGunFireHeadshotDamage(this.level().registryAccess(), this, this.shooter), this.damage * this.headShot); entity.hurt(TargetModDamageTypes.causeGunFireHeadshotDamage(this.level().registryAccess(), this, this.shooter), this.damage * this.headShot);
} else { } else if (legshot) {
if (!this.shooter.level().isClientSide() && this.shooter instanceof ServerPlayer player) {
var holder = Holder.direct(TargetModSounds.INDICATION.get());
player.connection.send(new ClientboundSoundPacket(holder, SoundSource.PLAYERS, player.getX(), player.getY(), player.getZ(), 1f, 1f, player.level().random.nextLong()));
TargetMod.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> player), new ClientIndicatorMessage(0, 5));
}
entity.hurt(TargetModDamageTypes.causeGunFireDamage(this.level().registryAccess(), this, this.shooter), this.damage * this.legShot);
}
else {
if (!this.shooter.level().isClientSide() && this.shooter instanceof ServerPlayer player) { if (!this.shooter.level().isClientSide() && this.shooter instanceof ServerPlayer player) {
var holder = Holder.direct(TargetModSounds.INDICATION.get()); var holder = Holder.direct(TargetModSounds.INDICATION.get());
player.connection.send(new ClientboundSoundPacket(holder, SoundSource.PLAYERS, player.getX(), player.getY(), player.getZ(), 1f, 1f, player.level().random.nextLong())); player.connection.send(new ClientboundSoundPacket(holder, SoundSource.PLAYERS, player.getX(), player.getY(), player.getZ(), 1f, 1f, player.level().random.nextLong()));
@ -492,11 +514,13 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
private final Entity entity; private final Entity entity;
private final Vec3 hitVec; private final Vec3 hitVec;
private final boolean headshot; private final boolean headshot;
private final boolean legshot;
public EntityResult(Entity entity, Vec3 hitVec, boolean headshot) { public EntityResult(Entity entity, Vec3 hitVec, boolean headshot, boolean legshot) {
this.entity = entity; this.entity = entity;
this.hitVec = hitVec; this.hitVec = hitVec;
this.headshot = headshot; this.headshot = headshot;
this.legshot = legshot;
} }
/** /**
@ -519,5 +543,9 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
public boolean isHeadshot() { public boolean isHeadshot() {
return this.headshot; return this.headshot;
} }
public boolean isLegshot() {
return this.legshot;
}
} }
} }

View file

@ -72,13 +72,15 @@ public class RpgRocketEntity extends ThrowableItemProjectile {
} }
} }
if (this.level() instanceof ServerLevel level) { if (this.tickCount > 2) {
level.explode(this, this.getX(), this.getY(), this.getZ(), 5, Level.ExplosionInteraction.NONE); if (this.level() instanceof ServerLevel level) {
level.explode(this, this.getX(), this.getY(), this.getZ(), 5, Level.ExplosionInteraction.NONE);
if (!entity.level().isClientSide()) { if (!entity.level().isClientSide()) {
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position()); ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
}
this.discard();
} }
this.discard();
} }
if (entity instanceof LivingEntity) { if (entity instanceof LivingEntity) {
@ -136,9 +138,11 @@ public class RpgRocketEntity extends ThrowableItemProjectile {
public void onHitBlock(BlockHitResult blockHitResult) { public void onHitBlock(BlockHitResult blockHitResult) {
super.onHitBlock(blockHitResult); super.onHitBlock(blockHitResult);
if (this.level() instanceof ServerLevel level) { if (this.tickCount > 2) {
level.explode(this, this.getX(), this.getY(), this.getZ(), 5, Level.ExplosionInteraction.NONE); if (this.level() instanceof ServerLevel level) {
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position()); level.explode(this, this.getX(), this.getY(), this.getZ(), 5, Level.ExplosionInteraction.NONE);
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
}
} }
this.discard(); this.discard();
@ -148,12 +152,12 @@ public class RpgRocketEntity extends ThrowableItemProjectile {
public void tick() { public void tick() {
super.tick(); super.tick();
if (this.tickCount == 4) { if (this.tickCount == 2) {
if (!this.level().isClientSide() && this.level() instanceof ServerLevel serverLevel) { if (!this.level().isClientSide() && this.level() instanceof ServerLevel serverLevel) {
ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY(), this.getZ(), 50, 0.8, 0.8, 0.8, 0.01, true); ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY(), this.getZ(), 50, 0.8, 0.8, 0.8, 0.01, true);
} }
} }
if (this.tickCount > 4) { if (this.tickCount > 2) {
this.setDeltaMovement(new Vec3((1.04 * this.getDeltaMovement().x()), (1.04 * this.getDeltaMovement().y() - 0.02), (1.04 * this.getDeltaMovement().z()))); this.setDeltaMovement(new Vec3((1.04 * this.getDeltaMovement().x()), (1.04 * this.getDeltaMovement().y() - 0.02), (1.04 * this.getDeltaMovement().z())));
if (!this.level().isClientSide() && this.level() instanceof ServerLevel serverLevel) { if (!this.level().isClientSide() && this.level() instanceof ServerLevel serverLevel) {

View file

@ -72,6 +72,11 @@ public class SenpaiEntity extends Spider implements GeoEntity, AnimatedEntity {
this.entityData.define(ANIMATION, "undefined"); this.entityData.define(ANIMATION, "undefined");
} }
@Override
protected float getStandingEyeHeight(Pose poseIn, EntityDimensions sizeIn) {
return 1.75F;
}
@Override @Override
public Packet<ClientGamePacketListener> getAddEntityPacket() { public Packet<ClientGamePacketListener> getAddEntityPacket() {
return NetworkHooks.getEntitySpawningPacket(this); return NetworkHooks.getEntitySpawningPacket(this);
@ -141,7 +146,7 @@ public class SenpaiEntity extends Spider implements GeoEntity, AnimatedEntity {
double target = this.getPersistentData().getInt("find_target"); double target = this.getPersistentData().getInt("find_target");
if (target == 1) { if (target == 1) {
final Vec3 center = new Vec3(this.getX(), this.getY(), this.getZ()); final Vec3 center = new Vec3(this.getX(), this.getY(), this.getZ());
this.level().getEntitiesOfClass(Entity.class, new AABB(center, center).inflate(1024 / 2d), e -> true) this.level().getEntitiesOfClass(Entity.class, new AABB(center, center).inflate(256 / 2d), e -> true)
.stream() .stream()
.sorted(Comparator.comparingDouble(e -> e.distanceToSqr(center))) .sorted(Comparator.comparingDouble(e -> e.distanceToSqr(center)))
.filter(e -> e instanceof Player player && !player.isCreative()) .filter(e -> e instanceof Player player && !player.isCreative())

View file

@ -41,7 +41,7 @@ public class MouseHandlerMixin {
if (!player.getMainHandItem().isEmpty() && mc.options.getCameraType() == CameraType.FIRST_PERSON) { if (!player.getMainHandItem().isEmpty() && mc.options.getCameraType() == CameraType.FIRST_PERSON) {
if (stack.is(TargetModTags.Items.GUN)) { if (stack.is(TargetModTags.Items.GUN)) {
if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming) { if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming) {
additionalAdsSensitivity = (float) Mth.clamp((1 + 0.1f * custom_sens) * (1.25F * fov / original_fov) * (1 + 0.05f * Math.pow((original_fov / fov), 2)), 0.125F, 2F); additionalAdsSensitivity = (float) Mth.clamp((1 + 0.1f * custom_sens) * (1.25F * fov / original_fov) * (1 + 0.2f * Math.pow((original_fov / fov), 1.25)), 0.125F, 2F);
} else { } else {
additionalAdsSensitivity = Mth.clamp((1 + 0.1f * custom_sens) * 1.25F, 0.125F, 2F); additionalAdsSensitivity = Mth.clamp((1 + 0.1f * custom_sens) * 1.25F, 0.125F, 2F);
} }

View file

@ -8,13 +8,18 @@ import net.minecraft.world.phys.EntityHitResult;
*/ */
public class ExtendedEntityRayTraceResult extends EntityHitResult { public class ExtendedEntityRayTraceResult extends EntityHitResult {
private final boolean headshot; private final boolean headshot;
private final boolean legshot;
public ExtendedEntityRayTraceResult(ProjectileEntity.EntityResult result) { public ExtendedEntityRayTraceResult(ProjectileEntity.EntityResult result) {
super(result.getEntity(), result.getHitPos()); super(result.getEntity(), result.getHitPos());
this.headshot = result.isHeadshot(); this.headshot = result.isHeadshot();
this.legshot = result.isLegshot();
} }
public boolean isHeadshot() { public boolean isHeadshot() {
return this.headshot; return this.headshot;
} }
public boolean isLegshot() {
return this.legshot;
}
} }

View file

@ -161,22 +161,16 @@
"death.attack.arrow_in_brain.entity": "%2$s's arrow shot into %1$s's brain", "death.attack.arrow_in_brain.entity": "%2$s's arrow shot into %1$s's brain",
"death.attack.arrow_in_brain.item": "%2$s used %3$s to make an arrow shot into %1$s's brain", "death.attack.arrow_in_brain.item": "%2$s used %3$s to make an arrow shot into %1$s's brain",
"death.attack.beast_gun": "%1$s was killed by %2$s using BEAST guns", "death.attack.beast_gun": "%1$s was killed by %2$s using BEAST guns",
"death.attack.mine": "%1$s不慎踩到了阔剑地雷", "death.attack.mine": "%1$s step on Claymore",
"death.attack.mine.entity": "%1$s step on %2$s's Claymore", "death.attack.mine.entity": "%1$s step on %2$s's Claymore",
"death.attack.mine.item": "%1$s踩到了%2$s的阔剑地雷", "death.attack.mine.item": "%1$s step on %2$s's Claymore",
"Shell Estimated Range": "Estimated Range:", "gui.target.mortar_gui.button_angle_add_05": "+0.5",
"gui.target.mortar_gui.label_proc_range": "Estimated Range:", "gui.target.mortar_gui.button_angle_reduce_05": "-0.5",
"gui.target.mortar_gui.button_051": "+0.5", "gui.target.mortar_gui.button_angle_add_1": "+1",
"gui.target.mortar_gui.button_05": "-0.5", "gui.target.mortar_gui.button_angle_reduce_1": "-1",
"gui.target.mortar_gui.button_zeng_da_yang_jiao": "+1", "gui.target.mortar_gui.button_angle_add_10": "+10",
"gui.target.mortar_gui.button_empty": "-1", "gui.target.mortar_gui.button_angle_reduce_10": "-10",
"gui.target.mortar_gui.button_10": "+10",
"gui.target.mortar_gui.button_101": "-10",
"gui.target.mortar_gui.label_empty": "",
"gui.target.mortar_gui.pitch": "",
"gui.target.mortar_gui.test": "Add",
"gui.target.mortar_gui.label_range2090": "Range:20~90",
"gui.target.gun_recycle_gui.tooltip_if_guns_level_10you_will_get": "If gun\u0027s level \u003e 10,you will get soul nuggets", "gui.target.gun_recycle_gui.tooltip_if_guns_level_10you_will_get": "If gun\u0027s level \u003e 10,you will get soul nuggets",
"gui.target.gun_recycle_gui.button_dismantle": "Dismantle", "gui.target.gun_recycle_gui.button_dismantle": "Dismantle",
"gui.target.mortar_gui.button_set": "Confirm", "gui.target.mortar_gui.button_set": "Confirm",

View file

@ -165,18 +165,12 @@
"death.attack.mine.entity": "%1$s踩到了%2$s的阔剑地雷", "death.attack.mine.entity": "%1$s踩到了%2$s的阔剑地雷",
"death.attack.mine.item": "%1$s踩到了%2$s的阔剑地雷", "death.attack.mine.item": "%1$s踩到了%2$s的阔剑地雷",
"Shell Estimated Range": "炮弹预估射程:", "gui.target.mortar_gui.button_angle_add_05": "+0.5",
"gui.target.mortar_gui.label_proc_range": "预估射程:", "gui.target.mortar_gui.button_angle_reduce_05": "-0.5",
"gui.target.mortar_gui.button_051": "+0.5", "gui.target.mortar_gui.button_angle_add_1": "+1",
"gui.target.mortar_gui.button_05": "-0.5", "gui.target.mortar_gui.button_angle_reduce_1": "-1",
"gui.target.mortar_gui.button_zeng_da_yang_jiao": "+1", "gui.target.mortar_gui.button_angle_add_10": "+10",
"gui.target.mortar_gui.button_empty": "-1", "gui.target.mortar_gui.button_angle_reduce_10": "-10",
"gui.target.mortar_gui.button_10": "+10",
"gui.target.mortar_gui.button_101": "-10",
"gui.target.mortar_gui.label_empty": "",
"gui.target.mortar_gui.pitch": "",
"gui.target.mortar_gui.test": "增加",
"gui.target.mortar_gui.label_range2090": "范围:20~90",
"gui.target.gun_recycle_gui.tooltip_if_guns_level_10you_will_get": "如果枪械熟练度大于10级你将会获得魂钢粒", "gui.target.gun_recycle_gui.tooltip_if_guns_level_10you_will_get": "如果枪械熟练度大于10级你将会获得魂钢粒",
"gui.target.gun_recycle_gui.button_dismantle": "拆解", "gui.target.gun_recycle_gui.button_dismantle": "拆解",
"gui.target.mortar_gui.button_set": "确认", "gui.target.mortar_gui.button_set": "确认",

View file

@ -4,7 +4,7 @@
"dev": 7, "dev": 7,
"recoil_x": 0.004, "recoil_x": 0.004,
"recoil_y": 0.03, "recoil_y": 0.03,
"damage": 40, "damage": 65,
"headshot": 3, "headshot": 3,
"velocity": 38, "velocity": 38,
"mag": 1, "mag": 1,