From 79743d316c646ed1e65ae2a0d2a324ea67049a94 Mon Sep 17 00:00:00 2001 From: Atsuishio <842960157@qq.com> Date: Fri, 18 Apr 2025 15:01:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=BD=BD=E5=85=B7=E7=A2=B0?= =?UTF-8?q?=E6=92=9E=E6=96=B9=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aea51f45d35dbbd3220b84682ce1417a457a0246 | 4 +-- .../tags/block/soft_collision.json | 3 --- .../datagen/ModBlockTagProvider.java | 6 ++--- .../vehicle/base/MobileVehicleEntity.java | 27 +++---------------- 4 files changed, 9 insertions(+), 31 deletions(-) diff --git a/src/generated/resources/.cache/aea51f45d35dbbd3220b84682ce1417a457a0246 b/src/generated/resources/.cache/aea51f45d35dbbd3220b84682ce1417a457a0246 index ce5416fbb..75420a444 100644 --- a/src/generated/resources/.cache/aea51f45d35dbbd3220b84682ce1417a457a0246 +++ b/src/generated/resources/.cache/aea51f45d35dbbd3220b84682ce1417a457a0246 @@ -1,7 +1,7 @@ -// 1.21.1 2025-04-07T06:12:27.7140791 Tags for minecraft:block mod id superbwarfare +// 1.21.1 2025-04-18T21:42:41.5729186 Tags for minecraft:block mod id superbwarfare 0acfd31854bf15f2c108138b3df7206bd2593e6b data/minecraft/tags/block/mineable/axe.json 8965b7e0b3f7494b78b596ed00b9721b483b0796 data/minecraft/tags/block/mineable/pickaxe.json 3da7f021790388a122717f16f51c7ec5232eebcb data/minecraft/tags/block/mineable/shovel.json f42a8c01336e64b74da966f03d45ee0d60ac5d6b data/minecraft/tags/block/needs_iron_tool.json 32d65f7120acb277f54e1a7d4f6163456b9d1030 data/superbwarfare/tags/block/hard_collision.json -72e1c9e318d4c8df58bc2b667c48ddb3c1e2d747 data/superbwarfare/tags/block/soft_collision.json +68e02f66c2338932da61ce57dde5221401b9340c data/superbwarfare/tags/block/soft_collision.json diff --git a/src/generated/resources/data/superbwarfare/tags/block/soft_collision.json b/src/generated/resources/data/superbwarfare/tags/block/soft_collision.json index 89fb94d0f..20934ada5 100644 --- a/src/generated/resources/data/superbwarfare/tags/block/soft_collision.json +++ b/src/generated/resources/data/superbwarfare/tags/block/soft_collision.json @@ -1,6 +1,5 @@ { "values": [ - "#minecraft:leaves", "#minecraft:fences", "#minecraft:fence_gates", "#minecraft:doors", @@ -10,7 +9,6 @@ "#minecraft:stairs", "#minecraft:slabs", "#c:glass_panes", - "minecraft:cactus", "minecraft:bamboo", "minecraft:melon", "minecraft:pumpkin", @@ -18,7 +16,6 @@ "minecraft:bell", "minecraft:chain", "minecraft:snow_block", - "minecraft:cobweb", "minecraft:mushroom_stem", "minecraft:brown_mushroom_block", "minecraft:red_mushroom_block" diff --git a/src/main/java/com/atsuishio/superbwarfare/datagen/ModBlockTagProvider.java b/src/main/java/com/atsuishio/superbwarfare/datagen/ModBlockTagProvider.java index f698d27e8..d4c1069d3 100644 --- a/src/main/java/com/atsuishio/superbwarfare/datagen/ModBlockTagProvider.java +++ b/src/main/java/com/atsuishio/superbwarfare/datagen/ModBlockTagProvider.java @@ -38,10 +38,10 @@ public class ModBlockTagProvider extends BlockTagsProvider { this.tag(BlockTags.MINEABLE_WITH_SHOVEL).add(ModBlocks.SANDBAG.get()); this.tag(ModTags.Blocks.SOFT_COLLISION) - .addTags(BlockTags.LEAVES, BlockTags.FENCES, BlockTags.FENCE_GATES, BlockTags.DOORS, BlockTags.TRAPDOORS, BlockTags.WALLS, BlockTags.WOOL, + .addTags(BlockTags.FENCES, BlockTags.FENCE_GATES, BlockTags.DOORS, BlockTags.TRAPDOORS, BlockTags.WALLS, BlockTags.WOOL, BlockTags.STAIRS, BlockTags.SLABS, Tags.Blocks.GLASS_PANES) - .add(Blocks.CACTUS, Blocks.BAMBOO, Blocks.MELON, Blocks.PUMPKIN, Blocks.HAY_BLOCK, Blocks.BELL, Blocks.CHAIN, Blocks.SNOW_BLOCK, - Blocks.COBWEB, Blocks.MUSHROOM_STEM, Blocks.BROWN_MUSHROOM_BLOCK, Blocks.RED_MUSHROOM_BLOCK); + .add(Blocks.BAMBOO, Blocks.MELON, Blocks.PUMPKIN, Blocks.HAY_BLOCK, Blocks.BELL, Blocks.CHAIN, Blocks.SNOW_BLOCK, + Blocks.MUSHROOM_STEM, Blocks.BROWN_MUSHROOM_BLOCK, Blocks.RED_MUSHROOM_BLOCK); this.tag(ModTags.Blocks.HARD_COLLISION) .addTags(BlockTags.LOGS, BlockTags.PLANKS, Tags.Blocks.GLASS_BLOCKS) diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/MobileVehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/MobileVehicleEntity.java index e6d4bb27c..ad9f8d794 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/MobileVehicleEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/MobileVehicleEntity.java @@ -21,6 +21,7 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; +import net.minecraft.tags.BlockTags; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -224,7 +225,7 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements } this.move(MoverType.SELF, this.getDeltaMovement()); - collideLilyPadBlock(); + baseCollideBlock(); this.refreshDimensions(); } @@ -232,7 +233,6 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements public void releaseSmokeDecoy() { if (decoyInputDown) { if (this.entityData.get(DECOY_COUNT) > 0 && this.level() instanceof ServerLevel) { - Entity passenger = getFirstPassenger(); for (int i = 0; i < 16; i++) { SmokeDecoyEntity smokeDecoyEntity = new SmokeDecoyEntity(this.level()); smokeDecoyEntity.setPos(this.getX(), this.getY() + 2, this.getZ()); @@ -256,7 +256,6 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements public void releaseDecoy() { if (decoyInputDown) { if (this.entityData.get(DECOY_COUNT) > 0 && this.level() instanceof ServerLevel) { - Entity passenger = getFirstPassenger(); for (int i = 0; i < 4; i++) { FlareDecoyEntity flareDecoyEntity = new FlareDecoyEntity(this.level()); flareDecoyEntity.setPos(this.getX() + this.getDeltaMovement().x, this.getY() + 0.5 + this.getDeltaMovement().y, this.getZ() + this.getDeltaMovement().z); @@ -292,14 +291,6 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements Matrix4f transform = this.getWheelsTransform(1); // 点位 - // 前 - Vector4f positionF = transformPosition(transform, 0, 0, l / 2); - // 后 - Vector4f positionB = transformPosition(transform, 0, 0, -l / 2); - // 左 - Vector4f positionL = transformPosition(transform, -w / 2, 0, 0); - // 右 - Vector4f positionR = transformPosition(transform, w / 2, 0, 0); // 左前 Vector4f positionLF = transformPosition(transform, w / 2, 0, l / 2); // 右前 @@ -314,22 +305,12 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements Vec3 p3 = new Vec3(positionLB.x, positionLB.y, positionLB.z); Vec3 p4 = new Vec3(positionRB.x, positionRB.y, positionRB.z); - Vec3 p5 = new Vec3(positionF.x, positionF.y, positionF.z); - Vec3 p6 = new Vec3(positionB.x, positionB.y, positionB.z); - Vec3 p7 = new Vec3(positionL.x, positionL.y, positionL.z); - Vec3 p8 = new Vec3(positionR.x, positionR.y, positionR.z); - // 确定点位是否在墙里来调整点位高度 float p1y = (float) this.traceBlockY(p1, l); float p2y = (float) this.traceBlockY(p2, l); float p3y = (float) this.traceBlockY(p3, l); float p4y = (float) this.traceBlockY(p4, l); - float p5y = (float) Mth.clamp(this.traceBlockY(p5, l), -l, l); - float p6y = (float) Mth.clamp(this.traceBlockY(p6, l), -l, l); - float p7y = (float) Mth.clamp(this.traceBlockY(p7, l), -l, l); - float p8y = (float) Mth.clamp(this.traceBlockY(p8, l), -l, l); - p1 = new Vec3(positionLF.x, p1y, positionLF.z); p2 = new Vec3(positionRF.x, p2y, positionRF.z); p3 = new Vec3(positionLB.x, p3y, positionLB.z); @@ -399,12 +380,12 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements return pos.y + 0.5f * diffY; } - public void collideLilyPadBlock() { + public void baseCollideBlock() { if (level() instanceof ServerLevel) { AABB aabb = getBoundingBox().inflate(0.05).move(this.getDeltaMovement().scale(0.6)); BlockPos.betweenClosedStream(aabb).forEach((pos) -> { BlockState blockstate = this.level().getBlockState(pos); - if (blockstate.is(Blocks.LILY_PAD)) { + if (blockstate.is(Blocks.LILY_PAD) || blockstate.is(BlockTags.LEAVES) || blockstate.is(Blocks.COBWEB) || blockstate.is(Blocks.CACTUS)) { this.level().destroyBlock(pos, true); } });