添加汤姆6投弹
This commit is contained in:
parent
b7530d1ebb
commit
e8afe454a0
8 changed files with 217 additions and 28 deletions
|
@ -0,0 +1,41 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.entity.projectile.MelonBombEntity;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.block.BlockRenderDispatcher;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.client.renderer.entity.TntMinecartRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
public class MelonBombEntityRenderer extends EntityRenderer<MelonBombEntity> {
|
||||
|
||||
private final BlockRenderDispatcher blockRenderer;
|
||||
|
||||
public MelonBombEntityRenderer(EntityRendererProvider.Context context) {
|
||||
super(context);
|
||||
this.shadowRadius = 0.2f;
|
||||
this.blockRenderer = context.getBlockRenderDispatcher();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MelonBombEntity entity, float entityYaw, float partialTicks, PoseStack matrixStack, MultiBufferSource buffer, int packedLight) {
|
||||
matrixStack.pushPose();
|
||||
matrixStack.translate(0.0, 0.5, 0.0);
|
||||
matrixStack.mulPose(Axis.YP.rotationDegrees(-90.0f));
|
||||
matrixStack.translate(-0.5, -0.5, 0.5);
|
||||
matrixStack.mulPose(Axis.YP.rotationDegrees(90.0f));
|
||||
TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, Blocks.MELON.defaultBlockState(), matrixStack, buffer, packedLight, false);
|
||||
matrixStack.popPose();
|
||||
super.render(entity, entityYaw, partialTicks, matrixStack, buffer, packedLight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureLocation(MelonBombEntity entity) {
|
||||
return TextureAtlas.LOCATION_BLOCKS;
|
||||
}
|
||||
}
|
|
@ -11,8 +11,11 @@ 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;
|
||||
|
||||
import static com.atsuishio.superbwarfare.entity.vehicle.Tom6Entity.MELON;
|
||||
|
||||
public class Tom6Renderer extends GeoEntityRenderer<Tom6Entity> {
|
||||
|
||||
public Tom6Renderer(EntityRendererProvider.Context renderManager) {
|
||||
|
@ -43,4 +46,13 @@ public class Tom6Renderer extends GeoEntityRenderer<Tom6Entity> {
|
|||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderRecursively(PoseStack poseStack, Tom6Entity 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("melon")) {
|
||||
bone.setHidden(!animatable.getEntityData().get(MELON));
|
||||
}
|
||||
super.renderRecursively(poseStack, animatable, bone, renderType, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, red, green, blue, alpha);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
package com.atsuishio.superbwarfare.entity.projectile;
|
||||
|
||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||
import com.atsuishio.superbwarfare.tools.ProjectileTool;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraftforge.network.NetworkHooks;
|
||||
import net.minecraftforge.network.PlayMessages;
|
||||
|
||||
public class MelonBombEntity extends ThrowableItemProjectile {
|
||||
public MelonBombEntity(EntityType<? extends MelonBombEntity> type, Level world) {
|
||||
super(type, world);
|
||||
this.noCulling = true;
|
||||
}
|
||||
|
||||
public MelonBombEntity(LivingEntity entity, Level level) {
|
||||
super(ModEntities.MELON_BOMB.get(), entity, level);
|
||||
}
|
||||
|
||||
public MelonBombEntity(PlayMessages.SpawnEntity spawnEntity, Level level) {
|
||||
this(ModEntities.MELON_BOMB.get(), level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet<ClientGamePacketListener> getAddEntityPacket() {
|
||||
return NetworkHooks.getEntitySpawningPacket(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Item getDefaultItem() {
|
||||
return Items.MELON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRenderAtSqrDistance(double pDistance) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onHit(HitResult result) {
|
||||
switch (result.getType()) {
|
||||
case BLOCK:
|
||||
ProjectileTool.causeCustomExplode(this, 1200, 24, 1.5f);
|
||||
break;
|
||||
case ENTITY:
|
||||
if (tickCount < 2) return;
|
||||
ProjectileTool.causeCustomExplode(this, 1200, 24, 1.5f);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (tickCount > 600) {
|
||||
this.discard();
|
||||
if (!this.level().isClientSide) {
|
||||
ProjectileTool.causeCustomExplode(this, 1200, 24, 1.2f);
|
||||
}
|
||||
}
|
||||
|
||||
// if (!this.level().isClientSide() && this.level() instanceof ServerLevel serverLevel) {
|
||||
// ParticleTool.sendParticle(serverLevel, ParticleTypes.SMOKE, this.xo, this.yo, this.zo,
|
||||
// 1, 0, 0, 0, 0.01, true);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getGravity() {
|
||||
return 0.06F;
|
||||
}
|
||||
}
|
|
@ -152,9 +152,10 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
|
|||
@Override
|
||||
public void baseTick() {
|
||||
propellerRotO = this.getPropellerRot();
|
||||
setZRot(roll * 0.9f);
|
||||
super.baseTick();
|
||||
|
||||
setZRot(getRoll() * 0.995f);
|
||||
|
||||
if (heat > 0) {
|
||||
heat--;
|
||||
}
|
||||
|
@ -277,7 +278,7 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
|
|||
|
||||
this.setYRot(this.getYRot() + Mth.clamp((this.onGround() ? 0.1f : 2f) * diffY * this.entityData.get(PROPELLER_ROT) - 0.5f * this.entityData.get(DELTA_ROT), -8f, 8f));
|
||||
this.setXRot(Mth.clamp(this.getXRot() + ((this.onGround()) ? 0 : 1.4f) * diffX * this.entityData.get(PROPELLER_ROT), -80, 80));
|
||||
this.setZRot(Mth.clamp(this.getRoll() - this.entityData.get(DELTA_ROT) + (this.onGround() ? 0 : 0.2f) * diffY * this.entityData.get(PROPELLER_ROT), -80, 80));
|
||||
this.setZRot(this.getRoll() - this.entityData.get(DELTA_ROT) + (this.onGround() ? 0 : 0.2f) * diffY * this.entityData.get(PROPELLER_ROT));
|
||||
}
|
||||
|
||||
if (this.level() instanceof ServerLevel) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.atsuishio.superbwarfare.entity.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.MelonBombEntity;
|
||||
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||
|
@ -15,12 +16,16 @@ 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.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
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.Items;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.network.NetworkHooks;
|
||||
|
@ -36,6 +41,7 @@ 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);
|
||||
public static final EntityDataAccessor<Boolean> MELON = SynchedEntityData.defineId(Tom6Entity.class, EntityDataSerializers.BOOLEAN);
|
||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||
public static final float MAX_HEALTH = 50;
|
||||
public static final int MAX_ENERGY = 100000;
|
||||
|
@ -53,16 +59,19 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
|||
protected void defineSynchedData() {
|
||||
super.defineSynchedData();
|
||||
this.entityData.define(DELTA_ROT, 0f);
|
||||
this.entityData.define(MELON, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAdditionalSaveData(CompoundTag compound) {
|
||||
super.addAdditionalSaveData(compound);
|
||||
compound.putBoolean("Melon", this.entityData.get(MELON));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readAdditionalSaveData(CompoundTag compound) {
|
||||
super.readAdditionalSaveData(compound);
|
||||
this.entityData.set(MELON, compound.getBoolean("Melon"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -78,19 +87,25 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResult interact(Player player, InteractionHand hand) {
|
||||
if (player.getMainHandItem().is(Items.MELON) && !entityData.get(MELON)) {
|
||||
entityData.set(MELON, true);
|
||||
player.getMainHandItem().shrink(1);
|
||||
player.level().playSound(player, this.getOnPos(), SoundEvents.WOOD_PLACE, SoundSource.PLAYERS, 1, 1);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
return super.interact(player, hand);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
f = (float) Mth.clamp(0.759f + 0.041f * 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().add(this.getViewVector(1).scale((0.24) * this.getDeltaMovement().length())));
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(f, f, f));
|
||||
this.refreshDimensions();
|
||||
}
|
||||
|
@ -112,32 +127,63 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
|||
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) {
|
||||
if (onGround()) {
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(0.8, 1, 0.8));
|
||||
}
|
||||
} else if (passenger instanceof Player player) {
|
||||
|
||||
// SoundTool.playLocalSound(player, SoundEvents.ELYTRA_FLYING);
|
||||
|
||||
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);
|
||||
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) - 0.4f);
|
||||
} else if (this.leftInputDown) {
|
||||
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) + 0.35f);
|
||||
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) + 0.4f);
|
||||
}
|
||||
}
|
||||
|
||||
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());
|
||||
float roll = Mth.abs(Mth.clamp(getRoll() / 60 , -1.5f , 1.5f));
|
||||
|
||||
float addY = Mth.clamp(Math.min((this.onGround() ? 1.5f : 0.9f) * (float) Math.max(getDeltaMovement().length() - 0.06, 0.1), 0.9f) * diffY - 0.5f * this.entityData.get(DELTA_ROT), (entityData.get(MELON) ? -2f : -3f) * (roll + 1), (entityData.get(MELON) ? 2f : 3f) * (roll + 1));
|
||||
float addX = Mth.clamp(Math.min((float) Math.max(getDeltaMovement().length() - 0.1, 0.01), 0.9f) * diffX, (entityData.get(MELON) ? -3f : -4f), (entityData.get(MELON) ? 3f : 4f));
|
||||
|
||||
this.setYRot(this.getYRot() + addY);
|
||||
this.setXRot(Mth.clamp(this.getXRot() + addX, onGround() ? -10 : -120, onGround() ? 2 : 120));
|
||||
this.setZRot(this.getRoll() - this.entityData.get(DELTA_ROT) + (this.onGround() ? 0 : 0.01f) * diffY * (float) getDeltaMovement().length());
|
||||
|
||||
if (upInputDown && !onGround()) {
|
||||
entityData.set(MELON, false);
|
||||
|
||||
Matrix4f transform = getVehicleTransform();
|
||||
Vector4f worldPosition;
|
||||
worldPosition = transformPosition(transform, 0, -0.2f, 0);
|
||||
|
||||
MelonBombEntity melonBomb = new MelonBombEntity(player, player.level());
|
||||
melonBomb.setPos(worldPosition.x, worldPosition.y, worldPosition.z);
|
||||
passenger.level().addFreshEntity(melonBomb);
|
||||
|
||||
this.level().playSound(null, this.getOnPos(), SoundEvents.IRON_DOOR_OPEN, SoundSource.PLAYERS, 1, 1);
|
||||
upInputDown = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (forwardInputDown) {
|
||||
this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.002f, 0.12f));
|
||||
this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + (entityData.get(MELON) ? 0.003f : 0.0022f), entityData.get(MELON) ? 0.12f : 0.15f));
|
||||
}
|
||||
|
||||
if (backInputDown) {
|
||||
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.004f, -0.08f));
|
||||
if (backInputDown || downInputDown) {
|
||||
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.006f, onGround() ? -0.12f : 0.04f));
|
||||
}
|
||||
|
||||
if (onGround()) {
|
||||
setXRot(getXRot() * 0.7f);
|
||||
setZRot(getRoll() * 0.7f);
|
||||
} else {
|
||||
setZRot(getRoll() * 0.994f);
|
||||
}
|
||||
|
||||
// if (this.forwardInputDown || this.backInputDown) {
|
||||
// this.extraEnergy(VehicleConfig.SPEEDBOAT_ENERGY_COST.get());
|
||||
|
@ -146,11 +192,10 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
|||
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)
|
||||
Mth.sin(-this.getYRot() * 0.017453292F) * (entityData.get(MELON) ? 0.14f : 0.16f) * this.entityData.get(POWER),
|
||||
Mth.clamp(Math.sin((onGround() ? 45 : -(getXRot() - 30)) * Mth.DEG_TO_RAD) * getDeltaMovement().horizontalDistance() * (entityData.get(MELON) ? 0.047f : 0.067f), -0.04, 0.09),
|
||||
Mth.cos(this.getYRot() * 0.017453292F) * (entityData.get(MELON) ? 0.14f : 0.16f) * this.entityData.get(POWER)
|
||||
));
|
||||
|
||||
}
|
||||
|
@ -161,14 +206,14 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
|||
}
|
||||
|
||||
protected void clampRotation(Entity entity) {
|
||||
float f = Mth.wrapDegrees(entity.getXRot());
|
||||
float f1 = Mth.clamp(f, -90.0F, 90F);
|
||||
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, -80.0F, 50.0F);
|
||||
float f3 = Mth.clamp(f2, -45.0F, 45.0F);
|
||||
entity.yRotO += f3 - f2;
|
||||
entity.setYRot(entity.getYRot() + f3 - f2);
|
||||
entity.setYBodyRot(this.getYRot());
|
||||
|
@ -190,7 +235,7 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
|||
|
||||
float x = 0f;
|
||||
float y = 0.95f;
|
||||
float z = -0.2f;
|
||||
float z = -0.4f;
|
||||
y += (float) passenger.getMyRidingOffset();
|
||||
|
||||
int i = this.getPassengers().indexOf(passenger);
|
||||
|
|
|
@ -77,7 +77,9 @@ public class ModEntities {
|
|||
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));
|
||||
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));
|
||||
EntityType.Builder.<Tom6Entity>of(Tom6Entity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(3).setCustomClientFactory(Tom6Entity::new).fireImmune().sized(1.05f, 1.0f));
|
||||
public static final RegistryObject<EntityType<MelonBombEntity>> MELON_BOMB = register("melon_bomb",
|
||||
EntityType.Builder.<MelonBombEntity>of(MelonBombEntity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(1).setCustomClientFactory(MelonBombEntity::new).sized(1f, 1f));
|
||||
|
||||
private static <T extends Entity> RegistryObject<EntityType<T>> register(String name, EntityType.Builder<T> entityTypeBuilder) {
|
||||
return REGISTRY.register(name, () -> entityTypeBuilder.build(name));
|
||||
|
|
|
@ -37,5 +37,6 @@ public class ModEntityRenderers {
|
|||
event.registerEntityRenderer(ModEntities.LAV_150.get(), Lav150Renderer::new);
|
||||
event.registerEntityRenderer(ModEntities.SMALL_CANNON_SHELL.get(), SmallCannonShellRenderer::new);
|
||||
event.registerEntityRenderer(ModEntities.TOM_6.get(), Tom6Renderer::new);
|
||||
event.registerEntityRenderer(ModEntities.MELON_BOMB.get(), MelonBombEntityRenderer::new);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.atsuishio.superbwarfare.config.client.VehicleControlConfig;
|
|||
import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.ICannonEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Tom6Entity;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.atsuishio.superbwarfare.init.ModItems;
|
||||
import com.atsuishio.superbwarfare.init.ModMobEffects;
|
||||
|
@ -12,6 +13,7 @@ import com.atsuishio.superbwarfare.tools.GunsTool;
|
|||
import net.minecraft.client.CameraType;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.MouseHandler;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
|
@ -78,7 +80,11 @@ public class MouseHandlerMixin {
|
|||
if (player == null) return i;
|
||||
|
||||
if (player.getVehicle() instanceof Ah6Entity ah6Entity && ah6Entity.getFirstPassenger() == player) {
|
||||
return VehicleControlConfig.INVERT_AIRCRAFT_CONTROL.get() ? -i : i;
|
||||
return VehicleControlConfig.INVERT_AIRCRAFT_CONTROL.get() ? (Mth.abs(ah6Entity.getRoll()) < 90 ? -i : i) : (Mth.abs(ah6Entity.getRoll()) < 90 ? i : -i);
|
||||
}
|
||||
|
||||
if (player.getVehicle() instanceof Tom6Entity tom6 && tom6.getFirstPassenger() == player) {
|
||||
return VehicleControlConfig.INVERT_AIRCRAFT_CONTROL.get() ? (Mth.abs(tom6.getRoll()) < 90 ? -i : i) : (Mth.abs(tom6.getRoll()) < 90 ? i : -i);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue