添加a10

This commit is contained in:
Atsuishio 2025-05-05 18:08:46 +08:00 committed by Light_Quanta
parent dee1e8a1ad
commit 6019b8fd42
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
13 changed files with 31317 additions and 17 deletions

View file

@ -0,0 +1,25 @@
package com.atsuishio.superbwarfare.client.model.entity;
import com.atsuishio.superbwarfare.Mod;
import com.atsuishio.superbwarfare.entity.vehicle.A10Entity;
import net.minecraft.resources.ResourceLocation;
import software.bernie.geckolib.model.GeoModel;
public class A10Model extends GeoModel<A10Entity> {
@Override
public ResourceLocation getAnimationResource(A10Entity entity) {
return null;
// return ModUtils.loc("animations/wheel_chair.animation.json");
}
@Override
public ResourceLocation getModelResource(A10Entity entity) {
return Mod.loc("geo/a10.geo.json");
}
@Override
public ResourceLocation getTextureResource(A10Entity entity) {
return Mod.loc("textures/entity/a10.png");
}
}

View file

@ -0,0 +1,69 @@
package com.atsuishio.superbwarfare.client.renderer.entity;
import com.atsuishio.superbwarfare.client.model.entity.A10Model;
import com.atsuishio.superbwarfare.entity.vehicle.A10Entity;
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 net.minecraft.world.phys.Vec3;
import software.bernie.geckolib.cache.object.BakedGeoModel;
import software.bernie.geckolib.cache.object.GeoBone;
import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class A10Renderer extends GeoEntityRenderer<A10Entity> {
public A10Renderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new A10Model());
this.shadowRadius = 0.5f;
}
@Override
public RenderType getRenderType(A10Entity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
return RenderType.entityTranslucent(getTextureLocation(animatable));
}
@Override
public void preRender(PoseStack poseStack, A10Entity entity, BakedGeoModel model, MultiBufferSource bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, int color) {
float scale = 1f;
this.scaleHeight = scale;
this.scaleWidth = scale;
super.preRender(poseStack, entity, model, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, color);
}
@Override
public void render(A10Entity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
poseStack.pushPose();
Vec3 root = new Vec3(0, 2.375, 0);
poseStack.rotateAround(Axis.YP.rotationDegrees(-entityYaw), (float) root.x, (float) root.y, (float) root.z);
poseStack.rotateAround(Axis.XP.rotationDegrees(Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())), (float) root.x, (float) root.y, (float) root.z);
poseStack.rotateAround(Axis.ZP.rotationDegrees(Mth.lerp(partialTicks, entityIn.prevRoll, entityIn.getRoll())), (float) root.x, (float) root.y, (float) root.z);
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
poseStack.popPose();
}
@Override
public void renderRecursively(PoseStack poseStack, A10Entity animatable, GeoBone bone, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, int color) {
String name = bone.getName();
if (name.equals("wingLR")) {
bone.setRotX(Mth.lerp(partialTick, animatable.flap1LRotO, animatable.getFlap1LRot()) * Mth.DEG_TO_RAD);
}
if (name.equals("wingRR")) {
bone.setRotX(Mth.lerp(partialTick, animatable.flap1RRotO, animatable.getFlap1RRot()) * Mth.DEG_TO_RAD);
}
if (name.equals("wingLB")) {
bone.setRotX(Mth.lerp(partialTick, animatable.flap2LRotO, animatable.getFlap2LRot()) * Mth.DEG_TO_RAD);
}
if (name.equals("wingRB")) {
bone.setRotX(Mth.lerp(partialTick, animatable.flap2RRotO, animatable.getFlap2RRot()) * Mth.DEG_TO_RAD);
}
if (name.equals("weiyiL") || name.equals("weiyiR")) {
bone.setRotY(Mth.clamp(Mth.lerp(partialTick, animatable.flap3RotO, animatable.getFlap3Rot()), -20f, 20f) * Mth.DEG_TO_RAD);
}
super.renderRecursively(poseStack, animatable, bone, renderType, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, color);
}
}

View file

