添加lav150装甲车
This commit is contained in:
parent
b6e0d75898
commit
44066ed7f2
17 changed files with 7895 additions and 10 deletions
|
@ -106,6 +106,7 @@ public class ClickHandler {
|
|||
if (stack.is(ModTags.Items.GUN)
|
||||
|| (player.getVehicle() instanceof ICannonEntity)
|
||||
|| (player.getVehicle() instanceof Ah6Entity ah6Entity && ah6Entity.getFirstPassenger() == player && !stack.getItem().isEdible())
|
||||
|| (player.getVehicle() instanceof Lav150Entity lav150 && lav150.isDriver(player) && !stack.getItem().isEdible())
|
||||
|| (player.getVehicle() instanceof SpeedboatEntity boat && boat.getFirstPassenger() == player && stack.is(ItemStack.EMPTY.getItem()))) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class Lav150Model extends GeoModel<Lav150Entity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(Lav150Entity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(Lav150Entity entity) {
|
||||
return ModUtils.loc("geo/lav150.geo.json");
|
||||
// Player player = Minecraft.getInstance().player;
|
||||
//
|
||||
// int distance = 0;
|
||||
//
|
||||
// if (player != null) {
|
||||
// distance = (int) player.position().distanceTo(entity.position());
|
||||
// }
|
||||
//
|
||||
// if (distance < 32) {
|
||||
// return ModUtils.loc("geo/lav150.geo.json");
|
||||
// } else {
|
||||
// return ModUtils.loc("geo/speedboat.lod1.geo.json");
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(Lav150Entity entity) {
|
||||
return ModUtils.loc("textures/entity/lav150.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.model.entity.Lav150Model;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import software.bernie.geckolib.cache.object.BakedGeoModel;
|
||||
import software.bernie.geckolib.cache.object.GeoBone;
|
||||
import software.bernie.geckolib.renderer.GeoEntityRenderer;
|
||||
|
||||
public class Lav150Renderer extends GeoEntityRenderer<Lav150Entity> {
|
||||
|
||||
public Lav150Renderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new Lav150Model());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(Lav150Entity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, Lav150Entity entity, BakedGeoModel model, MultiBufferSource bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, float red, float green,
|
||||
float blue, float alpha) {
|
||||
float scale = 1f;
|
||||
this.scaleHeight = scale;
|
||||
this.scaleWidth = scale;
|
||||
super.preRender(poseStack, entity, model, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, red, green, blue, alpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Lav150Entity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||
poseStack.pushPose();
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(-Mth.lerp(partialTicks, entityIn.yRotO, entityIn.getYRot())));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderRecursively(PoseStack poseStack, Lav150Entity animatable, GeoBone bone, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
|
||||
String name = bone.getName();
|
||||
if (name.equals("wheel1")) {
|
||||
bone.setRotY(Mth.lerp(partialTick, animatable.rudderRotO, animatable.getRudderRot()));
|
||||
bone.setRotX(1.5f * Mth.lerp(partialTick, animatable.leftWheelRotO, animatable.getLeftWheelRot()));
|
||||
}
|
||||
if (name.equals("wheel2")) {
|
||||
bone.setRotY(Mth.lerp(partialTick, animatable.rudderRotO, animatable.getRudderRot()));
|
||||
bone.setRotX(1.5f * Mth.lerp(partialTick, animatable.rightWheelRotO, animatable.getRightWheelRot()));
|
||||
}
|
||||
if (name.equals("wheel3")) {
|
||||
bone.setRotX(1.5f * Mth.lerp(partialTick, animatable.rightWheelRotO, animatable.getRightWheelRot()));
|
||||
}
|
||||
if (name.equals("wheel4")) {
|
||||
bone.setRotX(1.5f * Mth.lerp(partialTick, animatable.leftWheelRotO, animatable.getLeftWheelRot()));
|
||||
}
|
||||
if (name.equals("cannon")) {
|
||||
bone.setRotY(Mth.lerp(partialTick, animatable.turretYRotO, animatable.getTurretYRot()) * Mth.DEG_TO_RAD);
|
||||
}
|
||||
if (name.equals("barrel")) {
|
||||
bone.setRotX(-Mth.lerp(partialTick, animatable.turretXRotO, animatable.getTurretXRot()) * Mth.DEG_TO_RAD);
|
||||
}
|
||||
|
||||
// if (name.equals("flare")) {
|
||||
// bone.setRotZ((float) (0.5 * (Math.random() - 0.5)));
|
||||
// }
|
||||
super.renderRecursively(poseStack, animatable, bone, renderType, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, red, green, blue, alpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getDeathMaxRotation(Lav150Entity entityLivingBaseIn) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
|
@ -594,7 +594,7 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
|
|||
protected void explosionBulletEntity(Entity projectile, Entity target, float damage, int heLevel, float monsterMultiple) {
|
||||
CustomExplosion explosion = new CustomExplosion(projectile.level(), projectile,
|
||||
ModDamageTypes.causeProjectileBoomDamage(projectile.level().registryAccess(), projectile, this.getShooter()), (float) ((0.8 * damage) * (1 + 0.1 * heLevel)),
|
||||
target.getX(), target.getY(), target.getZ(), (float) ((1.5 + 0.02 * damage) * (1 + 0.05 * heLevel))).setDamageMultiplier(monsterMultiple);
|
||||
target.getX(), target.getY(), target.getZ(), (float) ((1.5 + 0.02 * damage) * (1 + 0.05 * heLevel))).setDamageMultiplier(monsterMultiple).isBulletExplode(true);
|
||||
explosion.explode();
|
||||
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(projectile.level(), explosion);
|
||||
explosion.finalizeExplosion(false);
|
||||
|
|
|
@ -464,7 +464,7 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
|
|||
Vector4f worldPositionLeft;
|
||||
|
||||
if (entityData.get(WEAPON_TYPE) == 0) {
|
||||
x = 1.25f;
|
||||
x = 1.15f;
|
||||
y = 0.62f;
|
||||
z = 0.8f;
|
||||
|
||||
|
|
|
@ -0,0 +1,564 @@
|
|||
package com.atsuishio.superbwarfare.entity.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig;
|
||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
||||
import com.atsuishio.superbwarfare.init.*;
|
||||
import com.atsuishio.superbwarfare.network.ModVariables;
|
||||
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
||||
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
|
||||
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
||||
import com.atsuishio.superbwarfare.tools.SoundTool;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
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.SoundEvent;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.fluids.FluidType;
|
||||
import net.minecraftforge.network.NetworkHooks;
|
||||
import net.minecraftforge.network.PacketDistributor;
|
||||
import net.minecraftforge.network.PlayMessages;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.joml.Math;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Vector4f;
|
||||
import software.bernie.geckolib.animatable.GeoEntity;
|
||||
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
|
||||
import software.bernie.geckolib.core.animation.AnimatableManager;
|
||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
||||
|
||||
public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IChargeEntity, IArmedVehicleEntity {
|
||||
|
||||
public static final EntityDataAccessor<Integer> FIRE_ANIM = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
|
||||
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.FLOAT);
|
||||
public static final EntityDataAccessor<Integer> HEAT = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
|
||||
public static final EntityDataAccessor<Integer> AMMO = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
|
||||
|
||||
public static final float MAX_HEALTH = VehicleConfig.SPEEDBOAT_HP.get();
|
||||
public static final int MAX_ENERGY = VehicleConfig.SPEEDBOAT_MAX_ENERGY.get();
|
||||
|
||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||
public float turretYRot;
|
||||
public float turretXRot;
|
||||
public float turretYRotO;
|
||||
public float turretXRotO;
|
||||
public float rudderRot;
|
||||
public float rudderRotO;
|
||||
public float leftWheelRot;
|
||||
public float rightWheelRot;
|
||||
public float leftWheelRotO;
|
||||
public float rightWheelRotO;
|
||||
public boolean cannotFire;
|
||||
|
||||
public Lav150Entity(PlayMessages.SpawnEntity packet, Level world) {
|
||||
this(ModEntities.LAV_150.get(), world);
|
||||
}
|
||||
|
||||
public Lav150Entity(EntityType<Lav150Entity> type, Level world) {
|
||||
super(type, world);
|
||||
this.setMaxUpStep(1.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void defineSynchedData() {
|
||||
super.defineSynchedData();
|
||||
this.entityData.define(AMMO, 0);
|
||||
this.entityData.define(FIRE_ANIM, 0);
|
||||
this.entityData.define(DELTA_ROT, 0f);
|
||||
this.entityData.define(HEAT, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAdditionalSaveData(CompoundTag compound) {
|
||||
super.addAdditionalSaveData(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readAdditionalSaveData(CompoundTag compound) {
|
||||
super.readAdditionalSaveData(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet<ClientGamePacketListener> getAddEntityPacket() {
|
||||
return NetworkHooks.getEntitySpawningPacket(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hurt(DamageSource source, float amount) {
|
||||
super.hurt(source, amount);
|
||||
if (this.level() instanceof ServerLevel serverLevel) {
|
||||
sendParticle(serverLevel, ModParticleTypes.FIRE_STAR.get(), this.getX(), this.getY() + 2.5, this.getZ(), 4, 0.2, 0.2, 0.2, 0.2, false);
|
||||
}
|
||||
if (source.is(ModDamageTypes.PROJECTILE_BOOM)) {
|
||||
amount *= 2f;
|
||||
}
|
||||
if (source.is(ModDamageTypes.CANNON_FIRE)) {
|
||||
amount *= 3f;
|
||||
}
|
||||
if (source.is(ModDamageTypes.GUN_FIRE)) {
|
||||
amount *= 0.2f;
|
||||
}
|
||||
if (source.is(ModDamageTypes.GUN_FIRE_ABSOLUTE)) {
|
||||
amount *= 0.4f;
|
||||
}
|
||||
this.level().playSound(null, this.getOnPos(), ModSounds.HIT.get(), SoundSource.PLAYERS, 1, 1);
|
||||
this.hurt(0.5f * Math.max(amount - 40, 0));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public double getSubmergedHeight(Entity entity) {
|
||||
for (FluidType fluidType : ForgeRegistries.FLUID_TYPES.get().getValues()) {
|
||||
if (entity.level().getFluidState(entity.blockPosition()).getFluidType() == fluidType)
|
||||
return entity.getFluidTypeHeight(fluidType);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void baseTick() {
|
||||
turretYRotO = this.getTurretYRot();
|
||||
turretXRotO = this.getTurretXRot();
|
||||
rudderRotO = this.getRudderRot();
|
||||
leftWheelRotO = this.getLeftWheelRot();
|
||||
rightWheelRotO = this.getRightWheelRot();
|
||||
|
||||
super.baseTick();
|
||||
|
||||
if (this.entityData.get(HEAT) > 0) {
|
||||
this.entityData.set(HEAT, this.entityData.get(HEAT) - 1);
|
||||
}
|
||||
|
||||
if (this.entityData.get(FIRE_ANIM) > 0) {
|
||||
this.entityData.set(FIRE_ANIM, this.entityData.get(FIRE_ANIM) - 1);
|
||||
}
|
||||
|
||||
if (this.entityData.get(HEAT) < 40) {
|
||||
cannotFire = false;
|
||||
}
|
||||
|
||||
if (this.level() instanceof ServerLevel) {
|
||||
this.entityData.set(AMMO, this.getItemStacks().stream().filter(stack -> stack.is(ModItems.HEAVY_AMMO.get())).mapToInt(ItemStack::getCount).sum());
|
||||
}
|
||||
|
||||
Entity driver = this.getFirstPassenger();
|
||||
if (driver instanceof Player player) {
|
||||
if (this.entityData.get(HEAT) > 100) {
|
||||
cannotFire = true;
|
||||
if (!player.level().isClientSide() && player instanceof ServerPlayer serverPlayer) {
|
||||
SoundTool.playLocalSound(serverPlayer, ModSounds.MINIGUN_OVERHEAT.get(), 1f, 1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double fluidFloat;
|
||||
fluidFloat = 0.045 * getSubmergedHeight(this);
|
||||
this.setDeltaMovement(this.getDeltaMovement().add(0.0, fluidFloat, 0.0));
|
||||
|
||||
if (this.onGround()) {
|
||||
float f0 = 0.44f + 0.25f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90 - 0.02f * Mth.abs(this.getRudderRot());
|
||||
this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).normalize().scale(0.05 * this.getDeltaMovement().horizontalDistance())));
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(f0, 0.85, f0));
|
||||
} else if (this.isInWater()) {
|
||||
float f1 = 0.74f + 0.09f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90 - 0.01f * Mth.abs(this.getRudderRot());
|
||||
this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).normalize().scale(0.04 * this.getDeltaMovement().horizontalDistance())));
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(f1, 0.85, f1));
|
||||
} else {
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(0.99, 0.95, 0.99));
|
||||
}
|
||||
|
||||
if (this.level() instanceof ServerLevel serverLevel && this.isInWater() && this.getDeltaMovement().length() > 0.1) {
|
||||
sendParticle(serverLevel, ParticleTypes.CLOUD, this.getX() + 0.5 * this.getDeltaMovement().x, this.getY() + getSubmergedHeight(this) - 0.2, this.getZ() + 0.5 * this.getDeltaMovement().z, (int) (2 + 4 * this.getDeltaMovement().length()), 0.65, 0, 0.65, 0, true);
|
||||
sendParticle(serverLevel, ParticleTypes.BUBBLE_COLUMN_UP, this.getX() + 0.5 * this.getDeltaMovement().x, this.getY() + getSubmergedHeight(this) - 0.2, this.getZ() + 0.5 * this.getDeltaMovement().z, (int) (2 + 10 * this.getDeltaMovement().length()), 0.65, 0, 0.65, 0, true);
|
||||
}
|
||||
|
||||
float deltaT = Math.abs(getTurretYRot() - turretYRotO);
|
||||
while (getTurretYRot() > 180F) {
|
||||
setTurretYRot(getTurretYRot() - 360F);
|
||||
turretYRotO = getTurretYRot() - deltaT;
|
||||
}
|
||||
while (getTurretYRot() <= -180F) {
|
||||
setTurretYRot(getTurretYRot() + 360F);
|
||||
turretYRotO = deltaT + getTurretYRot();
|
||||
}
|
||||
|
||||
// Player player = (Player) this.getFirstPassenger();
|
||||
//
|
||||
// if (player != null) {
|
||||
// player.displayClientMessage(Component.literal( new DecimalFormat("##").format(getTurretYRot())), true);
|
||||
// }
|
||||
|
||||
collideBlock();
|
||||
gunnerAngle();
|
||||
lowHealthWarning();
|
||||
|
||||
this.refreshDimensions();
|
||||
}
|
||||
|
||||
public boolean zooming() {
|
||||
Entity driver = this.getFirstPassenger();
|
||||
if (driver == null) return false;
|
||||
if (driver instanceof Player player) {
|
||||
return player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).zoom;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 机枪塔开火
|
||||
*/
|
||||
@Override
|
||||
public void vehicleShoot(Player player) {
|
||||
if (this.cannotFire) return;
|
||||
|
||||
Matrix4f transform = getBarrelTransform();
|
||||
|
||||
float x = -0.0234375f;
|
||||
float y = 0f;
|
||||
float z = 3f;
|
||||
|
||||
Vector4f worldPosition = transformPosition(transform, x, y, z);
|
||||
|
||||
ProjectileEntity projectile = new ProjectileEntity(player.level())
|
||||
.shooter(player)
|
||||
.damage(VehicleConfig.SPEEDBOAT_GUN_DAMAGE.get())
|
||||
.headShot(2f)
|
||||
.zoom(false);
|
||||
|
||||
projectile.bypassArmorRate(0.9f);
|
||||
projectile.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z);
|
||||
projectile.shoot(player, getBarrelVector(1).x, getBarrelVector(1).y + 0.002f, getBarrelVector(1).z, 20,
|
||||
(float) 0.4);
|
||||
this.level().addFreshEntity(projectile);
|
||||
|
||||
sendParticle((ServerLevel) this.level(), ParticleTypes.LARGE_SMOKE, worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z, 1, 0.02, 0.02, 0.02, 0, false);
|
||||
|
||||
float pitch = this.entityData.get(HEAT) <= 60 ? 1 : (float) (1 - 0.011 * java.lang.Math.abs(60 - this.entityData.get(HEAT)));
|
||||
|
||||
if (!player.level().isClientSide) {
|
||||
if (player instanceof ServerPlayer serverPlayer) {
|
||||
serverPlayer.playSound(ModSounds.M_2_FIRE_3P.get(), 4, pitch);
|
||||
serverPlayer.playSound(ModSounds.M_2_FAR.get(), 12, pitch);
|
||||
serverPlayer.playSound(ModSounds.M_2_VERYFAR.get(), 24, pitch);
|
||||
}
|
||||
}
|
||||
|
||||
Level level = player.level();
|
||||
final Vec3 center = new Vec3(this.getX(), this.getEyeY(), this.getZ());
|
||||
|
||||
for (Entity target : level.getEntitiesOfClass(Entity.class, new AABB(center, center).inflate(4), e -> true).stream().sorted(Comparator.comparingDouble(e -> e.distanceToSqr(center))).toList()) {
|
||||
if (target instanceof ServerPlayer serverPlayer) {
|
||||
ModUtils.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> serverPlayer), new ShakeClientMessage(6, 5, 5, this.getX(), this.getEyeY(), this.getZ()));
|
||||
}
|
||||
}
|
||||
|
||||
this.entityData.set(HEAT, this.entityData.get(HEAT) + 3);
|
||||
this.entityData.set(FIRE_ANIM, 3);
|
||||
this.getItemStacks().stream().filter(stack -> stack.is(ModItems.HEAVY_AMMO.get())).findFirst().ifPresent(stack -> stack.shrink(1));
|
||||
}
|
||||
|
||||
public final Vec3 getBarrelVector(float pPartialTicks) {
|
||||
return this.calculateViewVector(this.getBarrelXRot(pPartialTicks), this.getBarrelYRot(pPartialTicks));
|
||||
}
|
||||
|
||||
public float getBarrelXRot(float pPartialTicks) {
|
||||
return Mth.lerp(pPartialTicks, turretXRotO - this.xRotO, getTurretXRot() - this.getXRot());
|
||||
}
|
||||
|
||||
public float getBarrelYRot(float pPartialTick) {
|
||||
return -Mth.lerp(pPartialTick, turretYRotO - this.yRotO, getTurretYRot() - this.getYRot());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 撞掉莲叶和冰块
|
||||
*/
|
||||
public void collideBlock() {
|
||||
AABB aabb = AABB.ofSize(new Vec3(this.getX(), this.getY() + this.getBbHeight() * 0.5, this.getZ()), 3.6, 2.6, 3.6);
|
||||
BlockPos.betweenClosedStream(aabb).forEach((pos) -> {
|
||||
BlockState blockstate = this.level().getBlockState(pos);
|
||||
if (blockstate.is(Blocks.LILY_PAD) || blockstate.is(Blocks.ICE) || blockstate.is(Blocks.FROSTED_ICE)) {
|
||||
this.level().destroyBlock(pos, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void travel() {
|
||||
Entity passenger0 = this.getPassengers().isEmpty() ? null : this.getPassengers().get(0);
|
||||
|
||||
if (this.getEnergy() <= 0) return;
|
||||
|
||||
if (passenger0 == null) {
|
||||
this.leftInputDown = false;
|
||||
this.rightInputDown = false;
|
||||
this.forwardInputDown = false;
|
||||
this.backInputDown = false;
|
||||
}
|
||||
|
||||
if (forwardInputDown) {
|
||||
this.entityData.set(POWER, this.entityData.get(POWER) + 0.006f);
|
||||
}
|
||||
|
||||
if (backInputDown) {
|
||||
this.entityData.set(POWER, this.entityData.get(POWER) - 0.005f);
|
||||
}
|
||||
|
||||
if (rightInputDown) {
|
||||
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) + 0.1f);
|
||||
} else if (this.leftInputDown) {
|
||||
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) - 0.1f);
|
||||
}
|
||||
|
||||
if (this.forwardInputDown || this.backInputDown) {
|
||||
this.extraEnergy(VehicleConfig.SPEEDBOAT_ENERGY_COST.get());
|
||||
}
|
||||
|
||||
if (level().isClientSide) {
|
||||
level().playLocalSound(this.getX(), this.getY() + this.getBbHeight() * 0.5, this.getZ(), this.getEngineSound(), this.getSoundSource(), Math.min((this.forwardInputDown || this.backInputDown ? 7.5f : 5f) * 2 * Mth.abs(this.entityData.get(POWER)), 0.25f), (random.nextFloat() * 0.1f + 1f), false);
|
||||
}
|
||||
|
||||
this.entityData.set(POWER, this.entityData.get(POWER) * 0.97f);
|
||||
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) * (float)Math.max(0.7f - 0.1f * this.getDeltaMovement().horizontalDistance(), 0.3));
|
||||
|
||||
float angle = (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1));
|
||||
double s0;
|
||||
|
||||
if (Mth.abs(angle) < 90) {
|
||||
s0 = this.getDeltaMovement().horizontalDistance();
|
||||
} else {
|
||||
s0 = -this.getDeltaMovement().horizontalDistance();
|
||||
}
|
||||
|
||||
this.setLeftWheelRot((float) ((this.getLeftWheelRot() - 1.25 * s0) - this.getDeltaMovement().horizontalDistance() * Mth.clamp(1.5f * this.entityData.get(DELTA_ROT), -5f, 5f)));
|
||||
this.setRightWheelRot((float) ((this.getRightWheelRot() - 1.25 * s0) + this.getDeltaMovement().horizontalDistance() * Mth.clamp(1.5f * this.entityData.get(DELTA_ROT), -5f, 5f)));
|
||||
|
||||
this.setRudderRot(Mth.clamp(this.getRudderRot() - this.entityData.get(DELTA_ROT), -0.8f, 0.8f) * 0.75f);
|
||||
|
||||
if (this.isInWater() || onGround()) {
|
||||
this.setYRot((float) (this.getYRot() - Math.max(10 * this.getDeltaMovement().horizontalDistance(), 0) * this.getRudderRot() * (this.entityData.get(POWER) > 0 ? 1 : -1)));
|
||||
this.setDeltaMovement(this.getDeltaMovement().add(Mth.sin(-this.getYRot() * 0.017453292F) * (isInWater() ? 0.3f : 1) * this.entityData.get(POWER), 0.0, Mth.cos(this.getYRot() * 0.017453292F) * (isInWater() ? 0.3f : 1) * this.entityData.get(POWER)));
|
||||
}
|
||||
}
|
||||
|
||||
private void gunnerAngle() {
|
||||
Entity driver = this.getFirstPassenger();
|
||||
if (driver == null) return;
|
||||
|
||||
float gunAngle = -Mth.wrapDegrees(driver.getYHeadRot() - this.getYRot());
|
||||
|
||||
float diffY;
|
||||
float diffX;
|
||||
|
||||
diffY = Mth.wrapDegrees(gunAngle - getTurretYRot());
|
||||
diffX = Mth.wrapDegrees(driver.getXRot() - this.getTurretXRot());
|
||||
|
||||
|
||||
this.setTurretXRot(Mth.clamp(this.getTurretXRot() + Mth.clamp(0.5f * diffX, -2, 2), -25, 10));
|
||||
this.setTurretYRot(this.getTurretYRot() + Mth.clamp(0.5f * diffY, -8, 8));
|
||||
}
|
||||
|
||||
public float getTurretYRot() {
|
||||
return this.turretYRot;
|
||||
}
|
||||
|
||||
public void setTurretYRot(float pTurretYRot) {
|
||||
this.turretYRot = pTurretYRot;
|
||||
}
|
||||
|
||||
public float getTurretXRot() {
|
||||
return this.turretXRot;
|
||||
}
|
||||
|
||||
public void setTurretXRot(float pTurretXRot) {
|
||||
this.turretXRot = pTurretXRot;
|
||||
}
|
||||
|
||||
public float getRudderRot() {
|
||||
return this.rudderRot;
|
||||
}
|
||||
|
||||
public void setRudderRot(float pRudderRot) {
|
||||
this.rudderRot = pRudderRot;
|
||||
}
|
||||
|
||||
public float getLeftWheelRot() {
|
||||
return this.leftWheelRot;
|
||||
}
|
||||
|
||||
public void setLeftWheelRot(float pLeftWheelRot) {
|
||||
this.leftWheelRot = pLeftWheelRot;
|
||||
}
|
||||
|
||||
public float getRightWheelRot() {
|
||||
return this.rightWheelRot;
|
||||
}
|
||||
|
||||
public void setRightWheelRot(float pRightWheelRot) {
|
||||
this.rightWheelRot = pRightWheelRot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SoundEvent getEngineSound() {
|
||||
return ModSounds.BOAT_ENGINE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void positionRider(@NotNull Entity passenger, @NotNull MoveFunction callback) {
|
||||
// From Immersive_Aircraft
|
||||
if (!this.hasPassenger(passenger)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Matrix4f transform = getTurretTransform();
|
||||
|
||||
float x = 0.36f;
|
||||
float y = -0.3f;
|
||||
float z = 0.56f;
|
||||
y += (float) passenger.getMyRidingOffset();
|
||||
|
||||
int i = this.getPassengers().indexOf(passenger);
|
||||
|
||||
if (i == 0) {
|
||||
Vector4f worldPosition = transformPosition(transform, x, y, z);
|
||||
passenger.setPos(worldPosition.x, worldPosition.y, worldPosition.z);
|
||||
callback.accept(passenger, worldPosition.x, worldPosition.y, worldPosition.z);
|
||||
}
|
||||
}
|
||||
|
||||
public Matrix4f getBarrelTransform() {
|
||||
Matrix4f transformT = getTurretTransform();
|
||||
float x = 0f;
|
||||
float y = 0.33795f;
|
||||
float z = 0.825f;
|
||||
Vector4f worldPosition = transformPosition(transformT, x, y, z);
|
||||
|
||||
Matrix4f transform = new Matrix4f();
|
||||
transform.translate(worldPosition.x, worldPosition.y, worldPosition.z);
|
||||
transform.rotate(Axis.YP.rotationDegrees(getTurretYRot() - getYRot()));
|
||||
transform.rotate(Axis.XP.rotationDegrees(getTurretXRot()));
|
||||
transform.rotate(Axis.ZP.rotationDegrees(getRoll()));
|
||||
return transform;
|
||||
}
|
||||
|
||||
public Matrix4f getTurretTransform() {
|
||||
Matrix4f transform = new Matrix4f();
|
||||
transform.translate((float) getX(), (float) getY() + 2.4f, (float) getZ());
|
||||
transform.rotate(Axis.YP.rotationDegrees(getTurretYRot() - getYRot()));
|
||||
transform.rotate(Axis.XP.rotationDegrees(getXRot()));
|
||||
transform.rotate(Axis.ZP.rotationDegrees(getRoll()));
|
||||
return transform;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
Entity attacker = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_ATTACKER_UUID));
|
||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), 75f,
|
||||
this.getX(), this.getY(), this.getZ(), 5f, ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
||||
explosion.explode();
|
||||
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||
explosion.finalizeExplosion(false);
|
||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
||||
this.discard();
|
||||
}
|
||||
|
||||
protected void clampRotation(Entity entity) {
|
||||
float f = Mth.wrapDegrees(entity.getXRot());
|
||||
float f1 = Mth.clamp(f, -25.0F, 10F);
|
||||
entity.xRotO += f1 - f;
|
||||
entity.setXRot(entity.getXRot() + f1 - f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPassengerTurned(Entity entity) {
|
||||
this.clampRotation(entity);
|
||||
}
|
||||
|
||||
// private PlayState firePredicate(AnimationState<Lav150Entity> event) {
|
||||
// if (this.entityData.get(FIRE_ANIM) > 1) {
|
||||
// return event.setAndContinue(RawAnimation.begin().thenPlay("animation.speedboat.fire"));
|
||||
// }
|
||||
//
|
||||
// return event.setAndContinue(RawAnimation.begin().thenLoop("animation.speedboat.idle"));
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
||||
// data.add(new AnimationController<>(this, "movement", 0, this::firePredicate));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnimatableInstanceCache getAnimatableInstanceCache() {
|
||||
return this.cache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float ignoreExplosionHorizontalKnockBack() {
|
||||
return -0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float ignoreExplosionVerticalKnockBack() {
|
||||
return -0.9f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergy() {
|
||||
return MAX_ENERGY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMaxHealth() {
|
||||
return MAX_HEALTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDriver(Player player) {
|
||||
return player == this.getFirstPassenger();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int mainGunRpm() {
|
||||
return 240;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canShoot(Player player) {
|
||||
return (this.entityData.get(AMMO) > 0 || player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get())))
|
||||
&& !player.getMainHandItem().is(ModTags.Items.GUN)
|
||||
&& !cannotFire;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmmoCount(Player player) {
|
||||
return this.entityData.get(AMMO);
|
||||
}
|
||||
}
|
|
@ -148,7 +148,7 @@ public class MobileVehicleEntity extends EnergyVehicleEntity {
|
|||
double f = Math.min(entitySize / thisSize, 2);
|
||||
double f1 = Math.min(thisSize / entitySize, 4);
|
||||
|
||||
if (velocity.length() > 0.4) {
|
||||
if (velocity.length() > 0.3) {
|
||||
if (!this.level().isClientSide) {
|
||||
this.level().playSound(null, this, ModSounds.VEHICLE_STRIKE.get(), this.getSoundSource(), 1, 1);
|
||||
}
|
||||
|
@ -156,12 +156,12 @@ public class MobileVehicleEntity extends EnergyVehicleEntity {
|
|||
this.push(-f * velAdd.x, -f * velAdd.y, -f * velAdd.z);
|
||||
}
|
||||
entity.push(f1 * velAdd.x, f1 * velAdd.y, f1 * velAdd.z);
|
||||
entity.hurt(ModDamageTypes.causeVehicleStrikeDamage(this.level().registryAccess(), this, this.getFirstPassenger() == null ? this : this.getFirstPassenger()), (float) (thisSize * 10 * ((velocity.length() - 0.4) * (velocity.length() - 0.4))));
|
||||
entity.hurt(ModDamageTypes.causeVehicleStrikeDamage(this.level().registryAccess(), this, this.getFirstPassenger() == null ? this : this.getFirstPassenger()), (float) (thisSize * 20 * ((velocity.length() - 0.3) * (velocity.length() - 0.3))));
|
||||
if (entities instanceof VehicleEntity) {
|
||||
this.hurt(ModDamageTypes.causeVehicleStrikeDamage(this.level().registryAccess(), entity, entity.getFirstPassenger() == null ? entity : entity.getFirstPassenger()), (float) (entitySize * 10 * ((velocity.length() - 0.4) * (velocity.length() - 0.4))));
|
||||
this.hurt(ModDamageTypes.causeVehicleStrikeDamage(this.level().registryAccess(), entity, entity.getFirstPassenger() == null ? entity : entity.getFirstPassenger()), (float) (entitySize * 10 * ((velocity.length() - 0.3) * (velocity.length() - 0.3))));
|
||||
}
|
||||
} else {
|
||||
entity.push(0.2 * f1 * velAdd.x, 0.2 * f1 * velAdd.y, 0.2 * f1 * velAdd.z);
|
||||
entity.push(0.3 * f1 * velAdd.x, 0.3 * f1 * velAdd.y, 0.3 * f1 * velAdd.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -188,7 +188,7 @@ public class SpeedboatEntity extends ContainerMobileEntity implements GeoEntity,
|
|||
this.setDeltaMovement(this.getDeltaMovement().multiply(0.2, 0.85, 0.2));
|
||||
} else {
|
||||
float f = 0.74f + 0.09f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90;
|
||||
this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).normalize().scale(0.04 * this.getDeltaMovement().length())));
|
||||
this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).normalize().scale(0.04 * this.getDeltaMovement().horizontalDistance())));
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(f, 0.85, f));
|
||||
}
|
||||
|
||||
|
|
|
@ -382,6 +382,7 @@ public class ClientEventHandler {
|
|||
}
|
||||
|
||||
if ((holdFire || burstFireSize > 0)
|
||||
&& !((player.getVehicle() instanceof Ah6Entity ah6Entity && ah6Entity.isDriver(player)) || player.getVehicle() instanceof Lav150Entity)
|
||||
&& (stack.is(ModTags.Items.NORMAL_GUN)
|
||||
&& cantFireTime == 0
|
||||
&& drawTime < 0.01
|
||||
|
@ -840,7 +841,7 @@ public class ClientEventHandler {
|
|||
}
|
||||
}
|
||||
|
||||
if (player.getVehicle() instanceof ICannonEntity) {
|
||||
if (player.getVehicle() instanceof ICannonEntity || player.getVehicle() instanceof Lav150Entity) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
||||
|
@ -1321,7 +1322,7 @@ public class ClientEventHandler {
|
|||
public static void setPlayerInvisible(RenderPlayerEvent.Pre event) {
|
||||
var otherPlayer = event.getEntity();
|
||||
|
||||
if (otherPlayer.getVehicle() instanceof ICannonEntity) {
|
||||
if (otherPlayer.getVehicle() instanceof ICannonEntity || otherPlayer.getVehicle() instanceof Lav150Entity) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,6 +72,8 @@ public class ModEntities {
|
|||
EntityType.Builder.<HeliRocketEntity>of(HeliRocketEntity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(1).setCustomClientFactory(HeliRocketEntity::new).sized(0.5f, 0.5f));
|
||||
public static final RegistryObject<EntityType<FlareDecoyEntity>> FLARE_DECOY = register("flare_decoy_entity",
|
||||
EntityType.Builder.<FlareDecoyEntity>of(FlareDecoyEntity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(1).setCustomClientFactory(FlareDecoyEntity::new).sized(0.5f, 0.5f));
|
||||
public static final RegistryObject<EntityType<Lav150Entity>> LAV_150 = register("lav_150",
|
||||
EntityType.Builder.<Lav150Entity>of(Lav150Entity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(3).setCustomClientFactory(Lav150Entity::new).fireImmune().sized(2.8f, 3.1f));
|
||||
|
||||
private static <T extends Entity> RegistryObject<EntityType<T>> register(String name, EntityType.Builder<T> entityTypeBuilder) {
|
||||
return REGISTRY.register(name, () -> entityTypeBuilder.build(name));
|
||||
|
|
|
@ -34,5 +34,6 @@ public class ModEntityRenderers {
|
|||
event.registerEntityRenderer(ModEntities.WHEEL_CHAIR.get(), WheelChairRenderer::new);
|
||||
event.registerEntityRenderer(ModEntities.AH_6.get(), Ah6Renderer::new);
|
||||
event.registerEntityRenderer(ModEntities.FLARE_DECOY.get(), FlareDecoyEntityRenderer::new);
|
||||
event.registerEntityRenderer(ModEntities.LAV_150.get(), Lav150Renderer::new);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,6 +109,7 @@ public class ModTabs {
|
|||
output.accept(ContainerBlockItem.createInstance(ModEntities.SPEEDBOAT.get(), true));
|
||||
output.accept(ContainerBlockItem.createInstance(ModEntities.WHEEL_CHAIR.get()));
|
||||
output.accept(ContainerBlockItem.createInstance(ModEntities.AH_6.get()));
|
||||
output.accept(ContainerBlockItem.createInstance(ModEntities.LAV_150.get()));
|
||||
} else {
|
||||
output.accept(registryObject.get());
|
||||
if (registryObject.get() == ModItems.ARMOR_PLATE.get()) {
|
||||
|
|
|
@ -119,6 +119,11 @@ public abstract class CameraMixin {
|
|||
move(-getMaxZoom(7), 1, -2.7);
|
||||
return;
|
||||
}
|
||||
|
||||
if (thirdPerson && entity.getVehicle() instanceof Lav150Entity && !ClientEventHandler.zoom) {
|
||||
move(-getMaxZoom(2.5), 0.75, 0.0);
|
||||
return;
|
||||
}
|
||||
if (Minecraft.getInstance().options.getCameraType() == CameraType.THIRD_PERSON_BACK && entity instanceof Player player && player.getMainHandItem().is(ModTags.Items.GUN)) {
|
||||
move(-getMaxZoom(-2.9 * Math.max(ClientEventHandler.pullPos, ClientEventHandler.zoomPos)), 0, -ClientEventHandler.cameraLocation * Math.max(ClientEventHandler.pullPos, ClientEventHandler.zoomPos));
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.atsuishio.superbwarfare.mixins;
|
|||
import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.ICannonEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.atsuishio.superbwarfare.init.ModItems;
|
||||
import com.atsuishio.superbwarfare.init.ModMobEffects;
|
||||
|
@ -54,6 +55,10 @@ public class MouseHandlerMixin {
|
|||
return 0.24;
|
||||
}
|
||||
|
||||
if (player.getVehicle() instanceof Lav150Entity lav150 && lav150.getFirstPassenger() == player) {
|
||||
return 0.32;
|
||||
}
|
||||
|
||||
if (stack.is(ModItems.MONITOR.get()) && stack.getOrCreateTag().getBoolean("Using") && stack.getOrCreateTag().getBoolean("Linked")) {
|
||||
return 0.33 / (1 + 0.08 * (droneFovLerp - 1));
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ public class CustomExplosion extends Explosion {
|
|||
private final float damage;
|
||||
private int fireTime;
|
||||
private float damageMultiplier;
|
||||
private boolean bullet;
|
||||
|
||||
public CustomExplosion(Level pLevel, @Nullable Entity pSource, @Nullable DamageSource source, @Nullable ExplosionDamageCalculator pDamageCalculator,
|
||||
float damage, double pToBlowX, double pToBlowY, double pToBlowZ, float pRadius,
|
||||
|
@ -101,6 +102,11 @@ public class CustomExplosion extends Explosion {
|
|||
return this;
|
||||
}
|
||||
|
||||
public CustomExplosion isBulletExplode(boolean bullet) {
|
||||
this.bullet = bullet;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void explode() {
|
||||
this.level.gameEvent(this.source, GameEvent.EXPLODE, new Vec3(this.x, this.y, this.z));
|
||||
|
@ -198,7 +204,7 @@ public class CustomExplosion extends Explosion {
|
|||
yDistance *= d11;
|
||||
zDistance *= d11;
|
||||
|
||||
if (entity instanceof VehicleEntity vehicle) {
|
||||
if (entity instanceof VehicleEntity vehicle && !bullet) {
|
||||
Vec3 knockbackVec = new Vec3(vehicle.ignoreExplosionHorizontalKnockBack() * xDistance, vehicle.ignoreExplosionVerticalKnockBack() * yDistance, vehicle.ignoreExplosionHorizontalKnockBack() * zDistance);
|
||||
vehicle.setDeltaMovement(vehicle.getDeltaMovement().add(knockbackVec));
|
||||
}
|
||||
|
|
7183
src/main/resources/assets/superbwarfare/geo/lav150.geo.json
Normal file
7183
src/main/resources/assets/superbwarfare/geo/lav150.geo.json
Normal file
File diff suppressed because it is too large
Load diff
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
Loading…
Add table
Reference in a new issue