正确实现entity tag减伤
This commit is contained in:
parent
9b7773350f
commit
f534e6277a
7 changed files with 17 additions and 6 deletions
|
@ -43,11 +43,13 @@ public class DamageModify {
|
||||||
RESOURCE_KEY,
|
RESOURCE_KEY,
|
||||||
FUNCTION,
|
FUNCTION,
|
||||||
ENTITY_ID,
|
ENTITY_ID,
|
||||||
|
ENTITY_TAG,
|
||||||
ALL,
|
ALL,
|
||||||
}
|
}
|
||||||
|
|
||||||
private transient TagKey<DamageType> sourceTagKey = null;
|
private transient TagKey<DamageType> sourceTagKey = null;
|
||||||
private transient ResourceKey<DamageType> sourceKey = null;
|
private transient ResourceKey<DamageType> sourceKey = null;
|
||||||
|
private transient TagKey<EntityType<?>> entityTag = null;
|
||||||
private transient Function<DamageSource, Boolean> condition = null;
|
private transient Function<DamageSource, Boolean> condition = null;
|
||||||
|
|
||||||
public DamageModify() {
|
public DamageModify() {
|
||||||
|
@ -92,6 +94,9 @@ public class DamageModify {
|
||||||
if (source.startsWith("#")) {
|
if (source.startsWith("#")) {
|
||||||
sourceType = SourceType.TAG_KEY;
|
sourceType = SourceType.TAG_KEY;
|
||||||
this.sourceTagKey = TagKey.create(Registries.DAMAGE_TYPE, ResourceLocation.parse(source.substring(1)));
|
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("@")) {
|
} else if (source.startsWith("@")) {
|
||||||
sourceType = SourceType.ENTITY_ID;
|
sourceType = SourceType.ENTITY_ID;
|
||||||
this.entityId = source.substring(1);
|
this.entityId = source.substring(1);
|
||||||
|
@ -133,6 +138,12 @@ public class DamageModify {
|
||||||
yield false;
|
yield false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case ENTITY_TAG -> {
|
||||||
|
var directEntity = source.getDirectEntity();
|
||||||
|
if (directEntity == null) yield false;
|
||||||
|
|
||||||
|
yield directEntity.getType().is(entityTag);
|
||||||
|
}
|
||||||
case ALL -> true;
|
case ALL -> true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
{
|
{
|
||||||
"Type": "Multiply",
|
"Type": "Multiply",
|
||||||
"Value": 8,
|
"Value": 8,
|
||||||
"Source": "#superbwarfare:aerial_bomb"
|
"Source": "@#superbwarfare:aerial_bomb"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Type": "Multiply",
|
"Type": "Multiply",
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
{
|
{
|
||||||
"Type": "Multiply",
|
"Type": "Multiply",
|
||||||
"Value": 2,
|
"Value": 2,
|
||||||
"Source": "#superbwarfare:aerial_bomb"
|
"Source": "@#superbwarfare:aerial_bomb"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Type": "Multiply",
|
"Type": "Multiply",
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
{
|
{
|
||||||
"Type": "Multiply",
|
"Type": "Multiply",
|
||||||
"Value": 3,
|
"Value": 3,
|
||||||
"Source": "#superbwarfare:aerial_bomb"
|
"Source": "@#superbwarfare:aerial_bomb"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Type": "Multiply",
|
"Type": "Multiply",
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
{
|
{
|
||||||
"Type": "Multiply",
|
"Type": "Multiply",
|
||||||
"Value": 2,
|
"Value": 2,
|
||||||
"Source": "#superbwarfare:aerial_bomb"
|
"Source": "@#superbwarfare:aerial_bomb"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Type": "Multiply",
|
"Type": "Multiply",
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
{
|
{
|
||||||
"Type": "Multiply",
|
"Type": "Multiply",
|
||||||
"Value": 2,
|
"Value": 2,
|
||||||
"Source": "#superbwarfare:aerial_bomb"
|
"Source": "@#superbwarfare:aerial_bomb"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Type": "Multiply",
|
"Type": "Multiply",
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
{
|
{
|
||||||
"Type": "Multiply",
|
"Type": "Multiply",
|
||||||
"Value": 3,
|
"Value": 3,
|
||||||
"Source": "#superbwarfare:aerial_bomb"
|
"Source": "@#superbwarfare:aerial_bomb"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Type": "Immunity",
|
"Type": "Immunity",
|
||||||
|
|
Loading…
Add table
Reference in a new issue