ContentTweaker

ContentTweaker

27M Downloads

[Request] Return items on food consumption.

ZeroLevels opened this issue ยท 2 comments

commented

It would be cool to have the ability to return an item upon consumption. Something like food.consumptionReturn = <minecraft:glass_bottle> or something.

commented

You can already do this with a script like this:

var suspiciousstewresistence = VanillaFactory.createItemFood("suspiciousstewresistence", 6);
suspiciousstewresistence.saturation = 7.2;
suspiciousstewresistence.maxStackSize = 1;
suspiciousstewresistence.onItemFoodEaten = function(item, world, player) {
Commands.call("give @p minecraft:bowl", player, world, false, true);
Commands.call("effect @p 11 5", player, world, false, true);
};
suspiciousstewresistence.register();

The only real problem is that the item isn't transformed into the product item, it's deleted and the product item given to the player which means that the product item is given back in an adjacent slot.

commented

It wasn't when this was created.