From c75246dbfc890058947dc3e43ae560d8a31c9b52 Mon Sep 17 00:00:00 2001 From: Light_Quanta Date: Sat, 18 Jan 2025 20:41:22 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=82=AE=E5=BC=B9?= =?UTF-8?q?=E5=8C=BA=E5=9D=97=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/projectile/CannonShellEntity.java | 24 ++------ .../entity/projectile/MortarShellEntity.java | 24 ++------ .../superbwarfare/tools/ChunkLoadTool.java | 56 +++++++++++++++++++ 3 files changed, 64 insertions(+), 40 deletions(-) create mode 100644 src/main/java/com/atsuishio/superbwarfare/tools/ChunkLoadTool.java diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java index 481e12663..0cc7ab429 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java @@ -5,6 +5,7 @@ import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig; import com.atsuishio.superbwarfare.entity.AnimatedEntity; import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.network.message.ClientIndicatorMessage; +import com.atsuishio.superbwarfare.tools.ChunkLoadTool; import com.atsuishio.superbwarfare.tools.CustomExplosion; import com.atsuishio.superbwarfare.tools.ParticleTool; import com.atsuishio.superbwarfare.tools.ProjectileTool; @@ -25,7 +26,6 @@ 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.level.ChunkPos; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; @@ -35,7 +35,6 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.common.world.ForgeChunkManager; import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.PacketDistributor; import net.minecraftforge.network.PlayMessages; @@ -272,21 +271,8 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt ParticleTool.sendParticle(serverLevel, ParticleTypes.SMOKE, this.xo, this.yo, this.zo, 1, 0, 0, 0, 0.001, true); - var movement = this.getDeltaMovement(); - var currentX = this.chunkPosition().x; - var currentZ = this.chunkPosition().z; - var nextX = movement.x > 0 ? currentX + 1 : currentX - 1; - var nextZ = movement.z > 0 ? currentZ + 1 : currentZ - 1; - - ForgeChunkManager.forceChunk(serverLevel, ModUtils.MODID, this, currentX, currentZ, true, false); - ForgeChunkManager.forceChunk(serverLevel, ModUtils.MODID, this, currentX, nextZ, true, false); - ForgeChunkManager.forceChunk(serverLevel, ModUtils.MODID, this, nextX, currentZ, true, false); - ForgeChunkManager.forceChunk(serverLevel, ModUtils.MODID, this, nextX, nextZ, true, false); - - this.loadedChunks.add(ChunkPos.asLong(currentX, currentZ)); - this.loadedChunks.add(ChunkPos.asLong(currentX, nextZ)); - this.loadedChunks.add(ChunkPos.asLong(nextX, currentZ)); - this.loadedChunks.add(ChunkPos.asLong(nextX, nextZ)); + // 更新需要加载的区块 + ChunkLoadTool.updateLoadedChunks(serverLevel, this, this.loadedChunks); } if (this.tickCount > 600 || this.isInWater()) { if (this.level() instanceof ServerLevel) { @@ -404,9 +390,7 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt @Override public void onRemovedFromWorld() { if (this.level() instanceof ServerLevel serverLevel) { - for (long chunkPos : this.loadedChunks) { - ForgeChunkManager.forceChunk(serverLevel, ModUtils.MODID, this, ChunkPos.getX(chunkPos), ChunkPos.getZ(chunkPos), false, false); - } + ChunkLoadTool.unloadAllChunks(serverLevel, this, this.loadedChunks); } super.onRemovedFromWorld(); } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/MortarShellEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/MortarShellEntity.java index 01a47d865..28f33d93c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/MortarShellEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/MortarShellEntity.java @@ -1,10 +1,10 @@ package com.atsuishio.superbwarfare.entity.projectile; -import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.config.server.ExplosionConfig; import com.atsuishio.superbwarfare.init.ModDamageTypes; import com.atsuishio.superbwarfare.init.ModEntities; import com.atsuishio.superbwarfare.init.ModItems; +import com.atsuishio.superbwarfare.tools.ChunkLoadTool; import com.atsuishio.superbwarfare.tools.ParticleTool; import com.atsuishio.superbwarfare.tools.ProjectileTool; import net.minecraft.core.BlockPos; @@ -25,7 +25,6 @@ import net.minecraft.world.level.block.BellBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; -import net.minecraftforge.common.world.ForgeChunkManager; import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.PlayMessages; import software.bernie.geckolib.animatable.GeoEntity; @@ -158,21 +157,8 @@ public class MortarShellEntity extends ThrowableItemProjectile implements GeoEnt ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.xo, this.yo, this.zo, 1, 0, 0, 0, 0.001, true); - var movement = this.getDeltaMovement(); - var currentX = this.chunkPosition().x; - var currentZ = this.chunkPosition().z; - var nextX = movement.x > 0 ? currentX + 1 : currentX - 1; - var nextZ = movement.z > 0 ? currentZ + 1 : currentZ - 1; - - ForgeChunkManager.forceChunk(serverLevel, ModUtils.MODID, this, currentX, currentZ, true, false); - ForgeChunkManager.forceChunk(serverLevel, ModUtils.MODID, this, currentX, nextZ, true, false); - ForgeChunkManager.forceChunk(serverLevel, ModUtils.MODID, this, nextX, currentZ, true, false); - ForgeChunkManager.forceChunk(serverLevel, ModUtils.MODID, this, nextX, nextZ, true, false); - - this.loadedChunks.add(ChunkPos.asLong(currentX, currentZ)); - this.loadedChunks.add(ChunkPos.asLong(currentX, nextZ)); - this.loadedChunks.add(ChunkPos.asLong(nextX, currentZ)); - this.loadedChunks.add(ChunkPos.asLong(nextX, nextZ)); + // 更新需要加载的区块 + ChunkLoadTool.updateLoadedChunks(serverLevel, this, this.loadedChunks); } if (this.tickCount > this.life || this.isInWater()) { if (this.level() instanceof ServerLevel) { @@ -199,9 +185,7 @@ public class MortarShellEntity extends ThrowableItemProjectile implements GeoEnt @Override public void onRemovedFromWorld() { if (this.level() instanceof ServerLevel serverLevel) { - for (long chunkPos : this.loadedChunks) { - ForgeChunkManager.forceChunk(serverLevel, ModUtils.MODID, this, ChunkPos.getX(chunkPos), ChunkPos.getZ(chunkPos), false, false); - } + ChunkLoadTool.unloadAllChunks(serverLevel, this, this.loadedChunks); } super.onRemovedFromWorld(); } diff --git a/src/main/java/com/atsuishio/superbwarfare/tools/ChunkLoadTool.java b/src/main/java/com/atsuishio/superbwarfare/tools/ChunkLoadTool.java new file mode 100644 index 000000000..56aee48a5 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/tools/ChunkLoadTool.java @@ -0,0 +1,56 @@ +package com.atsuishio.superbwarfare.tools; + +import com.atsuishio.superbwarfare.ModUtils; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.ChunkPos; +import net.minecraftforge.common.world.ForgeChunkManager; + +import java.util.HashSet; +import java.util.Set; + +public class ChunkLoadTool { + + /** + * 根据动量计算需要加载的区块并卸载不再需要加载的区块 + */ + public static void updateLoadedChunks(ServerLevel level, Entity entity, Set loadedChunks) { + var x = entity.position().x; + var z = entity.position().z; + var nextX = x + entity.getDeltaMovement().x; + var nextZ = z + entity.getDeltaMovement().z; + + // 加载当前区块和下一tick会进入的区块 + var newChunks = new HashSet(); + newChunks.add(ChunkPos.asLong(new BlockPos((int) x, 0, (int) z))); + newChunks.add(ChunkPos.asLong(new BlockPos((int) nextX, 0, (int) nextZ))); + + // 计算需要更新的区块 + var chunksToLoad = newChunks.stream().filter(chunk -> !loadedChunks.contains(chunk)).toList(); + var chunksToUnload = loadedChunks.stream().filter(chunk -> !newChunks.contains(chunk)).toList(); + + chunksToLoad.forEach(chunk -> { + var chunkPos = new ChunkPos(chunk); + ForgeChunkManager.forceChunk(level, ModUtils.MODID, entity, chunkPos.x, chunkPos.z, true, false); + }); + + chunksToUnload.forEach(chunk -> { + var chunkPos = new ChunkPos(chunk); + ForgeChunkManager.forceChunk(level, ModUtils.MODID, entity, chunkPos.x, chunkPos.z, false, false); + }); + + loadedChunks.clear(); + loadedChunks.addAll(newChunks); + } + + /** + * 卸载所有已加载区块 + */ + public static void unloadAllChunks(ServerLevel level, Entity entity, Set loadedChunks) { + loadedChunks.forEach(chunk -> { + var chunkPos = new ChunkPos(chunk); + ForgeChunkManager.forceChunk(level, ModUtils.MODID, entity, chunkPos.x, chunkPos.z, false, false); + }); + } +} From 7f8307655fcca4a14d19fcaf146dc84d6d0a92ff Mon Sep 17 00:00:00 2001 From: Light_Quanta Date: Sat, 18 Jan 2025 21:43:03 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E8=A7=84=E8=8C=83animationprocedure?= =?UTF-8?q?=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/projectile/CannonShellEntity.java | 14 +++++++------- .../entity/projectile/RpgRocketEntity.java | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java index 0cc7ab429..4eff8e0c4 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java @@ -55,7 +55,7 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt public static final EntityDataAccessor ANIMATION = SynchedEntityData.defineId(CannonShellEntity.class, EntityDataSerializers.STRING); private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - public String animationprocedure = "empty"; + public String animationProcedure = "empty"; private float damage = 0; private float radius = 0; private float explosionDamage = 0; @@ -339,20 +339,20 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt } private PlayState movementPredicate(AnimationState event) { - if (this.animationprocedure.equals("empty")) { + if (this.animationProcedure.equals("empty")) { return event.setAndContinue(RawAnimation.begin().thenLoop("animation.cannon_shell.idle")); } return PlayState.STOP; } private PlayState procedurePredicate(AnimationState event) { - if (!animationprocedure.equals("empty") && event.getController().getAnimationState() == AnimationController.State.STOPPED) { - event.getController().setAnimation(RawAnimation.begin().thenPlay(this.animationprocedure)); + if (!animationProcedure.equals("empty") && event.getController().getAnimationState() == AnimationController.State.STOPPED) { + event.getController().setAnimation(RawAnimation.begin().thenPlay(this.animationProcedure)); if (event.getController().getAnimationState() == AnimationController.State.STOPPED) { - this.animationprocedure = "empty"; + this.animationProcedure = "empty"; event.getController().forceAnimationReset(); } - } else if (animationprocedure.equals("empty")) { + } else if (animationProcedure.equals("empty")) { return PlayState.STOP; } return PlayState.CONTINUE; @@ -373,7 +373,7 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt @Override public void setAnimationProcedure(String procedure) { - this.animationprocedure = procedure; + this.animationProcedure = procedure; } @Override diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/RpgRocketEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/RpgRocketEntity.java index 35afc2c86..4db31816c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/RpgRocketEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/RpgRocketEntity.java @@ -51,7 +51,7 @@ public class RpgRocketEntity extends ThrowableItemProjectile implements GeoEntit public static final EntityDataAccessor ANIMATION = SynchedEntityData.defineId(RpgRocketEntity.class, EntityDataSerializers.STRING); private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - public String animationprocedure = "empty"; + public String animationProcedure = "empty"; private float monsterMultiplier = 0.0f; private float damage = 250f; @@ -205,7 +205,7 @@ public class RpgRocketEntity extends ThrowableItemProjectile implements GeoEntit @Override public void setAnimationProcedure(String procedure) { - this.animationprocedure = procedure; + this.animationProcedure = procedure; } @Override From 27fbe9389f7f3b3558cfca6af81b895c6cf3ed03 Mon Sep 17 00:00:00 2001 From: Atsuihsio <842960157@qq.com> Date: Sun, 19 Jan 2025 18:04:21 +0800 Subject: [PATCH 03/12] =?UTF-8?q?=E8=B0=83=E6=95=B4lav150=E6=93=8D?= =?UTF-8?q?=E6=8E=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/vehicle/Lav150Entity.java | 15 ++++++++------- .../entity/vehicle/MobileVehicleEntity.java | 5 +++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java index 4730852d0..0556d6ebc 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java @@ -257,11 +257,12 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC this.setDeltaMovement(this.getDeltaMovement().add(0.0, fluidFloat, 0.0)); if (this.onGround()) { - float f0 = 0.54f + 0.25f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90 - 0.02f * Mth.abs(this.getRudderRot()); + float f0 = 0.54f + 0.25f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90; 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()); + float f1 = 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().horizontalDistance()))); this.setDeltaMovement(this.getDeltaMovement().multiply(f1, 0.85, f1)); } else { @@ -483,11 +484,11 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC } if (forwardInputDown) { - this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.015f, 0.2f)); + this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + (this.entityData.get(POWER) < 0 ? 0.012f : 0.0024f), 0.18f)); } if (backInputDown) { - this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.01f, -0.2f)); + this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - (this.entityData.get(POWER) > 0 ? 0.012f : 0.0024f), -0.13f)); } if (rightInputDown) { @@ -500,7 +501,7 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC this.extraEnergy(VehicleConfig.SPEEDBOAT_ENERGY_COST.get()); } - this.entityData.set(POWER, this.entityData.get(POWER) * 0.97f); + this.entityData.set(POWER, this.entityData.get(POWER) * (upInputDown ? 0.5f : (rightInputDown || leftInputDown) ? 0.977f : 0.99f)); this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) * (float)Math.max(0.76f - 0.1f * this.getDeltaMovement().horizontalDistance(), 0.3)); float angle = (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1)); @@ -518,8 +519,8 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC 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(12 * 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() && !onGround() ? 0.3f : 1) * this.entityData.get(POWER), 0.0, Mth.cos(this.getYRot() * 0.017453292F) * (isInWater() && !onGround() ? 0.3f : 1) * this.entityData.get(POWER))); + this.setYRot((float) (this.getYRot() - Math.max((isInWater() && !onGround() ? 5 : 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() && !onGround() ? 0.05f : (isInWater() && !onGround() ? 0.3f : 1)) * this.entityData.get(POWER), 0.0, Mth.cos(this.getYRot() * 0.017453292F) * (!isInWater() && !onGround() ? 0.05f : (isInWater() && !onGround() ? 0.3f : 1)) * this.entityData.get(POWER))); } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MobileVehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MobileVehicleEntity.java index 620b1d937..4d7bee35a 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MobileVehicleEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MobileVehicleEntity.java @@ -100,16 +100,17 @@ public class MobileVehicleEntity extends EnergyVehicleEntity { } collisionCoolDown = 4; crash = true; + this.entityData.set(POWER, 0.4f * entityData.get(POWER)); } } public void bounceHorizontal(Direction direction) { switch (direction.getAxis()) { case X: - this.setDeltaMovement(this.getDeltaMovement().multiply(-0.8, 0.99, 0.99)); + this.setDeltaMovement(this.getDeltaMovement().multiply(-0.4, 0.99, 0.99)); break; case Z: - this.setDeltaMovement(this.getDeltaMovement().multiply(0.99, 0.99, -0.8)); + this.setDeltaMovement(this.getDeltaMovement().multiply(0.99, 0.99, -0.4)); break; } } From c14b4a8cdeacb4cb89d52295dacf2bf6f4a451d6 Mon Sep 17 00:00:00 2001 From: Atsuihsio <842960157@qq.com> Date: Mon, 20 Jan 2025 16:40:04 +0800 Subject: [PATCH 04/12] =?UTF-8?q?=E7=9B=B4=E5=8D=87=E6=9C=BAS=E9=94=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E7=BC=93=E6=85=A2=E4=B8=8B=E9=99=8D=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BD=BD=E5=85=B7=E9=98=B2=E5=A0=86=E5=8F=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../block/entity/ContainerBlockEntity.java | 5 ++-- .../entity/vehicle/Ah6Entity.java | 27 +++++++++++------- .../entity/vehicle/MobileVehicleEntity.java | 28 +++++++++++++++++-- 3 files changed, 46 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/block/entity/ContainerBlockEntity.java b/src/main/java/com/atsuishio/superbwarfare/block/entity/ContainerBlockEntity.java index 26d1bb49c..d4350fb60 100644 --- a/src/main/java/com/atsuishio/superbwarfare/block/entity/ContainerBlockEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/block/entity/ContainerBlockEntity.java @@ -18,6 +18,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; +import org.joml.Math; import software.bernie.geckolib.animatable.GeoBlockEntity; import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; import software.bernie.geckolib.core.animation.AnimatableManager; @@ -54,12 +55,12 @@ public class ContainerBlockEntity extends BlockEntity implements GeoBlockEntity } } else { if (blockEntity.entity != null) { - blockEntity.entity.setPos(pPos.getX() + 0.5, pPos.getY() + 0.5, pPos.getZ() + 0.5); + blockEntity.entity.setPos(pPos.getX() + 0.5 + (2 * Math.random() - 1) * 0.1f, pPos.getY() + 0.5 + (2 * Math.random() - 1) * 0.1f, pPos.getZ() + 0.5 + (2 * Math.random() - 1) * 0.1f); pLevel.addFreshEntity(blockEntity.entity); } else if (blockEntity.entityType != null) { var entity = blockEntity.entityType.create(pLevel); if (entity != null) { - entity.setPos(pPos.getX() + 0.5, pPos.getY() + 0.5, pPos.getZ() + 0.5); + entity.setPos(pPos.getX() + 0.5 + (2 * Math.random() - 1) * 0.1f, pPos.getY() + 0.5 + (2 * Math.random() - 1) * 0.1f, pPos.getZ() + 0.5 + (2 * Math.random() - 1) * 0.1f); pLevel.addFreshEntity(entity); } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java index 3d7fa9b45..cac74ec7a 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java @@ -275,14 +275,14 @@ 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.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)); } if (this.level() instanceof ServerLevel) { if (this.getEnergy() > 0) { - boolean up = this.upInputDown || this.forwardInputDown; - boolean down = this.downInputDown || this.backInputDown; + boolean up = upInputDown || forwardInputDown; + boolean down = this.downInputDown; if (!engineStart && up) { engineStart = true; @@ -293,19 +293,26 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.002f, 0.12f)); } - if (down && engineStartOver) { - this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.0015f, this.onGround() ? 0 : 0.0375f)); + if (engineStartOver) { + if (down) { + this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.0015f, this.onGround() ? 0 : 0.0375f)); + } else if (backInputDown) { + this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.0015f, this.onGround() ? 0 : 0.052f)); + if (passenger != null) { + passenger.setXRot(0.8f * passenger.getXRot()); + } + } } if (engineStart && !engineStartOver) { this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.0012f, 0.045f)); } - if (!(up || down) && engineStartOver) { + if (!(up || down || backInputDown) && engineStartOver) { if (this.getDeltaMovement().y() < 0) { - this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.0002f, 0.12f)); + this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.0001f, 0.12f)); } else { - this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - (this.onGround() ? 0.00005f : 0.0002f), 0)); + this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - (this.onGround() ? 0.00005f : 0.0001f), 0)); } } } else { @@ -329,10 +336,10 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli setDeltaMovement(getDeltaMovement().add(0.0f, Math.min(Math.sin((90 - this.getXRot()) * Mth.DEG_TO_RAD), Math.sin((90 + this.getRoll()) * Mth.DEG_TO_RAD)) * this.entityData.get(PROPELLER_ROT), 0.0f)); Vector3f direction = getRightDirection().mul(Math.cos((this.getRoll() + 90) * Mth.DEG_TO_RAD) * this.entityData.get(PROPELLER_ROT)); - setDeltaMovement(getDeltaMovement().add(new Vec3(direction.x, direction.y, direction.z).scale(0.85))); + setDeltaMovement(getDeltaMovement().add(new Vec3(direction.x, direction.y, direction.z).scale(backInputDown ? 0.45 : 0.85))); Vector3f directionZ = getForwardDirection().mul(-Math.cos((this.getXRot() + 90) * Mth.DEG_TO_RAD) * this.entityData.get(PROPELLER_ROT)); - setDeltaMovement(getDeltaMovement().add(new Vec3(directionZ.x, directionZ.y, directionZ.z).scale(0.35))); + setDeltaMovement(getDeltaMovement().add(new Vec3(directionZ.x, directionZ.y, directionZ.z).scale(backInputDown ? 0.1 : 0.35))); if (this.entityData.get(POWER) > 0.04f) { engineStartOver = true; diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MobileVehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MobileVehicleEntity.java index 4d7bee35a..8ef0d029e 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MobileVehicleEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MobileVehicleEntity.java @@ -68,6 +68,7 @@ public class MobileVehicleEntity extends EnergyVehicleEntity { collisionCoolDown--; } super.baseTick(); + preventStacking(); crushEntities(this.getDeltaMovement()); this.setDeltaMovement(this.getDeltaMovement().add(0.0, -0.06, 0.0)); this.move(MoverType.SELF, this.getDeltaMovement()); @@ -126,13 +127,36 @@ public class MobileVehicleEntity extends EnergyVehicleEntity { } } + /** + * 防止载具堆叠 + */ + public void preventStacking() { + var Box = getBoundingBox(); + + var entities = level().getEntities(EntityTypeTest.forClass(Entity.class), Box, entity -> entity != this && entity != getFirstPassenger() && entity.getVehicle() == null) + .stream().filter(entity -> entity instanceof VehicleEntity) + .toList(); + + for (var entity : entities) { + Vec3 toVec = this.position().add(new Vec3(1, 1 ,1).scale(random.nextFloat() * 0.01f + 1f)).vectorTo(entity.position()); + Vec3 velAdd = toVec.normalize().scale(Math.max((this.getBbWidth() + 2) - position().distanceTo(entity.position()), 0) * 0.002); + double entitySize = entity.getBbWidth() * entity.getBbHeight(); + double thisSize = this.getBbWidth() * this.getBbHeight(); + double f = Math.min(entitySize / thisSize, 2); + double f1 = Math.min(thisSize / entitySize, 2); + + this.push(-f * velAdd.x, -f * velAdd.y, -f * velAdd.z); + entity.push(f1 * velAdd.x, f1 * velAdd.y, f1 * velAdd.z); + } + } + /** * 撞击实体并造成伤害 * @param velocity 动量 */ public void crushEntities(Vec3 velocity) { if (this instanceof DroneEntity) return; - if (velocity.horizontalDistance() < 0.1) return; + if (velocity.horizontalDistance() < 0.25) return; if (isRemoved()) return; var frontBox = getBoundingBox().move(velocity.scale(0.5)); var velAdd = velocity.add(0, 0, 0).scale(0.9); @@ -150,7 +174,7 @@ public class MobileVehicleEntity extends EnergyVehicleEntity { double f = Math.min(entitySize / thisSize, 2); double f1 = Math.min(thisSize / entitySize, 4); - if (velocity.length() > 0.3) { + if (velocity.length() > 0.3 && getBoundingBox().distanceToSqr(entity.getBoundingBox().getCenter()) < 1) { if (!this.level().isClientSide) { this.level().playSound(null, this, ModSounds.VEHICLE_STRIKE.get(), this.getSoundSource(), 1, 1); } From fec75999c09f88f9da4f658ef8762d6dee327698 Mon Sep 17 00:00:00 2001 From: Atsuihsio <842960157@qq.com> Date: Tue, 21 Jan 2025 02:36:19 +0800 Subject: [PATCH 05/12] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=97=A0=E4=BA=BA?= =?UTF-8?q?=E6=9C=BA=E8=87=AA=E5=8A=A8=E8=BF=94=E8=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../superbwarfare/entity/DroneEntity.java | 48 +++++++++++++++++-- .../atsuishio/superbwarfare/item/Monitor.java | 22 +++++++-- 2 files changed, 63 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/DroneEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/DroneEntity.java index f0dc2821d..4f117e698 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/DroneEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/DroneEntity.java @@ -9,6 +9,7 @@ import com.atsuishio.superbwarfare.init.ModEntities; import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.init.ModSounds; import com.atsuishio.superbwarfare.item.Monitor; +import com.atsuishio.superbwarfare.tools.ChunkLoadTool; import com.atsuishio.superbwarfare.tools.CustomExplosion; import com.atsuishio.superbwarfare.tools.EntityFindUtil; import com.atsuishio.superbwarfare.tools.ParticleTool; @@ -52,9 +53,7 @@ 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 java.util.Objects; -import java.util.UUID; +import java.util.*; public class DroneEntity extends MobileVehicleEntity implements GeoEntity { public static final EntityDataAccessor LINKED = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.BOOLEAN); @@ -76,6 +75,7 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity { public double lastTickVerticalSpeed; public float pitch; public float pitchO; + public Set loadedChunks = new HashSet<>(); public DroneEntity(PlayMessages.SpawnEntity packet, Level world) { this(ModEntities.DRONE.get(), world); @@ -165,6 +165,11 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity { super.baseTick(); + if (this.level() instanceof ServerLevel serverLevel) { + // 更新需要加载的区块 + ChunkLoadTool.updateLoadedChunks(serverLevel, this, this.loadedChunks); + } + lastTickSpeed = this.getDeltaMovement().length(); lastTickVerticalSpeed = this.getDeltaMovement().y; @@ -177,6 +182,7 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity { if (!this.onGround()) { if (controller != null) { + handleSimulationDistance(controller); ItemStack stack = controller.getMainHandItem(); if (stack.is(ModItems.MONITOR.get())) { if (stack.getOrCreateTag().getBoolean("Using") && controller.level().isClientSide) { @@ -193,6 +199,15 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity { if (!controller.level().isClientSide) { this.level().playSound(null, this.getOnPos(), ModSounds.DRONE_SOUND.get(), SoundSource.AMBIENT, 3, 1); } + + if (tickCount %5 == 0) { + controller.getInventory().items.stream().filter(pStack -> pStack.getItem() == ModItems.MONITOR.get()) + .forEach(pStack -> { + if (pStack.getOrCreateTag().getString(Monitor.LINKED_DRONE).equals(this.getStringUUID())) { + Monitor.getDronePos(pStack,this.position()); + } + }); + } } } @@ -222,6 +237,25 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity { this.refreshDimensions(); } + public void handleSimulationDistance(Player player) { + if (player.level() instanceof ServerLevel serverLevel && player instanceof ServerPlayer) { + var distanceManager = serverLevel.getChunkSource().chunkMap.getDistanceManager(); + var playerTicketManager = distanceManager.playerTicketManager; + int maxDistance = playerTicketManager.viewDistance; + + if (this.position().vectorTo(player.position()).horizontalDistance() > maxDistance * 16) { + upInputDown = false; + downInputDown = false; + forwardInputDown = false; + backInputDown = false; + leftInputDown = false; + rightInputDown = false; + Vec3 toVec = position().vectorTo(player.position()).normalize(); + setDeltaMovement(getDeltaMovement().add(new Vec3(toVec.x, 0,toVec.z).scale(0.2))); + } + } + } + public float getPropellerRot() { return this.propellerRot; } @@ -516,4 +550,12 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity { public AnimatableInstanceCache getAnimatableInstanceCache() { return this.cache; } + + @Override + public void onRemovedFromWorld() { + if (this.level() instanceof ServerLevel serverLevel) { + ChunkLoadTool.unloadAllChunks(serverLevel, this, this.loadedChunks); + } + super.onRemovedFromWorld(); + } } diff --git a/src/main/java/com/atsuishio/superbwarfare/item/Monitor.java b/src/main/java/com/atsuishio/superbwarfare/item/Monitor.java index 330bdaa03..fbeaa6646 100644 --- a/src/main/java/com/atsuishio/superbwarfare/item/Monitor.java +++ b/src/main/java/com/atsuishio/superbwarfare/item/Monitor.java @@ -21,6 +21,7 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -104,6 +105,12 @@ public class Monitor extends Item { return super.getAttributeModifiers(slot, stack); } + public static void getDronePos(ItemStack itemstack, Vec3 vec3) { + itemstack.getOrCreateTag().putDouble("PosX", vec3.x); + itemstack.getOrCreateTag().putDouble("PosY", vec3.y); + itemstack.getOrCreateTag().putDouble("PosZ", vec3.z); + } + @OnlyIn(Dist.CLIENT) @Override public void appendHoverText(ItemStack stack, Level world, List list, TooltipFlag flag) { @@ -112,11 +119,18 @@ public class Monitor extends Item { Player player = Minecraft.getInstance().player; if (player == null) return; - DroneEntity drone = EntityFindUtil.findDrone(player.level(), stack.getOrCreateTag().getString(LINKED_DRONE)); - if (drone == null) return; + Vec3 droneVec = new Vec3(stack.getOrCreateTag().getDouble("PosX"), stack.getOrCreateTag().getDouble("PosY"), stack.getOrCreateTag().getDouble("PosZ")); - list.add(Component.translatable("des.superbwarfare.monitor", - new DecimalFormat("##.#").format(player.distanceTo(drone)) + "m").withStyle(ChatFormatting.GRAY)); + list.add(Component.translatable("des.superbwarfare.monitor",new DecimalFormat("##.#").format(player.position().distanceTo(droneVec)) + "m").withStyle(ChatFormatting.GRAY)); + list.add(Component.literal("X: " + new DecimalFormat("##.#").format(droneVec.x) + + " Y: " + new DecimalFormat("##.#").format(droneVec.y) + + " Z: " + new DecimalFormat("##.#").format(droneVec.z) + )); + } + + @Override + public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { + return false; } @Override From 3dcc5fc696c1f2d84ea9373d1d0e070c311e0e92 Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Tue, 21 Jan 2025 19:04:52 +0800 Subject: [PATCH 06/12] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E5=AF=BC=E8=87=B4NPE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../superbwarfare/entity/DroneEntity.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/DroneEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/DroneEntity.java index 4f117e698..79ef2bc8d 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/DroneEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/DroneEntity.java @@ -56,6 +56,7 @@ import software.bernie.geckolib.util.GeckoLibUtil; import java.util.*; public class DroneEntity extends MobileVehicleEntity implements GeoEntity { + public static final EntityDataAccessor LINKED = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.BOOLEAN); public static final EntityDataAccessor CONTROLLER = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.STRING); public static final EntityDataAccessor AMMO = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.INT); @@ -167,7 +168,7 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity { if (this.level() instanceof ServerLevel serverLevel) { // 更新需要加载的区块 - ChunkLoadTool.updateLoadedChunks(serverLevel, this, this.loadedChunks); + ChunkLoadTool.updateLoadedChunks(serverLevel, this, this.loadedChunks); } lastTickSpeed = this.getDeltaMovement().length(); @@ -179,7 +180,6 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity { Player controller = EntityFindUtil.findPlayer(this.level(), this.entityData.get(CONTROLLER)); - if (!this.onGround()) { if (controller != null) { handleSimulationDistance(controller); @@ -200,11 +200,11 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity { this.level().playSound(null, this.getOnPos(), ModSounds.DRONE_SOUND.get(), SoundSource.AMBIENT, 3, 1); } - if (tickCount %5 == 0) { + if (tickCount % 5 == 0) { controller.getInventory().items.stream().filter(pStack -> pStack.getItem() == ModItems.MONITOR.get()) .forEach(pStack -> { if (pStack.getOrCreateTag().getString(Monitor.LINKED_DRONE).equals(this.getStringUUID())) { - Monitor.getDronePos(pStack,this.position()); + Monitor.getDronePos(pStack, this.position()); } }); } @@ -251,7 +251,7 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity { leftInputDown = false; rightInputDown = false; Vec3 toVec = position().vectorTo(player.position()).normalize(); - setDeltaMovement(getDeltaMovement().add(new Vec3(toVec.x, 0,toVec.z).scale(0.2))); + setDeltaMovement(getDeltaMovement().add(new Vec3(toVec.x, 0, toVec.z).scale(0.2))); } } } @@ -447,14 +447,13 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity { hitEntityCrash(controller, target); } } - } public void hitEntityCrash(Player controller, Entity target) { if (lastTickSpeed > 0.12) { if (this.entityData.get(KAMIKAZE) && 20 * lastTickSpeed > this.getHealth()) { target.hurt(ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), this, controller), ExplosionConfig.DRONE_KAMIKAZE_HIT_DAMAGE.get()); - if (controller.getMainHandItem().is(ModItems.MONITOR.get())) { + if (controller != null && controller.getMainHandItem().is(ModItems.MONITOR.get())) { Monitor.disLink(controller.getMainHandItem(), controller); } } @@ -484,7 +483,6 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity { @Override public void destroy() { - String id = this.entityData.get(CONTROLLER); UUID uuid; try { @@ -530,7 +528,6 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity { this.discard(); } - private void kamikazeExplosion() { Entity attacker = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_ATTACKER_UUID)); CustomExplosion explosion = new CustomExplosion(this.level(), this, From 56d852c39d45b821f5cba0b86b9f1a76724ddc0e Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Tue, 21 Jan 2025 19:05:21 +0800 Subject: [PATCH 07/12] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index b95dc3815..e10cc7637 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,5 +13,5 @@ mod_description=A Warfare Mod minecraft_version=1.20.1 jei_version=15.2.0.27 cloth_config_version=11.1.106 -mod_version=0.4.0 +mod_version=0.4.1 mod_authors=Atsuishio, Roki27, Light_Quanta \ No newline at end of file From 39dc6cf12b38434654897e60ec552f6fdc996bdd Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Wed, 22 Jan 2025 00:02:12 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E6=9E=AA?= =?UTF-8?q?=E6=A2=B0=E9=87=8D=E9=93=B8=E5=8F=B0=E5=90=9E=E7=82=B9=E6=95=B0?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/atsuishio/superbwarfare/menu/ReforgingTableMenu.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/menu/ReforgingTableMenu.java b/src/main/java/com/atsuishio/superbwarfare/menu/ReforgingTableMenu.java index f1de8655b..ef902e41f 100644 --- a/src/main/java/com/atsuishio/superbwarfare/menu/ReforgingTableMenu.java +++ b/src/main/java/com/atsuishio/superbwarfare/menu/ReforgingTableMenu.java @@ -294,7 +294,7 @@ public class ReforgingTableMenu extends AbstractContainerMenu { ItemStack output = gun.copy(); PerkHelper.removePerkByType(output, perkItem.getPerk().type); GunsTool.setGunDoubleTag(output, "UpgradePoint", Math.min(MAX_UPGRADE_POINT, level - 1 + GunsTool.getGunDoubleTag(output, "UpgradePoint", 0))); - this.upgradePoint.set((int) GunsTool.getGunDoubleTag(gun, "UpgradePoint", 0)); + this.upgradePoint.set((int) GunsTool.getGunDoubleTag(output, "UpgradePoint", 0)); this.container.setItem(INPUT_SLOT, output); this.container.setChanged(); From 5beee8d86a589c42ce8e53a4f80d4cda047e5316 Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Wed, 22 Jan 2025 00:02:34 +0800 Subject: [PATCH 09/12] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index e10cc7637..b0bb1898d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,5 +13,5 @@ mod_description=A Warfare Mod minecraft_version=1.20.1 jei_version=15.2.0.27 cloth_config_version=11.1.106 -mod_version=0.4.1 +mod_version=0.4.2 mod_authors=Atsuishio, Roki27, Light_Quanta \ No newline at end of file From b7530d1ebbcd04ecd8667d0e2e31f44e7b91f96d Mon Sep 17 00:00:00 2001 From: Atsuihsio <842960157@qq.com> Date: Wed, 22 Jan 2025 01:07:17 +0800 Subject: [PATCH 10/12] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B1=A4=E5=A7=86F6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/model/entity/Tom6Model.java | 25 + .../client/renderer/entity/Tom6Renderer.java | 46 + .../superbwarfare/entity/DroneEntity.java | 10 + .../entity/vehicle/Ah6Entity.java | 6 +- .../entity/vehicle/Tom6Entity.java | 265 +++++ .../entity/vehicle/VehicleEntity.java | 1 - .../superbwarfare/init/ModEntities.java | 2 + .../init/ModEntityRenderers.java | 1 + .../atsuishio/superbwarfare/init/ModTabs.java | 1 + .../superbwarfare/mixins/CameraMixin.java | 5 + .../mixins/GameRendererMixin.java | 26 + .../mixins/LivingEntityRendererMixin.java | 5 + .../assets/superbwarfare/geo/tom_6.geo.json | 1011 +++++++++++++++++ .../superbwarfare/textures/entity/tom_6.png | Bin 0 -> 5191 bytes 14 files changed, 1398 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/atsuishio/superbwarfare/client/model/entity/Tom6Model.java create mode 100644 src/main/java/com/atsuishio/superbwarfare/client/renderer/entity/Tom6Renderer.java create mode 100644 src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java create mode 100644 src/main/resources/assets/superbwarfare/geo/tom_6.geo.json create mode 100644 src/main/resources/assets/superbwarfare/textures/entity/tom_6.png diff --git a/src/main/java/com/atsuishio/superbwarfare/client/model/entity/Tom6Model.java b/src/main/java/com/atsuishio/superbwarfare/client/model/entity/Tom6Model.java new file mode 100644 index 000000000..97d61dd88 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/client/model/entity/Tom6Model.java @@ -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 { + + @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"); + } +} diff --git a/src/main/java/com/atsuishio/superbwarfare/client/renderer/entity/Tom6Renderer.java b/src/main/java/com/atsuishio/superbwarfare/client/renderer/entity/Tom6Renderer.java new file mode 100644 index 000000000..65a4c03f1 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/client/renderer/entity/Tom6Renderer.java @@ -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 { + + 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(); + } +} diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/DroneEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/DroneEntity.java index 79ef2bc8d..4b0ea08ab 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/DroneEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/DroneEntity.java @@ -548,6 +548,16 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity { return this.cache; } + @Override + public float ignoreExplosionHorizontalKnockBack() { + return 0; + } + + @Override + public float ignoreExplosionVerticalKnockBack() { + return 0; + } + @Override public void onRemovedFromWorld() { if (this.level() instanceof ServerLevel serverLevel) { diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java index cac74ec7a..6f5349736 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java @@ -152,6 +152,7 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli @Override public void baseTick() { propellerRotO = this.getPropellerRot(); + setZRot(roll * 0.9f); super.baseTick(); if (heat > 0) { @@ -403,10 +404,6 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli Vector4f worldPosition = transformPosition(transform, x, y, z); passenger.setPos(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()) { @@ -419,7 +416,6 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli 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()); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java new file mode 100644 index 000000000..74a53e020 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java @@ -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 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 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 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; + } +} diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/VehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/VehicleEntity.java index 744974eb1..9a930df61 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/VehicleEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/VehicleEntity.java @@ -236,7 +236,6 @@ public class VehicleEntity extends Entity { lastHurtTick ++; prevRoll = this.getRoll(); - setZRot(roll * 0.9f); float delta = Math.abs(getYRot() - yRotO); while (getYRot() > 180F) { diff --git a/src/main/java/com/atsuishio/superbwarfare/init/ModEntities.java b/src/main/java/com/atsuishio/superbwarfare/init/ModEntities.java index 3edffa1b6..1a0a03c07 100644 --- a/src/main/java/com/atsuishio/superbwarfare/init/ModEntities.java +++ b/src/main/java/com/atsuishio/superbwarfare/init/ModEntities.java @@ -76,6 +76,8 @@ public class ModEntities { EntityType.Builder.of(FlareDecoyEntity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(1).setCustomClientFactory(FlareDecoyEntity::new).sized(0.5f, 0.5f)); public static final RegistryObject> LAV_150 = register("lav_150", EntityType.Builder.of(Lav150Entity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(3).setCustomClientFactory(Lav150Entity::new).fireImmune().sized(2.8f, 3.1f)); + public static final RegistryObject> TOM_6 = register("tom_6", + EntityType.Builder.of(Tom6Entity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(3).setCustomClientFactory(Tom6Entity::new).fireImmune().sized(1.15f, 1.0f)); private static RegistryObject> register(String name, EntityType.Builder entityTypeBuilder) { return REGISTRY.register(name, () -> entityTypeBuilder.build(name)); diff --git a/src/main/java/com/atsuishio/superbwarfare/init/ModEntityRenderers.java b/src/main/java/com/atsuishio/superbwarfare/init/ModEntityRenderers.java index b3ecaf6b8..61c90823d 100644 --- a/src/main/java/com/atsuishio/superbwarfare/init/ModEntityRenderers.java +++ b/src/main/java/com/atsuishio/superbwarfare/init/ModEntityRenderers.java @@ -36,5 +36,6 @@ public class ModEntityRenderers { event.registerEntityRenderer(ModEntities.FLARE_DECOY.get(), FlareDecoyEntityRenderer::new); 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); } } diff --git a/src/main/java/com/atsuishio/superbwarfare/init/ModTabs.java b/src/main/java/com/atsuishio/superbwarfare/init/ModTabs.java index 475541223..e44a23c9f 100644 --- a/src/main/java/com/atsuishio/superbwarfare/init/ModTabs.java +++ b/src/main/java/com/atsuishio/superbwarfare/init/ModTabs.java @@ -110,6 +110,7 @@ public class ModTabs { output.accept(ContainerBlockItem.createInstance(ModEntities.WHEEL_CHAIR.get())); output.accept(ContainerBlockItem.createInstance(ModEntities.AH_6.get())); output.accept(ContainerBlockItem.createInstance(ModEntities.LAV_150.get())); + output.accept(ContainerBlockItem.createInstance(ModEntities.TOM_6.get())); } else { output.accept(registryObject.get()); if (registryObject.get() == ModItems.ARMOR_PLATE.get()) { diff --git a/src/main/java/com/atsuishio/superbwarfare/mixins/CameraMixin.java b/src/main/java/com/atsuishio/superbwarfare/mixins/CameraMixin.java index 5d9f23f42..903f5399c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/mixins/CameraMixin.java +++ b/src/main/java/com/atsuishio/superbwarfare/mixins/CameraMixin.java @@ -128,6 +128,11 @@ public abstract class CameraMixin { return; } + if (thirdPerson && entity.getVehicle() instanceof Tom6Entity) { + move(-getMaxZoom(4), 1, 0); + return; + } + if (thirdPerson && entity.getVehicle() instanceof Lav150Entity && !ClientEventHandler.zoomVehicle) { move(-getMaxZoom(2.75), 1, 0.0); return; diff --git a/src/main/java/com/atsuishio/superbwarfare/mixins/GameRendererMixin.java b/src/main/java/com/atsuishio/superbwarfare/mixins/GameRendererMixin.java index 8a049a3d8..2e482a975 100644 --- a/src/main/java/com/atsuishio/superbwarfare/mixins/GameRendererMixin.java +++ b/src/main/java/com/atsuishio/superbwarfare/mixins/GameRendererMixin.java @@ -1,6 +1,7 @@ package com.atsuishio.superbwarfare.mixins; import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity; +import com.atsuishio.superbwarfare.entity.vehicle.Tom6Entity; import com.atsuishio.superbwarfare.init.ModTags; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Axis; @@ -69,5 +70,30 @@ public class GameRendererMixin { matrices.mulPose(Axis.YP.rotationDegrees(-mainCamera.getYRot() - 180.0f)); 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())); + } } } diff --git a/src/main/java/com/atsuishio/superbwarfare/mixins/LivingEntityRendererMixin.java b/src/main/java/com/atsuishio/superbwarfare/mixins/LivingEntityRendererMixin.java index 33331bcfd..59359db6e 100644 --- a/src/main/java/com/atsuishio/superbwarfare/mixins/LivingEntityRendererMixin.java +++ b/src/main/java/com/atsuishio/superbwarfare/mixins/LivingEntityRendererMixin.java @@ -1,6 +1,7 @@ package com.atsuishio.superbwarfare.mixins; import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity; +import com.atsuishio.superbwarfare.entity.vehicle.Tom6Entity; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Axis; import net.minecraft.client.renderer.entity.LivingEntityRenderer; @@ -19,5 +20,9 @@ public class LivingEntityRendererMixin { matrices.mulPose(Axis.XP.rotationDegrees(-ah6Entity.getViewXRot(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))); + } } } diff --git a/src/main/resources/assets/superbwarfare/geo/tom_6.geo.json b/src/main/resources/assets/superbwarfare/geo/tom_6.geo.json new file mode 100644 index 000000000..75a138c3e --- /dev/null +++ b/src/main/resources/assets/superbwarfare/geo/tom_6.geo.json @@ -0,0 +1,1011 @@ +{ + "format_version": "1.12.0", + "minecraft:geometry": [ + { + "description": { + "identifier": "geometry.unknown", + "texture_width": 128, + "texture_height": 128, + "visible_bounds_width": 4, + "visible_bounds_height": 3.5, + "visible_bounds_offset": [0, 1.25, 0] + }, + "bones": [ + { + "name": "bone", + "pivot": [0, 0, 0], + "cubes": [ + { + "origin": [-8.5, 1.7, -12.75], + "size": [17, 0.85, 25.5], + "uv": { + "north": {"uv": [68, 58], "uv_size": [20, 1]}, + "east": {"uv": [60, 63], "uv_size": [30, 1]}, + "south": {"uv": [68, 59], "uv_size": [20, 1]}, + "west": {"uv": [64, 0], "uv_size": [30, 1]}, + "up": {"uv": [0, 0], "uv_size": [20, 30]}, + "down": {"uv": [20, 30], "uv_size": [20, -30]} + } + }, + { + "origin": [-8.5, 17, -12.75], + "size": [17, 0.85, 25.5], + "uv": { + "north": {"uv": [68, 60], "uv_size": [20, 1]}, + "east": {"uv": [64, 1], "uv_size": [30, 1]}, + "south": {"uv": [68, 61], "uv_size": [20, 1]}, + "west": {"uv": [64, 2], "uv_size": [30, 1]}, + "up": {"uv": [0, 30], "uv_size": [20, 30]}, + "down": {"uv": [20, 60], "uv_size": [20, -30]} + } + }, + { + "origin": [-8.075, 17.3625, -13.6], + "size": [0.8875, 1.275, 0.85], + "uv": { + "north": {"uv": [42, 72], "uv_size": [1, 2]}, + "east": {"uv": [43, 72], "uv_size": [1, 2]}, + "south": {"uv": [44, 72], "uv_size": [1, 2]}, + "west": {"uv": [45, 72], "uv_size": [1, 2]}, + "up": {"uv": [72, 57], "uv_size": [1, 1]}, + "down": {"uv": [58, 73], "uv_size": [1, -1]} + } + }, + { + "origin": [-8.075, 17.51727, -14.3781], + "size": [0.8875, 1.19, 1.0625], + "pivot": [-7.75625, 18.15477, -13.84685], + "rotation": [-22.5, 0, 0], + "uv": { + "north": {"uv": [59, 72], "uv_size": [1, 1]}, + "east": {"uv": [72, 65], "uv_size": [1, 1]}, + "south": {"uv": [72, 66], "uv_size": [1, 1]}, + "west": {"uv": [72, 67], "uv_size": [1, 1]}, + "up": {"uv": [72, 68], "uv_size": [1, 1]}, + "down": {"uv": [72, 70], "uv_size": [1, -1]} + } + }, + { + "origin": [-8.075, 17.86637, -20.9772], + "size": [0.8875, 0.85, 7.3125], + "pivot": [-7.75625, 18.50387, -14.19595], + "rotation": [-67.5, 0, 0], + "uv": { + "north": {"uv": [72, 71], "uv_size": [1, 1]}, + "east": {"uv": [45, 71], "uv_size": [3, 1]}, + "south": {"uv": [72, 72], "uv_size": [1, 1]}, + "west": {"uv": [71, 45], "uv_size": [3, 1]}, + "up": {"uv": [66, 22], "uv_size": [1, 3]}, + "down": {"uv": [67, 34], "uv_size": [1, -3]} + } + }, + { + "origin": [7.1875, 17.86637, -20.9772], + "size": [0.8875, 0.85, 7.3125], + "pivot": [7.75625, 18.50387, -14.19595], + "rotation": [-67.5, 0, 0], + "uv": { + "north": {"uv": [73, 30], "uv_size": [1, 1]}, + "east": {"uv": [71, 46], "uv_size": [3, 1]}, + "south": {"uv": [73, 34], "uv_size": [1, 1]}, + "west": {"uv": [71, 47], "uv_size": [3, 1]}, + "up": {"uv": [48, 71], "uv_size": [1, 3]}, + "down": {"uv": [71, 51], "uv_size": [1, -3]} + } + }, + { + "origin": [-7.1875, 23.92955, -17.11473], + "size": [14.375, 0.595, 0.595], + "pivot": [3.825, 24.22705, -16.81723], + "rotation": [-45, 0, 0], + "uv": { + "north": {"uv": [69, 19], "uv_size": [18, 1]}, + "east": {"uv": [73, 35], "uv_size": [1, 1]}, + "south": {"uv": [69, 20], "uv_size": [18, 1]}, + "west": {"uv": [73, 36], "uv_size": [1, 1]}, + "up": {"uv": [69, 21], "uv_size": [18, 1]}, + "down": {"uv": [69, 65], "uv_size": [18, -1]} + } + }, + { + "origin": [7.1875, 17.3625, -13.6], + "size": [0.8875, 1.275, 0.85], + "uv": { + "north": {"uv": [46, 72], "uv_size": [1, 2]}, + "east": {"uv": [47, 72], "uv_size": [1, 2]}, + "south": {"uv": [72, 48], "uv_size": [1, 2]}, + "west": {"uv": [49, 72], "uv_size": [1, 2]}, + "up": {"uv": [73, 28], "uv_size": [1, 1]}, + "down": {"uv": [73, 30], "uv_size": [1, -1]} + } + }, + { + "origin": [7.1875, 17.51727, -14.3781], + "size": [0.8875, 1.19, 1.0625], + "pivot": [7.75625, 18.15477, -13.84685], + "rotation": [-22.5, 0, 0], + "uv": { + "north": {"uv": [17, 73], "uv_size": [1, 1]}, + "east": {"uv": [18, 73], "uv_size": [1, 1]}, + "south": {"uv": [19, 73], "uv_size": [1, 1]}, + "west": {"uv": [20, 73], "uv_size": [1, 1]}, + "up": {"uv": [21, 73], "uv_size": [1, 1]}, + "down": {"uv": [22, 74], "uv_size": [1, -1]} + } + }, + { + "origin": [-8.5, 17.85, -12.75], + "size": [17, 0.85, 0.2125], + "uv": { + "north": {"uv": [68, 62], "uv_size": [20, 1]}, + "east": {"uv": [72, 52], "uv_size": [1, 1]}, + "south": {"uv": [3, 69], "uv_size": [20, 1]}, + "west": {"uv": [72, 53], "uv_size": [1, 1]}, + "up": {"uv": [69, 13], "uv_size": [20, 1]}, + "down": {"uv": [69, 15], "uv_size": [20, -1]} + } + }, + { + "origin": [-8.18125, 17.85, -4.14375], + "size": [25.075, 0.85, 0.2125], + "pivot": [8.39375, 18.275, -4.0375], + "rotation": [0, 90, 0], + "uv": { + "north": {"uv": [64, 3], "uv_size": [30, 1]}, + "east": {"uv": [72, 55], "uv_size": [1, 1]}, + "south": {"uv": [64, 4], "uv_size": [30, 1]}, + "west": {"uv": [56, 72], "uv_size": [1, 1]}, + "up": {"uv": [64, 5], "uv_size": [30, 1]}, + "down": {"uv": [64, 7], "uv_size": [30, -1]} + } + }, + { + "origin": [-16.89375, 17.85, -4.14375], + "size": [25.075, 0.85, 0.2125], + "pivot": [-8.39375, 18.275, -4.0375], + "rotation": [0, -90, 0], + "uv": { + "north": {"uv": [64, 7], "uv_size": [30, 1]}, + "east": {"uv": [72, 56], "uv_size": [1, 1]}, + "south": {"uv": [64, 8], "uv_size": [30, 1]}, + "west": {"uv": [57, 72], "uv_size": [1, 1]}, + "up": {"uv": [64, 9], "uv_size": [30, 1]}, + "down": {"uv": [64, 11], "uv_size": [30, -1]} + } + }, + { + "origin": [-8.5, 17.85, 12.5375], + "size": [17, 0.85, 0.2125], + "uv": { + "north": {"uv": [69, 15], "uv_size": [20, 1]}, + "east": {"uv": [72, 54], "uv_size": [1, 1]}, + "south": {"uv": [69, 16], "uv_size": [20, 1]}, + "west": {"uv": [55, 72], "uv_size": [1, 1]}, + "up": {"uv": [69, 17], "uv_size": [20, 1]}, + "down": {"uv": [69, 19], "uv_size": [20, -1]} + } + } + ] + }, + { + "name": "wing", + "parent": "bone", + "pivot": [8.87149, 17.6375, 0.00014], + "rotation": [0, 0, -15], + "cubes": [ + { + "origin": [8.5, 17.2125, -12.75], + "size": [3.6125, 0.85, 25.5], + "uv": { + "north": {"uv": [71, 40], "uv_size": [4, 1]}, + "east": {"uv": [64, 11], "uv_size": [30, 1]}, + "south": {"uv": [41, 71], "uv_size": [4, 1]}, + "up": {"uv": [40, 32], "uv_size": [4, 30]}, + "down": {"uv": [44, 62], "uv_size": [4, -30]} + } + }, + { + "origin": [7.12814, 17.2125, -13.19195], + "size": [2.7625, 0.85, 7.65], + "pivot": [8.50939, 17.6375, -0.44195], + "rotation": [0, -22.5, 0], + "uv": { + "north": {"uv": [71, 43], "uv_size": [3, 1]}, + "up": {"uv": [64, 27], "uv_size": [3, 9]}, + "down": {"uv": [66, 22], "uv_size": [3, -9]} + } + }, + { + "origin": [11.55548, 17.2125, -11.83646], + "size": [4.0375, 0.85, 7.65], + "pivot": [12.93673, 17.6375, -8.01146], + "rotation": [0, -45, 0], + "uv": { + "north": {"uv": [69, 70], "uv_size": [5, 1]}, + "up": {"uv": [35, 60], "uv_size": [5, 9]}, + "down": {"uv": [40, 71], "uv_size": [5, -9]} + } + }, + { + "origin": [13.13315, 17.2125, -9.92302], + "size": [5.7375, 0.85, 7.65], + "pivot": [14.5144, 17.6375, -6.09802], + "rotation": [0, -67.5, 0], + "uv": { + "north": {"uv": [70, 24], "uv_size": [7, 1]}, + "up": {"uv": [56, 36], "uv_size": [7, 9]}, + "down": {"uv": [56, 54], "uv_size": [7, -9]} + } + }, + { + "origin": [13.13315, 17.2125, 2.27302], + "size": [5.7375, 0.85, 7.65], + "pivot": [14.5144, 17.6375, 6.09802], + "rotation": [0, 67.5, 0], + "uv": { + "south": {"uv": [70, 25], "uv_size": [7, 1]}, + "up": {"uv": [56, 54], "uv_size": [7, 9]}, + "down": {"uv": [0, 69], "uv_size": [7, -9]} + } + }, + { + "origin": [11.55548, 17.2125, 4.18646], + "size": [4.0375, 0.85, 7.65], + "pivot": [12.93673, 17.6375, 8.01146], + "rotation": [0, 45, 0], + "uv": { + "south": {"uv": [71, 31], "uv_size": [5, 1]}, + "up": {"uv": [45, 62], "uv_size": [5, 9]}, + "down": {"uv": [50, 71], "uv_size": [5, -9]} + } + }, + { + "origin": [7.12814, 17.2125, 5.54195], + "size": [2.7625, 0.85, 7.65], + "pivot": [8.50939, 17.6375, 0.44195], + "rotation": [0, 22.5, 0], + "uv": { + "south": {"uv": [71, 44], "uv_size": [3, 1]}, + "up": {"uv": [66, 64], "uv_size": [3, 9]}, + "down": {"uv": [67, 31], "uv_size": [3, -9]} + } + }, + { + "origin": [14.50906, 17.2125, -1.62237], + "size": [7.072, 0.85, 7.60325], + "pivot": [15.89031, 17.6375, 2.15588], + "rotation": [0, 90, 0], + "uv": { + "south": {"uv": [70, 22], "uv_size": [8, 1]}, + "up": {"uv": [56, 0], "uv_size": [8, 9]}, + "down": {"uv": [56, 18], "uv_size": [8, -9]} + } + } + ] + }, + { + "name": "wing2", + "parent": "bone", + "pivot": [-8.87149, 17.6375, 0.00014], + "rotation": [0, 0, 15], + "cubes": [ + { + "origin": [-12.1125, 17.2125, -12.75], + "size": [3.6125, 0.85, 25.5], + "uv": { + "north": {"uv": [71, 41], "uv_size": [4, 1]}, + "south": {"uv": [71, 42], "uv_size": [4, 1]}, + "west": {"uv": [64, 12], "uv_size": [30, 1]}, + "up": {"uv": [48, 32], "uv_size": [4, 30]}, + "down": {"uv": [52, 62], "uv_size": [4, -30]} + } + }, + { + "origin": [-9.89064, 17.2125, -13.19195], + "size": [2.7625, 0.85, 7.65], + "pivot": [-8.50939, 17.6375, -0.44195], + "rotation": [0, 22.5, 0], + "uv": { + "north": {"uv": [49, 71], "uv_size": [3, 1]}, + "up": {"uv": [68, 31], "uv_size": [3, 9]}, + "down": {"uv": [68, 49], "uv_size": [3, -9]} + } + }, + { + "origin": [-15.59298, 17.2125, -11.83646], + "size": [4.0375, 0.85, 7.65], + "pivot": [-12.93673, 17.6375, -8.01146], + "rotation": [0, 45, 0], + "uv": { + "north": {"uv": [71, 32], "uv_size": [5, 1]}, + "up": {"uv": [63, 36], "uv_size": [5, 9]}, + "down": {"uv": [63, 54], "uv_size": [5, -9]} + } + }, + { + "origin": [-18.87065, 17.2125, -9.92302], + "size": [5.7375, 0.85, 7.65], + "pivot": [-14.5144, 17.6375, -6.09802], + "rotation": [0, 67.5, 0], + "uv": { + "north": {"uv": [70, 26], "uv_size": [7, 1]}, + "up": {"uv": [7, 60], "uv_size": [7, 9]}, + "down": {"uv": [14, 69], "uv_size": [7, -9]} + } + }, + { + "origin": [-18.87065, 17.2125, 2.27302], + "size": [5.7375, 0.85, 7.65], + "pivot": [-14.5144, 17.6375, 6.09802], + "rotation": [0, -67.5, 0], + "uv": { + "south": {"uv": [70, 27], "uv_size": [7, 1]}, + "up": {"uv": [21, 60], "uv_size": [7, 9]}, + "down": {"uv": [28, 69], "uv_size": [7, -9]} + } + }, + { + "origin": [-15.59298, 17.2125, 4.18646], + "size": [4.0375, 0.85, 7.65], + "pivot": [-12.93673, 17.6375, 8.01146], + "rotation": [0, -45, 0], + "uv": { + "south": {"uv": [71, 33], "uv_size": [5, 1]}, + "up": {"uv": [63, 54], "uv_size": [5, 9]}, + "down": {"uv": [55, 72], "uv_size": [5, -9]} + } + }, + { + "origin": [-9.89064, 17.2125, 5.54195], + "size": [2.7625, 0.85, 7.65], + "pivot": [-8.50939, 17.6375, 0.44195], + "rotation": [0, -22.5, 0], + "uv": { + "south": {"uv": [71, 51], "uv_size": [3, 1]}, + "up": {"uv": [68, 49], "uv_size": [3, 9]}, + "down": {"uv": [0, 78], "uv_size": [3, -9]} + } + }, + { + "origin": [-21.58106, 17.2125, -1.62237], + "size": [7.072, 0.85, 7.60325], + "pivot": [-15.89031, 17.6375, 2.15588], + "rotation": [0, -90, 0], + "uv": { + "south": {"uv": [70, 23], "uv_size": [8, 1]}, + "up": {"uv": [56, 18], "uv_size": [8, 9]}, + "down": {"uv": [56, 36], "uv_size": [8, -9]} + } + } + ] + }, + { + "name": "melon", + "parent": "bone", + "pivot": [0, 0, 0], + "cubes": [ + { + "origin": [-6.8, 2.55, -6.8], + "size": [13.6, 13.6, 13.6], + "uv": { + "north": {"uv": [40, 0], "uv_size": [16, 16]}, + "east": {"uv": [40, 0], "uv_size": [16, 16]}, + "south": {"uv": [40, 0], "uv_size": [16, 16]}, + "west": {"uv": [40, 0], "uv_size": [16, 16]}, + "up": {"uv": [40, 16], "uv_size": [16, 16]} + } + } + ] + }, + { + "name": "zhu", + "parent": "bone", + "pivot": [-7.4375, 14.875, -11.6875], + "cubes": [ + { + "origin": [-8.075, 14.45, -12.325], + "size": [1.275, 2.55, 1.275], + "pivot": [-7.4375, 20.4, -11.6875], + "rotation": [0, -45, 0], + "uv": { + "north": {"uv": [17, 70], "uv_size": [2, 3]}, + "east": {"uv": [19, 70], "uv_size": [2, 3]}, + "south": {"uv": [21, 70], "uv_size": [2, 3]}, + "west": {"uv": [70, 28], "uv_size": [2, 3]}, + "up": {"uv": [71, 38], "uv_size": [2, 2]}, + "down": {"uv": [39, 73], "uv_size": [2, -2]} + } + }, + { + "origin": [-8.075, 2.55, -12.325], + "size": [1.275, 11.05, 1.275], + "pivot": [-7.4375, 8.5, -11.6875], + "rotation": [0, -45, 0], + "uv": { + "north": {"uv": [64, 13], "uv_size": [2, 14]}, + "east": {"uv": [60, 64], "uv_size": [2, 14]}, + "south": {"uv": [62, 64], "uv_size": [2, 14]}, + "west": {"uv": [64, 64], "uv_size": [2, 14]}, + "up": {"uv": [71, 34], "uv_size": [2, 2]}, + "down": {"uv": [71, 38], "uv_size": [2, -2]} + } + }, + { + "origin": [-7.7775, 13.6, -12.0275], + "size": [0.68, 0.85, 0.68], + "pivot": [-7.4375, 14.025, -11.6875], + "rotation": [0, -45, 0], + "uv": { + "north": {"uv": [55, 62], "uv_size": [1, 1]}, + "east": {"uv": [71, 69], "uv_size": [1, 1]}, + "south": {"uv": [72, 30], "uv_size": [1, 1]}, + "west": {"uv": [50, 72], "uv_size": [1, 1]}, + "up": {"uv": [72, 50], "uv_size": [1, 1]}, + "down": {"uv": [51, 73], "uv_size": [1, -1]} + } + } + ] + }, + { + "name": "zhu2", + "parent": "bone", + "pivot": [7.4375, 14.875, -11.6875], + "cubes": [ + { + "origin": [6.8, 14.45, -12.325], + "size": [1.275, 2.55, 1.275], + "pivot": [7.4375, 20.4, -11.6875], + "rotation": [0, 45, 0], + "uv": { + "north": {"uv": [19, 70], "uv_size": [-2, 3]}, + "east": {"uv": [72, 28], "uv_size": [-2, 3]}, + "south": {"uv": [23, 70], "uv_size": [-2, 3]}, + "west": {"uv": [21, 70], "uv_size": [-2, 3]}, + "up": {"uv": [73, 38], "uv_size": [-2, 2]}, + "down": {"uv": [41, 73], "uv_size": [-2, -2]} + } + }, + { + "origin": [6.8, 2.55, -12.325], + "size": [1.275, 11.05, 1.275], + "pivot": [7.4375, 8.5, -11.6875], + "rotation": [0, 45, 0], + "uv": { + "north": {"uv": [66, 13], "uv_size": [-2, 14]}, + "east": {"uv": [66, 64], "uv_size": [-2, 14]}, + "south": {"uv": [64, 64], "uv_size": [-2, 14]}, + "west": {"uv": [62, 64], "uv_size": [-2, 14]}, + "up": {"uv": [73, 34], "uv_size": [-2, 2]}, + "down": {"uv": [73, 38], "uv_size": [-2, -2]} + } + }, + { + "origin": [7.0975, 13.6, -12.0275], + "size": [0.68, 0.85, 0.68], + "pivot": [7.4375, 14.025, -11.6875], + "rotation": [0, 45, 0], + "uv": { + "north": {"uv": [56, 62], "uv_size": [-1, 1]}, + "east": {"uv": [51, 72], "uv_size": [-1, 1]}, + "south": {"uv": [73, 30], "uv_size": [-1, 1]}, + "west": {"uv": [72, 69], "uv_size": [-1, 1]}, + "up": {"uv": [73, 50], "uv_size": [-1, 1]}, + "down": {"uv": [52, 73], "uv_size": [-1, -1]} + } + } + ] + }, + { + "name": "zhu3", + "parent": "bone", + "pivot": [7.4375, 14.875, 11.6875], + "cubes": [ + { + "origin": [6.8, 14.45, 11.05], + "size": [1.275, 2.55, 1.275], + "pivot": [7.4375, 20.4, 11.6875], + "rotation": [0, -45, 0], + "uv": { + "north": {"uv": [21, 70], "uv_size": [2, 3]}, + "east": {"uv": [70, 28], "uv_size": [2, 3]}, + "south": {"uv": [17, 70], "uv_size": [2, 3]}, + "west": {"uv": [19, 70], "uv_size": [2, 3]}, + "up": {"uv": [73, 40], "uv_size": [-2, -2]}, + "down": {"uv": [41, 71], "uv_size": [-2, 2]} + } + }, + { + "origin": [6.8, 2.55, 11.05], + "size": [1.275, 11.05, 1.275], + "pivot": [7.4375, 8.5, 11.6875], + "rotation": [0, -45, 0], + "uv": { + "north": {"uv": [62, 64], "uv_size": [2, 14]}, + "east": {"uv": [64, 64], "uv_size": [2, 14]}, + "south": {"uv": [64, 13], "uv_size": [2, 14]}, + "west": {"uv": [60, 64], "uv_size": [2, 14]}, + "up": {"uv": [73, 36], "uv_size": [-2, -2]}, + "down": {"uv": [73, 36], "uv_size": [-2, 2]} + } + }, + { + "origin": [7.0975, 13.6, 11.3475], + "size": [0.68, 0.85, 0.68], + "pivot": [7.4375, 14.025, 11.6875], + "rotation": [0, -45, 0], + "uv": { + "north": {"uv": [72, 30], "uv_size": [1, 1]}, + "east": {"uv": [50, 72], "uv_size": [1, 1]}, + "south": {"uv": [55, 62], "uv_size": [1, 1]}, + "west": {"uv": [71, 69], "uv_size": [1, 1]}, + "up": {"uv": [73, 51], "uv_size": [-1, -1]}, + "down": {"uv": [52, 72], "uv_size": [-1, 1]} + } + } + ] + }, + { + "name": "zhu4", + "parent": "bone", + "pivot": [-7.4375, 14.875, 11.6875], + "cubes": [ + { + "origin": [-8.075, 14.45, 11.05], + "size": [1.275, 2.55, 1.275], + "pivot": [-7.4375, 20.4, 11.6875], + "rotation": [0, 45, 0], + "uv": { + "north": {"uv": [23, 70], "uv_size": [-2, 3]}, + "east": {"uv": [21, 70], "uv_size": [-2, 3]}, + "south": {"uv": [19, 70], "uv_size": [-2, 3]}, + "west": {"uv": [72, 28], "uv_size": [-2, 3]}, + "up": {"uv": [71, 40], "uv_size": [2, -2]}, + "down": {"uv": [39, 71], "uv_size": [2, 2]} + } + }, + { + "origin": [-8.075, 2.55, 11.05], + "size": [1.275, 11.05, 1.275], + "pivot": [-7.4375, 8.5, 11.6875], + "rotation": [0, 45, 0], + "uv": { + "north": {"uv": [64, 64], "uv_size": [-2, 14]}, + "east": {"uv": [62, 64], "uv_size": [-2, 14]}, + "south": {"uv": [66, 13], "uv_size": [-2, 14]}, + "west": {"uv": [66, 64], "uv_size": [-2, 14]}, + "up": {"uv": [71, 36], "uv_size": [2, -2]}, + "down": {"uv": [71, 36], "uv_size": [2, 2]} + } + }, + { + "origin": [-7.7775, 13.6, 11.3475], + "size": [0.68, 0.85, 0.68], + "pivot": [-7.4375, 14.025, 11.6875], + "rotation": [0, 45, 0], + "uv": { + "north": {"uv": [73, 30], "uv_size": [-1, 1]}, + "east": {"uv": [72, 69], "uv_size": [-1, 1]}, + "south": {"uv": [56, 62], "uv_size": [-1, 1]}, + "west": {"uv": [51, 72], "uv_size": [-1, 1]}, + "up": {"uv": [72, 51], "uv_size": [1, -1]}, + "down": {"uv": [51, 72], "uv_size": [1, 1]} + } + } + ] + }, + { + "name": "wheel1", + "parent": "bone", + "pivot": [8.97813, 2.125, -10.2], + "cubes": [ + { + "origin": [8.5425, 0, -11.07975], + "size": [0.85, 4.25, 1.7595], + "pivot": [8.9675, 2.125, -10.2], + "rotation": [22.5, 0, 0], + "uv": { + "east": {"uv": [23, 69], "uv_size": [2, 5]}, + "west": {"uv": [25, 69], "uv_size": [2, 5]}, + "up": {"uv": [66, 25], "uv_size": [1, 2]}, + "down": {"uv": [67, 36], "uv_size": [1, -2]} + } + }, + { + "origin": [8.5425, 0, -11.07975], + "size": [0.85, 4.25, 1.7595], + "pivot": [8.9675, 2.125, -10.2], + "rotation": [67.5, 0, 0], + "uv": { + "east": {"uv": [27, 69], "uv_size": [2, 5]}, + "west": {"uv": [29, 69], "uv_size": [2, 5]}, + "up": {"uv": [39, 69], "uv_size": [1, 2]}, + "down": {"uv": [52, 73], "uv_size": [1, -2]} + } + }, + { + "origin": [8.5425, 0, -11.07975], + "size": [0.85, 4.25, 1.7595], + "pivot": [8.9675, 2.125, -10.2], + "rotation": [112.5, 0, 0], + "uv": { + "east": {"uv": [31, 69], "uv_size": [2, 5]}, + "west": {"uv": [33, 69], "uv_size": [2, 5]}, + "up": {"uv": [71, 52], "uv_size": [1, 2]}, + "down": {"uv": [53, 73], "uv_size": [1, -2]} + } + }, + { + "origin": [8.5425, 0, -11.07975], + "size": [0.85, 4.25, 1.7595], + "pivot": [8.9675, 2.125, -10.2], + "rotation": [157.5, 0, 0], + "uv": { + "east": {"uv": [35, 69], "uv_size": [2, 5]}, + "west": {"uv": [37, 69], "uv_size": [2, 5]}, + "up": {"uv": [54, 71], "uv_size": [1, 2]}, + "down": {"uv": [71, 56], "uv_size": [1, -2]} + } + }, + { + "origin": [8.5, 0.2125, -10.99177], + "size": [0.9775, 3.825, 1.58355], + "pivot": [8.9675, 2.125, -10.2], + "rotation": [22.5, 0, 0], + "uv": { + "east": {"uv": [13, 70], "uv_size": [2, 5]}, + "west": {"uv": [15, 70], "uv_size": [2, 5]}, + "up": {"uv": [72, 28], "uv_size": [1, 2]}, + "down": {"uv": [41, 74], "uv_size": [1, -2]} + } + }, + { + "origin": [8.5, 0.2125, -10.99177], + "size": [0.9775, 3.825, 1.58355], + "pivot": [8.9675, 2.125, -10.2], + "rotation": [67.5, 0, 0], + "uv": { + "east": {"uv": [9, 70], "uv_size": [2, 5]}, + "west": {"uv": [11, 70], "uv_size": [2, 5]}, + "up": {"uv": [70, 71], "uv_size": [1, 2]}, + "down": {"uv": [71, 73], "uv_size": [1, -2]} + } + }, + { + "origin": [8.5, 0.2125, -10.99177], + "size": [0.9775, 3.825, 1.58355], + "pivot": [8.9675, 2.125, -10.2], + "rotation": [112.5, 0, 0], + "uv": { + "east": {"uv": [5, 70], "uv_size": [2, 5]}, + "west": {"uv": [7, 70], "uv_size": [2, 5]}, + "up": {"uv": [71, 67], "uv_size": [1, 2]}, + "down": {"uv": [69, 73], "uv_size": [1, -2]} + } + }, + { + "origin": [8.5, 0.2125, -10.99177], + "size": [0.9775, 3.825, 1.58355], + "pivot": [8.9675, 2.125, -10.2], + "rotation": [157.5, 0, 0], + "uv": { + "east": {"uv": [69, 65], "uv_size": [2, 5]}, + "west": {"uv": [3, 70], "uv_size": [2, 5]}, + "up": {"uv": [71, 56], "uv_size": [1, 2]}, + "down": {"uv": [71, 67], "uv_size": [1, -2]} + } + } + ] + }, + { + "name": "wheel2", + "parent": "bone", + "pivot": [-8.97813, 2.125, -10.2], + "cubes": [ + { + "origin": [-9.3925, 0, -11.07975], + "size": [0.85, 4.25, 1.7595], + "pivot": [-8.9675, 2.125, -10.2], + "rotation": [22.5, 0, 0], + "uv": { + "east": {"uv": [27, 69], "uv_size": [-2, 5]}, + "west": {"uv": [25, 69], "uv_size": [-2, 5]}, + "up": {"uv": [67, 25], "uv_size": [-1, 2]}, + "down": {"uv": [68, 36], "uv_size": [-1, -2]} + } + }, + { + "origin": [-9.3925, 0, -11.07975], + "size": [0.85, 4.25, 1.7595], + "pivot": [-8.9675, 2.125, -10.2], + "rotation": [67.5, 0, 0], + "uv": { + "east": {"uv": [31, 69], "uv_size": [-2, 5]}, + "west": {"uv": [29, 69], "uv_size": [-2, 5]}, + "up": {"uv": [40, 69], "uv_size": [-1, 2]}, + "down": {"uv": [53, 73], "uv_size": [-1, -2]} + } + }, + { + "origin": [-9.3925, 0, -11.07975], + "size": [0.85, 4.25, 1.7595], + "pivot": [-8.9675, 2.125, -10.2], + "rotation": [112.5, 0, 0], + "uv": { + "east": {"uv": [35, 69], "uv_size": [-2, 5]}, + "west": {"uv": [33, 69], "uv_size": [-2, 5]}, + "up": {"uv": [72, 52], "uv_size": [-1, 2]}, + "down": {"uv": [54, 73], "uv_size": [-1, -2]} + } + }, + { + "origin": [-9.3925, 0, -11.07975], + "size": [0.85, 4.25, 1.7595], + "pivot": [-8.9675, 2.125, -10.2], + "rotation": [157.5, 0, 0], + "uv": { + "east": {"uv": [39, 69], "uv_size": [-2, 5]}, + "west": {"uv": [37, 69], "uv_size": [-2, 5]}, + "up": {"uv": [55, 71], "uv_size": [-1, 2]}, + "down": {"uv": [72, 56], "uv_size": [-1, -2]} + } + }, + { + "origin": [-9.4775, 0.2125, -10.99177], + "size": [0.9775, 3.825, 1.58355], + "pivot": [-8.9675, 2.125, -10.2], + "rotation": [22.5, 0, 0], + "uv": { + "east": {"uv": [17, 70], "uv_size": [-2, 5]}, + "west": {"uv": [15, 70], "uv_size": [-2, 5]}, + "up": {"uv": [73, 28], "uv_size": [-1, 2]}, + "down": {"uv": [42, 74], "uv_size": [-1, -2]} + } + }, + { + "origin": [-9.4775, 0.2125, -10.99177], + "size": [0.9775, 3.825, 1.58355], + "pivot": [-8.9675, 2.125, -10.2], + "rotation": [67.5, 0, 0], + "uv": { + "east": {"uv": [13, 70], "uv_size": [-2, 5]}, + "west": {"uv": [11, 70], "uv_size": [-2, 5]}, + "up": {"uv": [71, 71], "uv_size": [-1, 2]}, + "down": {"uv": [72, 73], "uv_size": [-1, -2]} + } + }, + { + "origin": [-9.4775, 0.2125, -10.99177], + "size": [0.9775, 3.825, 1.58355], + "pivot": [-8.9675, 2.125, -10.2], + "rotation": [112.5, 0, 0], + "uv": { + "east": {"uv": [9, 70], "uv_size": [-2, 5]}, + "west": {"uv": [7, 70], "uv_size": [-2, 5]}, + "up": {"uv": [72, 67], "uv_size": [-1, 2]}, + "down": {"uv": [70, 73], "uv_size": [-1, -2]} + } + }, + { + "origin": [-9.4775, 0.2125, -10.99177], + "size": [0.9775, 3.825, 1.58355], + "pivot": [-8.9675, 2.125, -10.2], + "rotation": [157.5, 0, 0], + "uv": { + "east": {"uv": [5, 70], "uv_size": [-2, 5]}, + "west": {"uv": [71, 65], "uv_size": [-2, 5]}, + "up": {"uv": [72, 56], "uv_size": [-1, 2]}, + "down": {"uv": [72, 67], "uv_size": [-1, -2]} + } + } + ] + }, + { + "name": "wheel3", + "parent": "bone", + "pivot": [-8.97813, 2.125, 10.2], + "cubes": [ + { + "origin": [-9.3925, 0, 9.32025], + "size": [0.85, 4.25, 1.7595], + "pivot": [-8.9675, 2.125, 10.2], + "rotation": [-22.5, 0, 0], + "uv": { + "east": {"uv": [25, 69], "uv_size": [2, 5]}, + "west": {"uv": [23, 69], "uv_size": [2, 5]}, + "up": {"uv": [67, 27], "uv_size": [-1, -2]}, + "down": {"uv": [68, 34], "uv_size": [-1, 2]} + } + }, + { + "origin": [-9.3925, 0, 9.32025], + "size": [0.85, 4.25, 1.7595], + "pivot": [-8.9675, 2.125, 10.2], + "rotation": [-67.5, 0, 0], + "uv": { + "east": {"uv": [29, 69], "uv_size": [2, 5]}, + "west": {"uv": [27, 69], "uv_size": [2, 5]}, + "up": {"uv": [40, 71], "uv_size": [-1, -2]}, + "down": {"uv": [53, 71], "uv_size": [-1, 2]} + } + }, + { + "origin": [-9.3925, 0, 9.32025], + "size": [0.85, 4.25, 1.7595], + "pivot": [-8.9675, 2.125, 10.2], + "rotation": [-112.5, 0, 0], + "uv": { + "east": {"uv": [33, 69], "uv_size": [2, 5]}, + "west": {"uv": [31, 69], "uv_size": [2, 5]}, + "up": {"uv": [72, 54], "uv_size": [-1, -2]}, + "down": {"uv": [54, 71], "uv_size": [-1, 2]} + } + }, + { + "origin": [-9.3925, 0, 9.32025], + "size": [0.85, 4.25, 1.7595], + "pivot": [-8.9675, 2.125, 10.2], + "rotation": [-157.5, 0, 0], + "uv": { + "east": {"uv": [37, 69], "uv_size": [2, 5]}, + "west": {"uv": [35, 69], "uv_size": [2, 5]}, + "up": {"uv": [55, 73], "uv_size": [-1, -2]}, + "down": {"uv": [72, 54], "uv_size": [-1, 2]} + } + }, + { + "origin": [-9.4775, 0.2125, 9.40823], + "size": [0.9775, 3.825, 1.58355], + "pivot": [-8.9675, 2.125, 10.2], + "rotation": [-22.5, 0, 0], + "uv": { + "east": {"uv": [15, 70], "uv_size": [2, 5]}, + "west": {"uv": [13, 70], "uv_size": [2, 5]}, + "up": {"uv": [73, 30], "uv_size": [-1, -2]}, + "down": {"uv": [42, 72], "uv_size": [-1, 2]} + } + }, + { + "origin": [-9.4775, 0.2125, 9.40823], + "size": [0.9775, 3.825, 1.58355], + "pivot": [-8.9675, 2.125, 10.2], + "rotation": [-67.5, 0, 0], + "uv": { + "east": {"uv": [11, 70], "uv_size": [2, 5]}, + "west": {"uv": [9, 70], "uv_size": [2, 5]}, + "up": {"uv": [71, 73], "uv_size": [-1, -2]}, + "down": {"uv": [72, 71], "uv_size": [-1, 2]} + } + }, + { + "origin": [-9.4775, 0.2125, 9.40823], + "size": [0.9775, 3.825, 1.58355], + "pivot": [-8.9675, 2.125, 10.2], + "rotation": [-112.5, 0, 0], + "uv": { + "east": {"uv": [7, 70], "uv_size": [2, 5]}, + "west": {"uv": [5, 70], "uv_size": [2, 5]}, + "up": {"uv": [72, 69], "uv_size": [-1, -2]}, + "down": {"uv": [70, 71], "uv_size": [-1, 2]} + } + }, + { + "origin": [-9.4775, 0.2125, 9.40823], + "size": [0.9775, 3.825, 1.58355], + "pivot": [-8.9675, 2.125, 10.2], + "rotation": [-157.5, 0, 0], + "uv": { + "east": {"uv": [3, 70], "uv_size": [2, 5]}, + "west": {"uv": [69, 65], "uv_size": [2, 5]}, + "up": {"uv": [72, 58], "uv_size": [-1, -2]}, + "down": {"uv": [72, 65], "uv_size": [-1, 2]} + } + } + ] + }, + { + "name": "wheel4", + "parent": "bone", + "pivot": [8.97813, 2.125, 10.2], + "cubes": [ + { + "origin": [8.5425, 0, 9.32025], + "size": [0.85, 4.25, 1.7595], + "pivot": [8.9675, 2.125, 10.2], + "rotation": [-22.5, 0, 0], + "uv": { + "east": {"uv": [25, 69], "uv_size": [-2, 5]}, + "west": {"uv": [27, 69], "uv_size": [-2, 5]}, + "up": {"uv": [66, 27], "uv_size": [1, -2]}, + "down": {"uv": [67, 34], "uv_size": [1, 2]} + } + }, + { + "origin": [8.5425, 0, 9.32025], + "size": [0.85, 4.25, 1.7595], + "pivot": [8.9675, 2.125, 10.2], + "rotation": [-67.5, 0, 0], + "uv": { + "east": {"uv": [29, 69], "uv_size": [-2, 5]}, + "west": {"uv": [31, 69], "uv_size": [-2, 5]}, + "up": {"uv": [39, 71], "uv_size": [1, -2]}, + "down": {"uv": [52, 71], "uv_size": [1, 2]} + } + }, + { + "origin": [8.5425, 0, 9.32025], + "size": [0.85, 4.25, 1.7595], + "pivot": [8.9675, 2.125, 10.2], + "rotation": [-112.5, 0, 0], + "uv": { + "east": {"uv": [33, 69], "uv_size": [-2, 5]}, + "west": {"uv": [35, 69], "uv_size": [-2, 5]}, + "up": {"uv": [71, 54], "uv_size": [1, -2]}, + "down": {"uv": [53, 71], "uv_size": [1, 2]} + } + }, + { + "origin": [8.5425, 0, 9.32025], + "size": [0.85, 4.25, 1.7595], + "pivot": [8.9675, 2.125, 10.2], + "rotation": [-157.5, 0, 0], + "uv": { + "east": {"uv": [37, 69], "uv_size": [-2, 5]}, + "west": {"uv": [39, 69], "uv_size": [-2, 5]}, + "up": {"uv": [54, 73], "uv_size": [1, -2]}, + "down": {"uv": [71, 54], "uv_size": [1, 2]} + } + }, + { + "origin": [8.5, 0.2125, 9.40823], + "size": [0.9775, 3.825, 1.58355], + "pivot": [8.9675, 2.125, 10.2], + "rotation": [-22.5, 0, 0], + "uv": { + "east": {"uv": [15, 70], "uv_size": [-2, 5]}, + "west": {"uv": [17, 70], "uv_size": [-2, 5]}, + "up": {"uv": [72, 30], "uv_size": [1, -2]}, + "down": {"uv": [41, 72], "uv_size": [1, 2]} + } + }, + { + "origin": [8.5, 0.2125, 9.40823], + "size": [0.9775, 3.825, 1.58355], + "pivot": [8.9675, 2.125, 10.2], + "rotation": [-67.5, 0, 0], + "uv": { + "east": {"uv": [11, 70], "uv_size": [-2, 5]}, + "west": {"uv": [13, 70], "uv_size": [-2, 5]}, + "up": {"uv": [70, 73], "uv_size": [1, -2]}, + "down": {"uv": [71, 71], "uv_size": [1, 2]} + } + }, + { + "origin": [8.5, 0.2125, 9.40823], + "size": [0.9775, 3.825, 1.58355], + "pivot": [8.9675, 2.125, 10.2], + "rotation": [-112.5, 0, 0], + "uv": { + "east": {"uv": [7, 70], "uv_size": [-2, 5]}, + "west": {"uv": [9, 70], "uv_size": [-2, 5]}, + "up": {"uv": [71, 69], "uv_size": [1, -2]}, + "down": {"uv": [69, 71], "uv_size": [1, 2]} + } + }, + { + "origin": [8.5, 0.2125, 9.40823], + "size": [0.9775, 3.825, 1.58355], + "pivot": [8.9675, 2.125, 10.2], + "rotation": [-157.5, 0, 0], + "uv": { + "east": {"uv": [71, 65], "uv_size": [-2, 5]}, + "west": {"uv": [5, 70], "uv_size": [-2, 5]}, + "up": {"uv": [71, 58], "uv_size": [1, -2]}, + "down": {"uv": [71, 65], "uv_size": [1, 2]} + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/superbwarfare/textures/entity/tom_6.png b/src/main/resources/assets/superbwarfare/textures/entity/tom_6.png new file mode 100644 index 0000000000000000000000000000000000000000..bc225322e31e3fc78ae4b341b485ffd1bfe48a02 GIT binary patch literal 5191 zcmcIo_d6So*NvU3t%yy{8kHEew<4;PirOpM8ntR~K}m>NE!EmSs69$;u_=ww(x?%n zq=cgOe*66+-upcFo}bTo?)l*y)FTrEdRi`8002M_HPkczhcW+KAoai7ui-rQ56Jw@ z4RiptSe^|4;1(HFPun8o!?yj`G~Oqc*NbUkb>C9GhFFI5{|vlUgCm`b#dVZ)#?ek= zv#Xj~)i|`MWXp?KoX`~+``h$MLoMNF+5;o(EJ-?LDB0YM*El}i96!-*zu=y*z#V5Z z;zICdP*>fbA3?;!OK4E=kB&e`Sf2mHaof|Vvon%>Dl-DO1foN0Kb58f$WjaFP-^Lc z0oBc5Jplj#WX4(~7)#jayGKvyO21bG_Po%#U| zH&LdD79X|^o6bh&nVBNph>_pe`IS(SCLzvD<`T@qT!T>_7gW_n~h)i(0zbxn6bzKP7)48Jj;BCFx(XH zh^><>?a7)aUp=l+n`ehT3}{3Xy9tuEP%!rMy%a`B-~15+eGJCjblt-x9zN=R;xjSv zjWdo(NC$m6enP&|1p(lZ8`jMmFH@i%TK%9nBTJOZb$up=>997+waQ-aDo*S*{^@wv zuVe*B59DD`aBQ zb=#Q`9FZuQTMpOGa;k-C^(K)1PmsuTSYDlX21`@v;Or~s zOmbU}1i&Um0daWx!eu0hiz%308h-7w7`^0%#wZ&aHiLN#2_E{+yBf$=VEPu zKC7a@Vg8tpad%PC^Wu>4uYxA;Ahi|bCHeZQW7MW!o6&F8<2NZt)05ymN{#u?yk)=r zX%N}Z9CmuHRyicw_v=JcMMA_Vu{UZpcewGvwV>#47BN~KNmR)MD+{fHlRvEIr_Ys3 z+&)Q0UNt=36Z=sY=Q0p|c|qL3Rc^=1;jgbyhgoThz|#C(a9AgzL^N%Zz|aysk#KmW zCA=d)M>UKEQ0D zXyMMKUrO+wAoaN5KP<*p2!N)CJbh zx+w9u`1`Xuh957odS2ele^090=j_#3=vIcD@u_jHTrup{RMia13|!652>wym z7lVhKKdYMGaLn39+&M&WI&_3EpP!$D(uM(IiAZrM`Hp&SnY&~uS{qnY^B>yFuDDX- z#fukG`ymdX&hMBxsjnS$w>dJ6g$UIjVy-$E8#jIIYyC)#z5keo7oc~Sp&eg_3uu&950qTH853$3%p70fNjflULfL(k+bSgLO6$M-3I1^xZ^L(cuWUm`|f#gRL z8+|{!YKi(?P_?-L%FuML~pXKm;~@m~zz?e<&z&q~WvyoLB*CfI&7AbHj2LM4>rOd^^lBeHjtml-4(3*^Z2!pK$&f;L>&DfJG z7FJ*Tk`*0X?u{NZ=||4vt(~G({D6r5`#0;^;j`{09spQd_ASd1iNc~sSgxZ~0A|Pb{n%s=|Dv2@rs&Y(WQ;QO_dxxFz@qFrz5!KMl|Gklo`D;-;9FCZ9DE3y3ZzIj{Q5# zMXL^qQ)zH-w7_kPA&g;@8+vp#4Iq(0IaG*ZCcv4>S>_Xys0^$5K_bu6VReJo+wT>8 zpC4U(OOjWtz8^^YJx+ax2OE+`zeDD!jqO#XA@FQD#WeWisOmlGJUpFgD3o?qTHlMa zG~0i|u6SadWhl4q(FeV!J{K%}R>nDuw7KN|h#yufOJzRayy#-O)gZPPg)q4QzSe3> z4L#hI#aY<*N}4j{30Q4h`C*;GAdD&vk*Bk{qSIhaJz=RNlYlMy%NJLvv!>qZ{}E!L zM%nMpuJ@{f-JiM5ED)=&oF*fYXS&$p6JRsgKJw0Kl?59Lct`4h!ElulAfj(VS8iS+ zeCz&mo z4{gutLzX4J46JK|WE_76&{1zg;}!L^(9kUwX5?#rZ7-x#TX`+2fu4h#qK-fs5@*iT)mGV<3he&Go5r2B9T z#v)wwepOrcpUp``YrX_M2?$QAXt6yBSme%D{6{zcyEXg0 zWCst`U-B4R>r+T<^}{NMgHJE0bZ5yssc2hul|U36@G&(zapsv8iIIaYc~`C=p^TKN zOSKGpvlNZu9OKnrxK)s*`}?>Xj*9g8+dJj=PJ$=$w@Z^vb)Tm54+B}r6B;Ri+)SI5s`P1Isid>%l1+2N<{%FYA6a)Ge)bT}PEzwQM*EO$SE1*2f_^E!@ z?~PP3LF4kHpBo=K$RScK$*}#=>f2Y3Z99$JI0d9*0}~RP>#@yj(t^ewC)UyfOv{}< z_y2jO&$KvGoy?`d>pLw+v8e2`d8~*|)fUh9HvPXhZ$r+Gz~&9FG_01osg2IkEqOh5 zgkE}k>-#S*=QVG~HM0+>TDwOt?qaP0)1agV7@I`KEoC`3oNxS3ozyIesdvh|4KY%W zhlzaRd>d_u(AgeXLMe>S4KZ805}sv);IH~MRkyFK8F?AVWs@xFSwWl0?3O~N{6pi> z+?a_aggfSucRuUhm%FaF_3%lS=2}m9IOU!aA#0(+j7~{ng_ zSi>w}R0i>6^Nd-{viGSD6U;sCIwJ+N#TO-8lT^Q>Ga#s`{QeK)`1UaJ7S`@pM(ZQM zySJuXtcBwO?_To4UvLYBRR?>K)vduq}=q$-@;io zhv%y*g0^cVx+s6hnd@WMRVgR8TnjEy^ZPqV%BG2=f_rkC=%m~0zQrx;dXzWMoGF+$ z%e3i=I^GrA?70ViMDn%@B>)E6y|)vjj$~9(HoQ|L#66}#y4T8|;y05itk&*)&}WXa zu!0+Nk3Dw;SuggOj3wbeR0lQRfDhhz`cP^PYPU&VHV5c}vzetpV*EQlhepwO8U7r1 zZtP!%*Q#4RpwtMhOudFcqL$HqUy*Vb5g*Zf5?tF%@%_E7fZrw6<&j3fLeu!NYW-S= zj#a}FqswwWi`D2sXu~Iw!}r7MgI$lWU1u^HPreEw@igj;qi;#-YYvDwvnpA@f5Or% zE7awgKN{E{Iq`CYQy1T(mwJ_3X#dTvK35@~4$6i2I=O^-= z%iU+^sojvvE(0;I)u6;N4_2W^wA#W!6Pgrt-CsaF4?fw6m6fr@J2iN@(K7UL&(P}6 z_8Imjs#)Y!Gsl_DQMPMfR27{+z?`+OqqyQOj^>*32&K34R7?behL+r>Eo-A|C4WjV z9Id2mGECoiM-dvieb-1pKP9=c)06Z1!{37jJzfsA=vPAy8NkKz@g`SE86pccHe{H0ApIc8@0+l#_EMslWX;M#%)rin+c$G=MQ$=Ri53c{ zn~#FRd6;0+1ox3ZlP0oa39F3oNfyIe({&srgC0-XDs_GUW8c`!{o8s$6kgvj%GtNW z2dY4BD24S-gxMLZox84wNYECtb6Lofl@vfZsyXvw`r|AtU4q~KOPQcUvRQm~DEUJN z^o?AHC#~4s>qNdOBT9MtTKdEq$7-qQ{+-@P@PB%n7rw~%MC?O7pJ#{(qls=6o|ZtA zHLZ$Ba+q)oVYb=rOtA!AIWqIiSc`M-28Q)*EL)Fi$lNhC72te9B6@m>8JBp<{#Ihr zcr_x`d&_nuSzwK$^ytwRy`@;BYR)KR)ZiD=df2Sd*+Q^l_L?Kr?NC)9kS&@Gyzl*A z?_<7H+pMZ)?dEtSn|j@ojq*VC4F#u#kkd79uY%?iXqs!A84UOO-n~?RJ<-e%4M_ax z{FEtTDjP0JF(SdNXp*b4zP1n$9pk;2PeWMHdqP@@i->y5)LvJ}$bY46dAx!|%p8kemC^_>5lIE>`)KH?f=J!n7Sk=yz1r|VWZl#$b`=HfxJ z`G^QLcCse_b!R2+o2kcn_TY}4hoh(#q>nKXDJXy*#?8+^z#lhVULLIbkWbGl=6g}J zQG;H$j3b(H7Ig(a$ldj$Bb0FakR6-To1JkQB1>kLVmh)X<`($N&mVkx_=`s8!A2y( zuQC+$p#Fgxup4Xtmgh%k5B~L^FT7O#oLcy{ubY(Rf*!HYr=8eK8O{1I--Zm{^k6bG z1&}tAW`^!Ewl4XBy>`@0ZqboTakA4-g{0xK!?*PdpLO0LsGc+Xn)VhW+w28aw(4TW zf_SWOKc`$m|BUeq!=#86bcFGpkz3W0dmY zz`mU5wvjD#n6tRl zozM(9efr(BpbUby++G~px{`L#S_=35mmpa$*C$F`MCj`8s3ujwr`01Cat@0V9}G!3 zOhN|Pt&SsOEk()X@736&{#;Z@?84Z8+wnV|J zH(-n(jgh5t&q%VpxBOn?tMNPc6Uk_u8iqIU-;xe%L$-Qz9?!FUtTqjW to_>VKBuGczkfoaYURn76Kg+ni>+Ha;C=!zN=3g@ifZjLJtJQIe{XZEN4{HDb literal 0 HcmV?d00001 From e8afe454a04583cbc3131153dd358b0e4d16fe3f Mon Sep 17 00:00:00 2001 From: Atsuihsio <842960157@qq.com> Date: Wed, 22 Jan 2025 19:13:33 +0800 Subject: [PATCH 11/12] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B1=A4=E5=A7=866?= =?UTF-8?q?=E6=8A=95=E5=BC=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/MelonBombEntityRenderer.java | 41 ++++++++ .../client/renderer/entity/Tom6Renderer.java | 12 +++ .../entity/projectile/MelonBombEntity.java | 81 ++++++++++++++++ .../entity/vehicle/Ah6Entity.java | 5 +- .../entity/vehicle/Tom6Entity.java | 93 ++++++++++++++----- .../superbwarfare/init/ModEntities.java | 4 +- .../init/ModEntityRenderers.java | 1 + .../mixins/MouseHandlerMixin.java | 8 +- 8 files changed, 217 insertions(+), 28 deletions(-) create mode 100644 src/main/java/com/atsuishio/superbwarfare/client/renderer/entity/MelonBombEntityRenderer.java create mode 100644 src/main/java/com/atsuishio/superbwarfare/entity/projectile/MelonBombEntity.java diff --git a/src/main/java/com/atsuishio/superbwarfare/client/renderer/entity/MelonBombEntityRenderer.java b/src/main/java/com/atsuishio/superbwarfare/client/renderer/entity/MelonBombEntityRenderer.java new file mode 100644 index 000000000..dd9d94465 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/client/renderer/entity/MelonBombEntityRenderer.java @@ -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 { + + 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; + } +} diff --git a/src/main/java/com/atsuishio/superbwarfare/client/renderer/entity/Tom6Renderer.java b/src/main/java/com/atsuishio/superbwarfare/client/renderer/entity/Tom6Renderer.java index 65a4c03f1..93d110fbf 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/renderer/entity/Tom6Renderer.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/renderer/entity/Tom6Renderer.java @@ -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 { public Tom6Renderer(EntityRendererProvider.Context renderManager) { @@ -43,4 +46,13 @@ public class Tom6Renderer extends GeoEntityRenderer { 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); + } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/MelonBombEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/MelonBombEntity.java new file mode 100644 index 000000000..af1d9dd15 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/MelonBombEntity.java @@ -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 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 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; + } +} diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java index 6f5349736..33f935530 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java @@ -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) { diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java index 74a53e020..3232c51b7 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java @@ -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 DELTA_ROT = SynchedEntityData.defineId(Tom6Entity.class, EntityDataSerializers.FLOAT); + public static final EntityDataAccessor 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); diff --git a/src/main/java/com/atsuishio/superbwarfare/init/ModEntities.java b/src/main/java/com/atsuishio/superbwarfare/init/ModEntities.java index 1a0a03c07..fa269d51b 100644 --- a/src/main/java/com/atsuishio/superbwarfare/init/ModEntities.java +++ b/src/main/java/com/atsuishio/superbwarfare/init/ModEntities.java @@ -77,7 +77,9 @@ public class ModEntities { public static final RegistryObject> LAV_150 = register("lav_150", EntityType.Builder.of(Lav150Entity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(3).setCustomClientFactory(Lav150Entity::new).fireImmune().sized(2.8f, 3.1f)); public static final RegistryObject> TOM_6 = register("tom_6", - EntityType.Builder.of(Tom6Entity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(3).setCustomClientFactory(Tom6Entity::new).fireImmune().sized(1.15f, 1.0f)); + EntityType.Builder.of(Tom6Entity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(3).setCustomClientFactory(Tom6Entity::new).fireImmune().sized(1.05f, 1.0f)); + public static final RegistryObject> MELON_BOMB = register("melon_bomb", + EntityType.Builder.of(MelonBombEntity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(1).setCustomClientFactory(MelonBombEntity::new).sized(1f, 1f)); private static RegistryObject> register(String name, EntityType.Builder entityTypeBuilder) { return REGISTRY.register(name, () -> entityTypeBuilder.build(name)); diff --git a/src/main/java/com/atsuishio/superbwarfare/init/ModEntityRenderers.java b/src/main/java/com/atsuishio/superbwarfare/init/ModEntityRenderers.java index 61c90823d..241a45001 100644 --- a/src/main/java/com/atsuishio/superbwarfare/init/ModEntityRenderers.java +++ b/src/main/java/com/atsuishio/superbwarfare/init/ModEntityRenderers.java @@ -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); } } diff --git a/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java b/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java index a894e7192..c8509dff5 100644 --- a/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java +++ b/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java @@ -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; } From 6d66180fa24b388047feab159da6f55d4ec6fce3 Mon Sep 17 00:00:00 2001 From: Atsuihsio <842960157@qq.com> Date: Wed, 22 Jan 2025 21:00:00 +0800 Subject: [PATCH 12/12] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B1=A4=E5=A7=86?= =?UTF-8?q?=E9=A3=9E=E6=9C=BA=E5=92=8C=E8=A5=BF=E7=93=9C=E8=88=AA=E5=BC=B9?= =?UTF-8?q?=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/projectile/MelonBombEntity.java | 22 ++---- .../entity/vehicle/Tom6Entity.java | 73 ++++++++++++++++--- .../assets/superbwarfare/lang/en_us.json | 2 + .../assets/superbwarfare/lang/zh_cn.json | 2 + 4 files changed, 74 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/MelonBombEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/MelonBombEntity.java index af1d9dd15..fb95674ea 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/MelonBombEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/MelonBombEntity.java @@ -10,7 +10,7 @@ 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.minecraft.world.phys.BlockHitResult; import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.PlayMessages; @@ -44,18 +44,10 @@ public class MelonBombEntity extends ThrowableItemProjectile { } @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; - } + public void onHitBlock(BlockHitResult blockHitResult) { + super.onHitBlock(blockHitResult); + ProjectileTool.causeCustomExplode(this, 1000, 16, 1.5f); + this.discard(); } @Override @@ -64,7 +56,7 @@ public class MelonBombEntity extends ThrowableItemProjectile { if (tickCount > 600) { this.discard(); if (!this.level().isClientSide) { - ProjectileTool.causeCustomExplode(this, 1200, 24, 1.2f); + ProjectileTool.causeCustomExplode(this, 1000, 16, 1.5f); } } @@ -76,6 +68,6 @@ public class MelonBombEntity extends ThrowableItemProjectile { @Override protected float getGravity() { - return 0.06F; + return 0.05F; } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java index 3232c51b7..c86f683e3 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java @@ -24,10 +24,12 @@ 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.LivingEntity; 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.event.ForgeEventFactory; import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.PlayMessages; import org.jetbrains.annotations.NotNull; @@ -39,6 +41,8 @@ import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache import software.bernie.geckolib.core.animation.AnimatableManager; import software.bernie.geckolib.util.GeckoLibUtil; +import java.util.List; + public class Tom6Entity extends MobileVehicleEntity implements GeoEntity { public static final EntityDataAccessor DELTA_ROT = SynchedEntityData.defineId(Tom6Entity.class, EntityDataSerializers.FLOAT); public static final EntityDataAccessor MELON = SynchedEntityData.defineId(Tom6Entity.class, EntityDataSerializers.BOOLEAN); @@ -82,6 +86,9 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity { @Override public boolean hurt(DamageSource source, float amount) { super.hurt(source, amount); + if (source.is(ModDamageTypes.VEHICLE_STRIKE)) { + amount *= 2f; + } this.level().playSound(null, this.getOnPos(), ModSounds.HIT.get(), SoundSource.PLAYERS, 1, 1); this.hurt(amount); return true; @@ -154,7 +161,7 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity { 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()) { + if (upInputDown && !onGround() && entityData.get(MELON)) { entityData.set(MELON, false); Matrix4f transform = getVehicleTransform(); @@ -163,6 +170,7 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity { MelonBombEntity melonBomb = new MelonBombEntity(player, player.level()); melonBomb.setPos(worldPosition.x, worldPosition.y, worldPosition.z); + melonBomb.shoot(this.getDeltaMovement().x, this.getDeltaMovement().y, this.getDeltaMovement().z, 0.96f * (float)this.getDeltaMovement().length(), 0); passenger.level().addFreshEntity(melonBomb); this.level().playSound(null, this.getOnPos(), SoundEvents.IRON_DOOR_OPEN, SoundSource.PLAYERS, 1, 1); @@ -193,9 +201,9 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity { this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) * 0.95f); this.setDeltaMovement(this.getDeltaMovement().add( - Mth.sin(-this.getYRot() * 0.017453292F) * (entityData.get(MELON) ? 0.14f : 0.16f) * this.entityData.get(POWER), + Mth.sin(-this.getYRot() * 0.017453292F) * (entityData.get(MELON) ? 0.16f : 0.19f) * 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) + Mth.cos(this.getYRot() * 0.017453292F) * (entityData.get(MELON) ? 0.16f : 0.19f) * this.entityData.get(POWER) )); } @@ -265,15 +273,60 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity { @Override public void destroy() { Entity attacker = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_ATTACKER_UUID)); + if (this.crash) { + List passengers = this.getPassengers(); + for (var entity : passengers) { + if (entity instanceof LivingEntity living) { + var tempAttacker = living == attacker ? null : attacker; + + living.hurt(ModDamageTypes.causeAirCrashDamage(this.level().registryAccess(), null, tempAttacker), Integer.MAX_VALUE); + living.invulnerableTime = 0; + living.hurt(ModDamageTypes.causeAirCrashDamage(this.level().registryAccess(), null, tempAttacker), Integer.MAX_VALUE); + living.invulnerableTime = 0; + living.hurt(ModDamageTypes.causeAirCrashDamage(this.level().registryAccess(), null, tempAttacker), Integer.MAX_VALUE); + living.invulnerableTime = 0; + living.hurt(ModDamageTypes.causeAirCrashDamage(this.level().registryAccess(), null, tempAttacker), Integer.MAX_VALUE); + living.invulnerableTime = 0; + living.hurt(ModDamageTypes.causeAirCrashDamage(this.level().registryAccess(), null, tempAttacker), Integer.MAX_VALUE); + } + } + } else { + List passengers = this.getPassengers(); + for (var entity : passengers) { + if (entity instanceof LivingEntity living) { + var tempAttacker = living == attacker ? null : attacker; + + living.hurt(ModDamageTypes.causeVehicleExplosionDamage(this.level().registryAccess(), null, tempAttacker), Integer.MAX_VALUE); + living.invulnerableTime = 0; + living.hurt(ModDamageTypes.causeVehicleExplosionDamage(this.level().registryAccess(), null, tempAttacker), Integer.MAX_VALUE); + living.invulnerableTime = 0; + living.hurt(ModDamageTypes.causeVehicleExplosionDamage(this.level().registryAccess(), null, tempAttacker), Integer.MAX_VALUE); + living.invulnerableTime = 0; + living.hurt(ModDamageTypes.causeVehicleExplosionDamage(this.level().registryAccess(), null, tempAttacker), Integer.MAX_VALUE); + living.invulnerableTime = 0; + living.hurt(ModDamageTypes.causeVehicleExplosionDamage(this.level().registryAccess(), null, tempAttacker), Integer.MAX_VALUE); + } + } + } 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()); + if (entityData.get(MELON)) { + CustomExplosion explosion = new CustomExplosion(this.level(), this, + ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), this, attacker), 1100.0f, + this.getX(), this.getY(), this.getZ(), 16f, ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1); + explosion.explode(); + ForgeEventFactory.onExplosionStart(this.level(), explosion); + explosion.finalizeExplosion(false); + ParticleTool.spawnHugeExplosionParticles(this.level(), this.position()); + } else { + CustomExplosion explosion = new CustomExplosion(this.level(), this, + ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), this, attacker), 15.0f, + this.getX(), this.getY(), this.getZ(), 2f, ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1); + explosion.explode(); + ForgeEventFactory.onExplosionStart(this.level(), explosion); + explosion.finalizeExplosion(false); + ParticleTool.spawnMediumExplosionParticles(this.level(), this.position()); + } } this.discard(); diff --git a/src/main/resources/assets/superbwarfare/lang/en_us.json b/src/main/resources/assets/superbwarfare/lang/en_us.json index b0ec6aed6..85b3119cf 100644 --- a/src/main/resources/assets/superbwarfare/lang/en_us.json +++ b/src/main/resources/assets/superbwarfare/lang/en_us.json @@ -396,6 +396,8 @@ "entity.superbwarfare.ah_6": "AH-6 Little Bird", "entity.superbwarfare.lav_150": "LAV-150 Commando", "entity.minecraft.villager.superbwarfare.armory": "Armory", + "entity.superbwarfare.tom_6": "Tom F6F", + "entity.superbwarfare.melon_bomb": "Melon Bomb", "key.categories.superbwarfare": "Superb Warfare", "key.superbwarfare.hold_zoom": "Zoom(Hold)", diff --git a/src/main/resources/assets/superbwarfare/lang/zh_cn.json b/src/main/resources/assets/superbwarfare/lang/zh_cn.json index 2f45dfe47..a64325073 100644 --- a/src/main/resources/assets/superbwarfare/lang/zh_cn.json +++ b/src/main/resources/assets/superbwarfare/lang/zh_cn.json @@ -394,6 +394,8 @@ "entity.superbwarfare.ah_6": "AH-6 小鸟直升机", "entity.superbwarfare.lav_150": "LAV-150 Commando", "entity.minecraft.villager.superbwarfare.armory": "军械师", + "entity.superbwarfare.tom_6": "汤姆 F6F", + "entity.superbwarfare.melon_bomb": "西瓜航弹", "key.categories.superbwarfare": "卓越前线", "key.superbwarfare.hold_zoom": "瞄准(按住)",