@ -0,0 +1,358 @@
package com.atsuishio.superbwarfare.entity.vehicle;
import com.atsuishio.superbwarfare.Mod;
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
import com.atsuishio.superbwarfare.entity.projectile.GunGrenadeEntity;
import com.atsuishio.superbwarfare.entity.projectile.MelonBombEntity;
import com.atsuishio.superbwarfare.entity.projectile.MortarShellEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.ThirdPersonCameraPosition;
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
import com.atsuishio.superbwarfare.init.ModDamageTypes;
import com.atsuishio.superbwarfare.init.ModSounds;
import com.atsuishio.superbwarfare.init.ModTags;
import com.atsuishio.superbwarfare.tools.CustomExplosion;
import com.atsuishio.superbwarfare.tools.FormatTool;
import com.atsuishio.superbwarfare.tools.ParticleTool;
import com.mojang.math.Axis;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.util.Mth;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.neoforged.neoforge.event.EventHooks;
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.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.animation.AnimatableManager;
import software.bernie.geckolib.util.GeckoLibUtil;
public class A10Entity extends MobileVehicleEntity implements GeoEntity {
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
private float yRotSync;
public A10Entity(EntityType<A10Entity> type, Level world) {
super(type, world);
}
@Override
public float maxUpStep() {
return 0.5f;
}
@Override
public ThirdPersonCameraPosition getThirdPersonCameraPosition(int index) {
return new ThirdPersonCameraPosition(17, 3, 0);
}
@Override
protected void defineSynchedData(SynchedEntityData.Builder builder) {
super.defineSynchedData(builder);
}
@Override
public void addAdditionalSaveData(CompoundTag compound) {
super.addAdditionalSaveData(compound);
}
@Override
public void readAdditionalSaveData(CompoundTag compound) {
super.readAdditionalSaveData(compound);
}
@Override
protected void playStepSound(@NotNull BlockPos pPos, @NotNull BlockState pState) {
this.playSound(ModSounds.WHEEL_STEP.get(), (float) (getDeltaMovement().length() * 0.5), random.nextFloat() * 0.1f + 1f);
}
@Override
public boolean sendFireStarParticleOnHurt() {
return false;
}
@Override
public DamageModifier getDamageModifier() {
return super.getDamageModifier()
.multiply(0.4f)
.multiply(1.5f, DamageTypes.ARROW)
.multiply(1.5f, DamageTypes.TRIDENT)
.multiply(2.5f, DamageTypes.MOB_ATTACK)
.multiply(2f, DamageTypes.MOB_ATTACK_NO_AGGRO)
.multiply(1.5f, DamageTypes.MOB_PROJECTILE)
.multiply(12.5f, DamageTypes.LAVA)
.multiply(6f, DamageTypes.EXPLOSION)
.multiply(6f, DamageTypes.PLAYER_EXPLOSION)
.multiply(2.4f, ModDamageTypes.CUSTOM_EXPLOSION)
.multiply(2f, ModDamageTypes.PROJECTILE_BOOM)
.multiply(0.75f, ModDamageTypes.MINE)
.multiply(1.5f, ModDamageTypes.CANNON_FIRE)
.multiply(0.25f, ModTags.DamageTypes.PROJECTILE)
.multiply(0.85f, ModTags.DamageTypes.PROJECTILE_ABSOLUTE)
.multiply(15f, ModDamageTypes.VEHICLE_STRIKE)
.custom((source, damage) -> getSourceAngle(source, 0.25f) * damage)
.custom((source, damage) -> {
if (source.getDirectEntity() instanceof MelonBombEntity) {
return 3f * damage;
}
if (source.getDirectEntity() instanceof MortarShellEntity) {
return 1.25f * damage;
}
if (source.getDirectEntity() instanceof GunGrenadeEntity) {
return 1.5f * damage;
}
return damage;
})
.reduce(7);
}
@Override
public void baseTick() {
super.baseTick();
float f;
f = (float) Mth.clamp(Math.max((onGround() ? 0.785f : 0.79f) - 0.01 * getDeltaMovement().length(), 0.5) + 0.031f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90, 0.01, 0.99);
boolean forward = Mth.abs((float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) < 90;
this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).scale((forward ? 0.23 : -0.23) * this.getDeltaMovement().length())));
this.setDeltaMovement(this.getDeltaMovement().multiply(f, f, f));
if (this.isInWater() && this.tickCount % 4 == 0) {
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6, 0.6, 0.6));
if (lastTickSpeed > 0.4) {
this.hurt(ModDamageTypes.causeVehicleStrikeDamage(this.level().registryAccess(), this, this.getFirstPassenger() == null ? this : this.getFirstPassenger()), (float) (20 * ((lastTickSpeed - 0.4) * (lastTickSpeed - 0.4))));
}
}
this.terrainCompact(5f, 5f);
this.refreshDimensions();
}
@Override
public void travel() {
Entity passenger = this.getFirstPassenger();
// if (this.getEnergy() <= 0) return;
float diffX;
float diffY;
if (passenger == null || isInWater()) {
this.leftInputDown = false;
this.rightInputDown = false;
this.forwardInputDown = false;
this.backInputDown = false;
this.entityData.set(POWER, this.entityData.get(POWER) * 0.95f);
if (onGround()) {
this.setDeltaMovement(this.getDeltaMovement().multiply(0.94, 1, 0.94));
} else {
this.setXRot(Mth.clamp(this.getXRot() + 0.1f, -89, 89));
}
} else if (passenger instanceof Player player) {
if (level().isClientSide && this.getEnergy() > 0) {
level().playLocalSound(this.getX(), this.getY() + this.getBbHeight() * 0.5, this.getZ(), this.getEngineSound(), this.getSoundSource(), Math.min((this.forwardInputDown ? 7.5f : 5f) * 2 * Mth.abs(this.entityData.get(POWER)), 0.25f), (random.nextFloat() * 0.1f + 1.2f), false);
}
if (forwardInputDown && getEnergy() > 0) {
this.consumeEnergy(VehicleConfig.TOM_6_ENERGY_COST.get());
this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.002f, 1f));
}
if (backInputDown) {
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.002f, onGround() ? -0.2f : 0.01f));
}
if (!onGround()) {
if (rightInputDown) {
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) - 0.2f);
} else if (this.leftInputDown) {
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) + 0.2f);
}
} else {
// 刹车
if (upInputDown) {
this.entityData.set(POWER, this.entityData.get(POWER) * 0.8f);
this.setDeltaMovement(this.getDeltaMovement().multiply(0.9, 1, 0.9));
}
if (!(backInputDown || forwardInputDown)) {
this.setDeltaMovement(this.getDeltaMovement().multiply(0.97, 1, 0.97));
}
}
diffY = Mth.clamp(Mth.wrapDegrees(passenger.getYHeadRot() - this.getYRot()), -90f, 90f);
diffX = Mth.clamp(Mth.wrapDegrees(passenger.getXRot() - this.getXRot()), -90f, 90f);
float roll = Mth.abs(Mth.clamp(getRoll() / 60, -1.5f, 1.5f));
float addY = Mth.clamp(Math.max((this.onGround() ? 0.1f : 0.2f) * (float) Math.max(getDeltaMovement().dot(getViewVector(1)), 0.05), 0f) * diffY - 0.5f * this.entityData.get(DELTA_ROT), -1.5f * (roll + 1), 1.5f * (roll + 1));
float addX = Mth.clamp(Math.min((float) Math.max(getDeltaMovement().dot(getViewVector(1)) - 0.2, 0.02), 0.5f) * diffX, -1.3f, 1.3f);
float addZ = this.entityData.get(DELTA_ROT) - (this.onGround() ? 0 : 0.01f) * diffY * (float) getDeltaMovement().dot(getViewVector(1));
float i = getXRot() / 90;
yRotSync = addY * (1 - Mth.abs(i)) + addZ * i;
this.setYRot(this.getYRot() + yRotSync);
this.setXRot(Mth.clamp(this.getXRot() + addX, onGround() ? 0 : -120, onGround() ? 0 : 120));
this.setZRot(this.getRoll() - addZ * (1 - Mth.abs(i)));
setFlap1LRot(Mth.clamp(-Mth.clamp(diffX, -22.5f, 22.5f) - 8 * addZ * (1 - Mth.abs(i)), -22.5f, 22.5f));
setFlap1RRot(Mth.clamp(-Mth.clamp(diffX, -22.5f, 22.5f) + 8 * addZ * (1 - Mth.abs(i)), -22.5f, 22.5f));
setFlap2LRot(Mth.clamp(Mth.clamp(diffX, -22.5f, 22.5f) - 8 * addZ * (1 - Mth.abs(i)), -22.5f, 22.5f));
setFlap2RRot(Mth.clamp(Mth.clamp(diffX, -22.5f, 22.5f) + 8 * addZ * (1 - Mth.abs(i)), -22.5f, 22.5f));
setFlap3Rot(diffY * 0.7f);
player.displayClientMessage(Component.literal("speed: " + FormatTool.format2D(getDeltaMovement().dot(getViewVector(1)) * 72)), true);
}
this.entityData.set(POWER, this.entityData.get(POWER) * 0.99f);
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) * 0.95f);
this.setDeltaMovement(this.getDeltaMovement().add(getViewVector(1).scale(Math.max((90 + this.getXRot()) / 90, 0.3) * 0.4 * this.entityData.get(POWER))));
double flapAngle = (getFlap1LRot() + getFlap1RRot()) / 2;
setDeltaMovement(getDeltaMovement().add(0.0f, Mth.clamp(Math.sin((onGround() ? 25 + flapAngle : -(getXRot() - 25) + flapAngle) * Mth.DEG_TO_RAD) * Math.sin((90 - this.getXRot()) * Mth.DEG_TO_RAD) * getDeltaMovement().dot(getViewVector(1)) * 0.06, -0.04, 0.065), 0.0f));
}
@Override
public SoundEvent getEngineSound() {
return ModSounds.WHEEL_CHAIR_ENGINE.get();
}
protected void clampRotation(Entity entity) {
float f = Mth.wrapDegrees(entity.getXRot() - this.getXRot());
float f1 = Mth.clamp(f, -85.0F, 60F);
entity.xRotO += f1 - f;
entity.setXRot(entity.getXRot() + f1 - f);
entity.setYBodyRot(this.getYRot());
float f2 = Mth.wrapDegrees(entity.getYRot() - this.getYRot());
float f3 = Mth.clamp(f2, -90.0F, 90.0F);
entity.yRotO += f3 - f2;
entity.setYRot(entity.getYRot() + f3 - f2);
entity.setYBodyRot(this.getYRot());
}
@Override
public void onPassengerTurned(@NotNull Entity entity) {
this.clampRotation(entity);
}
@Override
public void positionRider(@NotNull Entity passenger, @NotNull MoveFunction callback) {
// From Immersive_Aircraft
if (!this.hasPassenger(passenger)) {
return;
}
Matrix4f transform = getVehicleTransform(1);
float x = 0f;
float y = 0.1f;
float z = 3.8494875f;
// TODO 正确调整乘客位置
y += (float) passenger.getVehicleAttachmentPoint(this).y;
int i = this.getSeatIndex(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);
}
if (passenger != this.getFirstPassenger()) {
passenger.setXRot(passenger.getXRot() + (getXRot() - xRotO));
}
copyEntityData(passenger);
}
public void copyEntityData(Entity entity) {
float i = getXRot() / 90;
float f = Mth.wrapDegrees(entity.getYRot() - getYRot());
float g = Mth.clamp(f, -105.0f, 105.0f);
entity.yRotO += g - f;
entity.setYRot(entity.getYRot() + g - f + yRotSync * Mth.abs(i));
entity.setYHeadRot(entity.getYRot());
entity.setYBodyRot(getYRot());
}
@Override
public Matrix4f getVehicleTransform(float ticks) {
Matrix4f transform = new Matrix4f();
transform.translate((float) Mth.lerp(ticks, xo, getX()), (float) Mth.lerp(ticks, yo + 2.375f, getY() + 2.375f), (float) Mth.lerp(ticks, zo, getZ()));
transform.rotate(Axis.YP.rotationDegrees(-Mth.lerp(ticks, yRotO, getYRot())));
transform.rotate(Axis.XP.rotationDegrees(Mth.lerp(ticks, xRotO, getXRot())));
transform.rotate(Axis.ZP.rotationDegrees(Mth.lerp(ticks, prevRoll, getRoll())));
return transform;
}
@Override
public void destroy() {
if (this.crash) {
crashPassengers();
} else {
explodePassengers();
}
if (level() instanceof ServerLevel) {
CustomExplosion explosion = new CustomExplosion(this.level(), this,
ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), this, getAttacker()), 300.0f,
this.getX(), this.getY(), this.getZ(), 8f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP, true).setDamageMultiplier(1);
explosion.explode();
EventHooks.onExplosionStart(this.level(), explosion);
explosion.finalizeExplosion(false);
ParticleTool.spawnHugeExplosionParticles(this.level(), this.position());
}
this.discard();
}
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
}
@Override
public AnimatableInstanceCache getAnimatableInstanceCache() {
return this.cache;
}
@Override
public float getMaxHealth() {
return 300;
}
@Override
public int getMaxEnergy() {
return 5000000;
}
@Override
public ResourceLocation getVehicleIcon() {
return Mod.loc("textures/vehicle_icon/tom_6_icon.png");
}
@Override
public boolean allowFreeCam() {
return true;
}
}

