正确命名和移动RangeHelper
This commit is contained in:
parent
f69012702d
commit
cbdd279d40
5 changed files with 13 additions and 21 deletions
|
@ -1,9 +1,9 @@
|
|||
package com.atsuishio.superbwarfare.client.overlay;
|
||||
|
||||
import com.atsuishio.superbwarfare.Mod;
|
||||
import com.atsuishio.superbwarfare.client.gui.RangeHelper;
|
||||
import com.atsuishio.superbwarfare.entity.MortarEntity;
|
||||
import com.atsuishio.superbwarfare.tools.FormatTool;
|
||||
import com.atsuishio.superbwarfare.tools.RangeTool;
|
||||
import com.atsuishio.superbwarfare.tools.TraceTool;
|
||||
import net.minecraft.client.DeltaTracker;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -41,7 +41,7 @@ public class MortarInfoOverlay implements LayeredDraw.Layer {
|
|||
.append(Component.literal(FormatTool.format1D(mortar.getYRot(), "°"))),
|
||||
w / 2 - 90, h / 2 - 16, -1, false);
|
||||
guiGraphics.drawString(Minecraft.getInstance().font, Component.translatable("tips.superbwarfare.mortar.range")
|
||||
.append(Component.literal(FormatTool.format1D((int) RangeHelper.getRange(-mortar.getXRot(), 11.4, 0.146), "m"))),
|
||||
.append(Component.literal(FormatTool.format1D((int) RangeTool.getRange(-mortar.getXRot(), 11.4, 0.146), "m"))),
|
||||
w / 2 - 90, h / 2 - 6, -1, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.atsuishio.superbwarfare.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.Mod;
|
||||
import com.atsuishio.superbwarfare.client.gui.RangeHelper;
|
||||
import com.atsuishio.superbwarfare.component.ModDataComponents;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.MortarShellEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
||||
|
@ -9,6 +8,7 @@ import com.atsuishio.superbwarfare.init.ModEntities;
|
|||
import com.atsuishio.superbwarfare.init.ModItems;
|
||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||
import com.atsuishio.superbwarfare.item.common.ammo.MortarShell;
|
||||
import com.atsuishio.superbwarfare.tools.RangeTool;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.commands.arguments.EntityAnchorArgument;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
|
@ -171,13 +171,13 @@ public class MortarEntity extends VehicleEntity implements GeoEntity {
|
|||
double targetZ = pos.getZ();
|
||||
var isDepressed = parameters.isDepressed();
|
||||
|
||||
if (!RangeHelper.canReach(11.4, 0.146, this.getEyePosition(), new Vec3(targetX, targetY, targetZ), 20, 89, isDepressed)) {
|
||||
if (!RangeTool.canReach(11.4, 0.146, this.getEyePosition(), new Vec3(targetX, targetY, targetZ), 20, 89, isDepressed)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.look(new Vec3(targetX, targetY, targetZ));
|
||||
|
||||
entityData.set(PITCH, (float) -RangeHelper.calculateAngle(
|
||||
entityData.set(PITCH, (float) -RangeTool.calculateAngle(
|
||||
11.4, 0.146,
|
||||
this.getEyePosition(),
|
||||
new Vec3(targetX, targetY, targetZ),
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.atsuishio.superbwarfare.entity.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.Mod;
|
||||
import com.atsuishio.superbwarfare.client.gui.RangeHelper;
|
||||
import com.atsuishio.superbwarfare.component.ModDataComponents;
|
||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||
|
@ -18,10 +17,7 @@ import com.atsuishio.superbwarfare.init.ModSounds;
|
|||
import com.atsuishio.superbwarfare.init.ModTags;
|
||||
import com.atsuishio.superbwarfare.item.common.ammo.CannonShellItem;
|
||||
import com.atsuishio.superbwarfare.network.message.receive.ShakeClientMessage;
|
||||
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||
import com.atsuishio.superbwarfare.tools.InventoryTool;
|
||||
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
||||
import com.atsuishio.superbwarfare.tools.SoundTool;
|
||||
import com.atsuishio.superbwarfare.tools.*;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
|
@ -155,11 +151,11 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity
|
|||
int targetY = pos.getY();
|
||||
int targetZ = pos.getZ();
|
||||
|
||||
if (!RangeHelper.canReach(15, 0.2F, this.getEyePosition(), new Vec3(targetX, targetY, targetZ), -14.9, 85, parameters.isDepressed()))
|
||||
if (!RangeTool.canReach(15, 0.2F, this.getEyePosition(), new Vec3(targetX, targetY, targetZ), -14.9, 85, parameters.isDepressed()))
|
||||
return;
|
||||
|
||||
this.look(new Vec3(targetX, targetY, targetZ));
|
||||
entityData.set(PITCH, (float) -RangeHelper.calculateAngle(15, 0.2F, this.getEyePosition(), new Vec3(targetX, targetY, targetZ), parameters.isDepressed()));
|
||||
entityData.set(PITCH, (float) -RangeTool.calculateAngle(15, 0.2F, this.getEyePosition(), new Vec3(targetX, targetY, targetZ), parameters.isDepressed()));
|
||||
}
|
||||
|
||||
private void look(Vec3 pTarget) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.atsuishio.superbwarfare.entity.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.Mod;
|
||||
import com.atsuishio.superbwarfare.client.gui.RangeHelper;
|
||||
import com.atsuishio.superbwarfare.component.ModDataComponents;
|
||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||
|
@ -18,10 +17,7 @@ import com.atsuishio.superbwarfare.init.ModSounds;
|
|||
import com.atsuishio.superbwarfare.init.ModTags;
|
||||
import com.atsuishio.superbwarfare.item.common.ammo.CannonShellItem;
|
||||
import com.atsuishio.superbwarfare.network.message.receive.ShakeClientMessage;
|
||||
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||
import com.atsuishio.superbwarfare.tools.InventoryTool;
|
||||
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
||||
import com.atsuishio.superbwarfare.tools.SoundTool;
|
||||
import com.atsuishio.superbwarfare.tools.*;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
|
@ -158,11 +154,11 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
|
|||
int targetY = pos.getY();
|
||||
int targetZ = pos.getZ();
|
||||
|
||||
if (!RangeHelper.canReach(15, 0.2F, this.getEyePosition(), new Vec3(targetX, targetY, targetZ), -2.7, 30, parameters.isDepressed()))
|
||||
if (!RangeTool.canReach(15, 0.2F, this.getEyePosition(), new Vec3(targetX, targetY, targetZ), -2.7, 30, parameters.isDepressed()))
|
||||
return;
|
||||
|
||||
this.look(new Vec3(targetX, targetY, targetZ));
|
||||
entityData.set(PITCH, (float) -RangeHelper.calculateAngle(15, 0.2F, this.getEyePosition(), new Vec3(targetX, targetY, targetZ), parameters.isDepressed()));
|
||||
entityData.set(PITCH, (float) -RangeTool.calculateAngle(15, 0.2F, this.getEyePosition(), new Vec3(targetX, targetY, targetZ), parameters.isDepressed()));
|
||||
}
|
||||
|
||||
private void look(Vec3 pTarget) {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.atsuishio.superbwarfare.client.gui;
|
||||
package com.atsuishio.superbwarfare.tools;
|
||||
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public class RangeHelper {
|
||||
public class RangeTool {
|
||||
|
||||
/**
|
||||
* 计算迫击炮理论水平射程
|
Loading…
Add table
Reference in a new issue