Skip to content

Commit

Permalink
feat: Test infusion recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
Zepalesque committed Jun 11, 2024
1 parent b33a3a0 commit 708743f
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ aether_version=1.20.4-1.4.1-neoforge
nitrogen_version=1.20.4-1.1.4-neoforge
cumulus_version=1.20.4-1.0.1-neoforge
curios_version=7.3.4
zenith_version=1.0.42
zenith_version=1.0.45
aeroblender_version=5271794
terrablender_version=1.20.4-3.3.0.12
terrablender_version_minimum=1.20.4-3.3.0.0
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/net/zepalesque/redux/Redux.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import net.zepalesque.redux.data.gen.tags.ReduxItemTagsGen;
import net.zepalesque.redux.entity.ReduxEntities;
import net.zepalesque.redux.item.ReduxItems;
import net.zepalesque.redux.recipe.ReduxRecipes;
import net.zepalesque.redux.tile.ReduxTiles;
import net.zepalesque.redux.world.biome.tint.ReduxBiomeTints;
import net.zepalesque.redux.world.feature.gen.ReduxFeatures;
Expand Down Expand Up @@ -95,7 +96,9 @@ public Redux(IEventBus bus, Dist dist) {
ReduxBiomeTints.TINTS,
ReduxFeatures.FEATURES,
ReduxFoliagePlacers.FOLIAGE_PLACERS,
ReduxParticles.PARTICLES
ReduxParticles.PARTICLES,
ReduxRecipes.TYPES,
ReduxRecipes.Serializers.SERIALIZERS
};

for (DeferredRegister<?> register : registers) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