View file

@ -10,10 +10,12 @@ import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
import com.atsuishio.superbwarfare.init.ModDamageTypes;
import com.atsuishio.superbwarfare.init.ModSounds;
import com.atsuishio.superbwarfare.tools.CustomExplosion;
import com.atsuishio.superbwarfare.tools.FormatTool;
import com.atsuishio.superbwarfare.tools.ParticleTool;
import com.mojang.math.Axis;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
@ -115,7 +117,7 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
super.baseTick();
float f;
f = (float) Mth.clamp(0.759f + 0.041f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90, 0.01, 0.99);
f = (float) Mth.clamp(0.69f + 0.101f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90, 0.01, 0.99);
boolean forward = Mth.abs((float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) < 90;
@ -130,7 +132,6 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
}
this.terrainCompact(1f, 1.2f);
this.setDeltaMovement(this.getDeltaMovement().add(0.0, 0.01, 0.0));
this.refreshDimensions();
}
@ -161,11 +162,11 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
if (forwardInputDown && getEnergy() > 0) {
this.consumeEnergy(VehicleConfig.TOM_6_ENERGY_COST.get());
this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.01f, 0.07f));
this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.1f, 1f));
}
if (backInputDown || downInputDown) {
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - (this.entityData.get(POWER) > 0 ? 0.01f : 0.001f), onGround() ? -0.06f : 0.03f));
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - (this.entityData.get(POWER) > 0 ? 0.1f : 0.01f), onGround() ? -0.2f : 0.2f));
}
if (!onGround()) {
@ -209,16 +210,26 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
this.level().playSound(null, getOnPos(), SoundEvents.IRON_DOOR_OPEN, SoundSource.PLAYERS, 1, 1);
upInputDown = false;
}
player.displayClientMessage(Component.literal("speed: " + FormatTool.format2D(getDeltaMovement().dot(getViewVector(1)) * 20)), true);
}
this.entityData.set(POWER, this.entityData.get(POWER) * 0.99f);
this.entityData.set(POWER, this.entityData.get(POWER) * 0.995f);
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) * 0.95f);
this.setDeltaMovement(this.getDeltaMovement().add(
Mth.sin(-this.getYRot() * 0.017453292F) * 0.19 * this.entityData.get(POWER),
Mth.clamp(Math.sin((onGround() ? 45 : -(getXRot() - 30)) * Mth.DEG_TO_RAD) * getDeltaMovement().horizontalDistance() * 0.067, -0.04, 0.09),
Mth.cos(this.getYRot() * 0.017453292F) * 0.19 * this.entityData.get(POWER)
));
this.setDeltaMovement(this.getDeltaMovement().add(getViewVector(1).scale(0.03 * this.entityData.get(POWER))));
setDeltaMovement(getDeltaMovement().add(0.0f, Mth.clamp(Math.sin((onGround() ? 45 : -(getXRot() - 20)) * Mth.DEG_TO_RAD) * Math.sin((90 - this.getXRot()) * Mth.DEG_TO_RAD) * getDeltaMovement().dot(getViewVector(1)) * 0.04, -0.04, 0.09), 0.0f));
// Vector3f direction = getRightDirection().mul(-Math.sin(this.getRoll() * Mth.DEG_TO_RAD) * this.entityData.get(POWER));
// setDeltaMovement(getDeltaMovement().add(new Vec3(direction.x, direction.y, direction.z).scale(3)));
//
// this.setDeltaMovement(this.getDeltaMovement().add(
// Mth.sin(-this.getYRot() * 0.017453292F) * 0.19 * this.entityData.get(POWER),
// Mth.clamp(Math.sin((onGround() ? 45 : -(getXRot() - 30)) * Mth.DEG_TO_RAD) * getDeltaMovement().dot(getViewVector(1)) * 0.067, -0.04, 0.09),
// Mth.cos(this.getYRot() * 0.017453292F) * 0.19 * this.entityData.get(POWER)
// ));
}
@Override

