Skip to content

Commit

Permalink
improv: Scroll Durability
Browse files Browse the repository at this point in the history
  • Loading branch information
darksonic300 committed Aug 4, 2024
1 parent 51e89e3 commit fb63137
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ loader_version_range=[4,)
mod_id=seidr
mod_name=Seidr
mod_license=LGPL-3.0
mod_version=0.3
mod_version=0.4
mod_group_id=com.github.darksonic300.seidr
mod_authors=darksonic300
mod_description=Seidr - A simple magic mod based on Norse Mythology.\nIt is mainly based on Galdr, a branch of magic with singing incantations,\n and plans to cover more.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectCategory;
import net.minecraft.world.effect.MobEffects;
import net.neoforged.neoforge.registries.DeferredHolder;
import net.neoforged.neoforge.registries.DeferredRegister;

public class SeidrEffects {
public static final DeferredRegister<MobEffect> MOB_EFFECTS = DeferredRegister.create(BuiltInRegistries.MOB_EFFECT, Seidr.MODID);

public static final DeferredHolder<MobEffect, ? extends MobEffect> LIQUID_WALK = MOB_EFFECTS.register("liquid_walk", () -> new LiquidWalkEffect(MobEffectCategory.BENEFICIAL, 100000));
public static final DeferredHolder<MobEffect, ? extends MobEffect> ATTRACTION = MOB_EFFECTS.register("attraction", () -> new AttractionEffect(MobEffectCategory.NEUTRAL, 112330));
public static final DeferredHolder<MobEffect, ? extends MobEffect> LIQUID_WALK = MOB_EFFECTS.register("liquid_walk", () -> new LiquidWalkEffect(MobEffectCategory.BENEFICIAL, 3402751));
public static final DeferredHolder<MobEffect, ? extends MobEffect> ATTRACTION = MOB_EFFECTS.register("attraction", () -> new AttractionEffect(MobEffectCategory.NEUTRAL, 16262179));
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundSource;
import net.minecraft.util.RandomSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.player.Player;
Expand All @@ -19,6 +22,7 @@
import com.github.darksonic300.seidr.particle.SeidrParticleTypes;

import java.util.List;
import java.util.function.Consumer;

public class ScrollItem extends Item {
private int cooldown;
Expand Down Expand Up @@ -69,7 +73,7 @@ public boolean isFoil(ItemStack pStack) {
public ItemStack finishUsingItem(ItemStack pStack, Level pLevel, LivingEntity pLivingEntity) {
if (pLivingEntity instanceof Player player)
player.getCooldowns().addCooldown(this, cooldown);
// Decrease durability here
pStack.hurtAndBreak(1, pLivingEntity, EquipmentSlot.MAINHAND);
pLevel.addParticle(SeidrParticleTypes.WAVE_PARTICLE.get(), pLivingEntity.getX(), pLivingEntity.getY() + 0.05, pLivingEntity.getZ(), 0.0D, 0.0D, 0.0D);
return pStack;
}
Expand Down

0 comments on commit fb63137

Please sign in to comment.