mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
4eee99c75b
35 changed files with 370 additions and 476 deletions
|
@ -3,7 +3,6 @@ package de.ellpeck.actuallyadditions.api.internal;
|
|||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.recipe;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.WeightedRandom;
|
||||
|
||||
@Deprecated
|
||||
public class BallOfFurReturn extends WeightedRandom.Item {
|
||||
|
||||
public final ItemStack returnItem;
|
||||
|
||||
public BallOfFurReturn(ItemStack returnItem, int chance) {
|
||||
super(chance);
|
||||
this.returnItem = returnItem;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.recipe;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.potion.EffectInstance;
|
||||
|
||||
@Deprecated
|
||||
public class CoffeeIngredient {
|
||||
|
||||
protected final Ingredient input;
|
||||
protected final int maxAmplifier;
|
||||
protected EffectInstance[] effects;
|
||||
|
||||
@Deprecated
|
||||
public CoffeeIngredient(ItemStack input, EffectInstance[] effects, int maxAmplifier) {
|
||||
this(Ingredient.fromStacks(input), maxAmplifier, effects);
|
||||
}
|
||||
|
||||
public CoffeeIngredient(Ingredient input, int maxAmplifier, EffectInstance... effects) {
|
||||
this.input = input;
|
||||
this.effects = effects;
|
||||
this.maxAmplifier = maxAmplifier;
|
||||
}
|
||||
|
||||
public boolean matches(ItemStack stack) {
|
||||
return this.input.test(stack);
|
||||
}
|
||||
|
||||
public Ingredient getInput() {
|
||||
return this.input;
|
||||
}
|
||||
|
||||
public EffectInstance[] getEffects() {
|
||||
return this.effects;
|
||||
}
|
||||
|
||||
public boolean effect(ItemStack stack) {
|
||||
return ActuallyAdditionsAPI.methodHandler.addEffectToStack(stack, this);
|
||||
}
|
||||
|
||||
public String getExtraText() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public int getMaxAmplifier() {
|
||||
return this.maxAmplifier;
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.recipe;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
|
||||
@Deprecated
|
||||
public class CompostRecipe {
|
||||
|
||||
protected final Ingredient input;
|
||||
protected final ItemStack output;
|
||||
protected final BlockState inputDisplay;
|
||||
protected final BlockState outputDisplay;
|
||||
|
||||
@Deprecated
|
||||
public CompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay) {
|
||||
this(Ingredient.fromStacks(input), inputDisplay.getDefaultState(), output, outputDisplay.getDefaultState());
|
||||
}
|
||||
|
||||
public CompostRecipe(Ingredient input, BlockState inputDisplay, ItemStack output, BlockState outputDisplay) {
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.inputDisplay = inputDisplay;
|
||||
this.outputDisplay = outputDisplay;
|
||||
}
|
||||
|
||||
public boolean matches(ItemStack stack) {
|
||||
return this.input.test(stack);
|
||||
}
|
||||
|
||||
public Ingredient getInput() {
|
||||
return this.input;
|
||||
}
|
||||
|
||||
public ItemStack getOutput() {
|
||||
return this.output;
|
||||
}
|
||||
|
||||
public BlockState getInputDisplay() {
|
||||
return this.inputDisplay;
|
||||
}
|
||||
|
||||
public BlockState getOutputDisplay() {
|
||||
return this.outputDisplay;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.api.recipe;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
|
||||
public class CrusherRecipe {
|
||||
|
||||
protected Ingredient input;
|
||||
protected ItemStack outputOne;
|
||||
protected ItemStack outputTwo;
|
||||
protected int outputChance;
|
||||
|
||||
@Deprecated
|
||||
public CrusherRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int outputChance) {
|
||||
this(Ingredient.fromStacks(input), outputOne, outputTwo, outputChance);
|
||||
}
|
||||
|
||||
public CrusherRecipe(Ingredient input, ItemStack outputOne, ItemStack outputTwo, int outputChance) {
|
||||
this.input = input;
|
||||
this.outputOne = outputOne;
|
||||
this.outputTwo = outputTwo;
|
||||
this.outputChance = outputChance;
|
||||
}
|
||||
|
||||
public boolean matches(ItemStack stack) {
|
||||
return this.input.test(stack);
|
||||
}
|
||||
|
||||
public ItemStack getOutputOne() {
|
||||
return this.outputOne;
|
||||
}
|
||||
|
||||
public ItemStack getOutputTwo() {
|
||||
return this.outputTwo;
|
||||
}
|
||||
|
||||
public int getSecondChance() {
|
||||
return this.outputChance;
|
||||
}
|
||||
|
||||
public Ingredient getInput() {
|
||||
return this.input;
|
||||
}
|
||||
|
||||
}
|
|
@ -7,7 +7,6 @@ import java.util.List;
|
|||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||
import de.ellpeck.actuallyadditions.booklet.page.BookletPage;
|
||||
import de.ellpeck.actuallyadditions.booklet.page.PageCoffeeMachine;
|
||||
import de.ellpeck.actuallyadditions.common.items.ItemCoffee;
|
||||
|
|
|
@ -6,7 +6,6 @@ import java.util.List;
|
|||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
|
||||
import de.ellpeck.actuallyadditions.booklet.page.PageCrusherRecipe;
|
||||
import de.ellpeck.actuallyadditions.common.crafting.CrusherCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.List;
|
|||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||
import de.ellpeck.actuallyadditions.booklet.gui.GuiBooklet;
|
||||
import de.ellpeck.actuallyadditions.common.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.common.items.metalists.TheMiscItems;
|
||||
|
|
|
@ -3,7 +3,6 @@ package de.ellpeck.actuallyadditions.booklet.page;
|
|||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.booklet.gui.GuiBooklet;
|
||||
import de.ellpeck.actuallyadditions.common.util.StackUtil;
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.common.items.metalists.TheDusts;
|
||||
|
|
|
@ -6,7 +6,6 @@ import java.util.List;
|
|||
import javax.annotation.Nullable;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.items.base.ItemFoodBase;
|
||||
import de.ellpeck.actuallyadditions.common.items.metalists.TheMiscItems;
|
||||
|
|
|
@ -2,9 +2,6 @@ package de.ellpeck.actuallyadditions.common.jei;
|
|||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.InitBlocks;
|
||||
|
|
|
@ -7,7 +7,6 @@ import com.google.common.base.Strings;
|
|||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.InitBlocks;
|
||||
import de.ellpeck.actuallyadditions.booklet.misc.BookletUtils;
|
||||
|
|
|
@ -3,7 +3,6 @@ package de.ellpeck.actuallyadditions.common.jei.compost;
|
|||
import java.util.Arrays;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.InitBlocks;
|
||||
import de.ellpeck.actuallyadditions.booklet.misc.BookletUtils;
|
||||
import de.ellpeck.actuallyadditions.common.jei.RecipeWrapperWithButton;
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.InitBlocks;
|
||||
import de.ellpeck.actuallyadditions.booklet.misc.BookletUtils;
|
||||
import de.ellpeck.actuallyadditions.common.jei.RecipeWrapperWithButton;
|
||||
|
|
|
@ -10,7 +10,6 @@ import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
|||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||
import de.ellpeck.actuallyadditions.api.internal.IMethodHandler;
|
||||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.BlockLaserRelay;
|
||||
import de.ellpeck.actuallyadditions.booklet.chapter.BookletChapter;
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.config.values.ConfigStringListValues;
|
||||
import de.ellpeck.actuallyadditions.common.util.StackUtil;
|
||||
|
|
|
@ -6,10 +6,12 @@ import net.minecraft.item.crafting.IRecipeSerializer;
|
|||
import net.minecraft.item.crafting.IRecipeType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Recipe class for the AtomicReconstructor when hitting a items stack
|
||||
*/
|
||||
public class AtomicReconstructorBlockRecipe implements IDummyRecipe {
|
||||
public class AtomicReconstructorBlockRecipe implements IDummyRecipe<AtomicReconstructorBlockRecipe> {
|
||||
|
||||
public static final IRecipeType<AtomicReconstructorBlockRecipe> ATOMIC_RECONSTRUCTOR_BLOCK_RECIPE_TYPE = IRecipeType.register("actuallyadditions:atomic_reconstructor_block");
|
||||
|
||||
|
@ -44,16 +46,19 @@ public class AtomicReconstructorBlockRecipe implements IDummyRecipe {
|
|||
return energyConsumption;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ResourceLocation getId(){
|
||||
return this.recipeId;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeSerializer<?> getSerializer(){
|
||||
public IRecipeSerializer<AtomicReconstructorBlockRecipe> getSerializer(){
|
||||
return AtomicReconstructorBlockRecipeFactory.INSTANCE;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeType<?> getType(){
|
||||
return ATOMIC_RECONSTRUCTOR_BLOCK_RECIPE_TYPE;
|
||||
|
|
|
@ -7,21 +7,23 @@ import net.minecraft.item.crafting.IRecipeType;
|
|||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Recipe class for the AtomicReconstructor when hitting a items stack
|
||||
*/
|
||||
public class AtomicReconstructorItemRecipe implements IDummyRecipe {
|
||||
public class AtomicReconstructorItemRecipe implements IDummyRecipe<AtomicReconstructorItemRecipe> {
|
||||
|
||||
public static final IRecipeType<AtomicReconstructorItemRecipe> ATOMIC_RECONSTRUCTOR_ITEM_RECIPE_TYPE = IRecipeType.register("actuallyadditions:atomic_reconstructor_item");
|
||||
|
||||
private final ResourceLocation recipeId;
|
||||
@Nonnull private final ResourceLocation recipeId;
|
||||
|
||||
private final Lens lens;
|
||||
private final Ingredient input;
|
||||
private final ItemStack output;
|
||||
@Nonnull private final Lens lens;
|
||||
@Nonnull private final Ingredient input;
|
||||
@Nonnull private final ItemStack output;
|
||||
private final int energyConsumption;
|
||||
|
||||
public AtomicReconstructorItemRecipe(ResourceLocation recipeId, Lens lens, Ingredient input, ItemStack output, int energyConsumption){
|
||||
public AtomicReconstructorItemRecipe(@Nonnull ResourceLocation recipeId, @Nonnull Lens lens, @Nonnull Ingredient input, @Nonnull ItemStack output, int energyConsumption){
|
||||
this.recipeId = recipeId;
|
||||
this.lens = lens;
|
||||
this.input = input;
|
||||
|
@ -29,14 +31,17 @@ public class AtomicReconstructorItemRecipe implements IDummyRecipe {
|
|||
this.energyConsumption = energyConsumption;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public Lens getLens(){
|
||||
return lens;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public Ingredient getInput(){
|
||||
return input;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ItemStack getOutput(){
|
||||
return output;
|
||||
}
|
||||
|
@ -45,16 +50,19 @@ public class AtomicReconstructorItemRecipe implements IDummyRecipe {
|
|||
return energyConsumption;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ResourceLocation getId(){
|
||||
return this.recipeId;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeSerializer<?> getSerializer(){
|
||||
public IRecipeSerializer<AtomicReconstructorItemRecipe> getSerializer(){
|
||||
return AtomicReconstructorItemRecipeFactory.INSTANCE;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeType<?> getType(){
|
||||
return ATOMIC_RECONSTRUCTOR_ITEM_RECIPE_TYPE;
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.item.crafting.IRecipeType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class BallOfFurRecipe implements IDummyRecipe {
|
||||
|
||||
public static final IRecipeType<BallOfFurRecipe> BALL_OF_FUR_RECIPE_TYPE = IRecipeType.register("actuallyadditions:ball_of_fur");
|
||||
|
||||
private final ResourceLocation recipeId;
|
||||
|
||||
private final ItemStack returnItem;
|
||||
private final int chance;
|
||||
|
||||
public BallOfFurRecipe(ResourceLocation recipeId, ItemStack returnItem, int chance){
|
||||
this.recipeId = recipeId;
|
||||
this.returnItem = returnItem;
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
public ItemStack getReturnItem(){
|
||||
return this.returnItem;
|
||||
}
|
||||
|
||||
public int getChance(){
|
||||
return this.chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getId(){
|
||||
return this.recipeId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeSerializer<?> getSerializer(){
|
||||
return BallOfFurRecipeFactory.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeType<?> getType(){
|
||||
return BALL_OF_FUR_RECIPE_TYPE;
|
||||
}
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.recipes;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.item.crafting.ShapedRecipe;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.registries.ForgeRegistryEntry;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BallOfFurRecipeFactory extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<BallOfFurRecipe> {
|
||||
|
||||
public static final BallOfFurRecipeFactory INSTANCE = IRecipeSerializer.register("actuallyadditions:ball_of_fur", new BallOfFurRecipeFactory());
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BallOfFurRecipe read(@Nonnull ResourceLocation recipeId, @Nonnull JsonObject json){
|
||||
ItemStack stack;
|
||||
int chance;
|
||||
|
||||
if(json.has("stack")){
|
||||
JsonElement stackJsonElement = json.get("stack");
|
||||
if(stackJsonElement.isJsonObject()){
|
||||
stack = ShapedRecipe.deserializeItem(stackJsonElement.getAsJsonObject());
|
||||
} else {
|
||||
throw new JsonParseException("BallOfFurRecipe stack has to be a json object!");
|
||||
}
|
||||
} else {
|
||||
throw new JsonParseException("BallOfFurRecipe has no json stack object!");
|
||||
}
|
||||
|
||||
if(json.has("chance")){
|
||||
JsonElement chanceJsonElement = json.get("chance");
|
||||
if(chanceJsonElement.isJsonPrimitive()){
|
||||
chance = chanceJsonElement.getAsInt();
|
||||
} else {
|
||||
throw new JsonParseException("BallOfFurRecipe chance is not a json integer!");
|
||||
}
|
||||
} else {
|
||||
throw new JsonParseException("BallOfFurRecipe has no chance integer!");
|
||||
}
|
||||
|
||||
return new BallOfFurRecipe(recipeId, stack, chance);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BallOfFurRecipe read(@Nonnull ResourceLocation recipeId, @Nonnull PacketBuffer buffer){
|
||||
ItemStack stack = buffer.readItemStack();
|
||||
int chance = buffer.readInt();
|
||||
return new BallOfFurRecipe(recipeId, stack, chance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(@Nonnull PacketBuffer buffer, @Nonnull BallOfFurRecipe recipe){
|
||||
buffer.writeItemStack(recipe.getReturnItem());
|
||||
buffer.writeInt(recipe.getChance());
|
||||
}
|
||||
|
||||
}
|
|
@ -6,22 +6,25 @@ import net.minecraft.item.crafting.Ingredient;
|
|||
import net.minecraft.potion.EffectInstance;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class CoffeeMachineIngredient implements IDummyRecipe{
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class CoffeeMachineIngredient implements IDummyRecipe<CoffeeMachineIngredient> {
|
||||
|
||||
public static final IRecipeType<CoffeeMachineIngredient> COFFEE_MACHINE_RECIPE_TYPE = IRecipeType.register("actuallyadditions:coffee_machine");
|
||||
|
||||
protected final ResourceLocation recipeId;
|
||||
protected final Ingredient input;
|
||||
protected final int maxAmplifier;
|
||||
protected final EffectInstance[] effects;
|
||||
@Nonnull private final ResourceLocation recipeId;
|
||||
@Nonnull private final Ingredient input;
|
||||
private final int maxAmplifier;
|
||||
@Nonnull private final EffectInstance[] effects;
|
||||
|
||||
public CoffeeMachineIngredient(ResourceLocation recipeId, Ingredient input, int maxAmplifier, EffectInstance[] effects){
|
||||
public CoffeeMachineIngredient(@Nonnull ResourceLocation recipeId, @Nonnull Ingredient input, int maxAmplifier, @Nonnull EffectInstance[] effects){
|
||||
this.recipeId = recipeId;
|
||||
this.input = input;
|
||||
this.maxAmplifier = maxAmplifier;
|
||||
this.effects = effects;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public Ingredient getInput(){
|
||||
return input;
|
||||
}
|
||||
|
@ -30,20 +33,24 @@ public class CoffeeMachineIngredient implements IDummyRecipe{
|
|||
return maxAmplifier;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public EffectInstance[] getEffects(){
|
||||
return effects;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ResourceLocation getId(){
|
||||
return this.recipeId;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeSerializer<?> getSerializer(){
|
||||
public IRecipeSerializer<CoffeeMachineIngredient> getSerializer(){
|
||||
return CoffeeMachineIngredientFactory.INSTANCE;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeType<?> getType(){
|
||||
return COFFEE_MACHINE_RECIPE_TYPE;
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.recipes;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.item.crafting.IRecipeType;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class CompostRecipe implements IDummyRecipe {
|
||||
|
||||
public static final IRecipeType<CompostRecipe> COMPOST_RECIPE_TYPE = IRecipeType.register("actuallyadditions:compost");
|
||||
|
||||
private final ResourceLocation recipeId;
|
||||
|
||||
private final Ingredient input;
|
||||
private final ItemStack output;
|
||||
private final BlockState inputDisplay;
|
||||
private final BlockState outputDisplay;
|
||||
|
||||
public CompostRecipe(ResourceLocation recipeId, Ingredient input, ItemStack output, BlockState inputDisplay, BlockState outputDisplay){
|
||||
this.recipeId = recipeId;
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.inputDisplay = inputDisplay;
|
||||
this.outputDisplay = outputDisplay;
|
||||
}
|
||||
|
||||
public Ingredient getInput(){
|
||||
return this.input;
|
||||
}
|
||||
|
||||
public ItemStack getOutput(){
|
||||
return this.output;
|
||||
}
|
||||
|
||||
public BlockState getInputDisplay(){
|
||||
return this.inputDisplay;
|
||||
}
|
||||
|
||||
public BlockState getOutputDisplay(){
|
||||
return this.outputDisplay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getId(){
|
||||
return this.recipeId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeSerializer<?> getSerializer(){
|
||||
return CompostRecipeFactory.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeType<?> getType(){
|
||||
return COMPOST_RECIPE_TYPE;
|
||||
}
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.common.recipes;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.mojang.datafixers.Dynamic;
|
||||
import com.mojang.datafixers.types.JsonOps;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.item.crafting.ShapedRecipe;
|
||||
import net.minecraft.nbt.*;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.registries.ForgeRegistryEntry;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class CompostRecipeFactory extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<CompostRecipe> {
|
||||
|
||||
public static final CompostRecipeFactory INSTANCE = IRecipeSerializer.register("actuallyadditions:compost", new CompostRecipeFactory());
|
||||
|
||||
@Override
|
||||
public CompostRecipe read(ResourceLocation recipeId, JsonObject json){
|
||||
Ingredient input;
|
||||
ItemStack output;
|
||||
BlockState inputDisplay;
|
||||
BlockState outputDisplay;
|
||||
|
||||
if(json.has("input")){
|
||||
input = Ingredient.deserialize(json.get("input"));
|
||||
} else {
|
||||
throw new JsonParseException("CompostRecipe needs a input ingredient json element!");
|
||||
}
|
||||
|
||||
if(json.has("output")){
|
||||
JsonElement outputJsonElement = json.get("output");
|
||||
if(outputJsonElement.isJsonObject()){
|
||||
output = ShapedRecipe.deserializeItem(outputJsonElement.getAsJsonObject());
|
||||
} else {
|
||||
throw new JsonParseException("CompostRecipe output element is not a json object!");
|
||||
}
|
||||
} else {
|
||||
throw new JsonParseException("CompostRecipe needs a output itemstack json object!");
|
||||
}
|
||||
|
||||
if(json.has("display")){
|
||||
JsonElement displayJsonElement = json.get("display");
|
||||
if(displayJsonElement.isJsonObject()){
|
||||
JsonObject displayJsonObject = displayJsonElement.getAsJsonObject();
|
||||
if(displayJsonObject.has("input")){
|
||||
inputDisplay = BlockState.deserialize(new Dynamic<>(JsonOps.INSTANCE, displayJsonObject.get("input")));
|
||||
} else {
|
||||
throw new JsonParseException("CompostRecipe display needs an input json element!");
|
||||
}
|
||||
|
||||
if(displayJsonObject.has("output")){
|
||||
outputDisplay = BlockState.deserialize(new Dynamic<>(JsonOps.INSTANCE, displayJsonObject.get("output")));
|
||||
} else {
|
||||
throw new JsonParseException("CompostRecipe display needs an output json element!");
|
||||
}
|
||||
} else {
|
||||
throw new JsonParseException("CompostRecipe display has to be a json object!");
|
||||
}
|
||||
} else {
|
||||
// no exception but default values
|
||||
inputDisplay = Blocks.DIRT.getDefaultState();
|
||||
outputDisplay = Blocks.COARSE_DIRT.getDefaultState();
|
||||
}
|
||||
|
||||
return new CompostRecipe(recipeId, input, output, inputDisplay, outputDisplay);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public CompostRecipe read(ResourceLocation recipeId, PacketBuffer buffer){
|
||||
Ingredient input = Ingredient.read(buffer);
|
||||
ItemStack output = buffer.readItemStack();
|
||||
CompoundNBT inputNBT = buffer.readCompoundTag();
|
||||
CompoundNBT outputNBT = buffer.readCompoundTag();
|
||||
|
||||
BlockState inputDisplay = BlockState.deserialize(new Dynamic<>(NBTDynamicOps.INSTANCE, inputNBT));
|
||||
BlockState outputDisplay = BlockState.deserialize(new Dynamic<>(NBTDynamicOps.INSTANCE, outputNBT));
|
||||
|
||||
return new CompostRecipe(recipeId, input, output, inputDisplay, outputDisplay);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(PacketBuffer buffer, CompostRecipe recipe){
|
||||
recipe.getInput().write(buffer);
|
||||
buffer.writeItemStack(recipe.getOutput());
|
||||
|
||||
INBT inputNBT = BlockState.serialize(NBTDynamicOps.INSTANCE, recipe.getInputDisplay()).getValue();
|
||||
buffer.writeCompoundTag((CompoundNBT) inputNBT); // if it isn't a compound than something real big is wrong and a crash should be the best way to handle it
|
||||
|
||||
INBT outputNBT = BlockState.serialize(NBTDynamicOps.INSTANCE, recipe.getOutputDisplay()).getValue();
|
||||
buffer.writeCompoundTag((CompoundNBT) outputNBT);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,136 @@
|
|||
package de.ellpeck.actuallyadditions.common.recipes;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.item.crafting.IRecipeType;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class CrusherRecipe implements IDummyRecipe<CrusherRecipe> {
|
||||
|
||||
public static final IRecipeType<CrusherRecipe> RECIPE_TYPE = IRecipeType.register("actuallyadditions:crusher");
|
||||
public static final CrusherRecipeFactory FACTORY = IRecipeSerializer.register("actuallyadditions:crusher", new CrusherRecipeFactory());
|
||||
|
||||
@Nonnull
|
||||
private final ResourceLocation recipeId;
|
||||
|
||||
@Nonnull
|
||||
private final Ingredient input;
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
@Nonnull
|
||||
private final ItemStack secondaryOutput;
|
||||
private final int outputChance;
|
||||
|
||||
public CrusherRecipe(@Nonnull ResourceLocation recipeId, @Nonnull Ingredient input, @Nonnull ItemStack output, @Nonnull ItemStack secondaryOutput, int outputChance){
|
||||
this.recipeId = recipeId;
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.secondaryOutput = secondaryOutput;
|
||||
this.outputChance = outputChance;
|
||||
}
|
||||
|
||||
public CrusherRecipe(@Nonnull ResourceLocation recipeId, @Nonnull Ingredient input, @Nonnull ItemStack output){
|
||||
this(recipeId, input, output, ItemStack.EMPTY, 0);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public Ingredient getInput(){
|
||||
return input;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ItemStack getOutput(){
|
||||
return output;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ItemStack getSecondaryOutput(){
|
||||
return secondaryOutput;
|
||||
}
|
||||
|
||||
public int getOutputChance(){
|
||||
return outputChance;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ResourceLocation getId(){
|
||||
return this.recipeId;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeSerializer<CrusherRecipe> getSerializer(){
|
||||
return FACTORY;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeType<?> getType(){
|
||||
return RECIPE_TYPE;
|
||||
}
|
||||
|
||||
static class CrusherRecipeFactory extends RecipeFactoryBase<CrusherRecipe> {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public CrusherRecipe read(@Nonnull ResourceLocation recipeId, @Nonnull JsonObject json){
|
||||
Ingredient input = this.readIngredient(json, "input");
|
||||
ItemStack firstOutput = this.readItemStack(json, "output");
|
||||
ItemStack secondOutput = ItemStack.EMPTY;
|
||||
int secondaryOutputChance = 0;
|
||||
|
||||
if(json.has("secondary")){ // Optional
|
||||
JsonElement secondaryElement = json.get("secondary");
|
||||
if(secondaryElement.isJsonObject()){
|
||||
JsonObject secondary = secondaryElement.getAsJsonObject();
|
||||
secondOutput = this.readItemStack(secondary, "output", ItemStack.EMPTY);
|
||||
secondaryOutputChance = this.readInt(secondary, "chance", 0);
|
||||
} else {
|
||||
throw new JsonSyntaxException("Secondary is not valid!");
|
||||
}
|
||||
}
|
||||
|
||||
return new CrusherRecipe(recipeId, input, firstOutput, secondOutput, secondaryOutputChance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(@Nonnull JsonObject json, @Nonnull CrusherRecipe recipe){
|
||||
json.add("input", recipe.getInput().serialize());
|
||||
json.add("output", this.writeItemStack(recipe.getOutput()));
|
||||
if(!recipe.getSecondaryOutput().isEmpty() && recipe.getOutputChance() > 0){
|
||||
JsonObject secondary = new JsonObject();
|
||||
secondary.add("output", this.writeItemStack(recipe.getSecondaryOutput()));
|
||||
secondary.addProperty("chance", recipe.getOutputChance());
|
||||
json.add("secondary", secondary);
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public CrusherRecipe read(@Nonnull ResourceLocation recipeId, @Nonnull PacketBuffer buffer){
|
||||
Ingredient input = Ingredient.read(buffer);
|
||||
ItemStack output = buffer.readItemStack();
|
||||
ItemStack secondaryOutput = buffer.readItemStack();
|
||||
int chance = buffer.readVarInt();
|
||||
|
||||
return new CrusherRecipe(recipeId, input, output, secondaryOutput, chance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(@Nonnull PacketBuffer buffer, @Nonnull CrusherRecipe recipe){
|
||||
recipe.getInput().write(buffer);
|
||||
buffer.writeItemStack(recipe.getOutput());
|
||||
buffer.writeItemStack(recipe.getSecondaryOutput());
|
||||
buffer.writeVarInt(recipe.getOutputChance());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,25 +1,37 @@
|
|||
package de.ellpeck.actuallyadditions.common.recipes;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import net.minecraft.data.IFinishedRecipe;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A dummy Recipe implementation, because the minecraft recipe system forces us to use IRecipe with all of it's methods,
|
||||
* but we don't need any of them.
|
||||
* Additionally the "isDynamic()" methods now returns true, because this indicates that the recipe book doesn't list
|
||||
* this recipe at all.
|
||||
*/
|
||||
public interface IDummyRecipe extends IRecipe<IInventory> {
|
||||
public interface IDummyRecipe<T extends IDummyRecipe<T>> extends IRecipe<IInventory>, IFinishedRecipe {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
IRecipeSerializer<T> getSerializer();
|
||||
|
||||
@Override
|
||||
default boolean matches(IInventory inv, World worldIn){
|
||||
default boolean matches(@Nonnull IInventory inv, @Nonnull World world){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
default ItemStack getCraftingResult(IInventory inv){
|
||||
default ItemStack getCraftingResult(@Nonnull IInventory inv){
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
|
@ -28,6 +40,7 @@ public interface IDummyRecipe extends IRecipe<IInventory> {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
default ItemStack getRecipeOutput(){
|
||||
return ItemStack.EMPTY;
|
||||
|
@ -39,4 +52,28 @@ public interface IDummyRecipe extends IRecipe<IInventory> {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
default void serialize(@Nonnull JsonObject json){
|
||||
if(this.getSerializer() instanceof RecipeFactoryBase){
|
||||
(((RecipeFactoryBase<T>) this.getSerializer())).write(json, (T) this);
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
default ResourceLocation getID(){
|
||||
return this.getId();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
default JsonObject getAdvancementJson(){
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
default ResourceLocation getAdvancementID(){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
package de.ellpeck.actuallyadditions.common.recipes;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.ForgeRegistryEntry;
|
||||
|
||||
public abstract class RecipeFactoryBase<T extends IDummyRecipe<T>> extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<T> {
|
||||
|
||||
public abstract void write(JsonObject json, T recipe);
|
||||
|
||||
protected Ingredient readIngredient(JsonObject json, String key){
|
||||
if(json.has(key)){
|
||||
return Ingredient.deserialize(json.get(key));
|
||||
} else {
|
||||
throw new JsonSyntaxException(String.format("Json element does not contain any element with the key: '%s'", key));
|
||||
}
|
||||
}
|
||||
|
||||
protected Ingredient readIngredient(JsonObject json, String key, Ingredient alternative){
|
||||
try{
|
||||
return this.readIngredient(json, key);
|
||||
} catch(JsonSyntaxException e){
|
||||
return alternative;
|
||||
}
|
||||
}
|
||||
|
||||
protected ItemStack readItemStack(JsonObject json, String key){
|
||||
if(json.has(key)){
|
||||
if(json.get(key).isJsonObject()){
|
||||
return CraftingHelper.getItemStack(json.get(key).getAsJsonObject(), true);
|
||||
} else if(json.get(key).isJsonPrimitive()){
|
||||
ResourceLocation itemKey = new ResourceLocation(json.get(key).getAsString());
|
||||
if(ForgeRegistries.ITEMS.containsKey(itemKey)){
|
||||
return new ItemStack(ForgeRegistries.ITEMS.getValue(itemKey));
|
||||
} else {
|
||||
throw new JsonSyntaxException(String.format("Item with the key: '%s' is not registered!", key));
|
||||
}
|
||||
} else {
|
||||
throw new JsonSyntaxException(String.format("Json element with the key: '%s' is neither a object nor a string!", key));
|
||||
}
|
||||
} else {
|
||||
throw new JsonSyntaxException(String.format("Json element does not contain any element with the key: '%s'!", key));
|
||||
}
|
||||
}
|
||||
|
||||
protected JsonObject writeItemStack(ItemStack stack){
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("item", stack.getItem().getRegistryName().toString());
|
||||
json.addProperty("count", stack.getCount());
|
||||
if(stack.hasTag()){
|
||||
json.add("nbt", new JsonParser().parse(stack.getTag().toString()));
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
protected ItemStack readItemStack(JsonObject json, String key, ItemStack alternative){
|
||||
try{
|
||||
return this.readItemStack(json, key);
|
||||
} catch(JsonSyntaxException e){
|
||||
return alternative;
|
||||
}
|
||||
}
|
||||
|
||||
protected int readInt(JsonObject json, String key){
|
||||
if(json.has(key)){
|
||||
if(json.get(key).isJsonPrimitive()){
|
||||
try{
|
||||
return json.get(key).getAsJsonPrimitive().getAsInt();
|
||||
} catch(NumberFormatException e){
|
||||
throw new JsonSyntaxException(String.format("Json element '%s' is not a valid integer!", key), e);
|
||||
}
|
||||
} else {
|
||||
throw new JsonSyntaxException(String.format("Json element '%s' is not a valid integer!", key));
|
||||
}
|
||||
} else {
|
||||
throw new JsonSyntaxException(String.format("Json element '%s' does not exist!", key));
|
||||
}
|
||||
}
|
||||
|
||||
protected int readInt(JsonObject json, String key, int alternative){
|
||||
try{
|
||||
return this.readInt(json, key);
|
||||
} catch(Exception e){
|
||||
return alternative;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package de.ellpeck.actuallyadditions.common.tile;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||
import de.ellpeck.actuallyadditions.common.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.common.items.ItemCoffee;
|
||||
import de.ellpeck.actuallyadditions.common.items.metalists.TheMiscItems;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package de.ellpeck.actuallyadditions.common.tile;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
|
||||
import de.ellpeck.actuallyadditions.common.util.ItemStackHandlerAA.IAcceptor;
|
||||
import de.ellpeck.actuallyadditions.common.util.ItemStackHandlerAA.IRemover;
|
||||
import de.ellpeck.actuallyadditions.common.util.ItemUtil;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package de.ellpeck.actuallyadditions.common.tile;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.BlockFurnaceDouble;
|
||||
import de.ellpeck.actuallyadditions.common.misc.SoundHandler;
|
||||
import de.ellpeck.actuallyadditions.common.network.gui.IButtonReactor;
|
||||
|
|
|
@ -3,7 +3,6 @@ package de.ellpeck.actuallyadditions.common.util;
|
|||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
||||
import de.ellpeck.actuallyadditions.common.util.crafting.RecipeHandler;
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package de.ellpeck.actuallyadditions.data;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.data.recipes.CrusherRecipeGenerator;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraftforge.client.model.generators.ExistingFileHelper;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.GatherDataEvent;
|
||||
|
@ -10,6 +13,10 @@ public class AADataGenerator {
|
|||
|
||||
@SubscribeEvent
|
||||
public static void gatherData(GatherDataEvent event){
|
||||
DataGenerator dataGenerator = event.getGenerator();
|
||||
ExistingFileHelper existingFileHelper = event.getExistingFileHelper();
|
||||
|
||||
dataGenerator.addProvider(new BlockStateGenerator(dataGenerator, existingFileHelper));
|
||||
dataGenerator.addProvider(new CrusherRecipeGenerator(dataGenerator));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package de.ellpeck.actuallyadditions.data;
|
||||
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.blocks.InitBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraftforge.client.model.generators.BlockStateProvider;
|
||||
import net.minecraftforge.client.model.generators.ExistingFileHelper;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
|
||||
public class BlockStateGenerator extends BlockStateProvider {
|
||||
|
||||
public BlockStateGenerator(DataGenerator dataGenerator, ExistingFileHelper existingFileHelper){
|
||||
super(dataGenerator, ActuallyAdditions.MODID, existingFileHelper);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerStatesAndModels(){
|
||||
for(RegistryObject<Block> blockEntry : InitBlocks.BLOCKS.getEntries()){
|
||||
blockEntry.ifPresent(block -> {
|
||||
// todo check if the blocks aren't "simple" and provide a different model,
|
||||
// probably with the help of a interface the block implements, like naturesaura does
|
||||
this.simpleBlock(block);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package de.ellpeck.actuallyadditions.data.recipes;
|
||||
|
||||
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.common.recipes.CrusherRecipe;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.IFinishedRecipe;
|
||||
import net.minecraft.data.RecipeProvider;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class CrusherRecipeGenerator extends RecipeProvider {
|
||||
|
||||
public CrusherRecipeGenerator(DataGenerator dataGenerator){
|
||||
super(dataGenerator);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRecipes(Consumer<IFinishedRecipe> consumer){
|
||||
super.registerRecipes(consumer);
|
||||
consumer.accept(new CrusherRecipe(new ResourceLocation(ActuallyAdditions.MODID, "test"), Ingredient.fromItems(Items.DIAMOND), new ItemStack(Items.DIRT, 64)));
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"recipes": {
|
||||
"atomic_reconstructor": "de.ellpeck.actuallyadditions.common.recipes.AtomicReconstructorRecipeFactory",
|
||||
"ball_of_fur": "de.ellpeck.actuallyadditions.common.recipes.BallOfFurRecipeFactory",
|
||||
"coffee_machine_ingredient": "de.ellpeck.actuallyadditions.common.recipes.CoffeeMachineIngredientFactory",
|
||||
"compost": "de.ellpeck.actuallyadditions.common.recipes.CompostRecipeFactory"
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue