Skip to content
Mets edited this page Aug 8, 2023 · 9 revisions

Before starting don't forget to add #loader preinit at the start of your script

Creating a basic item

You might want to import the package import contentcreator.item.Item;

// Don't forget to load it in preinit, nothing will happen if you don't set it.
#loader preinit

import contentcreator.item.Item;

// To create the item: Item.create(String registryName);
var example as Item = Item.create("example_item");

// To register the item: Item#register();
example.register();

Sub Items

Basically, meta items.

You might want to import the package import contentcreator.item.SubItem;

// Don't forget to load it in preinit, nothing will happen if you don't set it.
#loader preinit

import contentcreator.item.Item;
import contentcreator.item.SubItem;

var example as Item = Item.create("example_item");

// Item.sub() method generates sub item with 0 as meta value. Meta values should be different if you want to add more than one meta item.
// You can use Item.sub(int meta) to generate items with different meta.
var subItem as SubItem = Item.sub();
subItem.setUnlocalizedName("among_us_sussy_item"); // sets unlocalized name to "item.contentcreator.among_us_sussy_item.name"
subItem.setMaxStackSize(32); // sets max stack size to 32

example.add(subItem).register(); // adds subItem to "example" item and registers it.

You can reach to items like <ccitem:-registryName-:-unlocalizedName-> (Returns IItemStack) So if you want to reach among_us_sussy_item you can do like this: <ccitem:example_item:among_us_sussy_item>

if you didn't specify unlocalized name it will use metadata instead (so if it's like 3rd sub item it should be <ccitem:example_item:3>). But specifying unlocalized name is always better.

Sub item methods

Stuffs like setting items max stack size, attack damage etc.

#loader preinit

import contentcreator.item.Item;
import contentcreator.item.SubItem;

var subItem as SubItem = Item.sub();

// Sets items unlocalized name. Not mandatory but kinda like "semi-mandatory"
subItem.setUnlocalizedName("test_name"); // setUnlocalizedName(String unlocalizedName)

// Sets items block destroy speed.
subItem.setDestroySpeed(3.5F); // setDestroySpeed(float value)

// Sets items xp increase ratio when you repair it in anvil.
subItem.setXpRepair(1.5F); // setXpRepair(float ratio)

// Sets itemscontainer item. e.g. filled buckets container item is empty bucket
subItem.setContainerItem("minecraft:iron_ingot"); // setContainerItem(String registryName)

// Sets items container item. e.g. filled buckets container item is empty bucket
// WARNING: You should use this outside of preinit loader or use itemUtils.getItem(String registryName, @Optional int meta) method.
subItem.setContainerItem(<minecraft:iron_ingot>); // setContainerItem(IItemStack stack)

// Sets items entity lifespan
subItem.setEntityLifespan(20 * 50 /* 50 seconds */); // setEntityLifespan(int ticks)

// Sets item as tool.
subItem.setTool("axe", 2, 250, 3.0F); // setTool(String toolClass, int toolLevel, int durability, float speed, @Optional int enchantability, @Optional double attackDamage, @Optional double attackSpeed)

// Sets item as weapon
subItem.setWeapon(250, 3.0F); // setWeapon(int durability, double attackDamage, @Optional double attackSpeed, @Optional int enchantability)

// Sets items hit damage
subItem.setAttackDamage(1.5F); // setAttackDamage(double value)

// Sets items reload speed
subItem.setAttackSpeed(-2.5F); // setAttackSpeed(double value)

// Item can't break blocks in creative like how swords can't.
subItem.disableCreativeBlockDestroy();

// Sets items stack size
subItem.setMaxStackSize(16); // setMaxStackSize(int size)

// Self explanatory. You can add more than one tool class
subItem.addToolClass("pickaxe", 2); // addToolClass(String tool, int level)

subItem.continueUsing();

// Sets how much enchantments can item get
subItem.setEnchantability(15); // setEnchantability(int enchantability)

// Item can be used in beacons like ingots and gems
subItem.setBeaconPayment();

