Skip to content

Instantly share code, notes, and snippets.

@kindlich
Created October 29, 2018 19:56
Show Gist options
  • Select an option

  • Save kindlich/c9c42748700088f760e92321c7899866 to your computer and use it in GitHub Desktop.

Select an option

Save kindlich/c9c42748700088f760e92321c7899866 to your computer and use it in GitHub Desktop.
#loader contenttweaker
//Doesnt do anything, I don't know how to use use actions, so I couldn't test this.
//Syntax is fine though ^^
var item1 = mods.contenttweaker.VanillaFactory.createItem("my_item_1");
item1.itemUseAction = "DRINK";
item1.onItemUseFinish = function(item, world, user) {
return <item:minecraft:bedrock> * item.amount;
};
item1.register();
//Doesnt provide food at all, but replaces as it should
var item2 = mods.contenttweaker.VanillaFactory.createItemFood("my_item_2", 10);
item2.onItemUseFinish = function(item, world, entityLivingBase) {
return <item:minecraft:bedrock> * item.amount;
};
item2.register();
//Prints 2 times hello one for client, one for server if eaten
//Provides food value
var item3 = mods.contenttweaker.VanillaFactory.createItemFood("my_item_3", 10);
item3.onItemFoodEaten = function(item, world, player) {
player.sendMessage("Hello!!!");
};
item3.register();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment