From f534e6277aa8d883d85614625ba05650f6934159 Mon Sep 17 00:00:00 2001 From: Light_Quanta Date: Fri, 13 Jun 2025 18:13:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E5=AE=9E=E7=8E=B0entity=20ta?= =?UTF-8?q?g=E5=87=8F=E4=BC=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/vehicle/damage/DamageModify.java | 11 +++++++++++ .../data/superbwarfare/vehicles/annihilator.json | 2 +- .../resources/data/superbwarfare/vehicles/bmp_2.json | 2 +- .../data/superbwarfare/vehicles/lav_150.json | 2 +- .../data/superbwarfare/vehicles/prism_tank.json | 2 +- .../data/superbwarfare/vehicles/speedboat.json | 2 +- .../resources/data/superbwarfare/vehicles/yx_100.json | 2 +- 7 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/damage/DamageModify.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/damage/DamageModify.java index b93beffef..298e92194 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/damage/DamageModify.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/damage/DamageModify.java @@ -43,11 +43,13 @@ public class DamageModify { RESOURCE_KEY, FUNCTION, ENTITY_ID, + ENTITY_TAG, ALL, } private transient TagKey sourceTagKey = null; private transient ResourceKey sourceKey = null; + private transient TagKey> entityTag = null; private transient Function condition = null; public DamageModify() { @@ -92,6 +94,9 @@ public class DamageModify { if (source.startsWith("#")) { sourceType = SourceType.TAG_KEY; this.sourceTagKey = TagKey.create(Registries.DAMAGE_TYPE, ResourceLocation.parse(source.substring(1))); + } else if (source.startsWith("@#")) { + sourceType = SourceType.ENTITY_TAG; + this.entityTag = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.parse(source.substring(2))); } else if (source.startsWith("@")) { sourceType = SourceType.ENTITY_ID; this.entityId = source.substring(1); @@ -133,6 +138,12 @@ public class DamageModify { yield false; } } + case ENTITY_TAG -> { + var directEntity = source.getDirectEntity(); + if (directEntity == null) yield false; + + yield directEntity.getType().is(entityTag); + } case ALL -> true; }; } diff --git a/src/main/resources/data/superbwarfare/vehicles/annihilator.json b/src/main/resources/data/superbwarfare/vehicles/annihilator.json index cd99dd36b..3c179d46a 100644 --- a/src/main/resources/data/superbwarfare/vehicles/annihilator.json +++ b/src/main/resources/data/superbwarfare/vehicles/annihilator.json @@ -73,7 +73,7 @@ { "Type": "Multiply", "Value": 8, - "Source": "#superbwarfare:aerial_bomb" + "Source": "@#superbwarfare:aerial_bomb" }, { "Type": "Multiply", diff --git a/src/main/resources/data/superbwarfare/vehicles/bmp_2.json b/src/main/resources/data/superbwarfare/vehicles/bmp_2.json index 2c91832e2..3dbd7cee0 100644 --- a/src/main/resources/data/superbwarfare/vehicles/bmp_2.json +++ b/src/main/resources/data/superbwarfare/vehicles/bmp_2.json @@ -77,7 +77,7 @@ { "Type": "Multiply", "Value": 2, - "Source": "#superbwarfare:aerial_bomb" + "Source": "@#superbwarfare:aerial_bomb" }, { "Type": "Multiply", diff --git a/src/main/resources/data/superbwarfare/vehicles/lav_150.json b/src/main/resources/data/superbwarfare/vehicles/lav_150.json index 9c962ea6c..6da348210 100644 --- a/src/main/resources/data/superbwarfare/vehicles/lav_150.json +++ b/src/main/resources/data/superbwarfare/vehicles/lav_150.json @@ -72,7 +72,7 @@ { "Type": "Multiply", "Value": 3, - "Source": "#superbwarfare:aerial_bomb" + "Source": "@#superbwarfare:aerial_bomb" }, { "Type": "Multiply", diff --git a/src/main/resources/data/superbwarfare/vehicles/prism_tank.json b/src/main/resources/data/superbwarfare/vehicles/prism_tank.json index 8800931ba..ea46cda86 100644 --- a/src/main/resources/data/superbwarfare/vehicles/prism_tank.json +++ b/src/main/resources/data/superbwarfare/vehicles/prism_tank.json @@ -77,7 +77,7 @@ { "Type": "Multiply", "Value": 2, - "Source": "#superbwarfare:aerial_bomb" + "Source": "@#superbwarfare:aerial_bomb" }, { "Type": "Multiply", diff --git a/src/main/resources/data/superbwarfare/vehicles/speedboat.json b/src/main/resources/data/superbwarfare/vehicles/speedboat.json index d12d145fe..67b9f610a 100644 --- a/src/main/resources/data/superbwarfare/vehicles/speedboat.json +++ b/src/main/resources/data/superbwarfare/vehicles/speedboat.json @@ -61,7 +61,7 @@ { "Type": "Multiply", "Value": 2, - "Source": "#superbwarfare:aerial_bomb" + "Source": "@#superbwarfare:aerial_bomb" }, { "Type": "Multiply", diff --git a/src/main/resources/data/superbwarfare/vehicles/yx_100.json b/src/main/resources/data/superbwarfare/vehicles/yx_100.json index ae3b11ec1..a21dfc758 100644 --- a/src/main/resources/data/superbwarfare/vehicles/yx_100.json +++ b/src/main/resources/data/superbwarfare/vehicles/yx_100.json @@ -32,7 +32,7 @@ { "Type": "Multiply", "Value": 3, - "Source": "#superbwarfare:aerial_bomb" + "Source": "@#superbwarfare:aerial_bomb" }, { "Type": "Immunity",