From 94a0e76973070eedb515fb6f6042fb44baaf4969 Mon Sep 17 00:00:00 2001 From: Atsuishio <842960157@qq.com> Date: Sun, 13 Jul 2025 22:12:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A063=E7=9A=84=E4=B8=8A=E5=BC=B9?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datagen/ModItemTagProvider.java | 2 + .../entity/vehicle/Type63Entity.java | 103 ++++++++++++++++-- .../atsuishio/superbwarfare/init/ModTags.java | 1 + 3 files changed, 97 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/datagen/ModItemTagProvider.java b/src/main/java/com/atsuishio/superbwarfare/datagen/ModItemTagProvider.java index 609f5f558..818bfdcfe 100644 --- a/src/main/java/com/atsuishio/superbwarfare/datagen/ModItemTagProvider.java +++ b/src/main/java/com/atsuishio/superbwarfare/datagen/ModItemTagProvider.java @@ -77,6 +77,8 @@ public class ModItemTagProvider extends ItemTagsProvider { this.tag(cTag("tools/crowbar")).add(ModItems.CROWBAR.get()); + this.tag(ModTags.Items.MEDIUM_ROCKET).add(ModItems.MEDIUM_ROCKET_AP.get(), ModItems.MEDIUM_ROCKET_HE.get(), ModItems.MEDIUM_ROCKET_CM.get()); + // TODO 清理枪械Tag ModItems.GUNS.getEntries().forEach(registryObject -> this.tag(ModTags.Items.GUN).add(registryObject.get())); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Type63Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Type63Entity.java index 28c7e23fb..1bafa0d09 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Type63Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Type63Entity.java @@ -4,10 +4,7 @@ import com.atsuishio.superbwarfare.Mod; import com.atsuishio.superbwarfare.config.server.ExplosionConfig; import com.atsuishio.superbwarfare.entity.OBBEntity; import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity; -import com.atsuishio.superbwarfare.init.ModDamageTypes; -import com.atsuishio.superbwarfare.init.ModSerializers; -import com.atsuishio.superbwarfare.init.ModSounds; -import com.atsuishio.superbwarfare.init.ModTags; +import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.item.common.container.ContainerBlockItem; import com.atsuishio.superbwarfare.tools.CustomExplosion; import com.atsuishio.superbwarfare.tools.OBB; @@ -77,6 +74,11 @@ public class Type63Entity extends ContainerMobileVehicleEntity implements GeoEnt public Type63Entity(EntityType type, Level world) { super(type, world); + this.wheel1 = new OBB(this.position().toVector3f(), new Vector3f(0.125f, 0.390625f, 0.390625f), new Quaternionf(), OBB.Part.WHEEL_LEFT); + this.wheel2 = new OBB(this.position().toVector3f(), new Vector3f(0.125f, 0.390625f, 0.390625f), new Quaternionf(), OBB.Part.WHEEL_RIGHT); + this.body1 = new OBB(this.position().toVector3f(), new Vector3f(0.4765625f, 0.3515625f, 0.7578125f), new Quaternionf(), OBB.Part.BODY); + this.body2 = new OBB(this.position().toVector3f(), new Vector3f(0.771875f, 0.109375f, 0.296875f), new Quaternionf(), OBB.Part.BODY); + this.barrel0 = new OBB(this.position().toVector3f(), new Vector3f(0.09375f, 0.09375f, 0.0625f), new Quaternionf(), OBB.Part.INTERACTIVE); this.barrel1 = new OBB(this.position().toVector3f(), new Vector3f(0.09375f, 0.09375f, 0.0625f), new Quaternionf(), OBB.Part.INTERACTIVE); this.barrel2 = new OBB(this.position().toVector3f(), new Vector3f(0.09375f, 0.09375f, 0.0625f), new Quaternionf(), OBB.Part.INTERACTIVE); @@ -93,11 +95,6 @@ public class Type63Entity extends ContainerMobileVehicleEntity implements GeoEnt this.yawController = new OBB(this.position().toVector3f(), new Vector3f(0.125f, 0.125f, 0.125f), new Quaternionf(), OBB.Part.INTERACTIVE); this.hoe1 = new OBB(this.position().toVector3f(), new Vector3f(0.125f, 0.125f, 0.875f), new Quaternionf(), OBB.Part.INTERACTIVE); this.hoe2 = new OBB(this.position().toVector3f(), new Vector3f(0.125f, 0.125f, 0.875f), new Quaternionf(), OBB.Part.INTERACTIVE); - - this.wheel1 = new OBB(this.position().toVector3f(), new Vector3f(0.125f, 0.390625f, 0.390625f), new Quaternionf(), OBB.Part.WHEEL_LEFT); - this.wheel2 = new OBB(this.position().toVector3f(), new Vector3f(0.125f, 0.390625f, 0.390625f), new Quaternionf(), OBB.Part.WHEEL_RIGHT); - this.body1 = new OBB(this.position().toVector3f(), new Vector3f(0.4765625f, 0.3515625f, 0.7578125f), new Quaternionf(), OBB.Part.BODY); - this.body2 = new OBB(this.position().toVector3f(), new Vector3f(0.771875f, 0.109375f, 0.296875f), new Quaternionf(), OBB.Part.BODY); } @Override @@ -164,6 +161,94 @@ public class Type63Entity extends ContainerMobileVehicleEntity implements GeoEnt } } + if (stack.is(ModItems.MEDIUM_ROCKET_AP.get()) || stack.is(ModItems.MEDIUM_ROCKET_HE.get()) || stack.is(ModItems.MEDIUM_ROCKET_CM.get())) { + if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel3 && items.get(0).isEmpty()) { + this.setItem(0, stack.copyWithCount(1)); + if (!player.isCreative()) { + stack.shrink(1); + } + player.swing(InteractionHand.MAIN_HAND); + } + if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel2 && items.get(1).isEmpty()) { + this.setItem(1, stack.copyWithCount(1)); + if (!player.isCreative()) { + stack.shrink(1); + } + player.swing(InteractionHand.MAIN_HAND); + } + if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel1 && items.get(2).isEmpty()) { + this.setItem(2, stack.copyWithCount(1)); + if (!player.isCreative()) { + stack.shrink(1); + } + player.swing(InteractionHand.MAIN_HAND); + } + if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel0 && items.get(3).isEmpty()) { + this.setItem(3, stack.copyWithCount(1)); + if (!player.isCreative()) { + stack.shrink(1); + } + player.swing(InteractionHand.MAIN_HAND); + } + if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel4 && items.get(4).isEmpty()) { + this.setItem(4, stack.copyWithCount(1)); + if (!player.isCreative()) { + stack.shrink(1); + } + player.swing(InteractionHand.MAIN_HAND); + } + if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel5 && items.get(5).isEmpty()) { + this.setItem(5, stack.copyWithCount(1)); + if (!player.isCreative()) { + stack.shrink(1); + } + player.swing(InteractionHand.MAIN_HAND); + } + if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel6 && items.get(6).isEmpty()) { + this.setItem(6, stack.copyWithCount(1)); + if (!player.isCreative()) { + stack.shrink(1); + } + player.swing(InteractionHand.MAIN_HAND); + } + if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel7 && items.get(7).isEmpty()) { + this.setItem(7, stack.copyWithCount(1)); + if (!player.isCreative()) { + stack.shrink(1); + } + player.swing(InteractionHand.MAIN_HAND); + } + if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel11 && items.get(8).isEmpty()) { + this.setItem(8, stack.copyWithCount(1)); + if (!player.isCreative()) { + stack.shrink(1); + } + player.swing(InteractionHand.MAIN_HAND); + } + if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel10 && items.get(9).isEmpty()) { + this.setItem(9, stack.copyWithCount(1)); + if (!player.isCreative()) { + stack.shrink(1); + } + player.swing(InteractionHand.MAIN_HAND); + } + if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel9 && items.get(10).isEmpty()) { + this.setItem(10, stack.copyWithCount(10)); + if (!player.isCreative()) { + stack.shrink(1); + } + player.swing(InteractionHand.MAIN_HAND); + } + if (OBB.getLookingObb(player, player.entityInteractionRange()) == this.barrel8 && items.get(11).isEmpty()) { + this.setItem(11, stack.copyWithCount(11)); + if (!player.isCreative()) { + stack.shrink(1); + } + player.swing(InteractionHand.MAIN_HAND); + } + setChanged(); + } + if (player.isShiftKeyDown() && stack.is(ModTags.Items.CROWBAR) && this.getPassengers().isEmpty()) { ItemStack container = ContainerBlockItem.createInstance(this); if (!player.addItem(container)) { diff --git a/src/main/java/com/atsuishio/superbwarfare/init/ModTags.java b/src/main/java/com/atsuishio/superbwarfare/init/ModTags.java index f58954c50..45452d054 100644 --- a/src/main/java/com/atsuishio/superbwarfare/init/ModTags.java +++ b/src/main/java/com/atsuishio/superbwarfare/init/ModTags.java @@ -42,6 +42,7 @@ public class ModTags { public static final TagKey EPIC_BLUEPRINT = tag("blueprint/epic"); public static final TagKey LEGENDARY_BLUEPRINT = tag("blueprint/legendary"); public static final TagKey CANNON_BLUEPRINT = tag("blueprint/cannon"); + public static final TagKey MEDIUM_ROCKET = tag("medium_rocket"); public static final TagKey WRENCHES = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "wrenches")); public static final TagKey WRENCH = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "tools/wrench"));