Skip to content

Commit

Permalink
staff now glints when fully charged
Browse files Browse the repository at this point in the history
  • Loading branch information
NewJumper committed Apr 1, 2024
1 parent 0edf0c7 commit 49ec16b
Showing 1 changed file with 12 additions and 0 deletions.
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.stats.Stats;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.player.Player;
Expand All @@ -22,6 +23,7 @@
@SuppressWarnings("NullableProblems")
public class SonorousStaffItem extends Item {
public double dropOffFactor = 1/3.0;
private boolean charged;

public SonorousStaffItem(Properties pProperties) {
super(pProperties);
Expand Down Expand Up @@ -71,6 +73,16 @@ public InteractionResultHolder<ItemStack> use(Level pLevel, Player pPlayer, Inte
return InteractionResultHolder.consume(stack);
}

@Override
public void inventoryTick(ItemStack pStack, Level pLevel, Entity pEntity, int pSlotId, boolean pIsSelected) {
if(pEntity instanceof Player player) charged = player.getUseItem() == pStack && pStack.getUseDuration() - player.getUseItemRemainingTicks() >= 668;
}

@Override
public boolean isFoil(ItemStack pStack) {
return charged;
}

@Override
public int getUseDuration(ItemStack pStack) {
return 72000;
Expand Down

0 comments on commit 49ec16b

Please sign in to comment.