diff --git a/src/main/java/net/mcreator/superbwarfare/client/model/item/AK12ItemModel.java b/src/main/java/net/mcreator/superbwarfare/client/model/item/AK12ItemModel.java index f7b1d62f8..9cf12badd 100644 --- a/src/main/java/net/mcreator/superbwarfare/client/model/item/AK12ItemModel.java +++ b/src/main/java/net/mcreator/superbwarfare/client/model/item/AK12ItemModel.java @@ -19,6 +19,8 @@ import static net.mcreator.superbwarfare.event.PlayerEventHandler.isProne; public class AK12ItemModel extends GeoModel { + public static float fireRotY = 0f; + public static float fireRotZ = 0f; public static float rotXBipod = 0f; @Override @@ -108,12 +110,15 @@ public class AK12ItemModel extends GeoModel { stack.getOrCreateTag().putBoolean("HoloHidden", !(gun.getPosX() > 1.85)); + fireRotY = (float) Mth.lerp(0.35f * times, fireRotY, 0.26f * ClientEventHandler.recoilHorizon * fpz); + fireRotZ = (float) Mth.lerp(0.35f * times, fireRotZ, (0.4f + 0.5 * fr) * ClientEventHandler.recoilHorizon); + shen.setPosX((float) (0.95f * ClientEventHandler.recoilHorizon * fpz * fp)); shen.setPosY((float) (0.15f * fp + 0.18f * fr)); shen.setPosZ((float) (0.275 * fp + 0.34f * fr + 0.65 * fpz)); shen.setRotX((float) (0.01f * fp + 0.05f * fr + 0.01f * fpz)); - shen.setRotY((float) (0.1f * ClientEventHandler.recoilHorizon * fpz)); - shen.setRotZ((float) ((0.08f + 0.1 * fr) * ClientEventHandler.recoilHorizon)); + shen.setRotY(fireRotY); + shen.setRotZ(fireRotZ); shen.setPosX((float) (shen.getPosX() * (1 - 0.5 * zt))); shen.setPosY((float) (shen.getPosY() * (-1 + 0.8 * zt))); diff --git a/src/main/java/net/mcreator/superbwarfare/client/model/item/AK47ItemModel.java b/src/main/java/net/mcreator/superbwarfare/client/model/item/AK47ItemModel.java index 1e993ac14..2670a8d01 100644 --- a/src/main/java/net/mcreator/superbwarfare/client/model/item/AK47ItemModel.java +++ b/src/main/java/net/mcreator/superbwarfare/client/model/item/AK47ItemModel.java @@ -16,6 +16,8 @@ import software.bernie.geckolib.core.animation.AnimationState; import software.bernie.geckolib.model.GeoModel; public class AK47ItemModel extends GeoModel { + public static float fireRotY = 0f; + public static float fireRotZ = 0f; @Override public ResourceLocation getAnimationResource(AK47Item animatable) { @@ -65,6 +67,7 @@ public class AK47ItemModel extends GeoModel { double fr = ClientEventHandler.fireRot; int type = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE); + float times = 0.6f * (float) Math.min(Minecraft.getInstance().getDeltaFrameTime(), 1.6); float posYAlt = switch (type) { case 2 -> 0.45f; @@ -108,19 +111,22 @@ public class AK47ItemModel extends GeoModel { stack.getOrCreateTag().putBoolean("HoloHidden", !(gun.getPosX() > 1.8)); + fireRotY = (float) Mth.lerp(0.3f * times, fireRotY, 0.3f * ClientEventHandler.recoilHorizon * fpz); + fireRotZ = (float) Mth.lerp(0.3f * times, fireRotZ, (0.5f + 0.7 * fr) * ClientEventHandler.recoilHorizon); + shen.setPosX((float) (0.95f * ClientEventHandler.recoilHorizon * fpz * fp)); shen.setPosY((float) (0.15f * fp + 0.18f * fr)); shen.setPosZ((float) (0.275 * fp + 0.34f * fr + 0.65 * fpz)); shen.setRotX((float) (0.01f * fp + 0.08f * fr + 0.01f * fpz)); - shen.setRotY((float) (0.1f * ClientEventHandler.recoilHorizon * fpz)); - shen.setRotZ((float) ((0.08f + 0.1 * fr) * ClientEventHandler.recoilHorizon)); + shen.setRotY(fireRotY); + shen.setRotZ(fireRotZ); shen.setPosX((float) (shen.getPosX() * (1 - 0.5 * zt))); shen.setPosY((float) (shen.getPosY() * (-1 + 0.8 * zt))); shen.setPosZ((float) (shen.getPosZ() * (1 - 0.6 * zt))); shen.setRotX((float) (shen.getRotX() * (1 - 0.9 * zt))); - shen.setRotY((float) (shen.getRotY() * (1 - 0.9 * zt))); - shen.setRotZ((float) (shen.getRotZ() * (1 - 0.9 * zt))); + shen.setRotY((float) (shen.getRotY() * (1 - 0.8 * zt))); + shen.setRotZ((float) (shen.getRotZ() * (1 - 0.8 * zt))); shuan.setPosZ(2.4f * (float) fp); diff --git a/src/main/java/net/mcreator/superbwarfare/client/model/item/Hk416ItemModel.java b/src/main/java/net/mcreator/superbwarfare/client/model/item/Hk416ItemModel.java index acc69fbd6..43f50bc7d 100644 --- a/src/main/java/net/mcreator/superbwarfare/client/model/item/Hk416ItemModel.java +++ b/src/main/java/net/mcreator/superbwarfare/client/model/item/Hk416ItemModel.java @@ -18,7 +18,8 @@ import software.bernie.geckolib.model.GeoModel; import static net.mcreator.superbwarfare.event.PlayerEventHandler.isProne; public class Hk416ItemModel extends GeoModel { - + public static float fireRotY = 0f; + public static float fireRotZ = 0f; public static float rotXBipod = 0f; @Override public ResourceLocation getAnimationResource(Hk416Item animatable) { @@ -101,12 +102,15 @@ public class Hk416ItemModel extends GeoModel { stack.getOrCreateTag().putBoolean("HoloHidden", !(gun.getPosX() > 3.1)); + fireRotY = (float) Mth.lerp(0.4f * times, fireRotY, 0.2f * ClientEventHandler.recoilHorizon * fpz); + fireRotZ = (float) Mth.lerp(0.4f * times, fireRotZ, (0.3f + 0.4 * fr) * ClientEventHandler.recoilHorizon); + shen.setPosX((float) (0.95f * ClientEventHandler.recoilHorizon * fpz * fp)); shen.setPosY((float) (0.15f * fp + 0.18f * fr)); shen.setPosZ((float) (0.275 * fp + 0.34f * fr + 0.65 * fpz)); shen.setRotX((float) (0.01f * fp + 0.05f * fr + 0.01f * fpz)); - shen.setRotY((float) (0.04f * ClientEventHandler.recoilHorizon * fpz)); - shen.setRotZ((float) ((0.08f + 0.1 * fr) * ClientEventHandler.recoilHorizon)); + shen.setRotY(fireRotY); + shen.setRotZ(fireRotZ); shen.setPosX((float) (shen.getPosX() * (1 - 0.5 * zt))); shen.setPosY((float) (shen.getPosY() * (-1 + 0.4 * zt))); diff --git a/src/main/java/net/mcreator/superbwarfare/client/model/item/M4ItemModel.java b/src/main/java/net/mcreator/superbwarfare/client/model/item/M4ItemModel.java index 803933f8a..cb3e04a99 100644 --- a/src/main/java/net/mcreator/superbwarfare/client/model/item/M4ItemModel.java +++ b/src/main/java/net/mcreator/superbwarfare/client/model/item/M4ItemModel.java @@ -23,6 +23,8 @@ public class M4ItemModel extends GeoModel { public static float posZAlt = 7.6f; public static float rotXSight = 0f; public static float rotXBipod = 0f; + public static float fireRotY = 0f; + public static float fireRotZ = 0f; @Override public ResourceLocation getAnimationResource(M4Item animatable) { @@ -124,12 +126,15 @@ public class M4ItemModel extends GeoModel { lh.setPosY((float) (-zt * 4)); } + fireRotY = (float) Mth.lerp(0.38f * times, fireRotY, 0.25f * ClientEventHandler.recoilHorizon * fpz); + fireRotZ = (float) Mth.lerp(0.38f * times, fireRotZ, (0.3f + 0.5 * fr) * ClientEventHandler.recoilHorizon); + shen.setPosX((float) (1.35f * ClientEventHandler.recoilHorizon * fpz * fp)); shen.setPosY((float) (0.15f * fp + 0.18f * fr)); shen.setPosZ((float) (0.345 * fp + 0.44f * fr + 0.75 * fpz)); shen.setRotX((float) (0.01f * fp + 0.05f * fr + 0.01f * fpz)); - shen.setRotY((float) (0.07f * ClientEventHandler.recoilHorizon * fpz)); - shen.setRotZ((float) ((0.08f + 0.1 * fr) * ClientEventHandler.recoilHorizon)); + shen.setRotY(fireRotY); + shen.setRotZ(fireRotZ); cross1.setPosY(-0.75f * (float) fpz); cross2.setPosY(-0.1f * (float) fpz); crossAlt.setPosY(-0.2f * (float) fpz); diff --git a/src/main/java/net/mcreator/superbwarfare/client/screens/CannonHudOverlay.java b/src/main/java/net/mcreator/superbwarfare/client/screens/CannonHudOverlay.java index 64e01a48e..1ca7207ba 100644 --- a/src/main/java/net/mcreator/superbwarfare/client/screens/CannonHudOverlay.java +++ b/src/main/java/net/mcreator/superbwarfare/client/screens/CannonHudOverlay.java @@ -4,11 +4,15 @@ 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.entity.Mk42Entity; +import net.mcreator.superbwarfare.entity.Mle1934Entity; import net.mcreator.superbwarfare.item.gun.GunItem; import net.mcreator.superbwarfare.tools.TraceTool; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; @@ -29,6 +33,11 @@ import static net.mcreator.superbwarfare.client.RenderHelper.preciseBlit; @Mod.EventBusSubscriber(value = Dist.CLIENT) public class CannonHudOverlay { + public static float health = 0; + public static float maxHealth = 0; + private static final ResourceLocation ARMOR = ModUtils.loc("textures/screens/armor.png"); + private static final ResourceLocation HEALTH = ModUtils.loc("textures/screens/armor_value.png"); + private static final ResourceLocation HEALTH_FRAME = ModUtils.loc("textures/screens/armor_value_frame.png"); @SubscribeEvent(priority = EventPriority.NORMAL) public static void eventHandler(RenderGuiEvent.Pre event) { @@ -42,10 +51,11 @@ public class CannonHudOverlay { 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)) { + Entity cannon = Objects.requireNonNull(player.getVehicle()); float yRotOffset = Mth.lerp(event.getPartialTick(), player.yRotO, player.getYRot()); 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 diffY = cannon.getViewYRot(event.getPartialTick()) - yRotOffset; + float diffX = cannon.getViewXRot(event.getPartialTick()) - xRotOffset + 1.3f; float fovAdjust = (float) 70 / Minecraft.getInstance().options.fov().get(); if (diffY > 180.0f) { diffY -= 360.0f; @@ -91,6 +101,23 @@ public class CannonHudOverlay { } else { preciseBlit(event.getGuiGraphics(), ModUtils.loc("textures/screens/cannon/cannon_crosshair_notzoom.png"), k, l, 0, 0.0F, i, j, i, j); } + + if (cannon instanceof Mk42Entity) { + health = cannon.getEntityData().get(net.mcreator.superbwarfare.entity.Mk42Entity.HEALTH); + maxHealth = 500; + } + + if (cannon instanceof Mle1934Entity) { + health = cannon.getEntityData().get(net.mcreator.superbwarfare.entity.Mle1934Entity.HEALTH); + maxHealth = 600; + } + + GuiGraphics guiGraphics = event.getGuiGraphics(); + guiGraphics.pose().pushPose(); + guiGraphics.blit(ARMOR, w - 96, h - 14, 0, 0, 12, 12, 12, 12); + guiGraphics.blit(HEALTH_FRAME, w - 83, h - 12, 0, 0, 80, 8, 80, 8); + guiGraphics.blit(HEALTH, w - 83, h - 12, 0, 0, (int)(80 * health / maxHealth), 8, 80, 8); + guiGraphics.pose().popPose(); } RenderSystem.depthMask(true); RenderSystem.defaultBlendFunc(); diff --git a/src/main/java/net/mcreator/superbwarfare/entity/DroneEntity.java b/src/main/java/net/mcreator/superbwarfare/entity/DroneEntity.java index 88eb0cc38..17859f6eb 100644 --- a/src/main/java/net/mcreator/superbwarfare/entity/DroneEntity.java +++ b/src/main/java/net/mcreator/superbwarfare/entity/DroneEntity.java @@ -189,47 +189,31 @@ public class DroneEntity extends LivingEntity implements GeoEntity { if (this.getPersistentData().getBoolean("left")) { this.entityData.set(MOVE_X, -1.5f); - this.entityData.set(ROT_X, Mth.clamp(this.entityData.get(ROT_X) + 0.05f, -0.5f, 0.5f)); + this.entityData.set(ROT_X, Mth.lerp(0.1f ,this.entityData.get(ROT_X) ,0.5f)); } if (this.getPersistentData().getBoolean("right")) { this.entityData.set(MOVE_X, 1.5f); - this.entityData.set(ROT_X, Mth.clamp(this.entityData.get(ROT_X) - 0.05f, -0.5f, 0.5f)); + this.entityData.set(ROT_X, Mth.lerp(0.1f ,this.entityData.get(ROT_X) ,-0.5f)); } - if (this.entityData.get(ROT_X) > 0) { - this.entityData.set(ROT_X, Mth.clamp(this.entityData.get(ROT_X) - 0.025f, 0, 0.5f)); - } else { - this.entityData.set(ROT_X, Mth.clamp(this.entityData.get(ROT_X) + 0.025f, -0.5f, 0)); - } + this.entityData.set(ROT_X, Mth.lerp(0.05f ,this.entityData.get(ROT_X) ,0)); if (!this.getPersistentData().getBoolean("left") && !this.getPersistentData().getBoolean("right")) { - if (this.entityData.get(MOVE_X) >= 0) { - this.entityData.set(MOVE_X, Mth.clamp(this.entityData.get(MOVE_X) - 0.3f, 0, 1)); - } else { - this.entityData.set(MOVE_X, Mth.clamp(this.entityData.get(MOVE_X) + 0.3f, -1, 0)); - } + this.entityData.set(MOVE_X, Mth.lerp(0.1f ,this.entityData.get(MOVE_X) ,0)); } if (this.getPersistentData().getBoolean("forward")) { - this.entityData.set(MOVE_Z, this.entityData.get(MOVE_Z) - 0.15f); - this.entityData.set(ROT_Z, Mth.clamp(this.entityData.get(ROT_Z) - 0.05f, -0.5f, 0.5f)); + this.entityData.set(MOVE_Z, this.entityData.get(MOVE_Z) - 0.11f); + this.entityData.set(ROT_Z, Mth.lerp(0.1f ,this.entityData.get(ROT_Z) ,-0.5f)); } if (this.getPersistentData().getBoolean("backward")) { - this.entityData.set(MOVE_Z, this.entityData.get(MOVE_Z) + 0.15f); - this.entityData.set(ROT_Z, Mth.clamp(this.entityData.get(ROT_Z) + 0.05f, -0.5f, 0.5f)); + this.entityData.set(MOVE_Z, this.entityData.get(MOVE_Z) + 0.11f); + this.entityData.set(ROT_Z, Mth.lerp(0.1f ,this.entityData.get(ROT_Z) ,0.5f)); } - if (this.entityData.get(ROT_Z) > 0) { - this.entityData.set(ROT_Z, Mth.clamp(this.entityData.get(ROT_Z) - 0.025f, 0, 0.5f)); - } else { - this.entityData.set(ROT_Z, Mth.clamp(this.entityData.get(ROT_Z) + 0.025f, -0.5f, 0)); - } + this.entityData.set(ROT_Z, Mth.lerp(0.05f ,this.entityData.get(ROT_Z) ,0)); - if (this.entityData.get(MOVE_Z) >= 0) { - this.entityData.set(MOVE_Z, Mth.clamp(this.entityData.get(MOVE_Z) - 0.1f, 0, 1)); - } else { - this.entityData.set(MOVE_Z, Mth.clamp(this.entityData.get(MOVE_Z) + 0.1f, -1, 0)); - } + this.entityData.set(MOVE_Z, Mth.lerp(0.1f ,this.entityData.get(MOVE_Z) ,0)); if (this.getPersistentData().getBoolean("up")) { this.entityData.set(MOVE_Y, -1.5f); @@ -237,11 +221,8 @@ public class DroneEntity extends LivingEntity implements GeoEntity { if (this.getPersistentData().getBoolean("down")) { this.entityData.set(MOVE_Y, 1.5f); } - if (this.entityData.get(MOVE_Y) >= 0) { - this.entityData.set(MOVE_Y, Mth.clamp(this.entityData.get(MOVE_Y) - 0.3f, 0, 1)); - } else { - this.entityData.set(MOVE_Y, Mth.clamp(this.entityData.get(MOVE_Y) + 0.3f, -1, 0)); - } + + this.entityData.set(MOVE_Y, Mth.lerp(0.1f ,this.entityData.get(MOVE_Y) ,0)); this.setDeltaMovement(new Vec3( this.getDeltaMovement().x + -this.entityData.get(MOVE_Z) * 0.1f * this.getLookAngle().x, diff --git a/src/main/java/net/mcreator/superbwarfare/entity/Mk42Entity.java b/src/main/java/net/mcreator/superbwarfare/entity/Mk42Entity.java index 7d19bb5ef..d3fe244f8 100644 --- a/src/main/java/net/mcreator/superbwarfare/entity/Mk42Entity.java +++ b/src/main/java/net/mcreator/superbwarfare/entity/Mk42Entity.java @@ -15,6 +15,7 @@ import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; @@ -47,7 +48,7 @@ public class Mk42Entity extends Entity implements GeoEntity, ICannonEntity { public static final EntityDataAccessor TYPE = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.INT); public static final EntityDataAccessor HEALTH = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.FLOAT); private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - + public static final float MAX_HEALTH = 500.0f; protected int interpolationSteps; protected double serverYRot; protected double serverXRot; @@ -64,7 +65,7 @@ public class Mk42Entity extends Entity implements GeoEntity, ICannonEntity { protected void defineSynchedData() { this.entityData.define(COOL_DOWN, 0); this.entityData.define(TYPE, 0); - this.entityData.define(HEALTH, 500f); + this.entityData.define(HEALTH, MAX_HEALTH); } @Override @@ -130,6 +131,9 @@ public class Mk42Entity extends Entity implements GeoEntity, ICannonEntity { return false; if (source.is(DamageTypes.WITHER_SKULL)) return false; + if (source.is(ModDamageTypes.PROJECTILE_BOOM)) { + amount *= 0.25f; + } if (amount < 32) { return false; } @@ -208,9 +212,12 @@ public class Mk42Entity extends Entity implements GeoEntity, ICannonEntity { sendParticle(serverLevel, ParticleTypes.FLAME, this.getX(), this.getY() + 3.2, this.getZ(), 4, 0.6, 0.1, 0.6, 0.05, false); sendParticle(serverLevel, ModParticleTypes.FIRE_STAR.get(), this.getX(), this.getY() + 3, this.getZ(), 4, 0.1, 0.1, 0.1, 0.4, false); } + if (this.tickCount % 15 == 0) { + this.level().playSound(null, this.getOnPos(), SoundEvents.FIRE_AMBIENT, SoundSource.PLAYERS, 1, 1); + } this.entityData.set(HEALTH, this.entityData.get(HEALTH) - 0.1f); } else { - this.entityData.set(HEALTH, this.entityData.get(HEALTH) + 0.05f); + this.entityData.set(HEALTH, Math.min(this.entityData.get(HEALTH) + 0.05f, MAX_HEALTH)); } if (this.entityData.get(HEALTH) <= 0) { @@ -330,23 +337,20 @@ public class Mk42Entity extends Entity implements GeoEntity, ICannonEntity { Entity passenger = this.getPassengers().isEmpty() ? null : this.getPassengers().get(0); if (!(passenger instanceof LivingEntity entity)) return; - ItemStack stack = entity.getMainHandItem(); - if (!stack.isEmpty() && this.isVehicle() && !stack.is(ModTags.Items.GUN)) { - float diffY = entity.getYHeadRot() - this.getYRot(); - float diffX = entity.getXRot() - 1.3f - this.getXRot(); - if (diffY > 180.0f) { - diffY -= 360.0f; - } else if (diffY < -180.0f) { - diffY += 360.0f; - } - diffY = diffY * 0.15f; - diffX = diffX * 0.15f; - - this.setYRot(this.getYRot() + Mth.clamp(diffY, -1.75f, 1.75f)); - this.setXRot(Mth.clamp(this.getXRot() + Mth.clamp(diffX, -3f, 3f), -85, 15)); - this.setRot(this.getYRot(), this.getXRot()); + float diffY = entity.getYHeadRot() - this.getYRot(); + float diffX = entity.getXRot() - 1.3f - this.getXRot(); + if (diffY > 180.0f) { + diffY -= 360.0f; + } else if (diffY < -180.0f) { + diffY += 360.0f; } + diffY = diffY * 0.15f; + diffX = diffX * 0.15f; + + this.setYRot(this.getYRot() + Mth.clamp(diffY, -1.75f, 1.75f)); + this.setXRot(Mth.clamp(this.getXRot() + Mth.clamp(diffX, -3f, 3f), -85, 15)); + this.setRot(this.getYRot(), this.getXRot()); } protected void clampRotation(Entity entity) { diff --git a/src/main/java/net/mcreator/superbwarfare/entity/Mle1934Entity.java b/src/main/java/net/mcreator/superbwarfare/entity/Mle1934Entity.java index 9c6bc2ba5..99b4922de 100644 --- a/src/main/java/net/mcreator/superbwarfare/entity/Mle1934Entity.java +++ b/src/main/java/net/mcreator/superbwarfare/entity/Mle1934Entity.java @@ -16,6 +16,7 @@ import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; @@ -50,6 +51,8 @@ public class Mle1934Entity extends Entity implements GeoEntity, ICannonEntity { public static final EntityDataAccessor HEALTH = SynchedEntityData.defineId(Mle1934Entity.class, EntityDataSerializers.FLOAT); private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + public static final float MAX_HEALTH = 600.0f; + public String animationprocedure = "empty"; protected int interpolationSteps; @@ -68,7 +71,7 @@ public class Mle1934Entity extends Entity implements GeoEntity, ICannonEntity { protected void defineSynchedData() { this.entityData.define(COOL_DOWN, 0); this.entityData.define(TYPE, 0); - this.entityData.define(HEALTH, 600f); + this.entityData.define(HEALTH, MAX_HEALTH); } @Override @@ -134,6 +137,9 @@ public class Mle1934Entity extends Entity implements GeoEntity, ICannonEntity { return false; if (source.is(DamageTypes.WITHER_SKULL)) return false; + if (source.is(ModDamageTypes.PROJECTILE_BOOM)) { + amount *= 0.25f; + } if (amount < 32) { return false; } @@ -204,9 +210,12 @@ public class Mle1934Entity extends Entity implements GeoEntity, ICannonEntity { sendParticle(serverLevel, ParticleTypes.FLAME, this.getX(), this.getY() + 3.2, this.getZ(), 4, 0.6, 0.1, 0.6, 0.05, false); sendParticle(serverLevel, ModParticleTypes.FIRE_STAR.get(), this.getX(), this.getY() + 3, this.getZ(), 4, 0.1, 0.1, 0.1, 0.4, false); } + if (this.tickCount % 15 == 0) { + this.level().playSound(null, this.getOnPos(), SoundEvents.FIRE_AMBIENT, SoundSource.PLAYERS, 1, 1); + } this.entityData.set(HEALTH, this.entityData.get(HEALTH) - 0.1f); } else { - this.entityData.set(HEALTH, this.entityData.get(HEALTH) + 0.05f); + this.entityData.set(HEALTH, Math.min(this.entityData.get(HEALTH) + 0.05f, MAX_HEALTH)); } if (this.entityData.get(HEALTH) <= 0) { @@ -404,22 +413,19 @@ public class Mle1934Entity extends Entity implements GeoEntity, ICannonEntity { Entity passenger = this.getPassengers().isEmpty() ? null : this.getPassengers().get(0); if (!(passenger instanceof LivingEntity entity)) return; - ItemStack stack = entity.getMainHandItem(); - if (!stack.isEmpty() && this.isVehicle() && !stack.is(ModTags.Items.GUN)) { - float diffY = entity.getYHeadRot() - this.getYRot(); - float diffX = entity.getXRot() - 1.2f - this.getXRot(); - if (diffY > 180.0f) { - diffY -= 360.0f; - } else if (diffY < -180.0f) { - diffY += 360.0f; - } - diffY = diffY * 0.15f; - diffX = diffX * 0.15f; - this.setYRot(this.getYRot() + Mth.clamp(diffY, -1.25f, 1.25f)); - this.setXRot(Mth.clamp(this.getXRot() + Mth.clamp(diffX, -2f, 2f), -30, 4)); - this.setRot(this.getYRot(), this.getXRot()); + float diffY = entity.getYHeadRot() - this.getYRot(); + float diffX = entity.getXRot() - 1.2f - this.getXRot(); + if (diffY > 180.0f) { + diffY -= 360.0f; + } else if (diffY < -180.0f) { + diffY += 360.0f; } + diffY = diffY * 0.15f; + diffX = diffX * 0.15f; + this.setYRot(this.getYRot() + Mth.clamp(diffY, -1.25f, 1.25f)); + this.setXRot(Mth.clamp(this.getXRot() + Mth.clamp(diffX, -2f, 2f), -30, 4)); + this.setRot(this.getYRot(), this.getXRot()); } protected void clampRotation(Entity entity) { diff --git a/src/main/java/net/mcreator/superbwarfare/entity/projectile/CannonShellEntity.java b/src/main/java/net/mcreator/superbwarfare/entity/projectile/CannonShellEntity.java index a360f8a36..e1bb190ff 100644 --- a/src/main/java/net/mcreator/superbwarfare/entity/projectile/CannonShellEntity.java +++ b/src/main/java/net/mcreator/superbwarfare/entity/projectile/CannonShellEntity.java @@ -200,7 +200,7 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt } CustomExplosion explosion = new CustomExplosion(this.level(), this, - ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), explosionDamage, + ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), explosionDamage, this.getX(), this.getY(), this.getZ(), explosionRadius, Explosion.BlockInteraction.KEEP).setDamageMultiplier(1).setFireTime(fireTime); explosion.explode(); net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion); diff --git a/src/main/java/net/mcreator/superbwarfare/network/message/ZoomMessage.java b/src/main/java/net/mcreator/superbwarfare/network/message/ZoomMessage.java index a4260f217..7184340b1 100644 --- a/src/main/java/net/mcreator/superbwarfare/network/message/ZoomMessage.java +++ b/src/main/java/net/mcreator/superbwarfare/network/message/ZoomMessage.java @@ -4,6 +4,7 @@ import net.mcreator.superbwarfare.ModUtils; import net.mcreator.superbwarfare.entity.ICannonEntity; import net.mcreator.superbwarfare.init.ModItems; import net.mcreator.superbwarfare.init.ModSounds; +import net.mcreator.superbwarfare.init.ModTags; import net.mcreator.superbwarfare.network.ModVariables; import net.mcreator.superbwarfare.tools.SoundTool; import net.minecraft.network.FriendlyByteBuf; @@ -11,6 +12,7 @@ import net.minecraft.network.protocol.game.ClientboundStopSoundPacket; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundSource; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraftforge.network.NetworkEvent; @@ -37,6 +39,7 @@ public class ZoomMessage { ServerPlayer player = context.getSender(); if (player != null) { + ItemStack stack = player.getMainHandItem(); Level level = player.level(); if (!level.isLoaded(player.blockPosition())) { @@ -50,8 +53,7 @@ public class ZoomMessage { capability.syncPlayerVariables(player); }); - - if (player.isPassenger() && player.getVehicle() instanceof ICannonEntity) { + if (player.isPassenger() && player.getVehicle() instanceof ICannonEntity && !stack.is(ModTags.Items.GUN)) { SoundTool.playLocalSound(player, ModSounds.CANNON_ZOOM_IN.get(), 2, 1); } } @@ -63,7 +65,7 @@ public class ZoomMessage { capability.syncPlayerVariables(player); }); - if (player.isPassenger() && player.getVehicle() instanceof ICannonEntity) { + if (player.isPassenger() && player.getVehicle() instanceof ICannonEntity && !stack.is(ModTags.Items.GUN)) { SoundTool.playLocalSound(player, ModSounds.CANNON_ZOOM_OUT.get(), 2, 1); } diff --git a/src/main/resources/assets/superbwarfare/animations/mk_42.animation.json b/src/main/resources/assets/superbwarfare/animations/mk_42.animation.json index f123fd7f7..17923bec6 100644 --- a/src/main/resources/assets/superbwarfare/animations/mk_42.animation.json +++ b/src/main/resources/assets/superbwarfare/animations/mk_42.animation.json @@ -13,7 +13,7 @@ }, "animation.mk42.fire": { "loop": "hold_on_last_frame", - "animation_length": 1, + "animation_length": 1.5, "bones": { "paoguan": { "position": { @@ -120,7 +120,7 @@ }, "animation.mk42.fire2": { "loop": "hold_on_last_frame", - "animation_length": 1, + "animation_length": 1.5, "bones": { "paoguan": { "position": { diff --git a/src/main/resources/assets/superbwarfare/geo/ak.geo.json b/src/main/resources/assets/superbwarfare/geo/ak.geo.json index b7f6462b2..3d7814004 100644 --- a/src/main/resources/assets/superbwarfare/geo/ak.geo.json +++ b/src/main/resources/assets/superbwarfare/geo/ak.geo.json @@ -27,7 +27,7 @@ { "name": "shen", "parent": "bone", - "pivot": [0, 0, 0] + "pivot": [0.5, 3, 2] }, { "name": "0", diff --git a/src/main/resources/assets/superbwarfare/geo/ak12.geo.json b/src/main/resources/assets/superbwarfare/geo/ak12.geo.json index ee6add17b..28d99ee9b 100644 --- a/src/main/resources/assets/superbwarfare/geo/ak12.geo.json +++ b/src/main/resources/assets/superbwarfare/geo/ak12.geo.json @@ -27,7 +27,7 @@ { "name": "shen", "parent": "bone", - "pivot": [0, 0, 0] + "pivot": [0.5, 3.5, 3] }, { "name": "0", diff --git a/src/main/resources/assets/superbwarfare/geo/hk416.geo.json b/src/main/resources/assets/superbwarfare/geo/hk416.geo.json index 0597061a6..d3836c538 100644 --- a/src/main/resources/assets/superbwarfare/geo/hk416.geo.json +++ b/src/main/resources/assets/superbwarfare/geo/hk416.geo.json @@ -23,7 +23,7 @@ { "name": "shen", "parent": "bone", - "pivot": [0, 0, 0] + "pivot": [0, 3.4, 3] }, { "name": "0", diff --git a/src/main/resources/assets/superbwarfare/geo/m4.geo.json b/src/main/resources/assets/superbwarfare/geo/m4.geo.json index 0c95a9e66..1891c6941 100644 --- a/src/main/resources/assets/superbwarfare/geo/m4.geo.json +++ b/src/main/resources/assets/superbwarfare/geo/m4.geo.json @@ -27,7 +27,7 @@ { "name": "shen", "parent": "bone", - "pivot": [0, 0, 0] + "pivot": [0, 3, 3.25] }, { "name": "0", diff --git a/src/main/resources/assets/superbwarfare/sounds/m_4/m_4_fire_1p.ogg b/src/main/resources/assets/superbwarfare/sounds/m_4/m_4_fire_1p.ogg index 59300ad77..fd90a9ceb 100644 Binary files a/src/main/resources/assets/superbwarfare/sounds/m_4/m_4_fire_1p.ogg and b/src/main/resources/assets/superbwarfare/sounds/m_4/m_4_fire_1p.ogg differ diff --git a/src/main/resources/assets/superbwarfare/sounds/m_4/m_4_fire_3p.ogg b/src/main/resources/assets/superbwarfare/sounds/m_4/m_4_fire_3p.ogg index 95a8f79d9..fe47b8530 100644 Binary files a/src/main/resources/assets/superbwarfare/sounds/m_4/m_4_fire_3p.ogg and b/src/main/resources/assets/superbwarfare/sounds/m_4/m_4_fire_3p.ogg differ diff --git a/src/main/resources/assets/superbwarfare/textures/screens/armor.png b/src/main/resources/assets/superbwarfare/textures/screens/armor.png new file mode 100644 index 000000000..5fbd32b2b Binary files /dev/null and b/src/main/resources/assets/superbwarfare/textures/screens/armor.png differ diff --git a/src/main/resources/assets/superbwarfare/textures/screens/armor_plate_icon.png b/src/main/resources/assets/superbwarfare/textures/screens/armor_plate_icon.png index b6a02a627..abcb6787e 100644 Binary files a/src/main/resources/assets/superbwarfare/textures/screens/armor_plate_icon.png and b/src/main/resources/assets/superbwarfare/textures/screens/armor_plate_icon.png differ diff --git a/src/main/resources/assets/superbwarfare/textures/screens/armor_plate_level1_frame.png b/src/main/resources/assets/superbwarfare/textures/screens/armor_plate_level1_frame.png index 918e382c1..5f87121c5 100644 Binary files a/src/main/resources/assets/superbwarfare/textures/screens/armor_plate_level1_frame.png and b/src/main/resources/assets/superbwarfare/textures/screens/armor_plate_level1_frame.png differ diff --git a/src/main/resources/assets/superbwarfare/textures/screens/armor_plate_level2_frame.png b/src/main/resources/assets/superbwarfare/textures/screens/armor_plate_level2_frame.png index 3e5fede76..dcd5708fe 100644 Binary files a/src/main/resources/assets/superbwarfare/textures/screens/armor_plate_level2_frame.png and b/src/main/resources/assets/superbwarfare/textures/screens/armor_plate_level2_frame.png differ diff --git a/src/main/resources/assets/superbwarfare/textures/screens/armor_plate_level3_frame.png b/src/main/resources/assets/superbwarfare/textures/screens/armor_plate_level3_frame.png index c235d827e..6fb3695c8 100644 Binary files a/src/main/resources/assets/superbwarfare/textures/screens/armor_plate_level3_frame.png and b/src/main/resources/assets/superbwarfare/textures/screens/armor_plate_level3_frame.png differ diff --git a/src/main/resources/assets/superbwarfare/textures/screens/armor_value.png b/src/main/resources/assets/superbwarfare/textures/screens/armor_value.png new file mode 100644 index 000000000..3e66cf0b3 Binary files /dev/null and b/src/main/resources/assets/superbwarfare/textures/screens/armor_value.png differ diff --git a/src/main/resources/assets/superbwarfare/textures/screens/armor_value_frame.png b/src/main/resources/assets/superbwarfare/textures/screens/armor_value_frame.png new file mode 100644 index 000000000..dcd5708fe Binary files /dev/null and b/src/main/resources/assets/superbwarfare/textures/screens/armor_value_frame.png differ