添加火炮HUD的标尺功能
This commit is contained in:
parent
16df84e0a3
commit
271917eb92
3 changed files with 5 additions and 4 deletions
|
@ -40,19 +40,20 @@ public class CannonHudOverlay {
|
|||
float xRotOffset = Mth.lerp(event.getPartialTick(), player.xRotO, player.getXRot());
|
||||
float diffY = Objects.requireNonNull(player.getVehicle()).getViewYRot(event.getPartialTick()) - yRotOffset;
|
||||
float diffX = Objects.requireNonNull(player.getVehicle()).getViewXRot(event.getPartialTick()) - xRotOffset + 1.3f;
|
||||
float fovAdjust = (float) 70 / Minecraft.getInstance().options.fov().get();
|
||||
if (diffY > 180.0f) {
|
||||
diffY -= 360.0f;
|
||||
} else if (diffY < -180.0f) {
|
||||
diffY += 360.0f;
|
||||
}
|
||||
float f = (float)Math.min(w, h);
|
||||
float f1 = Math.min((float)w / f, (float)h / f);
|
||||
float f1 = Math.min((float)w / f, (float)h / f) * fovAdjust;
|
||||
int i = Mth.floor(f * f1);
|
||||
int j = Mth.floor(f * f1);
|
||||
int k = (w - i) / 2;
|
||||
int l = (h - j) / 2;
|
||||
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/cannon/cannon_crosshair.png"), k, l, 0, 0.0F, i, j, i, j);
|
||||
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/cannon/indicator.png"), k + 13 * diffY, l + 17 * diffX, 0, 0.0F, i, j, i, j);
|
||||
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/cannon/indicator.png"), k + 15.6f * diffY * fovAdjust, l + 20.4f * diffX * fovAdjust, 0, 0.0F, i, j, i, j);
|
||||
}
|
||||
RenderSystem.depthMask(true);
|
||||
RenderSystem.defaultBlendFunc();
|
||||
|
|
|
@ -252,7 +252,7 @@ public class Mle1934Entity extends PathfinderMob implements GeoEntity, ICannonEn
|
|||
entityToSpawnLeft.setPos(this.getX() + leftPos.x,
|
||||
this.getEyeY() - 0.2 + leftPos.y,
|
||||
this.getZ() + leftPos.z);
|
||||
entityToSpawnLeft.shoot(this.getLookAngle().x, this.getLookAngle().y, this.getLookAngle().z, 18, 0.05f);
|
||||
entityToSpawnLeft.shoot(this.getLookAngle().x, this.getLookAngle().y, this.getLookAngle().z, 15, 0.05f);
|
||||
level.addFreshEntity(entityToSpawnLeft);
|
||||
|
||||
//右炮管
|
||||
|
@ -267,7 +267,7 @@ public class Mle1934Entity extends PathfinderMob implements GeoEntity, ICannonEn
|
|||
entityToSpawnRight.setPos(this.getX() + rightPos.x,
|
||||
this.getEyeY() - 0.2 + rightPos.y,
|
||||
this.getZ() + rightPos.z);
|
||||
entityToSpawnRight.shoot(this.getLookAngle().x, this.getLookAngle().y, this.getLookAngle().z, 18, 0.05f);
|
||||
entityToSpawnRight.shoot(this.getLookAngle().x, this.getLookAngle().y, this.getLookAngle().z, 15, 0.05f);
|
||||
level.addFreshEntity(entityToSpawnRight);
|
||||
|
||||
player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> capability.recoilHorizon = 1);
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 5.8 KiB |
Loading…
Add table
Reference in a new issue