Skip to content

Commit

Permalink
Merge pull request #192 from Gu-ZT/Utusan
Browse files Browse the repository at this point in the history
修改五毒散的使用时间与效果
  • Loading branch information
Gugle2308 authored Apr 7, 2024
2 parents 19a6e6a + 68b4a0c commit f82b06a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions common/src/main/java/dev/dubhe/anvilcraft/item/UtusanItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@
import java.util.ArrayList;
import java.util.List;

@SuppressWarnings("resource")
public class UtusanItem extends Item {
public UtusanItem(Properties properties) {
super(properties);
}

@Override
public @NotNull ItemStack finishUsingItem(ItemStack itemStack, Level level, LivingEntity livingEntity) {
public @NotNull ItemStack finishUsingItem(@NotNull ItemStack itemStack, @NotNull Level level, @NotNull LivingEntity livingEntity) {
if (livingEntity instanceof ServerPlayer serverPlayer) {
CriteriaTriggers.CONSUME_ITEM.trigger(serverPlayer, itemStack);
serverPlayer.awardStat(Stats.ITEM_USED.get(this));
Expand All @@ -51,24 +52,24 @@ public static void removeHarmfulEffects(@NotNull LivingEntity livingEntity) {
bl = true;
}
if (!bl) {
livingEntity.addEffect(new MobEffectInstance(MobEffects.POISON, 200));
livingEntity.addEffect(new MobEffectInstance(MobEffects.POISON, 200, 2));
return;
}
for (MobEffect effect : effects) livingEntity.removeEffect(effect);
}

@Override
public int getUseDuration(ItemStack itemStack) {
return 1;
public int getUseDuration(@NotNull ItemStack itemStack) {
return 10;
}

@Override
public @NotNull UseAnim getUseAnimation(ItemStack itemStack) {
public @NotNull UseAnim getUseAnimation(@NotNull ItemStack itemStack) {
return UseAnim.EAT;
}

@Override
public @NotNull InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand interactionHand) {
public @NotNull InteractionResultHolder<ItemStack> use(@NotNull Level level, @NotNull Player player, @NotNull InteractionHand interactionHand) {
return ItemUtils.startUsingInstantly(level, player, interactionHand);
}
}

0 comments on commit f82b06a

Please sign in to comment.