继续优化代码

This commit is contained in:
17146 2024-08-15 15:15:56 +08:00
parent 4032d4537a
commit 84bf5662c2
19 changed files with 87 additions and 247 deletions

View file

@ -3,6 +3,7 @@ package net.mcreator.superbwarfare.client.renderer.entity;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Axis; import com.mojang.math.Axis;
import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.client.model.entity.ModelBocekArrow; import net.mcreator.superbwarfare.client.model.entity.ModelBocekArrow;
import net.mcreator.superbwarfare.entity.BocekArrowEntity; import net.mcreator.superbwarfare.entity.BocekArrowEntity;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
@ -14,7 +15,7 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
public class BocekArrowRenderer extends EntityRenderer<BocekArrowEntity> { public class BocekArrowRenderer extends EntityRenderer<BocekArrowEntity> {
private static final ResourceLocation texture = new ResourceLocation("superbwarfare:textures/entity/bocek_arrow.png"); private static final ResourceLocation TEXTURE = new ResourceLocation(ModUtils.MODID, "textures/entity/bocek_arrow.png");
private final ModelBocekArrow<BocekArrowEntity> model; private final ModelBocekArrow<BocekArrowEntity> model;
public BocekArrowRenderer(EntityRendererProvider.Context context) { public BocekArrowRenderer(EntityRendererProvider.Context context) {
@ -35,6 +36,6 @@ public class BocekArrowRenderer extends EntityRenderer<BocekArrowEntity> {
@Override @Override
public ResourceLocation getTextureLocation(BocekArrowEntity entity) { public ResourceLocation getTextureLocation(BocekArrowEntity entity) {
return texture; return TEXTURE;
} }
} }

View file

@ -3,6 +3,7 @@ package net.mcreator.superbwarfare.client.renderer.entity;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Axis; import com.mojang.math.Axis;
import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.client.model.entity.ModelBullet; import net.mcreator.superbwarfare.client.model.entity.ModelBullet;
import net.mcreator.superbwarfare.entity.FragEntity; import net.mcreator.superbwarfare.entity.FragEntity;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
@ -15,7 +16,7 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
public class FragRenderer extends EntityRenderer<FragEntity> { public class FragRenderer extends EntityRenderer<FragEntity> {
private static final ResourceLocation texture = new ResourceLocation("superbwarfare:textures/entity/bullet_tex.png"); private static final ResourceLocation TEXTURE = new ResourceLocation(ModUtils.MODID, "textures/entity/bullet_tex.png");
private final ModelBullet<FragEntity> model; private final ModelBullet<FragEntity> model;
public FragRenderer(EntityRendererProvider.Context context) { public FragRenderer(EntityRendererProvider.Context context) {
@ -40,6 +41,6 @@ public class FragRenderer extends EntityRenderer<FragEntity> {
@Override @Override
public ResourceLocation getTextureLocation(FragEntity entity) { public ResourceLocation getTextureLocation(FragEntity entity) {
return texture; return TEXTURE;
} }
} }

View file

@ -3,6 +3,7 @@ package net.mcreator.superbwarfare.client.renderer.entity;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Axis; import com.mojang.math.Axis;
import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.client.model.entity.ModelGrenade; import net.mcreator.superbwarfare.client.model.entity.ModelGrenade;
import net.mcreator.superbwarfare.entity.GunGrenadeEntity; import net.mcreator.superbwarfare.entity.GunGrenadeEntity;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
@ -14,7 +15,7 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
public class GunGrenadeRenderer extends EntityRenderer<GunGrenadeEntity> { public class GunGrenadeRenderer extends EntityRenderer<GunGrenadeEntity> {
private static final ResourceLocation texture = new ResourceLocation("superbwarfare:textures/entity/grenade.png"); private static final ResourceLocation TEXTURE = new ResourceLocation(ModUtils.MODID, "textures/entity/grenade.png");
private final ModelGrenade<GunGrenadeEntity> model; private final ModelGrenade<GunGrenadeEntity> model;
public GunGrenadeRenderer(EntityRendererProvider.Context context) { public GunGrenadeRenderer(EntityRendererProvider.Context context) {
@ -35,6 +36,6 @@ public class GunGrenadeRenderer extends EntityRenderer<GunGrenadeEntity> {
@Override @Override
public ResourceLocation getTextureLocation(GunGrenadeEntity entity) { public ResourceLocation getTextureLocation(GunGrenadeEntity entity) {
return texture; return TEXTURE;
} }
} }

View file

@ -3,6 +3,7 @@ package net.mcreator.superbwarfare.client.renderer.entity;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Axis; import com.mojang.math.Axis;
import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.client.model.entity.ModelHandGrenade; import net.mcreator.superbwarfare.client.model.entity.ModelHandGrenade;
import net.mcreator.superbwarfare.entity.HandGrenadeEntity; import net.mcreator.superbwarfare.entity.HandGrenadeEntity;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
@ -14,7 +15,7 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
public class HandGrenadeEntityRenderer extends EntityRenderer<HandGrenadeEntity> { public class HandGrenadeEntityRenderer extends EntityRenderer<HandGrenadeEntity> {
private static final ResourceLocation texture = new ResourceLocation("superbwarfare:textures/entity/hand_grenade.png"); private static final ResourceLocation TEXTURE = new ResourceLocation(ModUtils.MODID, "textures/entity/hand_grenade.png");
private final ModelHandGrenade<HandGrenadeEntity> model; private final ModelHandGrenade<HandGrenadeEntity> model;
public HandGrenadeEntityRenderer(EntityRendererProvider.Context context) { public HandGrenadeEntityRenderer(EntityRendererProvider.Context context) {
@ -35,6 +36,6 @@ public class HandGrenadeEntityRenderer extends EntityRenderer<HandGrenadeEntity>
@Override @Override
public ResourceLocation getTextureLocation(HandGrenadeEntity entity) { public ResourceLocation getTextureLocation(HandGrenadeEntity entity) {
return texture; return TEXTURE;
} }
} }

View file

@ -3,6 +3,7 @@ package net.mcreator.superbwarfare.client.renderer.entity;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Axis; import com.mojang.math.Axis;
import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.client.model.entity.ModelMortarShell; import net.mcreator.superbwarfare.client.model.entity.ModelMortarShell;
import net.mcreator.superbwarfare.entity.MortarShellEntity; import net.mcreator.superbwarfare.entity.MortarShellEntity;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
@ -14,7 +15,7 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
public class MortarShellRenderer extends EntityRenderer<MortarShellEntity> { public class MortarShellRenderer extends EntityRenderer<MortarShellEntity> {
private static final ResourceLocation texture = new ResourceLocation("superbwarfare:textures/entity/mortar_shell.png"); private static final ResourceLocation TEXTURE = new ResourceLocation(ModUtils.MODID, "textures/entity/mortar_shell.png");
private final ModelMortarShell<MortarShellEntity> model; private final ModelMortarShell<MortarShellEntity> model;
public MortarShellRenderer(EntityRendererProvider.Context context) { public MortarShellRenderer(EntityRendererProvider.Context context) {
@ -35,6 +36,6 @@ public class MortarShellRenderer extends EntityRenderer<MortarShellEntity> {
@Override @Override
public ResourceLocation getTextureLocation(MortarShellEntity entity) { public ResourceLocation getTextureLocation(MortarShellEntity entity) {
return texture; return TEXTURE;
} }
} }

View file

@ -3,6 +3,7 @@ package net.mcreator.superbwarfare.client.renderer.entity;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Axis; import com.mojang.math.Axis;
import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.client.model.entity.ModelTaserRod; import net.mcreator.superbwarfare.client.model.entity.ModelTaserRod;
import net.mcreator.superbwarfare.entity.TaserBulletProjectileEntity; import net.mcreator.superbwarfare.entity.TaserBulletProjectileEntity;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
@ -14,7 +15,7 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
public class TaserBulletProjectileRenderer extends EntityRenderer<TaserBulletProjectileEntity> { public class TaserBulletProjectileRenderer extends EntityRenderer<TaserBulletProjectileEntity> {
private static final ResourceLocation texture = new ResourceLocation("superbwarfare:textures/entity/taser_rod.png"); private static final ResourceLocation TEXTURE = new ResourceLocation(ModUtils.MODID, "textures/entity/taser_rod.png");
private final ModelTaserRod<TaserBulletProjectileEntity> model; private final ModelTaserRod<TaserBulletProjectileEntity> model;
public TaserBulletProjectileRenderer(EntityRendererProvider.Context context) { public TaserBulletProjectileRenderer(EntityRendererProvider.Context context) {
@ -35,6 +36,6 @@ public class TaserBulletProjectileRenderer extends EntityRenderer<TaserBulletPro
@Override @Override
public ResourceLocation getTextureLocation(TaserBulletProjectileEntity entity) { public ResourceLocation getTextureLocation(TaserBulletProjectileEntity entity) {
return texture; return TEXTURE;
} }
} }

View file

@ -2,6 +2,7 @@ package net.mcreator.superbwarfare.client.screens;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.init.ModItems; import net.mcreator.superbwarfare.init.ModItems;
import net.mcreator.superbwarfare.init.ModTags; import net.mcreator.superbwarfare.init.ModTags;
import net.mcreator.superbwarfare.network.ModVariables; import net.mcreator.superbwarfare.network.ModVariables;
@ -47,11 +48,11 @@ public class CrossHairOverlay {
RenderSystem.setShaderColor(1, 1, 1, 1); RenderSystem.setShaderColor(1, 1, 1, 1);
if (shouldRenderCrossHair(player) || stack.is(ModItems.MINIGUN.get())) { if (shouldRenderCrossHair(player) || stack.is(ModItems.MINIGUN.get())) {
preciseBlit(event.getGuiGraphics(), new ResourceLocation("superbwarfare:textures/screens/point.png"), w / 2f - 7.5f, h / 2f - 8, 0, 0, 16, 16, 16, 16); preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/point.png"), w / 2f - 7.5f, h / 2f - 8, 0, 0, 16, 16, 16, 16);
preciseBlit(event.getGuiGraphics(), new ResourceLocation("superbwarfare:textures/screens/rexheng.png"), w / 2f - 9.5f - 2.8f * (float) spread, h / 2f - 8, 0, 0, 16, 16, 16, 16); preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/rexheng.png"), w / 2f - 9.5f - 2.8f * (float) spread, h / 2f - 8, 0, 0, 16, 16, 16, 16);
preciseBlit(event.getGuiGraphics(), new ResourceLocation("superbwarfare:textures/screens/rexheng.png"), w / 2f - 6.5f + 2.8f * (float) spread, h / 2f - 8, 0, 0, 16, 16, 16, 16); preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/rexheng.png"), w / 2f - 6.5f + 2.8f * (float) spread, h / 2f - 8, 0, 0, 16, 16, 16, 16);
preciseBlit(event.getGuiGraphics(), new ResourceLocation("superbwarfare:textures/screens/rexshu.png"), w / 2f - 7.5f, h / 2f - 7 + 2.8f * (float) spread, 0, 0, 16, 16, 16, 16); preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/rexshu.png"), w / 2f - 7.5f, h / 2f - 7 + 2.8f * (float) spread, 0, 0, 16, 16, 16, 16);
preciseBlit(event.getGuiGraphics(), new ResourceLocation("superbwarfare:textures/screens/rexshu.png"), w / 2f - 7.5f, h / 2f - 10 - 2.8f * (float) spread, 0, 0, 16, 16, 16, 16); preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/rexshu.png"), w / 2f - 7.5f, h / 2f - 10 - 2.8f * (float) spread, 0, 0, 16, 16, 16, 16);
} }
float ww = w / 2f - 7.5f + (float) (2 * (Math.random() - 0.5f)); float ww = w / 2f - 7.5f + (float) (2 * (Math.random() - 0.5f));
@ -59,18 +60,18 @@ public class CrossHairOverlay {
float m = (40 - KILL_INDICATOR * 5) / 5.5f; float m = (40 - KILL_INDICATOR * 5) / 5.5f;
if (HIT_INDICATOR > 0) { if (HIT_INDICATOR > 0) {
preciseBlit(event.getGuiGraphics(), new ResourceLocation("superbwarfare:textures/screens/hit_marker.png"), ww, hh, 0, 0, 16, 16, 16, 16); preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/hit_marker.png"), ww, hh, 0, 0, 16, 16, 16, 16);
} }
if (HEAD_INDICATOR > 0) { if (HEAD_INDICATOR > 0) {
preciseBlit(event.getGuiGraphics(), new ResourceLocation("superbwarfare:textures/screens/headshotmark.png"), ww, hh, 0, 0, 16, 16, 16, 16); preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/headshotmark.png"), ww, hh, 0, 0, 16, 16, 16, 16);
} }
if (KILL_INDICATOR > 0) { if (KILL_INDICATOR > 0) {
preciseBlit(event.getGuiGraphics(), new ResourceLocation("superbwarfare:textures/screens/kill_mark1.png"), w / 2f - 7.5f - 2 + m, h / 2f - 8 - 2 + m, 0, 0, 16, 16, 16, 16); preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/kill_mark1.png"), w / 2f - 7.5f - 2 + m, h / 2f - 8 - 2 + m, 0, 0, 16, 16, 16, 16);
preciseBlit(event.getGuiGraphics(), new ResourceLocation("superbwarfare:textures/screens/kill_mark2.png"), w / 2f - 7.5f + 2 - m, h / 2f - 8 - 2 + m, 0, 0, 16, 16, 16, 16); preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/kill_mark2.png"), w / 2f - 7.5f + 2 - m, h / 2f - 8 - 2 + m, 0, 0, 16, 16, 16, 16);
preciseBlit(event.getGuiGraphics(), new ResourceLocation("superbwarfare:textures/screens/kill_mark3.png"), w / 2f - 7.5f - 2 + m, h / 2f - 8 + 2 - m, 0, 0, 16, 16, 16, 16); preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/kill_mark3.png"), w / 2f - 7.5f - 2 + m, h / 2f - 8 + 2 - m, 0, 0, 16, 16, 16, 16);
preciseBlit(event.getGuiGraphics(), new ResourceLocation("superbwarfare:textures/screens/kill_mark4.png"), w / 2f - 7.5f + 2 - m, h / 2f - 8 + 2 - m, 0, 0, 16, 16, 16, 16); preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/kill_mark4.png"), w / 2f - 7.5f + 2 - m, h / 2f - 8 + 2 - m, 0, 0, 16, 16, 16, 16);
} }
RenderSystem.depthMask(true); RenderSystem.depthMask(true);

View file

@ -2,6 +2,7 @@ package net.mcreator.superbwarfare.client.screens;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.entity.DroneEntity; import net.mcreator.superbwarfare.entity.DroneEntity;
import net.mcreator.superbwarfare.init.ModItems; import net.mcreator.superbwarfare.init.ModItems;
import net.mcreator.superbwarfare.tools.TraceTool; import net.mcreator.superbwarfare.tools.TraceTool;
@ -34,6 +35,7 @@ public class DroneUIOverlay {
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) { if (player != null) {
ItemStack stack = player.getMainHandItem(); ItemStack stack = player.getMainHandItem();
RenderSystem.disableDepthTest(); RenderSystem.disableDepthTest();
@ -43,13 +45,12 @@ public class DroneUIOverlay {
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
RenderSystem.setShaderColor(1, 1, 1, 1); RenderSystem.setShaderColor(1, 1, 1, 1);
if (stack.is(ModItems.MONITOR.get()) && stack.getOrCreateTag().getBoolean("Using") && stack.getOrCreateTag().getBoolean("Linked")) { if (stack.is(ModItems.MONITOR.get()) && stack.getOrCreateTag().getBoolean("Using") && stack.getOrCreateTag().getBoolean("Linked")) {
event.getGuiGraphics().blit(new ResourceLocation("superbwarfare:textures/screens/drone.png"), w / 2 - 16, h / 2 - 16, 0, 0, 32, 32, 32, 32); event.getGuiGraphics().blit(new ResourceLocation(ModUtils.MODID, "textures/screens/drone.png"), w / 2 - 16, h / 2 - 16, 0, 0, 32, 32, 32, 32);
DroneEntity entity = player.level().getEntitiesOfClass(DroneEntity.class, player.getBoundingBox().inflate(512)) DroneEntity entity = player.level().getEntitiesOfClass(DroneEntity.class, player.getBoundingBox().inflate(512))
.stream().filter(e -> e.getStringUUID().equals(stack.getOrCreateTag().getString("LinkedDrone"))).findFirst().orElse(null); .stream().filter(e -> e.getStringUUID().equals(stack.getOrCreateTag().getString("LinkedDrone"))).findFirst().orElse(null);
if (entity != null) { if (entity != null) {
boolean lookAtEntity = false; boolean lookAtEntity = false;
double distance = player.distanceTo(entity); double distance = player.distanceTo(entity);
double block_range = entity.position().distanceTo((Vec3.atLowerCornerOf(entity.level().clip( double block_range = entity.position().distanceTo((Vec3.atLowerCornerOf(entity.level().clip(
@ -67,56 +68,45 @@ public class DroneUIOverlay {
int color = -1; int color = -1;
if (distance > MAX_DISTANCE - 48) { if (distance > MAX_DISTANCE - 48) {
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.warning") event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.warning"),
, w / 2 + -18, h / 2 + -47, -65536, false); w / 2 - 18, h / 2 - 47, -65536, false);
color = -65536; color = -65536;
} }
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.distance") event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.distance")
.append(Component.literal(new DecimalFormat("##.#").format(distance) + "M")) .append(Component.literal(new DecimalFormat("##.#").format(distance) + "M")),
, w / 2 + 10, h / 2 + 33, color, false); w / 2 + 10, h / 2 + 33, color, false);
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.health") event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.health")
.append(Component.literal(new DecimalFormat("##.#").format(entity.getHealth()) + "/" + new DecimalFormat("##.#").format(entity.getMaxHealth()))) .append(Component.literal(new DecimalFormat("##.#").format(entity.getHealth()) + "/" + new DecimalFormat("##.#").format(entity.getMaxHealth()))),
, w / 2 - 77, h / 2 + 33, -1, false); w / 2 - 77, h / 2 + 33, -1, false);
if (!entity.getEntityData().get(KAMIKAZE)) { if (!entity.getEntityData().get(KAMIKAZE)) {
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.ammo") event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.ammo")
.append(Component.literal(new DecimalFormat("##.#").format(entity.getEntityData().get(AMMO)) + " / 6")) .append(Component.literal(new DecimalFormat("##.#").format(entity.getEntityData().get(AMMO)) + " / 6")),
, w / 2 + 12, h / 2 + -37, -1, false); w / 2 + 12, h / 2 - 37, -1, false);
} else { } else {
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.kamikaze"),
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.kamikaze") w / 2 + 12, h / 2 - 37, -65536, false);
, w / 2 + 12, h / 2 + -37, -65536, false);
} }
if (lookAtEntity) { if (lookAtEntity) {
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.range") event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.range")
.append(Component.literal(new DecimalFormat("##.#").format(entity_range) + "M " + lookingEntity.getDisplayName().getString())) .append(Component.literal(new DecimalFormat("##.#").format(entity_range) + "M " + lookingEntity.getDisplayName().getString())),
, w / 2 + 12, h / 2 - 28, color, false); w / 2 + 12, h / 2 - 28, color, false);
} else { } else {
if (block_range > 512) { if (block_range > 512) {
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.range") event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.range")
.append(Component.literal("---M")) .append(Component.literal("---M")), w / 2 + 12, h / 2 - 28, color, false);
, w / 2 + 12, h / 2 - 28, color, false);
} else { } else {
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.range") event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.range")
.append(Component.literal(new DecimalFormat("##.#").format(block_range) + "M")) .append(Component.literal(new DecimalFormat("##.#").format(block_range) + "M")),
, w / 2 + 12, h / 2 - 28, color, false); w / 2 + 12, h / 2 - 28, color, false);
} }
} }
} }
} }
RenderSystem.depthMask(true); RenderSystem.depthMask(true);
RenderSystem.defaultBlendFunc(); RenderSystem.defaultBlendFunc();
RenderSystem.enableDepthTest(); RenderSystem.enableDepthTest();

View file

@ -2,6 +2,7 @@ package net.mcreator.superbwarfare.client.screens;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.entity.ICannonEntity; import net.mcreator.superbwarfare.entity.ICannonEntity;
import net.mcreator.superbwarfare.init.ModItems; import net.mcreator.superbwarfare.init.ModItems;
import net.mcreator.superbwarfare.network.ModVariables; import net.mcreator.superbwarfare.network.ModVariables;
@ -31,7 +32,7 @@ public class M79UIOverlay {
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
RenderSystem.setShaderColor(1, 1, 1, 1); RenderSystem.setShaderColor(1, 1, 1, 1);
if (shouldRenderCrossHair(player) || shouldRenderCrossHair2(player)) { if (shouldRenderCrossHair(player) || shouldRenderCrossHair2(player)) {
event.getGuiGraphics().blit(new ResourceLocation("superbwarfare:textures/screens/rex.png"), w / 2 - 16, h / 2 - 16, 0, 0, 32, 32, 32, 32); event.getGuiGraphics().blit(new ResourceLocation(ModUtils.MODID, "textures/screens/rex.png"), w / 2 - 16, h / 2 - 16, 0, 0, 32, 32, 32, 32);
} }
RenderSystem.depthMask(true); RenderSystem.depthMask(true);
RenderSystem.defaultBlendFunc(); RenderSystem.defaultBlendFunc();

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.getOffhandItem().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

@ -1,40 +0,0 @@
package net.mcreator.superbwarfare.enchantment;
import net.mcreator.superbwarfare.init.ModItems;
import net.mcreator.superbwarfare.init.ModTags;
import net.mcreator.superbwarfare.tools.EnchantmentCategoryTool;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.Enchantment;
public class FourthTimesCharm extends Enchantment {
public FourthTimesCharm() {
super(Rarity.VERY_RARE, EnchantmentCategoryTool.GUN, new EquipmentSlot[]{EquipmentSlot.MAINHAND});
}
@Override
public int getMaxLevel() {
return super.getMaxLevel();
}
@Override
public boolean isTreasureOnly() {
return true;
}
@Override
public int getMinCost(int pLevel) {
return 20 + 8 * pLevel;
}
@Override
public int getMaxCost(int pLevel) {
return getMinCost(pLevel) + 20;
}
@Override
public boolean canApplyAtEnchantingTable(ItemStack itemstack) {
return itemstack.is(ModTags.Items.CAN_SHOOT_BULLET) && !itemstack.is(ModItems.MINIGUN.get()) && !itemstack.is(ModTags.Items.USE_SHOTGUN_AMMO);
}
}

View file

@ -1,35 +0,0 @@
package net.mcreator.superbwarfare.enchantment;
import net.mcreator.superbwarfare.init.ModItems;
import net.mcreator.superbwarfare.init.ModTags;
import net.mcreator.superbwarfare.tools.EnchantmentCategoryTool;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.Enchantment;
public class GutshotStraight extends Enchantment {
public GutshotStraight() {
super(Rarity.UNCOMMON, EnchantmentCategoryTool.GUN, new EquipmentSlot[]{EquipmentSlot.MAINHAND});
}
@Override
public int getMaxLevel() {
return 2;
}
@Override
public int getMinCost(int pLevel) {
return 13 + 5 * pLevel;
}
@Override
public int getMaxCost(int pLevel) {
return getMinCost(pLevel) + 20;
}
@Override
public boolean canApplyAtEnchantingTable(ItemStack itemstack) {
return itemstack.is(ModTags.Items.CAN_SHOOT_BULLET) && !itemstack.is(ModItems.MINIGUN.get());
}
}

View file

@ -1,35 +0,0 @@
package net.mcreator.superbwarfare.enchantment;
import net.mcreator.superbwarfare.init.ModTags;
import net.mcreator.superbwarfare.tools.EnchantmentCategoryTool;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.Enchantment;
public class HealClip extends Enchantment {
public HealClip() {
super(Rarity.RARE, EnchantmentCategoryTool.CAN_RELOAD, new EquipmentSlot[]{EquipmentSlot.MAINHAND});
}
@Override
public int getMaxLevel() {
return 2;
}
@Override
public int getMinCost(int pLevel) {
return 15 + 6 * pLevel;
}
@Override
public int getMaxCost(int pLevel) {
return getMinCost(pLevel) + 10;
}
@Override
public boolean canApplyAtEnchantingTable(ItemStack itemstack) {
return itemstack.is(ModTags.Items.CAN_RELOAD);
}
}

View file

@ -1,39 +0,0 @@
package net.mcreator.superbwarfare.enchantment;
import net.mcreator.superbwarfare.init.ModTags;
import net.mcreator.superbwarfare.tools.EnchantmentCategoryTool;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.Enchantment;
public class KillingTally extends Enchantment {
public KillingTally() {
super(Rarity.VERY_RARE, EnchantmentCategoryTool.GUN, new EquipmentSlot[]{EquipmentSlot.MAINHAND});
}
@Override
public int getMaxLevel() {
return 2;
}
@Override
public boolean isTreasureOnly() {
return true;
}
@Override
public int getMinCost(int pLevel) {
return 23 + 3 * pLevel;
}
@Override
public int getMaxCost(int pLevel) {
return getMinCost(pLevel) + 20;
}
@Override
public boolean canApplyAtEnchantingTable(ItemStack itemstack) {
return itemstack.is(ModTags.Items.CAN_SHOOT_BULLET);
}
}

View file

@ -98,7 +98,7 @@ public class BocekArrowEntity extends AbstractArrow implements ItemSupplier {
super.onHitBlock(blockHitResult); super.onHitBlock(blockHitResult);
BlockPos resultPos = blockHitResult.getBlockPos(); BlockPos resultPos = blockHitResult.getBlockPos();
BlockState state = this.level().getBlockState(resultPos); BlockState state = this.level().getBlockState(resultPos);
if(state.getBlock() instanceof BellBlock bell) { if (state.getBlock() instanceof BellBlock bell) {
bell.attemptToRing(this.level(), resultPos, blockHitResult.getDirection()); bell.attemptToRing(this.level(), resultPos, blockHitResult.getDirection());
} }
} }
@ -162,10 +162,10 @@ public class BocekArrowEntity extends AbstractArrow implements ItemSupplier {
} }
boolean hurt; boolean hurt;
if (entity instanceof Monster) { if (entity instanceof Monster monster) {
hurt = performHurt(entity, i * damageMultiplier * (entity instanceof LivingEntity living && living.getMobType() == MobType.UNDEAD? this.undeadMultiple : 1), headshot); hurt = performHurt(entity, i * damageMultiplier * (monster.getMobType() == MobType.UNDEAD ? this.undeadMultiple : 1), headshot);
} else { } else {
hurt = performHurt(entity, i * (entity instanceof LivingEntity living && living.getMobType() == MobType.UNDEAD? this.undeadMultiple : 1), headshot); hurt = performHurt(entity, i * (entity instanceof LivingEntity living && living.getMobType() == MobType.UNDEAD ? this.undeadMultiple : 1), headshot);
} }
if (!hurt) { if (!hurt) {

View file

@ -34,10 +34,6 @@ public class FragEntity extends ThrowableItemProjectile {
super(type, world); super(type, world);
} }
public FragEntity(EntityType<? extends FragEntity> type, LivingEntity entity, Level world) {
super(type, entity, world);
}
public FragEntity(LivingEntity entity, Level level) { public FragEntity(LivingEntity entity, Level level) {
super(ModEntities.FRAG.get(), entity, level); super(ModEntities.FRAG.get(), entity, level);
} }
@ -88,7 +84,7 @@ public class FragEntity extends ThrowableItemProjectile {
super.onHitBlock(blockHitResult); super.onHitBlock(blockHitResult);
BlockPos resultPos = blockHitResult.getBlockPos(); BlockPos resultPos = blockHitResult.getBlockPos();
BlockState state = this.level().getBlockState(resultPos); BlockState state = this.level().getBlockState(resultPos);
if(state.getBlock() instanceof BellBlock bell) { if (state.getBlock() instanceof BellBlock bell) {
bell.attemptToRing(this.level(), resultPos, blockHitResult.getDirection()); bell.attemptToRing(this.level(), resultPos, blockHitResult.getDirection());
} }

View file

@ -40,10 +40,6 @@ public class GunGrenadeEntity extends ThrowableItemProjectile {
super(type, world); super(type, world);
} }
public GunGrenadeEntity(EntityType<? extends GunGrenadeEntity> type, LivingEntity entity, Level world) {
super(type, entity, world);
}
public GunGrenadeEntity(LivingEntity entity, Level level, float damage, int monsterMultiplier) { public GunGrenadeEntity(LivingEntity entity, Level level, float damage, int monsterMultiplier) {
super(ModEntities.GUN_GRENADE.get(), entity, level); super(ModEntities.GUN_GRENADE.get(), entity, level);
this.damage = damage; this.damage = damage;
@ -93,7 +89,7 @@ public class GunGrenadeEntity extends ThrowableItemProjectile {
if (this.tickCount > 0) { if (this.tickCount > 0) {
if (this.level() instanceof ServerLevel) { if (this.level() instanceof ServerLevel) {
causeEntityhitExplode(entity); causeEntityHitExplode(entity);
} }
} }
@ -148,7 +144,7 @@ public class GunGrenadeEntity extends ThrowableItemProjectile {
} }
} }
private void causeEntityhitExplode(Entity entity) { private void causeEntityHitExplode(Entity entity) {
CustomExplosion explosion = new CustomExplosion(this.level(), this, CustomExplosion explosion = new CustomExplosion(this.level(), this,
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), 1.8f * this.damage, ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), 1.8f * this.damage,
entity.getX(), entity.getY(), entity.getZ(), 7.5f, Explosion.BlockInteraction.KEEP).setDamageMultiplier(this.monsterMultiplier); entity.getX(), entity.getY(), entity.getZ(), 7.5f, Explosion.BlockInteraction.KEEP).setDamageMultiplier(this.monsterMultiplier);

View file

@ -12,32 +12,36 @@ import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.model.GeoModel; import software.bernie.geckolib.model.GeoModel;
public class ProjectileEntityModel extends GeoModel<ProjectileEntity> { public class ProjectileEntityModel extends GeoModel<ProjectileEntity> {
@Override @Override
public ResourceLocation getAnimationResource(ProjectileEntity entity) { public ResourceLocation getAnimationResource(ProjectileEntity entity) {
return null; return null;
} }
@Override @Override
public ResourceLocation getModelResource(ProjectileEntity entity) { public ResourceLocation getModelResource(ProjectileEntity entity) {
Player player = Minecraft.getInstance().player; Player player = Minecraft.getInstance().player;
if ((player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).zooming if (player == null) {
|| player.getMainHandItem().is(ModItems.GLOCK_17.get()) return new ResourceLocation(ModUtils.MODID, "geo/projectile_entity2.geo.json");
|| player.getMainHandItem().is(ModItems.GLOCK_18.get()) }
|| player.getMainHandItem().is(ModItems.BOCEK.get())) {
return new ResourceLocation(ModUtils.MODID, "geo/projectile_entity.geo.json");
} else {
return new ResourceLocation(ModUtils.MODID, "geo/projectile_entity2.geo.json");
}
}
@Override if ((player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).zooming
public ResourceLocation getTextureResource(ProjectileEntity entity) { || player.getMainHandItem().is(ModItems.GLOCK_17.get())
return new ResourceLocation(ModUtils.MODID, "textures/entity/empty.png"); || player.getMainHandItem().is(ModItems.GLOCK_18.get())
} || player.getMainHandItem().is(ModItems.BOCEK.get())) {
return new ResourceLocation(ModUtils.MODID, "geo/projectile_entity.geo.json");
} else {
return new ResourceLocation(ModUtils.MODID, "geo/projectile_entity2.geo.json");
}
}
@Override @Override
public void setCustomAnimations(ProjectileEntity animatable, long instanceId, AnimationState animationState) { public ResourceLocation getTextureResource(ProjectileEntity entity) {
CoreGeoBone bone = getAnimationProcessor().getBone("bone"); return new ResourceLocation(ModUtils.MODID, "textures/entity/empty.png");
}
@Override
public void setCustomAnimations(ProjectileEntity animatable, long instanceId, AnimationState animationState) {
CoreGeoBone bone = getAnimationProcessor().getBone("bone");
bone.setHidden(animatable.tickCount <= 1); bone.setHidden(animatable.tickCount <= 1);
} }
} }

View file

@ -21,9 +21,4 @@ public class RpgRocketModel extends GeoModel<RpgRocketEntity> {
return new ResourceLocation(ModUtils.MODID, "textures/entity/rpg_rocket.png"); return new ResourceLocation(ModUtils.MODID, "textures/entity/rpg_rocket.png");
} }
// @Override
// public void setCustomAnimations(RpgRocketEntity animatable, long instanceId, AnimationState animationState) {
// CoreGeoBone bone = getAnimationProcessor().getBone("bone");
// bone.setHidden(animatable.tickCount <= 1);
// }
} }