Skip to content

Commit

Permalink
Add furnace tags and mechanisms
Browse files Browse the repository at this point in the history
For dLocations
  • Loading branch information
Morphan1 committed Jun 1, 2015
1 parent 7693ea2 commit 97f5466
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions src/main/java/net/aufdemrand/denizen/objects/dLocation.java
Expand Up @@ -1533,6 +1533,30 @@ && getBlock().getType() == Material.COMMAND) {
.getAttribute(attribute.fulfill(1));
}

// <--[tag]
// @attribute <l@location.furnace_burn_time>
// @returns Element(Number)
// @mechanism furnace_burn_time
// @description
// Returns the burn time a furnace has left.
// -->
if (attribute.startsWith("furnace_burn_time")) {
return new Element(((Furnace) getBlock().getState()).getBurnTime())
.getAttribute(attribute.fulfill(1));
}

// <--[tag]
// @attribute <l@location.furnace_cook_time>
// @returns Element(Number)
// @mechanism furnace_cook_time
// @description
// Returns the cook time a furnace has left.
// -->
if (attribute.startsWith("furnace_cook_time")) {
return new Element(((Furnace) getBlock().getState()).getCookTime())
.getAttribute(attribute.fulfill(1));
}

// Iterate through this object's properties' attributes
for (Property property : PropertyParser.getProperties(this)) {
String returned = property.getAttribute(attribute);
Expand Down Expand Up @@ -1683,6 +1707,40 @@ && getBlock().getState() instanceof CreatureSpawner) {
}
}

// <--[mechanism]
// @object dLocation
// @name furnace_burn_time
// @input Element(Number)
// @description
// Sets the burn time for a furnace in ticks. Maximum is 32767.
// @tags
// <l@location.furnace_burn_time>
// -->
if (mechanism.matches("furnace_burn_time")) {
Material material = getBlock().getType();
if (material == Material.FURNACE || material == Material.BURNING_FURNACE) {
Furnace furnace = (Furnace) getBlock().getState();
furnace.setBurnTime((short) value.asInt());
}
}

// <--[mechanism]
// @object dLocation
// @name furnace_cook_time
// @input Element(Number)
// @description
// Sets the cook time for a furnace in ticks. Maximum is 32767.
// @tags
// <l@location.furnace_cook_time>
// -->
if (mechanism.matches("furnace_cook_time")) {
Material material = getBlock().getType();
if (material == Material.FURNACE || material == Material.BURNING_FURNACE) {
Furnace furnace = (Furnace) getBlock().getState();
furnace.setCookTime((short) value.asInt());
}
}

// <--[mechanism]
// @object dLocation
// @name data
Expand Down

0 comments on commit 97f5466

Please sign in to comment.