import com.aetherteam.aether.block.AetherBlocks;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.data.PackOutput;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.data.recipes.RecipeOutput;
import net.minecraft.data.recipes.ShapedRecipeBuilder;
import net.minecraft.data.recipes.SimpleCookingRecipeBuilder;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.Ingredient;
import net.zepalesque.redux.Redux;
import net.zepalesque.redux.block.ReduxBlocks;
Expand Down Expand Up @@ -72,6 +76,8 @@ protected void buildRecipes(@NotNull RecipeOutput output) {
.unlockedBy(ReduxRecipeProvider.getHasName(AetherBlocks.SENTRY_STONE.get()), ReduxRecipeProvider.has(AetherBlocks.SENTRY_STONE.get()))
.save(output);

// Temporary test recipe
infuse(ReduxItems.VERIDIUM_INGOT.get(), Items.IRON_INGOT).withSound(BuiltInRegistries.SOUND_EVENT.wrapAsHolder(SoundEvents.ENCHANTMENT_TABLE_USE));

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ public void crossTintedDualGloverlay(Block block, String location, boolean useGl
.texture("glow", this.texture(this.name(block) + "_glow", location)).renderType("cutout")
.texture("overlay", this.texture(this.name(block) + "_overlay", location)).renderType("cutout");
this.crossBlock(block, cross);

}
public void crossTintedOverlay(Block block, String location) {
BlockModelBuilder cross = models().withExistingParent(this.name(block), Redux.loc(ModelProvider.BLOCK_FOLDER + "/template/cross/cross_tinted_overlay"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package net.zepalesque.redux.data.prov;

import com.aetherteam.aether.data.providers.AetherRecipeProvider;
import com.aetherteam.aether.recipe.recipes.block.AmbrosiumRecipe;
import com.aetherteam.nitrogen.data.providers.NitrogenRecipeProvider;
import com.aetherteam.nitrogen.recipe.BlockStateIngredient;
import com.aetherteam.nitrogen.recipe.builder.BlockStateRecipeBuilder;
import net.minecraft.advancements.Criterion;
import net.minecraft.advancements.critereon.InventoryChangeTrigger;
import net.minecraft.advancements.critereon.ItemPredicate;
Expand All @@ -18,11 +21,14 @@
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.zepalesque.redux.recipe.recipes.InfusionRecipe;
import net.zepalesque.zenith.recipe.builder.StackingRecipeBuilder;

import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
Expand Down Expand Up @@ -131,6 +137,10 @@ public SimpleCookingRecipeBuilder smeltingOreRecipe(ItemLike result, ItemLike in
return super.smeltingOreRecipe(result, ingredient, experience);
}

public StackingRecipeBuilder infuse(ItemLike result, ItemLike ingredient) {
return StackingRecipeBuilder.recipe(Ingredient.of(ingredient), new ItemStack(result), InfusionRecipe::new);
}

@Override
public ResourceLocation name(String name) {
return super.name(name);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package net.zepalesque.redux.event.listener;

import com.aetherteam.aether.item.AetherItems;
import net.minecraft.world.inventory.ClickAction;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod.EventBusSubscriber;
import net.neoforged.neoforge.event.ItemStackedOnOtherEvent;
import net.zepalesque.redux.Redux;
import net.zepalesque.redux.recipe.ReduxRecipes;
import net.zepalesque.zenith.recipe.StackingRecipeHelper;

@EventBusSubscriber(modid = Redux.MODID)
public class RecipeListener {

@SubscribeEvent
public static void onStackItem(ItemStackedOnOtherEvent event) {
if (event.getClickAction() == ClickAction.SECONDARY) {
StackingRecipeHelper.stack(event, stack -> stack.is(AetherItems.AMBROSIUM_SHARD), ReduxRecipes.INFUSION.get());
}
}
}
27 changes: 27 additions & 0 deletions src/main/java/net/zepalesque/redux/recipe/ReduxRecipes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package net.zepalesque.redux.recipe;

import com.aetherteam.aether.Aether;
import com.aetherteam.aether.recipe.recipes.block.AmbrosiumRecipe;
import com.aetherteam.nitrogen.recipe.serializer.BlockStateRecipeSerializer;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.world.item.crafting.RecipeType;
import net.neoforged.neoforge.registries.DeferredHolder;
import net.neoforged.neoforge.registries.DeferredRegister;
import net.zepalesque.redux.Redux;
import net.zepalesque.redux.recipe.recipes.InfusionRecipe;
import net.zepalesque.zenith.recipe.serializer.StackingRecipeSerializer;

public class ReduxRecipes {
public static final DeferredRegister<RecipeType<?>> TYPES = DeferredRegister.create(BuiltInRegistries.RECIPE_TYPE, Redux.MODID);
public static final DeferredHolder<RecipeType<?>, RecipeType<InfusionRecipe>> INFUSION = TYPES.register("infusion", () -> RecipeType.simple(new ResourceLocation(Redux.MODID, "infusion")));



public static class Serializers {
public static final DeferredRegister<RecipeSerializer<?>> SERIALIZERS = DeferredRegister.create(BuiltInRegistries.RECIPE_SERIALIZER, Redux.MODID);
public static final DeferredHolder<RecipeSerializer<?>, StackingRecipeSerializer<InfusionRecipe>> INFUSION = SERIALIZERS.register("infusion", InfusionRecipe.Serializer::new);

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package net.zepalesque.redux.recipe.recipes;

import net.minecraft.core.Holder;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.crafting.RecipeSerializer;
import net.zepalesque.redux.recipe.ReduxRecipes;
import net.zepalesque.zenith.recipe.recipes.AbstractStackingRecipe;
import net.zepalesque.zenith.recipe.serializer.StackingRecipeSerializer;

import java.util.Optional;

public class InfusionRecipe extends AbstractStackingRecipe {
public InfusionRecipe(Ingredient ingredient, ItemStack result, Optional<CompoundTag> additional, Optional<Holder<SoundEvent>> sound) {
super(ReduxRecipes.INFUSION.get(), ingredient, result, additional, sound);
}

@Override
public RecipeSerializer<?> getSerializer() {
return ReduxRecipes.Serializers.INFUSION.get();
}

public static class Serializer extends StackingRecipeSerializer<InfusionRecipe> {
public Serializer() {
super(InfusionRecipe::new);
}
}
}

0 comments on commit 708743f

Please sign in to comment.