添加汤姆F6
This commit is contained in:
parent
5beee8d86a
commit
b7530d1ebb
14 changed files with 1398 additions and 6 deletions
|
@ -0,0 +1,25 @@
|
||||||
|
package com.atsuishio.superbwarfare.client.model.entity;
|
||||||
|
|
||||||
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.Tom6Entity;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import software.bernie.geckolib.model.GeoModel;
|
||||||
|
|
||||||
|
public class Tom6Model extends GeoModel<Tom6Entity> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getAnimationResource(Tom6Entity entity) {
|
||||||
|
return null;
|
||||||
|
// return ModUtils.loc("animations/wheel_chair.animation.json");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getModelResource(Tom6Entity entity) {
|
||||||
|
return ModUtils.loc("geo/tom_6.geo.json");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getTextureResource(Tom6Entity entity) {
|
||||||
|
return ModUtils.loc("textures/entity/tom_6.png");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||||
|
|
||||||
|
import com.atsuishio.superbwarfare.client.model.entity.Tom6Model;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.Tom6Entity;
|
||||||
|
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.renderer.GeoEntityRenderer;
|
||||||
|
|
||||||
|
public class Tom6Renderer extends GeoEntityRenderer<Tom6Entity> {
|
||||||
|
|
||||||
|
public Tom6Renderer(EntityRendererProvider.Context renderManager) {
|
||||||
|
super(renderManager, new Tom6Model());
|
||||||
|
this.shadowRadius = 0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RenderType getRenderType(Tom6Entity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||||
|
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void preRender(PoseStack poseStack, Tom6Entity 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(Tom6Entity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||||
|
poseStack.pushPose();
|
||||||
|
poseStack.mulPose(Axis.YP.rotationDegrees(-entityYaw));
|
||||||
|
poseStack.mulPose(Axis.XP.rotationDegrees(Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())));
|
||||||
|
poseStack.mulPose(Axis.ZP.rotationDegrees(Mth.lerp(partialTicks, entityIn.prevRoll, entityIn.getRoll())));
|
||||||
|
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||||
|
poseStack.popPose();
|
||||||
|
}
|
||||||
|
}
|
|
@ -548,6 +548,16 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
|
||||||
return this.cache;
|
return this.cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float ignoreExplosionHorizontalKnockBack() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float ignoreExplosionVerticalKnockBack() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRemovedFromWorld() {
|
public void onRemovedFromWorld() {
|
||||||
if (this.level() instanceof ServerLevel serverLevel) {
|
if (this.level() instanceof ServerLevel serverLevel) {
|
||||||
|
|
|
@ -152,6 +152,7 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
|
||||||
@Override
|
@Override
|
||||||
public void baseTick() {
|
public void baseTick() {
|
||||||
propellerRotO = this.getPropellerRot();
|
propellerRotO = this.getPropellerRot();
|
||||||
|
setZRot(roll * 0.9f);
|
||||||
super.baseTick();
|
super.baseTick();
|
||||||
|
|
||||||
if (heat > 0) {
|
if (heat > 0) {
|
||||||
|
@ -403,10 +404,6 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
|
||||||
Vector4f worldPosition = transformPosition(transform, x, y, z);
|
Vector4f worldPosition = transformPosition(transform, x, y, z);
|
||||||
passenger.setPos(worldPosition.x, worldPosition.y, worldPosition.z);
|
passenger.setPos(worldPosition.x, worldPosition.y, worldPosition.z);
|
||||||
callback.accept(passenger, worldPosition.x, worldPosition.y, worldPosition.z);
|
callback.accept(passenger, worldPosition.x, worldPosition.y, worldPosition.z);
|
||||||
} else if (i == 1) {
|
|
||||||
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()) {
|
if (passenger != this.getFirstPassenger()) {
|
||||||
|
@ -419,7 +416,6 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
|
||||||
public void copyEntityData(Entity entity) {
|
public void copyEntityData(Entity entity) {
|
||||||
float f = Mth.wrapDegrees(entity.getYRot() - getYRot());
|
float f = Mth.wrapDegrees(entity.getYRot() - getYRot());
|
||||||
float g = Mth.clamp(f, -105.0f, 105.0f);
|
float g = Mth.clamp(f, -105.0f, 105.0f);
|
||||||
|
|
||||||
entity.yRotO += g - f;
|
entity.yRotO += g - f;
|
||||||
entity.setYRot(entity.getYRot() + g - f);
|
entity.setYRot(entity.getYRot() + g - f);
|
||||||
entity.setYHeadRot(entity.getYRot());
|
entity.setYHeadRot(entity.getYRot());
|
||||||
|
|
|
@ -0,0 +1,265 @@
|
||||||
|
package com.atsuishio.superbwarfare.entity.vehicle;
|
||||||
|
|
||||||
|
import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig;
|
||||||
|
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||||
|
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||||
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
|
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||||
|
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
|
||||||
|
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
||||||
|
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.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.level.Explosion;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraftforge.network.NetworkHooks;
|
||||||
|
import net.minecraftforge.network.PlayMessages;
|
||||||
|
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;
|
||||||
|
|
||||||
|
public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
||||||
|
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(Tom6Entity.class, EntityDataSerializers.FLOAT);
|
||||||
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
|
public static final float MAX_HEALTH = 50;
|
||||||
|
public static final int MAX_ENERGY = 100000;
|
||||||
|
|
||||||
|
public Tom6Entity(PlayMessages.SpawnEntity packet, Level world) {
|
||||||
|
this(ModEntities.TOM_6.get(), world);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Tom6Entity(EntityType<Tom6Entity> type, Level world) {
|
||||||
|
super(type, world);
|
||||||
|
this.setMaxUpStep(0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void defineSynchedData() {
|
||||||
|
super.defineSynchedData();
|
||||||
|
this.entityData.define(DELTA_ROT, 0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@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);
|
||||||
|
this.level().playSound(null, this.getOnPos(), ModSounds.HIT.get(), SoundSource.PLAYERS, 1, 1);
|
||||||
|
this.hurt(amount);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void baseTick() {
|
||||||
|
setZRot(roll * (onGround() ? 0.9f : 0.995f));
|
||||||
|
super.baseTick();
|
||||||
|
float f;
|
||||||
|
|
||||||
|
if (this.onGround()) {
|
||||||
|
f = (float) Mth.clamp(0.403f + 0.34f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90, 0.01, 0.99);
|
||||||
|
} else {
|
||||||
|
f = (float) Mth.clamp(0.683f + 0.06f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90, 0.01, 0.99);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).scale((0.33) * this.getDeltaMovement().length())));
|
||||||
|
this.setDeltaMovement(this.getDeltaMovement().multiply(f, f, f));
|
||||||
|
this.refreshDimensions();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void travel() {
|
||||||
|
Entity passenger = this.getPassengers().isEmpty() ? null : this.getPassengers().get(0);
|
||||||
|
|
||||||
|
// if (this.getEnergy() <= 0) return;
|
||||||
|
|
||||||
|
float diffX;
|
||||||
|
float diffY;
|
||||||
|
|
||||||
|
if (passenger == null) {
|
||||||
|
this.leftInputDown = false;
|
||||||
|
this.rightInputDown = false;
|
||||||
|
this.forwardInputDown = false;
|
||||||
|
this.backInputDown = false;
|
||||||
|
this.setZRot(this.roll * 0.8f);
|
||||||
|
this.setXRot(this.getXRot() * 0.7f);
|
||||||
|
this.entityData.set(POWER, this.entityData.get(POWER) * 0.98f);
|
||||||
|
} else if (passenger instanceof Player) {
|
||||||
|
|
||||||
|
diffY = Math.clamp(-90f, 90f, Mth.wrapDegrees(passenger.getYHeadRot() - this.getYRot()));
|
||||||
|
diffX = Math.clamp(-60f, 60f, Mth.wrapDegrees(passenger.getXRot() - this.getXRot()));
|
||||||
|
|
||||||
|
if (!onGround()) {
|
||||||
|
if (rightInputDown) {
|
||||||
|
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) - 0.35f);
|
||||||
|
} else if (this.leftInputDown) {
|
||||||
|
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) + 0.35f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setYRot(this.getYRot() + Mth.clamp(Math.min((this.onGround() ? 1.5f : 0.8f) * (float) Math.max(getDeltaMovement().length() - 0.06, 0), 0.9f) * diffY - 0.5f * this.entityData.get(DELTA_ROT), -3f, 3f));
|
||||||
|
this.setXRot(Mth.clamp(this.getXRot() + Mth.clamp(Math.min(((this.onGround()) ? 0 : 0.3f) * (float) Math.max(getDeltaMovement().length() - 0.02, 0), 0.9f) * diffX, -2f, 2f), onGround() ? -10 : -120, onGround() ? 2 : 120));
|
||||||
|
this.setZRot(this.getRoll() - this.entityData.get(DELTA_ROT) + (this.onGround() ? 0 : 0.004f) * diffY * (float) getDeltaMovement().length());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (forwardInputDown) {
|
||||||
|
this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.002f, 0.12f));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (backInputDown) {
|
||||||
|
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.004f, -0.08f));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// if (this.forwardInputDown || this.backInputDown) {
|
||||||
|
// this.extraEnergy(VehicleConfig.SPEEDBOAT_ENERGY_COST.get());
|
||||||
|
// }
|
||||||
|
|
||||||
|
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(
|
||||||
|
Mth.sin(-this.getYRot() * 0.017453292F) * 0.16f * this.entityData.get(POWER),
|
||||||
|
Mth.clamp(Math.sin((onGround() ? 45 : -(getXRot() - 30)) * Mth.DEG_TO_RAD) * getDeltaMovement().horizontalDistance() * 0.092f, -0.04, 0.09),
|
||||||
|
Mth.cos(this.getYRot() * 0.017453292F) * 0.16f * this.entityData.get(POWER)
|
||||||
|
));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SoundEvent getEngineSound() {
|
||||||
|
return ModSounds.WHEEL_CHAIR_ENGINE.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void clampRotation(Entity entity) {
|
||||||
|
float f = Mth.wrapDegrees(entity.getXRot());
|
||||||
|
float f1 = Mth.clamp(f, -90.0F, 90F);
|
||||||
|
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, -80.0F, 50.0F);
|
||||||
|
entity.yRotO += f3 - f2;
|
||||||
|
entity.setYRot(entity.getYRot() + f3 - f2);
|
||||||
|
entity.setYBodyRot(this.getYRot());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPassengerTurned(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();
|
||||||
|
|
||||||
|
float x = 0f;
|
||||||
|
float y = 0.95f;
|
||||||
|
float z = -0.2f;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (passenger != this.getFirstPassenger()) {
|
||||||
|
passenger.setXRot(passenger.getXRot() + (getXRot() - xRotO));
|
||||||
|
}
|
||||||
|
|
||||||
|
copyEntityData(passenger);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void copyEntityData(Entity entity) {
|
||||||
|
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);
|
||||||
|
entity.setYHeadRot(entity.getYRot());
|
||||||
|
entity.setYBodyRot(getYRot());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy() {
|
||||||
|
Entity attacker = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_ATTACKER_UUID));
|
||||||
|
|
||||||
|
if (level() instanceof ServerLevel) {
|
||||||
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
|
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), 10f,
|
||||||
|
this.getX(), this.getY(), this.getZ(), 2f, 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.spawnSmallExplosionParticles(this.level(), this.position());
|
||||||
|
}
|
||||||
|
|
||||||
|
this.discard();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float ignoreExplosionHorizontalKnockBack() {
|
||||||
|
return -0.2f;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float ignoreExplosionVerticalKnockBack() {
|
||||||
|
return -0.3f;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AnimatableInstanceCache getAnimatableInstanceCache() {
|
||||||
|
return this.cache;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getMaxHealth() {
|
||||||
|
return MAX_HEALTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxEnergy() {
|
||||||
|
return MAX_ENERGY;
|
||||||
|
}
|
||||||
|
}
|
|
@ -236,7 +236,6 @@ public class VehicleEntity extends Entity {
|
||||||
lastHurtTick ++;
|
lastHurtTick ++;
|
||||||
|
|
||||||
prevRoll = this.getRoll();
|
prevRoll = this.getRoll();
|
||||||
setZRot(roll * 0.9f);
|
|
||||||
|
|
||||||
float delta = Math.abs(getYRot() - yRotO);
|
float delta = Math.abs(getYRot() - yRotO);
|
||||||
while (getYRot() > 180F) {
|
while (getYRot() > 180F) {
|
||||||
|
|
|
@ -76,6 +76,8 @@ public class ModEntities {
|
||||||
EntityType.Builder.<FlareDecoyEntity>of(FlareDecoyEntity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(1).setCustomClientFactory(FlareDecoyEntity::new).sized(0.5f, 0.5f));
|
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",
|
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));
|
EntityType.Builder.<Lav150Entity>of(Lav150Entity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(3).setCustomClientFactory(Lav150Entity::new).fireImmune().sized(2.8f, 3.1f));
|
||||||
|
public static final RegistryObject<EntityType<Tom6Entity>> TOM_6 = register("tom_6",
|
||||||
|
EntityType.Builder.<Tom6Entity>of(Tom6Entity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(3).setCustomClientFactory(Tom6Entity::new).fireImmune().sized(1.15f, 1.0f));
|
||||||
|
|
||||||
private static <T extends Entity> RegistryObject<EntityType<T>> register(String name, EntityType.Builder<T> entityTypeBuilder) {
|
private static <T extends Entity> RegistryObject<EntityType<T>> register(String name, EntityType.Builder<T> entityTypeBuilder) {
|
||||||
return REGISTRY.register(name, () -> entityTypeBuilder.build(name));
|
return REGISTRY.register(name, () -> entityTypeBuilder.build(name));
|
||||||
|
|
|
@ -36,5 +36,6 @@ public class ModEntityRenderers {
|
||||||
event.registerEntityRenderer(ModEntities.FLARE_DECOY.get(), FlareDecoyEntityRenderer::new);
|
event.registerEntityRenderer(ModEntities.FLARE_DECOY.get(), FlareDecoyEntityRenderer::new);
|
||||||
event.registerEntityRenderer(ModEntities.LAV_150.get(), Lav150Renderer::new);
|
event.registerEntityRenderer(ModEntities.LAV_150.get(), Lav150Renderer::new);
|
||||||
event.registerEntityRenderer(ModEntities.SMALL_CANNON_SHELL.get(), SmallCannonShellRenderer::new);
|
event.registerEntityRenderer(ModEntities.SMALL_CANNON_SHELL.get(), SmallCannonShellRenderer::new);
|
||||||
|
event.registerEntityRenderer(ModEntities.TOM_6.get(), Tom6Renderer::new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,6 +110,7 @@ public class ModTabs {
|
||||||
output.accept(ContainerBlockItem.createInstance(ModEntities.WHEEL_CHAIR.get()));
|
output.accept(ContainerBlockItem.createInstance(ModEntities.WHEEL_CHAIR.get()));
|
||||||
output.accept(ContainerBlockItem.createInstance(ModEntities.AH_6.get()));
|
output.accept(ContainerBlockItem.createInstance(ModEntities.AH_6.get()));
|
||||||
output.accept(ContainerBlockItem.createInstance(ModEntities.LAV_150.get()));
|
output.accept(ContainerBlockItem.createInstance(ModEntities.LAV_150.get()));
|
||||||
|
output.accept(ContainerBlockItem.createInstance(ModEntities.TOM_6.get()));
|
||||||
} else {
|
} else {
|
||||||
output.accept(registryObject.get());
|
output.accept(registryObject.get());
|
||||||
if (registryObject.get() == ModItems.ARMOR_PLATE.get()) {
|
if (registryObject.get() == ModItems.ARMOR_PLATE.get()) {
|
||||||
|
|
|
@ -128,6 +128,11 @@ public abstract class CameraMixin {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (thirdPerson && entity.getVehicle() instanceof Tom6Entity) {
|
||||||
|
move(-getMaxZoom(4), 1, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (thirdPerson && entity.getVehicle() instanceof Lav150Entity && !ClientEventHandler.zoomVehicle) {
|
if (thirdPerson && entity.getVehicle() instanceof Lav150Entity && !ClientEventHandler.zoomVehicle) {
|
||||||
move(-getMaxZoom(2.75), 1, 0.0);
|
move(-getMaxZoom(2.75), 1, 0.0);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.atsuishio.superbwarfare.mixins;
|
package com.atsuishio.superbwarfare.mixins;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity;
|
import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.Tom6Entity;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.math.Axis;
|
import com.mojang.math.Axis;
|
||||||
|
@ -69,5 +70,30 @@ public class GameRendererMixin {
|
||||||
matrices.mulPose(Axis.YP.rotationDegrees(-mainCamera.getYRot() - 180.0f));
|
matrices.mulPose(Axis.YP.rotationDegrees(-mainCamera.getYRot() - 180.0f));
|
||||||
matrices.mulPose(Axis.XP.rotationDegrees(-mainCamera.getXRot()));
|
matrices.mulPose(Axis.XP.rotationDegrees(-mainCamera.getXRot()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (entity != null && !mainCamera.isDetached() && entity.getRootVehicle() instanceof Tom6Entity vehicle) {
|
||||||
|
// rotate camera
|
||||||
|
|
||||||
|
matrices.mulPose(Axis.ZP.rotationDegrees(vehicle.getRoll(tickDelta)));
|
||||||
|
// matrices.mulPose(Axis.XP.rotationDegrees(vehicle.getViewXRot(tickDelta)));
|
||||||
|
|
||||||
|
// fetch eye offset
|
||||||
|
float eye = entity.getEyeHeight();
|
||||||
|
|
||||||
|
// transform eye offset to match aircraft rotation
|
||||||
|
Vector3f offset = new Vector3f(0, -eye, 0);
|
||||||
|
Quaternionf quaternion = Axis.XP.rotationDegrees(0.0f);
|
||||||
|
quaternion.mul(Axis.YP.rotationDegrees(-vehicle.getViewYRot(tickDelta)));
|
||||||
|
quaternion.mul(Axis.XP.rotationDegrees(vehicle.getViewXRot(tickDelta)));
|
||||||
|
quaternion.mul(Axis.ZP.rotationDegrees(vehicle.getRoll(tickDelta)));
|
||||||
|
offset.rotate(quaternion);
|
||||||
|
|
||||||
|
// apply camera offset
|
||||||
|
matrices.mulPose(Axis.XP.rotationDegrees(mainCamera.getXRot()));
|
||||||
|
matrices.mulPose(Axis.YP.rotationDegrees(mainCamera.getYRot() + 180.0f));
|
||||||
|
matrices.translate(offset.x(), offset.y() + eye, offset.z());
|
||||||
|
matrices.mulPose(Axis.YP.rotationDegrees(-mainCamera.getYRot() - 180.0f));
|
||||||
|
matrices.mulPose(Axis.XP.rotationDegrees(-mainCamera.getXRot()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.atsuishio.superbwarfare.mixins;
|
package com.atsuishio.superbwarfare.mixins;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity;
|
import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.Tom6Entity;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.math.Axis;
|
import com.mojang.math.Axis;
|
||||||
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
|
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
|
||||||
|
@ -19,5 +20,9 @@ public class LivingEntityRendererMixin<T extends LivingEntity> {
|
||||||
matrices.mulPose(Axis.XP.rotationDegrees(-ah6Entity.getViewXRot(tickDelta)));
|
matrices.mulPose(Axis.XP.rotationDegrees(-ah6Entity.getViewXRot(tickDelta)));
|
||||||
matrices.mulPose(Axis.ZP.rotationDegrees(-ah6Entity.getRoll(tickDelta)));
|
matrices.mulPose(Axis.ZP.rotationDegrees(-ah6Entity.getRoll(tickDelta)));
|
||||||
}
|
}
|
||||||
|
if (entity.getRootVehicle() != entity && entity.getRootVehicle() instanceof Tom6Entity tom6Entity) {
|
||||||
|
matrices.mulPose(Axis.XP.rotationDegrees(-tom6Entity.getViewXRot(tickDelta)));
|
||||||
|
matrices.mulPose(Axis.ZP.rotationDegrees(-tom6Entity.getRoll(tickDelta)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
1011
src/main/resources/assets/superbwarfare/geo/tom_6.geo.json
Normal file
1011
src/main/resources/assets/superbwarfare/geo/tom_6.geo.json
Normal file
File diff suppressed because it is too large
Load diff
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
Loading…
Add table
Reference in a new issue