add notch system to all charms
This commit is contained in:
parent
aee9b4f81c
commit
fc913a0f4e
@ -28,6 +28,7 @@ public class fragileHeartCharm extends Item {
|
|||||||
|
|
||||||
if (availableSlots > 0) {
|
if (availableSlots > 0) {
|
||||||
availableSlots--;
|
availableSlots--;
|
||||||
|
Playerentity.sendMessage(new LiteralText("You have " + availableSlots + "charm notches left."), false);
|
||||||
Playerentity.addStatusEffect(new StatusEffectInstance(StatusEffects.HEALTH_BOOST, 20*1000000, 2));
|
Playerentity.addStatusEffect(new StatusEffectInstance(StatusEffects.HEALTH_BOOST, 20*1000000, 2));
|
||||||
Playerentity.getMainHandStack().damage(50,Playerentity,e-> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND));
|
Playerentity.getMainHandStack().damage(50,Playerentity,e-> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND));
|
||||||
try {
|
try {
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
package net.serenas.shitmod;
|
package net.serenas.shitmod;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import net.minecraft.entity.EquipmentSlot;
|
import net.minecraft.entity.EquipmentSlot;
|
||||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||||
import net.minecraft.entity.effect.StatusEffects;
|
import net.minecraft.entity.effect.StatusEffects;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.text.LiteralText;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.TypedActionResult;
|
import net.minecraft.util.TypedActionResult;
|
||||||
@ -16,11 +19,28 @@ public class fragileStrengthCharm extends Item{
|
|||||||
public fragileStrengthCharm(Settings settings) {
|
public fragileStrengthCharm(Settings settings) {
|
||||||
super(settings);
|
super(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int availableSlots = 1;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity Playerentity, Hand Hand) {
|
public TypedActionResult<ItemStack> use(World world, PlayerEntity PlayerEntity, Hand Hand) {
|
||||||
Playerentity.addStatusEffect(new StatusEffectInstance(StatusEffects.STRENGTH, 20*1000000, 2));
|
if (availableSlots > 0) {
|
||||||
Playerentity.getMainHandStack().damage(50,Playerentity,e-> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND));
|
availableSlots--;
|
||||||
return new TypedActionResult<ItemStack>(ActionResult.SUCCESS, Playerentity.getStackInHand(Hand));
|
PlayerEntity.sendMessage(new LiteralText("You have " + availableSlots + "charm notches left."), false);
|
||||||
|
PlayerEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.STRENGTH, 20*1000000, 2));
|
||||||
|
PlayerEntity.getMainHandStack().damage(50,PlayerEntity,e-> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND));
|
||||||
|
try {
|
||||||
|
TimeUnit.SECONDS.sleep(5);
|
||||||
|
} 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<ItemStack>(ActionResult.SUCCESS, PlayerEntity.getStackInHand(Hand));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ public class kingsoul extends Item {
|
|||||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity PlayerEntity, Hand hand) {
|
public TypedActionResult<ItemStack> use(World world, PlayerEntity PlayerEntity, Hand hand) {
|
||||||
if (availableSlots > 0) {
|
if (availableSlots > 0) {
|
||||||
availableSlots--;
|
availableSlots--;
|
||||||
|
PlayerEntity.sendMessage(new LiteralText("You have " + availableSlots + "charm notches left."), false);
|
||||||
PlayerEntity.getHungerManager().add(1, 1);
|
PlayerEntity.getHungerManager().add(1, 1);
|
||||||
PlayerEntity.getMainHandStack().damage(1,PlayerEntity,e-> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND));
|
PlayerEntity.getMainHandStack().damage(1,PlayerEntity,e-> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND));
|
||||||
try {
|
try {
|
||||||
|
@ -27,6 +27,7 @@ public class stalwartShell extends Item{
|
|||||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity PlayerEntity, Hand hand) {
|
public TypedActionResult<ItemStack> use(World world, PlayerEntity PlayerEntity, Hand hand) {
|
||||||
if (availableSlots > 0) {
|
if (availableSlots > 0) {
|
||||||
availableSlots--;
|
availableSlots--;
|
||||||
|
PlayerEntity.sendMessage(new LiteralText("You have " + availableSlots + "charm notches left."), false);
|
||||||
PlayerEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.RESISTANCE, 20, 5));
|
PlayerEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.RESISTANCE, 20, 5));
|
||||||
PlayerEntity.getMainHandStack().damage(1,PlayerEntity,e-> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND));
|
PlayerEntity.getMainHandStack().damage(1,PlayerEntity,e-> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND));
|
||||||
try {
|
try {
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package net.serenas.shitmod;
|
package net.serenas.shitmod;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||||
import net.minecraft.entity.effect.StatusEffects;
|
import net.minecraft.entity.effect.StatusEffects;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.text.LiteralText;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.TypedActionResult;
|
import net.minecraft.util.TypedActionResult;
|
||||||
@ -15,9 +18,26 @@ public class unbreakableHeartCharm extends Item {
|
|||||||
public unbreakableHeartCharm(Settings settings) {
|
public unbreakableHeartCharm(Settings settings) {
|
||||||
super(settings);
|
super(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int availableSlots = 1;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity Playerentity, Hand Hand) {
|
public TypedActionResult<ItemStack> use(World world, PlayerEntity PlayerEntity, Hand Hand) {
|
||||||
Playerentity.addStatusEffect(new StatusEffectInstance(StatusEffects.HEALTH_BOOST, 20*1000000, 4));
|
|
||||||
return new TypedActionResult<ItemStack>(ActionResult.SUCCESS, Playerentity.getStackInHand(Hand));
|
if (availableSlots > 0) {
|
||||||
|
availableSlots--;
|
||||||
|
PlayerEntity.sendMessage(new LiteralText("You have " + availableSlots + "charm notches left."), false);
|
||||||
|
PlayerEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.HEALTH_BOOST, 20*1000000, 4));
|
||||||
|
try {
|
||||||
|
TimeUnit.SECONDS.sleep(5);
|
||||||
|
} 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<ItemStack>(ActionResult.SUCCESS, PlayerEntity.getStackInHand(Hand));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,10 +1,13 @@
|
|||||||
package net.serenas.shitmod;
|
package net.serenas.shitmod;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||||
import net.minecraft.entity.effect.StatusEffects;
|
import net.minecraft.entity.effect.StatusEffects;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.text.LiteralText;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.TypedActionResult;
|
import net.minecraft.util.TypedActionResult;
|
||||||
@ -15,9 +18,27 @@ public class unbreakableStrengthCharm extends Item {
|
|||||||
public unbreakableStrengthCharm(Settings settings) {
|
public unbreakableStrengthCharm(Settings settings) {
|
||||||
super(settings);
|
super(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int availableSlots = 1;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity Playerentity, Hand Hand) {
|
public TypedActionResult<ItemStack> use(World world, PlayerEntity PlayerEntity, Hand Hand) {
|
||||||
Playerentity.addStatusEffect(new StatusEffectInstance(StatusEffects.STRENGTH, 20*1000000, 3));
|
|
||||||
return new TypedActionResult<ItemStack>(ActionResult.SUCCESS, Playerentity.getStackInHand(Hand));
|
if (availableSlots > 0) {
|
||||||
|
availableSlots--;
|
||||||
|
PlayerEntity.sendMessage(new LiteralText("You have " + availableSlots + "charm notches left."), false);
|
||||||
|
PlayerEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.STRENGTH, 20*1000000, 3));
|
||||||
|
try {
|
||||||
|
TimeUnit.SECONDS.sleep(5);
|
||||||
|
} 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<ItemStack>(ActionResult.SUCCESS, PlayerEntity.getStackInHand(Hand));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user