Item Filter Scripting (1.13) - mcenderdragon/Futurepack-API GitHub Wiki

You can use JavaScript to create advancet item filters which can do tons of stuff. (Like only bees with certain stats are allowed).

Base Code:

function filterItem(item)
{
    return item.getRegisteredName() == "minecraft:stick";
}

function  transferItemCallback(item)
{
    //this is just a callbakc for every item transfered
}

IItem Object

Every item has the following functions:

public int getStackSize();

returns an integer, how many item are there

public String getRegisteredName();

returns a String representing the name e.g. "minecraft:stick"

public Bindings getNBT();

The extra data of this item, can be null
Bindings are directly accessible from JavaScript
Example:
the NBTTag is: {"display": { "text": "Sword" } }
from JavaScript you can access it like this:
print(item.getNBT().display.text)}
The output would be:
Sword

public boolean hasNBT();

returns true if this Item has extra data

public float getSmeltedItems();

returns a float representing the amount this item can smelt, if 0 is returned no items can be melted

public boolean isEmpty();

returns true is this item is "empty" as in 0 stack size or an "air" item.

public int getMaxStacksize();

returns the max amoutn of item you can stack, often 64.

public int getDurability();

returns the amount of damage this item already took.

public int getMaxDurability();

returns The max amount of damage this tool can take, if 0 then this item is not damageable

Global Variables:

helper_tags (accesable from Script)

public boolean hasTag(IItem iitem, String res)

returns true if this item is in the given tag

public boolean isOre(IItem iitem)

Short for helper_tags.hasTag(iitem, "forge:ores")

public boolean isIngot(IItem iitem)

Short for helper_tags.hasTag(iitem, "forge:ingots")

public boolean isDust(IItem iitem)

Short for helper_tags.hasTag(iitem, "forge:dusts")

public Set getTags(IItem iitem)

returns all tags associated with this item

game_version

futurepack_version

game_name

modlist

⚠️ **GitHub.com Fallback** ⚠️