diff --git a/src/main/java/net/serenas/shitmod/fragileHeartCharm.java b/src/main/java/net/serenas/shitmod/fragileHeartCharm.java index dea90e7..b098627 100644 --- a/src/main/java/net/serenas/shitmod/fragileHeartCharm.java +++ b/src/main/java/net/serenas/shitmod/fragileHeartCharm.java @@ -3,10 +3,14 @@ package net.serenas.shitmod; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.text.LiteralText; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.TypedActionResult; import net.minecraft.world.World; + +import java.util.concurrent.TimeUnit; + import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffects; @@ -17,10 +21,27 @@ public class fragileHeartCharm extends Item { super(settings); } + public int availableSlots = 1; + @Override public TypedActionResult use(World World, PlayerEntity Playerentity, Hand Hand) { - Playerentity.addStatusEffect(new StatusEffectInstance(StatusEffects.HEALTH_BOOST, 20*1000000, 3)); - Playerentity.getMainHandStack().damage(50,Playerentity,e-> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND)); + + if (availableSlots > 0) { + availableSlots--; + Playerentity.addStatusEffect(new StatusEffectInstance(StatusEffects.HEALTH_BOOST, 20*1000000, 2)); + Playerentity.getMainHandStack().damage(50,Playerentity,e-> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND)); + try { + TimeUnit.SECONDS.sleep(100); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + availableSlots++; + + } else if (availableSlots < 1) { + Playerentity.sendMessage(new LiteralText("You don't have enough charm notches to do that!"), true); + } + + return new TypedActionResult(ActionResult.SUCCESS, Playerentity.getStackInHand(Hand)); } } diff --git a/src/main/java/net/serenas/shitmod/kingsoul.java b/src/main/java/net/serenas/shitmod/kingsoul.java index 9183ef2..9e4824b 100644 --- a/src/main/java/net/serenas/shitmod/kingsoul.java +++ b/src/main/java/net/serenas/shitmod/kingsoul.java @@ -19,7 +19,7 @@ public class kingsoul extends Item { } - public int availableSlots = 2; + public int availableSlots = 10; @Override public TypedActionResult use(World world, PlayerEntity PlayerEntity, Hand hand) { @@ -34,7 +34,7 @@ public class kingsoul extends Item { } availableSlots++; - } else if (availableSlots < 0) { + } else if (availableSlots < 1) { PlayerEntity.sendMessage(new LiteralText("You don't have enough charm notches to do that!"), true); } diff --git a/src/main/java/net/serenas/shitmod/stalwartShell.java b/src/main/java/net/serenas/shitmod/stalwartShell.java index 923a248..1913ed7 100644 --- a/src/main/java/net/serenas/shitmod/stalwartShell.java +++ b/src/main/java/net/serenas/shitmod/stalwartShell.java @@ -1,12 +1,15 @@ package net.serenas.shitmod; +import java.util.concurrent.TimeUnit; + import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffects; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.text.LiteralText; import net.minecraft.util.ActionResult; import net.minecraft.util.TypedActionResult; import net.minecraft.world.World; @@ -18,11 +21,26 @@ public class stalwartShell extends Item{ super(settings); } + public int availableSlots = 8; + @Override - public TypedActionResult use(World world, PlayerEntity Playerentity, Hand hand) { - Playerentity.addStatusEffect(new StatusEffectInstance(StatusEffects.RESISTANCE, 20, 5)); - Playerentity.getMainHandStack().damage(1,Playerentity,e-> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND)); - return new TypedActionResult(ActionResult.SUCCESS, Playerentity.getStackInHand(hand)); + public TypedActionResult use(World world, PlayerEntity PlayerEntity, Hand hand) { + if (availableSlots > 0) { + availableSlots--; + PlayerEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.RESISTANCE, 20, 5)); + PlayerEntity.getMainHandStack().damage(1,PlayerEntity,e-> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND)); + try { + TimeUnit.SECONDS.sleep(15); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + availableSlots++; + + } else if (availableSlots < 1) { + PlayerEntity.sendMessage(new LiteralText("You don't have enough charm notches to do that!"), true); + } + + return new TypedActionResult(ActionResult.SUCCESS, PlayerEntity.getStackInHand(hand)); }