View file

@ -104,6 +104,17 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements
public double velocityO;
public double velocity;
public float flap1LRot;
public float flap1LRotO;
public float flap1RRot;
public float flap1RRotO;
public float flap2LRot;
public float flap2LRotO;
public float flap2RRot;
public float flap2RRotO;
public float flap3Rot;
public float flap3RotO;
public MobileVehicleEntity(EntityType<?> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
}
@ -170,6 +181,12 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements
collisionCoolDown--;
}
flap1LRotO = this.getFlap1LRot();
flap1RRotO = this.getFlap1RRot();
flap2LRotO = this.getFlap2LRot();
flap2RRotO = this.getFlap2RRot();
flap3RotO = this.getFlap3Rot();
super.baseTick();
double direct = (90 - calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90;
@ -746,6 +763,46 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements
this.recoilShake = pRecoilShake;
}
public float getFlap1LRot() {
return this.flap1LRot;
}
public void setFlap1LRot(float pFlap1LRot) {
this.flap1LRot = pFlap1LRot;
}
public float getFlap1RRot() {
return this.flap1RRot;
}
public void setFlap1RRot(float pFlap1RRot) {
this.flap1RRot = pFlap1RRot;
}
public float getFlap2LRot() {
return this.flap2LRot;
}
public void setFlap2LRot(float pFlap2LRot) {
this.flap2LRot = pFlap2LRot;
}
public float getFlap2RRot() {
return this.flap2RRot;
}
public void setFlap2RRot(float pFlap2RRot) {
this.flap2RRot = pFlap2RRot;
}
public float getFlap3Rot() {
return this.flap3Rot;
}
public void setFlap3Rot(float pFlap3Rot) {
this.flap3Rot = pFlap3Rot;
}
public boolean hasDecoy() {
return false;
}