// Items furnace fuel value
subItem.setBurnTime(20 * 15 /* 15 seconds */); // setBurnTime(int ticks)

// Item can disable shields like axes
subItem.canDisableShield();

// Sets items tooltip
subItem.setTooltip("hi, i'm tooltip of sub item.", ":scream:"); // setTooltip(String... string)

// Sets items ore entries
subItem.setOres("ingotIron", "oreCopper", "logWood"); // setOres(String... ores)

// Sets color of items name. Allowed values => common, uncommon, rare, epic
subItem.setRarity("rare"); // setRarity(String name)

// Adds enchantment effect like golden apple
subItem.setEffect();

// Use animation when item gets used. Should be used with setMaxUseDuration() method.
// Allowed values => none, eat, drink, block, bow
subItem.setUseAction("bow"); // setUseAction(String action)

// Items food value. Sets item as food
subItem.setHealAmount(5); // setHealAmount(int amount)

// Items saturation value. It's like invisible food value
subItem.setSaturation(3.5F); // setSaturation(float amount)

// You can use it to heal wolfs. Should be used with setHealAmount() method.
subItem.setWolfsFavorite();

// You can always eat it, like golden apple. Should be food
subItem.setAlwaysEdible();

Advanced Methods

addProperty(String name, IItemPropertyFunc func) setUnlocalizedName(IItemUnlocalizedNameFunc func) setItemUse(IItemUseFunc func) setDestroySpeed(IItemDestroySpeedFunc func) setXpRepair(IItemFloatStackFunc func) setBlockStartBreak(IItemBlockStartBreakFunc func) setUsingTick(IItemUsingTickFunc func) setLeftClickEntity(IItemLeftClickEntityFunc func) SubItem setContainerItem(IItemContainerItemFunc func) setEntityLifespan(IItemEntityLifespanFunc func) setCustomEntity(IItemCustomEntityFunc func) setEntityItemUpdate(IItemEntityItemUpdateFunc func) setEntitySwing(IItemEntitySwingFunc func) setItemDamageGetter(IItemIntStackFunc func) shouldShowDurabilityBar(IItemBooleanStackFunc func) setDurabilityDisplay(IItemDoubleStackFunc func) setDurabilityColor(IItemIntStackFunc func) setMaxDamageGetter(IItemIntStackFunc func) setDamageSetter(IItemSetDamageFunc func) setAttackDamage(IItemAttributeModifier func) setAttackSpeed(IItemAttributeModifier func) canDestroyInCreative(IItemDestroyCreative func) canHarvestBlock(IItemHarvestBlockFunc func) setMaxStackSize(IItemIntStackFunc func) causeReequipAnimation(IItemReequipAnimation func) causeBlockBreakReset(IItemBlockBreakResetFunc func) continueUsing(IItemContinueUsingFunc func) setCreatorModId(IItemStringStackFunc func) setEnchantability(IItemIntStackFunc func) canApplyEnchantment(IItemApplyEnchantmentTableFunc func) setBeaconPayment(IItemBooleanStackFunc func) setItemUseFirst(IItemUseFunc func) setItemCreated(IItemCreatedFunc func) setBurnTime(IItemIntStackFunc func) canDisableShield(IItemDisableShieldFunc func) setTooltip(IItemInformation func) setRarity(IItemStringStackFunc func) setEffect(IItemBooleanStackFunc func) setUseAction(IItemStringStackFunc func) setRightClick(IItemRightClick func) setHealAmount(IItemIntStackFunc func) setSaturation(IItemFloatStackFunc func) setWolfsFavorite(IItemBooleanStackFunc func) setAlwaysEdible(IItemBooleanStackFunc func) setUseFinish(IItemUseFinishFunc func) setEntityHit(IItemHitEntityFunc func) setEntityInteract(IItemInteractionEntityFunc func) setColor(IItemColorFunc func) setBlockDestroyed(IItemBlockDestroy func) setHighlightTip(IItemHighlightTip func) setPlayerDropped(IItemPlayerDrop func)

Setting items texture and model

Clone this wiki locally