Antidote Added

This commit is contained in:
nelle 2024-01-08 00:02:36 -07:00
parent f23e169bdc
commit 9fc34cdcb9
3 changed files with 46 additions and 1 deletions

View file

@ -44,6 +44,7 @@
- [ ] At sunset clouds turn pink
- [ ] Colored Torch
- [ ] [Medicine](https://minecraft.wiki/Medicine) each one removes a specific effect
- [ ] Milk doesnt clear all status effects but only nausea ?
- [ ] Smelt mushroom to get dye?
- [ ] My own take on a Limbo Dimension
- [ ] More unique mobs (mythology)

View file

@ -0,0 +1,44 @@
package xyz.limepot.emb.item;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.UseAction;
import net.minecraft.world.World;
public class AntidoteItem extends Item {
public AntidoteItem() {
this.setMaxCount(1);
}
@Override
public ItemStack onFinishUse(ItemStack stack, World world, PlayerEntity player) {
if (!player.abilities.creativeMode) {
--stack.count;
}
if (!world.isClient) {
player.removeEffect(StatusEffect.POISON.id);
}
return stack.count <= 0 ? new ItemStack(Items.GLASS_BOTTLE) : stack;
}
@Override
public int getMaxUseTime(ItemStack stack) {
return 32;
}
@Override
public UseAction getUseAction(ItemStack stack) {
return UseAction.DRINK;
}
@Override
public ItemStack onStartUse(ItemStack stack, World world, PlayerEntity player) {
player.setUseItem(stack, this.getMaxUseTime(stack));
return stack;
}
}

View file

@ -44,7 +44,7 @@ public class ModItems {
//Potions/Medicine
/*this actually registers an entire set of potion items, potion item/potion bottle*/
//public static final Item ANTIDOTE_ITEM = registerItem(new PotionItem().setItemGroup(ItemGroup.BREWING), "antidote");
public static final Item ANTIDOTE = registerItem(new AntidoteItem().setItemGroup(ItemGroup.MISC), "antidote");
//Register Items
public static Item registerItem(Item item, String name) {