View file

@ -170,7 +170,7 @@ public class ClientMouseHandler {
return 0.33;
}
if (player.getVehicle() instanceof Tom6Entity) {
if (player.getVehicle() instanceof Tom6Entity || player.getVehicle() instanceof A10Entity) {
return 0.3;
}

View file

@ -110,6 +110,8 @@ public class ModEntities {
EntityType.Builder.<LaserTowerEntity>of(LaserTowerEntity::new, MobCategory.MISC).setTrackingRange(64).setUpdateInterval(1).fireImmune().sized(0.9f, 1.65f));
public static final DeferredHolder<EntityType<?>, EntityType<PrismTankEntity>> PRISM_TANK = register("prism_tank",
EntityType.Builder.of(PrismTankEntity::new, MobCategory.MISC).setTrackingRange(64).setUpdateInterval(1).fireImmune().sized(5f, 2.6f));
public static final DeferredHolder<EntityType<?>, EntityType<A10Entity>> A_10A = register("a_10a",
EntityType.Builder.of(A10Entity::new, MobCategory.MISC).setTrackingRange(64).setUpdateInterval(1).fireImmune().sized(8.625f, 4f));
private static <T extends Entity> DeferredHolder<EntityType<?>, EntityType<T>> register(String name, EntityType.Builder<T> entityTypeBuilder) {
return REGISTRY.register(name, () -> entityTypeBuilder.build(name));

View file

@ -49,5 +49,6 @@ public class ModEntityRenderers {
event.registerEntityRenderer(ModEntities.PRISM_TANK.get(), PrismTankRenderer::new);
event.registerEntityRenderer(ModEntities.SWARM_DRONE.get(), SwarmDroneRenderer::new);
event.registerEntityRenderer(ModEntities.HPJ_11.get(), Hpj11Renderer::new);
event.registerEntityRenderer(ModEntities.A_10A.get(), A10Renderer::new);
}
}

View file

@ -59,7 +59,8 @@ public class ContainerBlockItem extends BlockItem implements GeoItem {
() -> ContainerBlockItem.createInstance(ModEntities.PRISM_TANK.get(), true),
() -> ContainerBlockItem.createInstance(ModEntities.YX_100.get()),
() -> ContainerBlockItem.createInstance(ModEntities.WHEEL_CHAIR.get()),
() -> ContainerBlockItem.createInstance(ModEntities.TOM_6.get())
() -> ContainerBlockItem.createInstance(ModEntities.TOM_6.get()),
() -> ContainerBlockItem.createInstance(ModEntities.A_10A.get())
);
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);

