继续优化代码

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.VertexConsumer;
import com.mojang.math.Axis;
import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.client.model.entity.ModelBocekArrow;
import net.mcreator.superbwarfare.entity.BocekArrowEntity;
import net.minecraft.client.renderer.MultiBufferSource;
@ -14,7 +15,7 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
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;
public BocekArrowRenderer(EntityRendererProvider.Context context) {
@ -35,6 +36,6 @@ public class BocekArrowRenderer extends EntityRenderer<BocekArrowEntity> {
@Override
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.VertexConsumer;
import com.mojang.math.Axis;
import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.client.model.entity.ModelBullet;
import net.mcreator.superbwarfare.entity.FragEntity;
import net.minecraft.client.renderer.MultiBufferSource;
@ -15,7 +16,7 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
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;
public FragRenderer(EntityRendererProvider.Context context) {
@ -40,6 +41,6 @@ public class FragRenderer extends EntityRenderer<FragEntity> {
@Override
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.VertexConsumer;
import com.mojang.math.Axis;
import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.client.model.entity.ModelGrenade;
import net.mcreator.superbwarfare.entity.GunGrenadeEntity;
import net.minecraft.client.renderer.MultiBufferSource;
@ -14,7 +15,7 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
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;
public GunGrenadeRenderer(EntityRendererProvider.Context context) {
@ -35,6 +36,6 @@ public class GunGrenadeRenderer extends EntityRenderer<GunGrenadeEntity> {
@Override
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.VertexConsumer;
import com.mojang.math.Axis;
import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.client.model.entity.ModelHandGrenade;
import net.mcreator.superbwarfare.entity.HandGrenadeEntity;
import net.minecraft.client.renderer.MultiBufferSource;
@ -14,7 +15,7 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
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;
public HandGrenadeEntityRenderer(EntityRendererProvider.Context context) {
@ -35,6 +36,6 @@ public class HandGrenadeEntityRenderer extends EntityRenderer<HandGrenadeEntity>
@Override
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.VertexConsumer;
import com.mojang.math.Axis;
import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.client.model.entity.ModelMortarShell;
import net.mcreator.superbwarfare.entity.MortarShellEntity;
import net.minecraft.client.renderer.MultiBufferSource;
@ -14,7 +15,7 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
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;
public MortarShellRenderer(EntityRendererProvider.Context context) {
@ -35,6 +36,6 @@ public class MortarShellRenderer extends EntityRenderer<MortarShellEntity> {
@Override
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.VertexConsumer;
import com.mojang.math.Axis;
import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.client.model.entity.ModelTaserRod;
import net.mcreator.superbwarfare.entity.TaserBulletProjectileEntity;
import net.minecraft.client.renderer.MultiBufferSource;
@ -14,7 +15,7 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
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;
public TaserBulletProjectileRenderer(EntityRendererProvider.Context context) {
@ -35,6 +36,6 @@ public class TaserBulletProjectileRenderer extends EntityRenderer<TaserBulletPro
@Override
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.systems.RenderSystem;
import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.init.ModItems;
import net.mcreator.superbwarfare.init.ModTags;
import net.mcreator.superbwarfare.network.ModVariables;
@ -47,11 +48,11 @@ public class CrossHairOverlay {
RenderSystem.setShaderColor(1, 1, 1, 1);
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("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("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("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("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/point.png"), w / 2f - 7.5f, 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(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(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(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));
@ -59,18 +60,18 @@ public class CrossHairOverlay {
float m = (40 - KILL_INDICATOR * 5) / 5.5f;
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) {
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) {
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("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("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("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_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_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_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_mark4.png"), w / 2f - 7.5f + 2 - m, h / 2f - 8 + 2 - m, 0, 0, 16, 16, 16, 16);
}
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.systems.RenderSystem;
import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.entity.DroneEntity;
import net.mcreator.superbwarfare.init.ModItems;
import net.mcreator.superbwarfare.tools.TraceTool;
@ -34,6 +35,7 @@ public class DroneUIOverlay {
int w = event.getWindow().getGuiScaledWidth();
int h = event.getWindow().getGuiScaledHeight();
Player player = Minecraft.getInstance().player;
if (player != null) {
ItemStack stack = player.getMainHandItem();
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.setShaderColor(1, 1, 1, 1);
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))
.stream().filter(e -> e.getStringUUID().equals(stack.getOrCreateTag().getString("LinkedDrone"))).findFirst().orElse(null);
if (entity != null) {
boolean lookAtEntity = false;
double distance = player.distanceTo(entity);
double block_range = entity.position().distanceTo((Vec3.atLowerCornerOf(entity.level().clip(
@ -67,56 +68,45 @@ public class DroneUIOverlay {
int color = -1;
if (distance > MAX_DISTANCE - 48) {
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.warning")
, w / 2 + -18, h / 2 + -47, -65536, false);
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.warning"),
w / 2 - 18, h / 2 - 47, -65536, false);
color = -65536;
}
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.distance")
.append(Component.literal(new DecimalFormat("##.#").format(distance) + "M"))
, w / 2 + 10, h / 2 + 33, color, false);
.append(Component.literal(new DecimalFormat("##.#").format(distance) + "M")),
w / 2 + 10, h / 2 + 33, color, false);
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())))
, w / 2 - 77, h / 2 + 33, -1, false);
.append(Component.literal(new DecimalFormat("##.#").format(entity.getHealth()) + "/" + new DecimalFormat("##.#").format(entity.getMaxHealth()))),
w / 2 - 77, h / 2 + 33, -1, false);
if (!entity.getEntityData().get(KAMIKAZE)) {
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.ammo")
.append(Component.literal(new DecimalFormat("##.#").format(entity.getEntityData().get(AMMO)) + " / 6"))
, w / 2 + 12, h / 2 + -37, -1, false);
.append(Component.literal(new DecimalFormat("##.#").format(entity.getEntityData().get(AMMO)) + " / 6")),
w / 2 + 12, h / 2 - 37, -1, false);
} else {
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.kamikaze")
, w / 2 + 12, h / 2 + -37, -65536, false);
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.kamikaze"),
w / 2 + 12, h / 2 - 37, -65536, false);
}
if (lookAtEntity) {
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.range")
.append(Component.literal(new DecimalFormat("##.#").format(entity_range) + "M " + lookingEntity.getDisplayName().getString()))
, w / 2 + 12, h / 2 - 28, color, false);
.append(Component.literal(new DecimalFormat("##.#").format(entity_range) + "M " + lookingEntity.getDisplayName().getString())),
w / 2 + 12, h / 2 - 28, color, false);
} else {
if (block_range > 512) {
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.range")
.append(Component.literal("---M"))
, w / 2 + 12, h / 2 - 28, color, false);
.append(Component.literal("---M")), w / 2 + 12, h / 2 - 28, color, false);
} else {
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.range")
.append(Component.literal(new DecimalFormat("##.#").format(block_range) + "M"))
, w / 2 + 12, h / 2 - 28, color, false);
.append(Component.literal(new DecimalFormat("##.#").format(block_range) + "M")),
w / 2 + 12, h / 2 - 28, color, false);
}
}
}
}
RenderSystem.depthMask(true);
RenderSystem.defaultBlendFunc();
RenderSystem.enableDepthTest();

View file

@ -2,6 +2,7 @@ package net.mcreator.superbwarfare.client.screens;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.entity.ICannonEntity;
import net.mcreator.superbwarfare.init.ModItems;
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.setShaderColor(1, 1, 1, 1);
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.defaultBlendFunc();

View file

@ -22,7 +22,7 @@ public class SpyglassRangeOverlay {
int w = event.getWindow().getGuiScaledWidth();
int h = event.getWindow().getGuiScaledHeight();
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(
Minecraft.getInstance().font,
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);
BlockPos resultPos = blockHitResult.getBlockPos();
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());
}
}
@ -162,10 +162,10 @@ public class BocekArrowEntity extends AbstractArrow implements ItemSupplier {
}
boolean hurt;
if (entity instanceof Monster) {
hurt = performHurt(entity, i * damageMultiplier * (entity instanceof LivingEntity living && living.getMobType() == MobType.UNDEAD? this.undeadMultiple : 1), headshot);
if (entity instanceof Monster monster) {
hurt = performHurt(entity, i * damageMultiplier * (monster.getMobType() == MobType.UNDEAD ? this.undeadMultiple : 1), headshot);
} 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) {

View file

@ -34,10 +34,6 @@ public class FragEntity extends ThrowableItemProjectile {
super(type, world);
}
public FragEntity(EntityType<? extends FragEntity> type, LivingEntity entity, Level world) {
super(type, entity, world);
}
public FragEntity(LivingEntity entity, Level level) {
super(ModEntities.FRAG.get(), entity, level);
}
@ -88,7 +84,7 @@ public class FragEntity extends ThrowableItemProjectile {
super.onHitBlock(blockHitResult);
BlockPos resultPos = blockHitResult.getBlockPos();
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());
}

View file

@ -40,10 +40,6 @@ public class GunGrenadeEntity extends ThrowableItemProjectile {
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) {
super(ModEntities.GUN_GRENADE.get(), entity, level);
this.damage = damage;
@ -93,7 +89,7 @@ public class GunGrenadeEntity extends ThrowableItemProjectile {
if (this.tickCount > 0) {
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,
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);

View file

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

View file

@ -21,9 +21,4 @@ public class RpgRocketModel extends GeoModel<RpgRocketEntity> {
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);
// }
}