修复服务端崩溃bug
This commit is contained in:
parent
3d079dbf47
commit
5f3a11eb01
5 changed files with 11 additions and 14 deletions
|
@ -27,7 +27,6 @@ import com.atsuishio.superbwarfare.tools.ParticleTool;
|
||||||
import com.mojang.math.Axis;
|
import com.mojang.math.Axis;
|
||||||
import net.minecraft.client.gui.Font;
|
import net.minecraft.client.gui.Font;
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.particles.ParticleTypes;
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
@ -690,7 +689,7 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
@Override
|
@Override
|
||||||
public void renderFirstPersonOverlay(GuiGraphics guiGraphics, Font font, LocalPlayer player, int screenWidth, int screenHeight, float scale) {
|
public void renderFirstPersonOverlay(GuiGraphics guiGraphics, Font font, Player player, int screenWidth, int screenHeight, float scale) {
|
||||||
super.renderFirstPersonOverlay(guiGraphics, font, player, screenWidth, screenHeight, scale);
|
super.renderFirstPersonOverlay(guiGraphics, font, player, screenWidth, screenHeight, scale);
|
||||||
|
|
||||||
if (this.getWeaponIndex(0) == 0) {
|
if (this.getWeaponIndex(0) == 0) {
|
||||||
|
@ -706,7 +705,7 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
@Override
|
@Override
|
||||||
public void renderThirdPersonOverlay(GuiGraphics guiGraphics, Font font, LocalPlayer player, int screenWidth, int screenHeight, float scale) {
|
public void renderThirdPersonOverlay(GuiGraphics guiGraphics, Font font, Player player, int screenWidth, int screenHeight, float scale) {
|
||||||
if (this.getWeaponIndex(0) == 0) {
|
if (this.getWeaponIndex(0) == 0) {
|
||||||
double heat = this.getEntityData().get(HEAT) / 100.0F;
|
double heat = this.getEntityData().get(HEAT) / 100.0F;
|
||||||
guiGraphics.drawString(font, Component.literal("30MM 2A42 " + (InventoryTool.hasCreativeAmmoBox(player) ? "∞" : this.getAmmoCount(player))), 30, -9, Mth.hsvToRgb(0F, (float) heat, 1.0F), false);
|
guiGraphics.drawString(font, Component.literal("30MM 2A42 " + (InventoryTool.hasCreativeAmmoBox(player) ? "∞" : this.getAmmoCount(player))), 30, -9, Mth.hsvToRgb(0F, (float) heat, 1.0F), false);
|
||||||
|
|
|
@ -26,7 +26,6 @@ import com.atsuishio.superbwarfare.tools.ParticleTool;
|
||||||
import com.mojang.math.Axis;
|
import com.mojang.math.Axis;
|
||||||
import net.minecraft.client.gui.Font;
|
import net.minecraft.client.gui.Font;
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.particles.ParticleTypes;
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
@ -597,7 +596,7 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
@Override
|
@Override
|
||||||
public void renderFirstPersonOverlay(GuiGraphics guiGraphics, Font font, LocalPlayer player, int screenWidth, int screenHeight, float scale) {
|
public void renderFirstPersonOverlay(GuiGraphics guiGraphics, Font font, Player player, int screenWidth, int screenHeight, float scale) {
|
||||||
super.renderFirstPersonOverlay(guiGraphics, font, player, screenWidth, screenHeight, scale);
|
super.renderFirstPersonOverlay(guiGraphics, font, player, screenWidth, screenHeight, scale);
|
||||||
|
|
||||||
if (this.getWeaponIndex(0) == 0) {
|
if (this.getWeaponIndex(0) == 0) {
|
||||||
|
@ -611,7 +610,7 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
@Override
|
@Override
|
||||||
public void renderThirdPersonOverlay(GuiGraphics guiGraphics, Font font, LocalPlayer player, int screenWidth, int screenHeight, float scale) {
|
public void renderThirdPersonOverlay(GuiGraphics guiGraphics, Font font, Player player, int screenWidth, int screenHeight, float scale) {
|
||||||
super.renderThirdPersonOverlay(guiGraphics, font, player, screenWidth, screenHeight, scale);
|
super.renderThirdPersonOverlay(guiGraphics, font, player, screenWidth, screenHeight, scale);
|
||||||
|
|
||||||
if (this.getWeaponIndex(0) == 0) {
|
if (this.getWeaponIndex(0) == 0) {
|
||||||
|
|
|
@ -24,7 +24,6 @@ import com.mojang.math.Axis;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.client.gui.Font;
|
import net.minecraft.client.gui.Font;
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.Holder;
|
import net.minecraft.core.Holder;
|
||||||
|
@ -740,7 +739,7 @@ public class PrismTankEntity extends ContainerMobileVehicleEntity implements Geo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderFirstPersonOverlay(GuiGraphics guiGraphics, Font font, LocalPlayer player, int screenWidth, int screenHeight, float scale) {
|
public void renderFirstPersonOverlay(GuiGraphics guiGraphics, Font font, Player player, int screenWidth, int screenHeight, float scale) {
|
||||||
float minWH = (float) Math.min(screenWidth, screenHeight);
|
float minWH = (float) Math.min(screenWidth, screenHeight);
|
||||||
float scaledMinWH = Mth.floor(minWH * scale);
|
float scaledMinWH = Mth.floor(minWH * scale);
|
||||||
float centerW = ((screenWidth - scaledMinWH) / 2);
|
float centerW = ((screenWidth - scaledMinWH) / 2);
|
||||||
|
@ -755,7 +754,7 @@ public class PrismTankEntity extends ContainerMobileVehicleEntity implements Geo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderThirdPersonOverlay(GuiGraphics guiGraphics, Font font, LocalPlayer player, int screenWidth, int screenHeight, float scale) {
|
public void renderThirdPersonOverlay(GuiGraphics guiGraphics, Font font, Player player, int screenWidth, int screenHeight, float scale) {
|
||||||
super.renderThirdPersonOverlay(guiGraphics, font, player, screenWidth, screenHeight, scale);
|
super.renderThirdPersonOverlay(guiGraphics, font, player, screenWidth, screenHeight, scale);
|
||||||
|
|
||||||
double heat = this.getEntityData().get(HEAT) / 100.0F;
|
double heat = this.getEntityData().get(HEAT) / 100.0F;
|
||||||
|
|
|
@ -27,7 +27,6 @@ import net.minecraft.client.CameraType;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.Font;
|
import net.minecraft.client.gui.Font;
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
|
||||||
import net.minecraft.client.renderer.GameRenderer;
|
import net.minecraft.client.renderer.GameRenderer;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.particles.ParticleTypes;
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
|
@ -1174,7 +1173,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderFirstPersonOverlay(GuiGraphics guiGraphics, Font font, LocalPlayer player, int screenWidth, int screenHeight, float scale) {
|
public void renderFirstPersonOverlay(GuiGraphics guiGraphics, Font font, Player player, int screenWidth, int screenHeight, float scale) {
|
||||||
float minWH = (float) Math.min(screenWidth, screenHeight);
|
float minWH = (float) Math.min(screenWidth, screenHeight);
|
||||||
float scaledMinWH = Mth.floor(minWH * scale);
|
float scaledMinWH = Mth.floor(minWH * scale);
|
||||||
float centerW = ((screenWidth - scaledMinWH) / 2);
|
float centerW = ((screenWidth - scaledMinWH) / 2);
|
||||||
|
@ -1210,7 +1209,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderThirdPersonOverlay(GuiGraphics guiGraphics, Font font, LocalPlayer player, int screenWidth, int screenHeight, float scale) {
|
public void renderThirdPersonOverlay(GuiGraphics guiGraphics, Font font, Player player, int screenWidth, int screenHeight, float scale) {
|
||||||
if (this.getWeaponIndex(0) == 0) {
|
if (this.getWeaponIndex(0) == 0) {
|
||||||
guiGraphics.drawString(font, Component.literal("AP SHELL " + this.getAmmoCount(player) + " " + (InventoryTool.hasCreativeAmmoBox(player) ? "∞" : this.getEntityData().get(AMMO))), 30, -9, -1, false);
|
guiGraphics.drawString(font, Component.literal("AP SHELL " + this.getAmmoCount(player) + " " + (InventoryTool.hasCreativeAmmoBox(player) ? "∞" : this.getEntityData().get(AMMO))), 30, -9, -1, false);
|
||||||
} else if (this.getWeaponIndex(0) == 1) {
|
} else if (this.getWeaponIndex(0) == 1) {
|
||||||
|
|
|
@ -954,8 +954,9 @@ public abstract class VehicleEntity extends Entity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void renderFirstPersonOverlay(GuiGraphics guiGraphics, Font font, LocalPlayer player, int screenWidth, int screenHeight, float scale) {
|
public void renderFirstPersonOverlay(GuiGraphics guiGraphics, Font font, Player player, int screenWidth, int screenHeight, float scale) {
|
||||||
if (!(this instanceof WeaponVehicleEntity weaponVehicle)) return;
|
if (!(this instanceof WeaponVehicleEntity weaponVehicle)) return;
|
||||||
|
if (!(player instanceof LocalPlayer)) return;
|
||||||
|
|
||||||
float minWH = (float) Math.min(screenWidth, screenHeight);
|
float minWH = (float) Math.min(screenWidth, screenHeight);
|
||||||
float scaledMinWH = Mth.floor(minWH * scale);
|
float scaledMinWH = Mth.floor(minWH * scale);
|
||||||
|
@ -982,6 +983,6 @@ public abstract class VehicleEntity extends Entity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void renderThirdPersonOverlay(GuiGraphics guiGraphics, Font font, LocalPlayer player, int screenWidth, int screenHeight, float scale) {
|
public void renderThirdPersonOverlay(GuiGraphics guiGraphics, Font font, Player player, int screenWidth, int screenHeight, float scale) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue