Skip to content

Commit

Permalink
Update ItemShouLamp.java
Browse files Browse the repository at this point in the history
  • Loading branch information
H2Sxxa authored Oct 19, 2023
1 parent c0d5953 commit e56c921
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,24 @@ public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player
player.setActiveHand(hand);
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
}

@Override
public void onUsingTick(ItemStack stack, EntityLivingBase player, int count) {
if(JEWELS.get(stack) < 500 && player instanceof EntityPlayer) {
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityLivingBase entityLiving, int timeLeft) {
if(entityLiving instanceof EntityPlayer) {
EntityPlayer player = ((EntityPlayer) entityLiving);
int timeUsed = getMaxItemUseDuration(stack) - timeLeft;
if(timeUsed > 500) {
timeUsed = 500;
}
addJewels(stack, (short) timeUsed);
player.addPotionEffect(new PotionEffect(MobEffects.LUCK, 10, 5));
if(count % 4 == 0) {
player.playSound(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, 0.1F, 1F);
player.playSound(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, 0.1F, 1F);
if(JEWELS.get(stack) > 500){
JEWELS.set((short) 500);
}
addJewels(stack, (short) 1);
}
}

@Override
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityLivingBase entityLiving, int timeLeft) {
if(entityLiving instanceof EntityPlayer) {
Expand Down

0 comments on commit e56c921

Please sign in to comment.