Skip to content

Commit

Permalink
fix: pickaxe durabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
klikli-dev committed Aug 22, 2024
1 parent 86adf51 commit bf51900
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 37 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@ public class OccultismItems {
public static final DeferredItem<Item> SPIRIT_ATTUNED_PICKAXE_HEAD = ITEMS.register("spirit_attuned_pickaxe_head",
() -> new Item(defaultProperties()));
public static final DeferredItem<InfusedPickaxeItem> INFUSED_PICKAXE = ITEMS.register("infused_pickaxe",
() -> new InfusedPickaxeItem(Tiers.DIAMOND, defaultProperties()
() -> new InfusedPickaxeItem(OccultismTiers.SPIRIT_ATTUNED, defaultProperties()
.component(OccultismDataComponents.SPIRIT_NAME, "(Not yet known)")
.attributes(PickaxeItem.createAttributes(Tiers.DIAMOND, 1.0F, -2.8F))));
public static final DeferredItem<OtherworldPickaxeItem> IESNIUM_PICKAXE = ITEMS.register("iesnium_pickaxe",
() -> new OtherworldPickaxeItem(Tiers.DIAMOND, defaultProperties().attributes(PickaxeItem.createAttributes(Tiers.DIAMOND, 1.0F, -2.8F))));
() -> new OtherworldPickaxeItem(OccultismTiers.IESNIUM, defaultProperties().attributes(PickaxeItem.createAttributes(Tiers.DIAMOND, 1.0F, -2.8F))));

public static final DeferredItem<SoulGemItem> SOUL_GEM_ITEM = ITEMS.register("soul_gem",
() -> new SoulGemItem(defaultProperties().stacksTo(1)));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* MIT License
*
* Copyright 2024 klikli-dev
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/

package com.klikli_dev.occultism.registry;

import com.google.common.base.Suppliers;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.Tier;
import net.minecraft.world.item.Tiers;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.block.Block;

import java.util.function.Supplier;

public enum OccultismTiers implements Tier {
SPIRIT_ATTUNED(Tiers.DIAMOND, BlockTags.INCORRECT_FOR_DIAMOND_TOOL, Tiers.STONE.getUses(), 8.0F, 3.0F, 10, () -> Ingredient.of(Items.DIAMOND)),
IESNIUM(Tiers.DIAMOND, BlockTags.INCORRECT_FOR_DIAMOND_TOOL, 1561, 8.0F, 3.0F, 10, () -> Ingredient.of(Items.DIAMOND));

private final Tiers vanillaTier;
private final TagKey<Block> incorrectBlocksForDrops;
private final int uses;
private final float speed;
private final float damage;
private final int enchantmentValue;
private final Supplier<Ingredient> repairIngredient;

OccultismTiers(Tiers vanillaTier, TagKey<Block> incorrectBlockForDrops, int uses, float speed, float damage, int enchantmentValue, Supplier<Ingredient> repairIngredient) {
this.vanillaTier = vanillaTier;
this.incorrectBlocksForDrops = incorrectBlockForDrops;
this.uses = uses;
this.speed = speed;
this.damage = damage;
this.enchantmentValue = enchantmentValue;
this.repairIngredient = Suppliers.memoize(repairIngredient::get);
}

@Override
public int getUses() {
return this.uses;
}

@Override
public float getSpeed() {
return this.speed;
}

@Override
public float getAttackDamageBonus() {
return this.damage;
}

@Override
public TagKey<Block> getIncorrectBlocksForDrops() {
return this.incorrectBlocksForDrops;
}

@Override
public int getEnchantmentValue() {
return this.enchantmentValue;
}

@Override
public Ingredient getRepairIngredient() {
return this.repairIngredient.get();
}

@org.jetbrains.annotations.Nullable
public net.minecraft.tags.TagKey<net.minecraft.world.level.block.Block> getTag() {
return net.neoforged.neoforge.common.CommonHooks.getTagFromVanillaTier(this.vanillaTier);
}
}

0 comments on commit bf51900

Please sign in to comment.