Skip to content

Commit

Permalink
Fix mining hammer durability (#648)
Browse files Browse the repository at this point in the history
* Multiply mining hammer durability by 3

* Not hardcoding it
  • Loading branch information
TacoMonkey11 authored Dec 27, 2023
1 parent a50d8ef commit 19bc833
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public enum GTToolType {
AXE("axe", "axes", 6.0F, -3.2F, true),
HOE("hoe", "hoes", 0, -3.0F, true),

MINING_HAMMER("mining_hammer", "mining_hammers", TagUtil.createBlockTag("mineable/pickaxe", true), 1.5F, -3.2F, GTCEu.id("item/tools/mining_hammer"), null, false),
MINING_HAMMER("mining_hammer", "mining_hammers", TagUtil.createBlockTag("mineable/pickaxe", true), 1.5F, -3.2F, GTCEu.id("item/tools/mining_hammer"), null, false, 3),

SAW("saw", "saws", 1, 1, GTSoundEntries.SAW_TOOL),
HARD_HAMMER("hammer", "hammers", 1, 1, GTSoundEntries.FORGE_HAMMER),
Expand All @@ -53,23 +53,25 @@ public enum GTToolType {
public final ResourceLocation modelLocation;
@Nullable
public final SoundEntry soundEntry;
public final int durabilityMultiplier;

GTToolType(String name, TagKey<Block> harvestTag, TagKey<Item> itemTag, float attackDamageModifier, float attackSpeedModifier, ResourceLocation modelLocation, SoundEntry soundEntry) {
GTToolType(String name, TagKey<Block> harvestTag, TagKey<Item> itemTag, float attackDamageModifier, float attackSpeedModifier, ResourceLocation modelLocation, SoundEntry soundEntry, int durabilityMultiplier) {
this.name = name;
this.itemTag = itemTag;
this.harvestTag = harvestTag;
this.attackDamageModifier = attackDamageModifier;
this.attackSpeedModifier = attackSpeedModifier;
this.modelLocation = modelLocation;
this.soundEntry = soundEntry;
this.durabilityMultiplier = durabilityMultiplier;
}

GTToolType(String name, String plural, TagKey<Block> harvestTag, float attackDamageModifier, float attackSpeedModifier, ResourceLocation modelLocation, SoundEntry soundEntry, boolean isVanilla) {
this(name, harvestTag, isVanilla ? TagUtil.createItemTag(plural, true) : TagUtil.createPlatformItemTag("tools/" + plural, plural), attackDamageModifier, attackSpeedModifier, modelLocation, soundEntry);
GTToolType(String name, String plural, TagKey<Block> harvestTag, float attackDamageModifier, float attackSpeedModifier, ResourceLocation modelLocation, SoundEntry soundEntry, boolean isVanilla, int durabilityMultiplier) {
this(name, harvestTag, isVanilla ? TagUtil.createItemTag(plural, true) : TagUtil.createPlatformItemTag("tools/" + plural, plural), attackDamageModifier, attackSpeedModifier, modelLocation, soundEntry, durabilityMultiplier);
}

GTToolType(String name, String plural, float attackDamageModifier, float attackSpeedModifier, ResourceLocation modelLocation, SoundEntry soundEntry, boolean isVanilla) {
this(name, plural, isVanilla ? TagUtil.createBlockTag("mineable/" + name, true) : TagUtil.createPlatformUnprefixedTag(BuiltInRegistries.BLOCK, "forge:mineable/" + name, "fabric:mineable/" + name), attackDamageModifier, attackSpeedModifier, modelLocation, soundEntry, isVanilla);
this(name, plural, isVanilla ? TagUtil.createBlockTag("mineable/" + name, true) : TagUtil.createPlatformUnprefixedTag(BuiltInRegistries.BLOCK, "forge:mineable/" + name, "fabric:mineable/" + name), attackDamageModifier, attackSpeedModifier, modelLocation, soundEntry, isVanilla, 1);
}

GTToolType(String name, String plural, float attackDamageModifier, float attackSpeedModifier, SoundEntry soundEntry, boolean isVanilla) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public static void generateTools() {
for (GTToolType toolType : GTToolType.values()) {
if (property.hasType(toolType)) {
TOOL_ITEMS.put(tier, toolType, REGISTRATE.item("%s_%s".formatted(tier.material.getName().toLowerCase(Locale.ROOT), toolType.name), p -> GTToolItem.create(toolType, tier, p))
.properties(p -> p.craftRemainder(Items.AIR))
.properties(p -> p.craftRemainder(Items.AIR).durability(tier.getUses() * toolType.durabilityMultiplier))
.setData(ProviderType.LANG, NonNullBiConsumer.noop())
.model(NonNullBiConsumer.noop())
.color(() -> GTToolItem::tintColor)
Expand Down

0 comments on commit 19bc833

Please sign in to comment.