优化GUI和实装配件系统武器的开火动画
|
@ -19,6 +19,8 @@ import static net.mcreator.superbwarfare.event.PlayerEventHandler.isProne;
|
|||
|
||||
public class AK12ItemModel extends GeoModel<AK12Item> {
|
||||
|
||||
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<AK12Item> {
|
|||
|
||||
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)));
|
||||
|
|
|
@ -16,6 +16,8 @@ import software.bernie.geckolib.core.animation.AnimationState;
|
|||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class AK47ItemModel extends GeoModel<AK47Item> {
|
||||
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<AK47Item> {
|
|||
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<AK47Item> {
|
|||
|
||||
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);
|
||||
|
||||
|
|
|
@ -18,7 +18,8 @@ import software.bernie.geckolib.model.GeoModel;
|
|||
import static net.mcreator.superbwarfare.event.PlayerEventHandler.isProne;
|
||||
|
||||
public class Hk416ItemModel extends GeoModel<Hk416Item> {
|
||||
|
||||
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<Hk416Item> {
|
|||
|
||||
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)));
|
||||
|
|
|
@ -23,6 +23,8 @@ public class M4ItemModel extends GeoModel<M4Item> {
|
|||
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<M4Item> {
|
|||
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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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<Integer> TYPE = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.INT);
|
||||
public static final EntityDataAccessor<Float> 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,9 +337,7 @@ 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) {
|
||||
|
@ -347,7 +352,6 @@ public class Mk42Entity extends Entity implements GeoEntity, ICannonEntity {
|
|||
this.setXRot(Mth.clamp(this.getXRot() + Mth.clamp(diffX, -3f, 3f), -85, 15));
|
||||
this.setRot(this.getYRot(), this.getXRot());
|
||||
}
|
||||
}
|
||||
|
||||
protected void clampRotation(Entity entity) {
|
||||
ItemStack stack = ItemStack.EMPTY;
|
||||
|
|
|
@ -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<Float> 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,9 +413,7 @@ 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) {
|
||||
|
@ -420,7 +427,6 @@ public class Mle1934Entity extends Entity implements GeoEntity, ICannonEntity {
|
|||
this.setXRot(Mth.clamp(this.getXRot() + Mth.clamp(diffX, -2f, 2f), -30, 4));
|
||||
this.setRot(this.getYRot(), this.getXRot());
|
||||
}
|
||||
}
|
||||
|
||||
protected void clampRotation(Entity entity) {
|
||||
ItemStack stack = ItemStack.EMPTY;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
{
|
||||
"name": "shen",
|
||||
"parent": "bone",
|
||||
"pivot": [0, 0, 0]
|
||||
"pivot": [0.5, 3, 2]
|
||||
},
|
||||
{
|
||||
"name": "0",
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
{
|
||||
"name": "shen",
|
||||
"parent": "bone",
|
||||
"pivot": [0, 0, 0]
|
||||
"pivot": [0.5, 3.5, 3]
|
||||
},
|
||||
{
|
||||
"name": "0",
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
{
|
||||
"name": "shen",
|
||||
"parent": "bone",
|
||||
"pivot": [0, 0, 0]
|
||||
"pivot": [0, 3.4, 3]
|
||||
},
|
||||
{
|
||||
"name": "0",
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
{
|
||||
"name": "shen",
|
||||
"parent": "bone",
|
||||
"pivot": [0, 0, 0]
|
||||
"pivot": [0, 3, 3.25]
|
||||
},
|
||||
{
|
||||
"name": "0",
|
||||
|
|
After Width: | Height: | Size: 164 B |
Before Width: | Height: | Size: 151 B After Width: | Height: | Size: 181 B |
Before Width: | Height: | Size: 114 B After Width: | Height: | Size: 137 B |
Before Width: | Height: | Size: 121 B After Width: | Height: | Size: 150 B |
Before Width: | Height: | Size: 125 B After Width: | Height: | Size: 155 B |
After Width: | Height: | Size: 119 B |
After Width: | Height: | Size: 150 B |