Drinking jam items or a tea item gives glass bottles back
hlemont opened this issue ยท 1 comments
Make sure you are not opening a duplicate.
- I have searched the issue tracker and did not find an issue describing my bug.
Platform.
Fabric
Minecraft version.
1.18.1
Croptopia version.
1.8.2
What happened?
When you drink some 'drink' items like jams or tea, it gives the drinker glass bottle back.
Since those items does not require any bottles when crafting, so I'm quite sure it is not an intended behavior and they should not give glass bottles back.
Relevant log.
No response
Additional information.
Possible solution would be giving recipe remainder items instead of glass bottles. Following modification solved the issue.
// me.thonk.croptopia.items.Drink.java
public class Drink extends Item {
/* ... */
@Override
public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) {
PlayerEntity playerEntity = user instanceof PlayerEntity ? (PlayerEntity)user : null;
if (playerEntity instanceof ServerPlayerEntity) {
Criteria.CONSUME_ITEM.trigger((ServerPlayerEntity)playerEntity, stack);
}
if (playerEntity != null) {
playerEntity.incrementStat(Stats.USED.getOrCreateStat(this));
if (!playerEntity.getAbilities().creativeMode) {
if (isFood()) {
DrinkEvent.DRINK.invoker().onDrink(stack, playerEntity);
user.eatFood(world, stack);
}
}
}
if (playerEntity == null || !playerEntity.getAbilities().creativeMode) {
if (stack.isEmpty()) {
// here
return new ItemStack(getRecipeRemainder());
}
if (playerEntity != null) {
// and here
playerEntity.getInventory().insertStack(new ItemStack(getRecipeRemainder()));
}
}
return stack;
}
}
Before:
before.mp4
After: