Skip to content

Commit

Permalink
EntityTag.visual_fire property (#2510)
Browse files Browse the repository at this point in the history
* `EntityTag.visual_fire` property

Property that returns whether an entity has a fake fire effect. Requested by zemenus on Discord.

* Fix issue with documentation.

<@link tag on_fire> -> <@link tag EntityTag.on_fire>
  • Loading branch information
funkychicken493 committed Jul 30, 2023
1 parent 9d27245 commit ff0f280
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
Expand Up @@ -177,6 +177,7 @@ public static void registerMainProperties() {
PropertyParser.registerProperty(EntityVillagerExperience.class, EntityTag.class);
PropertyParser.registerProperty(EntityVillagerLevel.class, EntityTag.class);
PropertyParser.registerProperty(EntityVisible.class, EntityTag.class);
PropertyParser.registerProperty(EntityVisualFire.class, EntityTag.class);
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_19)) {
PropertyParser.registerProperty(EntityWidth.class, EntityTag.class);
}
Expand Down
@@ -0,0 +1,46 @@
package com.denizenscript.denizen.objects.properties.entity;

import com.denizenscript.denizen.objects.EntityTag;
import com.denizenscript.denizencore.objects.Mechanism;
import com.denizenscript.denizencore.objects.core.ElementTag;

public class EntityVisualFire extends EntityProperty<ElementTag> {

// <--[property]
// @object EntityTag
// @name visual_fire
// @input ElementTag(Boolean)
// @description
// Whether an entity has a fake fire effect. For actual fire, see <@link command burn> and <@link tag EntityTag.on_fire>.
// -->

public static boolean describes(EntityTag entity) {
return true;
}

@Override
public ElementTag getPropertyValue() {
return new ElementTag(getEntity().isVisualFire());
}

@Override
public boolean isDefaultValue(ElementTag value) {
return !value.asBoolean();
}

@Override
public void setPropertyValue(ElementTag value, Mechanism mechanism) {
if (mechanism.requireBoolean()) {
getEntity().setVisualFire(value.asBoolean());
}
}

@Override
public String getPropertyId() {
return "visual_fire";
}

public static void register() {
autoRegister("visual_fire", EntityVisualFire.class, ElementTag.class, false);
}
}

0 comments on commit ff0f280

Please sign in to comment.