Skip to content

Commit

Permalink
fix ancient horn crafting and fix chunk loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Treetrain1 committed Oct 16, 2023
1 parent 56b5746 commit f59ac40
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 29 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ Make sure to clear this after each release

What's new:
-----------------
- Updated mixins to be more lenient if they can't be applied
- Fixed Ancient Horn crafting
- Fixed chunk loading
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
minecraft_version=1.20.1
quilt_mappings=1.20.1+build.23
parchment_mappings=1.20.1:2023.09.03
loader_version=0.14.22
loader_version=0.14.23

# Mod Properties
mod_id = wilderwild
mod_version = 2.1.8
mod_version = 2.1.9
mod_loader = Fabric
maven_group = net.frozenblock
archives_base_name = WilderWild
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package net.frozenblock.wilderwild.misc.recipe;

import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import net.frozenblock.wilderwild.registry.RegisterItems;
import net.minecraft.core.Holder;
import net.minecraft.core.NonNullList;
import net.minecraft.core.RegistryAccess;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.inventory.CraftingContainer;
import net.minecraft.world.item.Instrument;
import net.minecraft.world.item.InstrumentItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.CraftingBookCategory;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.world.item.crafting.ShapedRecipe;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.NotNull;

public class AncientHornRecipe extends ShapedRecipe {

public AncientHornRecipe(ResourceLocation location, CraftingBookCategory category) {
super(location, "wilderwild_ancient_horn", category, 3, 3,
NonNullList.of(
Ingredient.of(RegisterItems.ANCIENT_HORN_FRAGMENT), Ingredient.of(Items.GOLD_INGOT), Ingredient.of(RegisterItems.ANCIENT_HORN_FRAGMENT),
Ingredient.of(RegisterItems.ANCIENT_HORN_FRAGMENT), Ingredient.of(Items.ECHO_SHARD), Ingredient.of(RegisterItems.ANCIENT_HORN_FRAGMENT),
Ingredient.of(Items.ECHO_SHARD), Ingredient.of(RegisterItems.ANCIENT_HORN_FRAGMENT), Ingredient.of(Items.ECHO_SHARD)
), new ItemStack(RegisterItems.COPPER_HORN)
);
}

@Override
public ItemStack assemble(CraftingContainer container, RegistryAccess registryAccess) {
return InstrumentItem.create(super.assemble(container, registryAccess).getItem(), BuiltInRegistries.INSTRUMENT.getHolderOrThrow(RegisterItems.ANCIENT_HORN_INSTRUMENT));
}

@Override
public boolean isSpecial() {
return true;
}

@Override
public RecipeSerializer<?> getSerializer() {
return RegisterItems.ANCIENT_HORN_CRAFTING;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import net.fabricmc.fabric.api.registry.StrippableBlockRegistry;
import net.fabricmc.fabric.api.transfer.v1.item.ItemStorage;
import net.fabricmc.fabric.api.transfer.v1.item.ItemVariant;
import net.fabricmc.loader.api.FabricLoader;
import net.frozenblock.lib.axe.api.AxeBehaviors;
import net.frozenblock.lib.block.api.FrozenCeilingHangingSignBlock;
import net.frozenblock.lib.block.api.FrozenSignBlock;
Expand Down Expand Up @@ -595,11 +596,14 @@ public static void registerMisc() {
registerBlockBefore(Items.SPONGE, "lime_nematocyst", LIME_NEMATOCYST, CreativeModeTabs.NATURAL_BLOCKS);
}

public static void init() {}
private static boolean initialized = false;
public static void init() {
if (!initialized) registerBlocks();
}

// register blocks after blocks are initialized
static {
registerBlocks();
if (FabricLoader.getInstance().isModLoaded("connector")) registerBlocks();
}

public static void registerBlocks() {
Expand All @@ -612,6 +616,7 @@ public static void registerBlocks() {
registerPlants();
registerNotSoPlants();
registerMisc();
initialized = true;
}

public static void registerDispenses() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import net.frozenblock.wilderwild.item.MilkweedPod;
import net.frozenblock.wilderwild.misc.WilderEnumValues;
import net.frozenblock.wilderwild.misc.WilderSharedConstants;
import net.frozenblock.wilderwild.misc.recipe.AncientHornRecipe;
import net.frozenblock.wilderwild.misc.recipe.CopperHornRecipe;
import net.frozenblock.wilderwild.tag.WilderInstrumentTags;
import net.minecraft.core.Registry;
Expand Down Expand Up @@ -70,7 +71,10 @@
public final class RegisterItems {

// RECIPE SERIALIZERS
public static final RecipeSerializer<AncientHornRecipe> ANCIENT_HORN_CRAFTING = registerSerializer("crafting_ancient_horn", new SimpleCraftingRecipeSerializer<>(AncientHornRecipe::new));

public static final RecipeSerializer<CopperHornRecipe> COPPER_HORN_CRAFTING = registerSerializer("crafting_copper_horn", new SimpleCraftingRecipeSerializer<>(CopperHornRecipe::new));

// BLOCK ITEMS
public static final BlockItem BAOBAB_NUT = new BlockItem(RegisterBlocks.BAOBAB_NUT, new FabricItemSettings().food(RegisterFood.BAOBAB_NUT));
public static final SignItem BAOBAB_SIGN = new SignItem(new FabricItemSettings().maxCount(16),
Expand Down
26 changes: 2 additions & 24 deletions src/main/resources/data/wilderwild/recipes/ancient_horn.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,5 @@
{
"type": "minecraft:crafting_shaped",
"type": "wilderwild:crafting_ancient_horn",
"category": "equipment",
"group": "ancient_horn",
"key": {
"#": {
"item": "wilderwild:ancient_horn_fragment"
},
"I": {
"item": "minecraft:echo_shard"
},
"G": {
"item": "minecraft:gold_ingot"
}
},
"pattern": [
"#G#",
"#I#",
"I#I"
],
"result": {
"item": "wilderwild:ancient_horn",
"data": {
"instrument": "wilderwild:ancient_horn"
}
}
"group": "wilderwild_ancient_horn"
}

0 comments on commit f59ac40

Please sign in to comment.