Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EntityTag.visual_fire
property (#2510)
* `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
1 parent
9d27245
commit ff0f280
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...n/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityVisualFire.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |