Skip to content

Commit

Permalink
deprecate 'remaining_air' mech in favor of 'oxygen' with duration input
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Dec 24, 2019
1 parent 49e2201 commit 92a074e
Showing 1 changed file with 8 additions and 3 deletions.
Expand Up @@ -2261,7 +2261,7 @@ else if (mtr.angle == BlockFace.EAST) {
// <--[tag]
// @attribute <EntityTag.oxygen>
// @returns DurationTag
// @mechanism EntityTag.remaining_air
// @mechanism EntityTag.oxygen
// @group attributes
// @description
// Returns the duration of oxygen the entity has left.
Expand Down Expand Up @@ -2953,16 +2953,21 @@ public void adjust(Mechanism mechanism) {

// <--[mechanism]
// @object EntityTag
// @name remaining_air
// @input ElementTag(Number)
// @name oxygen
// @input DurationTag
// @description
// Sets how much air the entity has remaining before it drowns.
// The entity must be living.
// @tags
// <EntityTag.oxygen>
// <EntityTag.max_oxygen>
// -->
if (mechanism.matches("oxygen") && mechanism.requireObject(DurationTag.class)) {
getLivingEntity().setRemainingAir(mechanism.valueAsType(DurationTag.class).getTicksAsInt());
}

if (mechanism.matches("remaining_air") && mechanism.requireInteger()) {
Deprecations.entityRemainingAir.warn(mechanism.context);
getLivingEntity().setRemainingAir(mechanism.getValue().asInt());
}

Expand Down

0 comments on commit 92a074e

Please sign in to comment.