View file

@ -152,6 +152,13 @@ public abstract class CameraMixin {
return;
}
// if (player.getVehicle() instanceof A10Entity vehicle && (Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON || ClientEventHandler.zoomVehicle)) {
// setRotation(Mth.lerp(partialTicks, vehicle.yRotO, vehicle.getYRot()), Mth.lerp(partialTicks, vehicle.xRotO, vehicle.getXRot()));
// setPosition(Mth.lerp(partialTicks, player.xo, player.getX()), Mth.lerp(partialTicks, player.yo + player.getEyeHeight(), player.getEyeY()), Mth.lerp(partialTicks, player.zo, player.getZ()));
// info.cancel();
// return;
// }
if (player.getVehicle() instanceof VehicleEntity vehicle && vehicle instanceof CannonEntity cannon && (Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON || ClientEventHandler.zoomVehicle)) {
setRotation(Mth.lerp(partialTicks, player.yRotO, player.getYRot()), Mth.lerp(partialTicks, player.xRotO, player.getXRot()));
if (!(cannon instanceof AnnihilatorEntity) && ClientEventHandler.zoomVehicle) {

View file

@ -1,9 +1,6 @@
package com.atsuishio.superbwarfare.mixins;
import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity;
import com.atsuishio.superbwarfare.entity.vehicle.SpeedboatEntity;
import com.atsuishio.superbwarfare.entity.vehicle.Tom6Entity;
import com.atsuishio.superbwarfare.entity.vehicle.WheelChairEntity;
import com.atsuishio.superbwarfare.entity.vehicle.*;
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis;
@ -22,7 +19,7 @@ public class LivingEntityRendererMixin<T extends LivingEntity> {
@Inject(method = "setupRotations", at = @At("TAIL"))
public void render(T entity, PoseStack poseStack, float bob, float yBodyRot, float partialTick, float scale, CallbackInfo ci) {
if (entity.getRootVehicle() != entity && entity.getRootVehicle() instanceof VehicleEntity vehicle) {
if (vehicle instanceof Tom6Entity || vehicle instanceof WheelChairEntity || vehicle instanceof SpeedboatEntity) {
if (vehicle instanceof Tom6Entity || vehicle instanceof WheelChairEntity || vehicle instanceof SpeedboatEntity || vehicle instanceof A10Entity) {
poseStack.mulPose(Axis.XP.rotationDegrees(-vehicle.getViewXRot(partialTick)));
poseStack.mulPose(Axis.ZP.rotationDegrees(-vehicle.getRoll(partialTick)));
} else if (vehicle instanceof Ah6Entity ah6Entity) {

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB