Skip to content

Commit

Permalink
fix: microblock recipes not working with Exploration saws
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTJP committed Mar 23, 2024
1 parent ea02026 commit 295d86f
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"values": [
"projectred_exploration:gold_saw",
"projectred_exploration:ruby_saw",
"projectred_exploration:sapphire_saw",
"projectred_exploration:peridot_saw"
]
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package mrtjp.projectred.exploration.data;

import codechicken.microblock.init.CBMicroblockTags;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.tags.ItemTagsProvider;
import net.minecraftforge.common.Tags;
Expand Down Expand Up @@ -109,5 +110,11 @@ protected void addTags() {
tag(GREEN_BACKPACK_TAG).add(GREEN_BACKPACK.get());
tag(RED_BACKPACK_TAG).add(RED_BACKPACK.get());
tag(BLACK_BACKPACK_TAG).add(BLACK_BACKPACK.get());

tag(CBMicroblockTags.Items.TOOL_SAW)
.add(GOLD_SAW.get())
.add(RUBY_SAW.get())
.add(SAPPHIRE_SAW.get())
.add(PERIDOT_SAW.get());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
import mrtjp.projectred.exploration.item.BackpackItem;
import mrtjp.projectred.exploration.item.SickleItem;
import mrtjp.projectred.exploration.item.WoolGinItem;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.*;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraftforge.common.TierSortingRegistry;
import net.minecraftforge.registries.RegistryObject;

import java.util.List;
import java.util.function.Supplier;

import static mrtjp.projectred.core.init.CoreTags.*;
Expand Down Expand Up @@ -249,6 +252,12 @@ public static void register() {
WOOL_GIN = ITEMS.register(ID_WOOL_GIN, WoolGinItem::new);
ATHAME = ITEMS.register(ID_ATHAME, () -> new AthameItem(ATHAME_ITEM_TIER, 3, -2.4F));

// Tiers
registerSubDiamondTeir(ATHAME_ITEM_TIER, "athame");
registerSubDiamondTeir(RUBY_ITEM_TIER, "ruby");
registerSubDiamondTeir(SAPPHIRE_ITEM_TIER, "sapphire");
registerSubDiamondTeir(PERIDOT_ITEM_TIER, "peridot");

/* Tools */

RUBY_AXE = ITEMS.register(ID_RUBY_AXE, () -> createAxeItem(RUBY_ITEM_TIER, 5.0F, -3.0F));
Expand Down Expand Up @@ -327,23 +336,23 @@ private static Supplier<Item> createSimpleItemSupplier() {
return () -> new Item(new Item.Properties().tab(EXPLORATION_CREATIVE_TAB));
}

private static Item createAxeItem(SimpleItemTier tier, float attackDamage, float attackSpeed) {
private static Item createAxeItem(Tier tier, float attackDamage, float attackSpeed) {
return new AxeItem(tier, attackDamage, attackSpeed, new Item.Properties().tab(EXPLORATION_CREATIVE_TAB));
}

private static Item createPickaxeItem(SimpleItemTier tier, int attackDamage, float attackSpeed) {
private static Item createPickaxeItem(Tier tier, int attackDamage, float attackSpeed) {
return new PickaxeItem(tier, attackDamage, attackSpeed, new Item.Properties().tab(EXPLORATION_CREATIVE_TAB));
}

private static Item createShovelItem(SimpleItemTier tier, float attackDamage, float attackSpeed) {
private static Item createShovelItem(Tier tier, float attackDamage, float attackSpeed) {
return new ShovelItem(tier, attackDamage, attackSpeed, new Item.Properties().tab(EXPLORATION_CREATIVE_TAB));
}

private static Item createHoeItem(SimpleItemTier tier, int attackDamage, float attackSpeed) {
private static Item createHoeItem(Tier tier, int attackDamage, float attackSpeed) {
return new HoeItem(tier, attackDamage, attackSpeed, new Item.Properties().tab(EXPLORATION_CREATIVE_TAB));
}

private static Item createSwordItem(SimpleItemTier tier, int attackDamage, float attackSpeed) {
private static Item createSwordItem(Tier tier, int attackDamage, float attackSpeed) {
return new SwordItem(tier, attackDamage, attackSpeed, new Item.Properties().tab(EXPLORATION_CREATIVE_TAB));
}

Expand All @@ -359,6 +368,14 @@ private static Item createArmorItem(SimpleArmorMaterial material, EquipmentSlot
return new ArmorItem(material, slot, new Item.Properties().tab(EXPLORATION_CREATIVE_TAB));
}

private static void registerSubDiamondTeir(Tier tier, String id) {
TierSortingRegistry.registerTier(
tier,
new ResourceLocation(MOD_ID, id),
List.of(Tiers.WOOD, Tiers.STONE, Tiers.IRON, Tiers.GOLD),
List.of(Tiers.DIAMOND, Tiers.NETHERITE));
}

//region Utilities
public static Item getBackpackByColor(int color) {
return switch (color) {
Expand Down
6 changes: 6 additions & 0 deletions exploration/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ Redstone. The way it was meant to be.
versionRange="[${cbm_version},)"
ordering="AFTER"
side="BOTH"
[[dependencies.projectred_exploration]]
modId="cb_microblock"
mandatory=true
versionRange="[${cbm_version},)"
ordering="AFTER"
side="BOTH"
[[dependencies.projectred_exploration]]
modId="projectred_core"
mandatory=true
Expand Down

0 comments on commit 295d86f

Please sign in to comment.