Attempt to fix 1.16.3 branch's issues on the repository
Added the original 'wayoftime' folder back, so see if that fixed the multiple folder issue.
This commit is contained in:
parent
6b4145a67c
commit
9fa68e86ae
224 changed files with 24047 additions and 0 deletions
|
@ -0,0 +1,69 @@
|
|||
package wayoftime.bloodmagic.api.impl.recipe;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import wayoftime.bloodmagic.api.inventory.IgnoredIInventory;
|
||||
|
||||
public abstract class BloodMagicRecipe implements IRecipe<IgnoredIInventory>
|
||||
{
|
||||
private final ResourceLocation id;
|
||||
|
||||
protected BloodMagicRecipe(ResourceLocation id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes this recipe to a PacketBuffer.
|
||||
*
|
||||
* @param buffer The buffer to write to.
|
||||
*/
|
||||
public abstract void write(PacketBuffer buffer);
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ResourceLocation getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(@Nonnull IgnoredIInventory inv, @Nonnull World world)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDynamic()
|
||||
{
|
||||
// Note: If we make this non dynamic, we can make it show in vanilla's crafting
|
||||
// book and also then obey the recipe locking.
|
||||
// For now none of that works/makes sense in our concept so don't lock it
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getCraftingResult(@Nonnull IgnoredIInventory inv)
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFit(int width, int height)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
package wayoftime.bloodmagic.api.impl.recipe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import wayoftime.bloodmagic.api.event.recipes.FluidStackIngredient;
|
||||
|
||||
public abstract class RecipeARC extends BloodMagicRecipe
|
||||
{
|
||||
public static final int MAX_RANDOM_OUTPUTS = 3;
|
||||
|
||||
@Nonnull
|
||||
private final Ingredient input;
|
||||
@Nonnull
|
||||
private final Ingredient arc_tool;
|
||||
private final FluidStackIngredient inputFluid;
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
private final FluidStack outputFluid;
|
||||
|
||||
private final List<Pair<ItemStack, Double>> addedItems;
|
||||
|
||||
protected RecipeARC(ResourceLocation id, Ingredient input, Ingredient arc_tool, FluidStackIngredient inputFluid, ItemStack output, FluidStack outputFluid)
|
||||
{
|
||||
this(id, input, arc_tool, inputFluid, output, new ArrayList<Pair<ItemStack, Double>>(), outputFluid);
|
||||
}
|
||||
|
||||
protected RecipeARC(ResourceLocation id, Ingredient input, Ingredient arc_tool, FluidStackIngredient inputFluid, ItemStack output, List<Pair<ItemStack, Double>> addedItems, FluidStack outputFluid)
|
||||
{
|
||||
super(id);
|
||||
this.input = input;
|
||||
this.arc_tool = arc_tool;
|
||||
this.inputFluid = inputFluid;
|
||||
this.output = output;
|
||||
this.addedItems = addedItems;
|
||||
this.outputFluid = outputFluid;
|
||||
}
|
||||
|
||||
public RecipeARC addRandomOutput(ItemStack stack, double chance)
|
||||
{
|
||||
if (addedItems.size() >= MAX_RANDOM_OUTPUTS)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
addedItems.add(Pair.of(stack, chance));
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final Ingredient getInput()
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final Ingredient getTool()
|
||||
{
|
||||
return arc_tool;
|
||||
}
|
||||
|
||||
public final FluidStackIngredient getFluidIngredient()
|
||||
{
|
||||
return inputFluid;
|
||||
}
|
||||
|
||||
public final FluidStack getFluidOutput()
|
||||
{
|
||||
return outputFluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final NonNullList<Ingredient> getIngredients()
|
||||
{
|
||||
NonNullList<Ingredient> list = NonNullList.create();
|
||||
list.add(getInput());
|
||||
list.add(getTool());
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<ItemStack> getAllListedOutputs()
|
||||
{
|
||||
List<ItemStack> list = new ArrayList<ItemStack>();
|
||||
|
||||
list.add(output.copy());
|
||||
for (Pair<ItemStack, Double> pair : addedItems)
|
||||
{
|
||||
list.add(pair.getLeft().copy());
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<ItemStack> getAllOutputs(Random rand)
|
||||
{
|
||||
List<ItemStack> list = new ArrayList<ItemStack>();
|
||||
|
||||
list.add(output.copy());
|
||||
for (Pair<ItemStack, Double> pair : addedItems)
|
||||
{
|
||||
if (rand.nextDouble() < pair.getRight())
|
||||
list.add(pair.getLeft().copy());
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(PacketBuffer buffer)
|
||||
{
|
||||
input.write(buffer);
|
||||
arc_tool.write(buffer);
|
||||
buffer.writeItemStack(output);
|
||||
buffer.writeInt(addedItems.size());
|
||||
for (Pair<ItemStack, Double> pair : addedItems)
|
||||
{
|
||||
buffer.writeItemStack(pair.getLeft());
|
||||
buffer.writeDouble(pair.getValue());
|
||||
}
|
||||
|
||||
buffer.writeBoolean(inputFluid != null);
|
||||
if (inputFluid != null)
|
||||
{
|
||||
inputFluid.write(buffer);
|
||||
}
|
||||
|
||||
buffer.writeBoolean(outputFluid != null);
|
||||
if (outputFluid != null)
|
||||
{
|
||||
outputFluid.writeToPacket(buffer);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
package wayoftime.bloodmagic.api.impl.recipe;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public abstract class RecipeAlchemyArray extends BloodMagicRecipe
|
||||
{
|
||||
private final ResourceLocation id;
|
||||
private final ResourceLocation texture;
|
||||
@Nonnull
|
||||
private final Ingredient baseInput;
|
||||
@Nonnull
|
||||
private final Ingredient addedInput;
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
|
||||
protected RecipeAlchemyArray(ResourceLocation id, ResourceLocation texture, @Nonnull Ingredient baseIngredient, @Nonnull Ingredient addedIngredient, @Nonnull ItemStack result)
|
||||
{
|
||||
super(id);
|
||||
this.id = id;
|
||||
this.texture = texture;
|
||||
this.baseInput = baseIngredient;
|
||||
this.addedInput = addedIngredient;
|
||||
this.output = result;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final ResourceLocation getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final ResourceLocation getTexture()
|
||||
{
|
||||
return texture;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final Ingredient getBaseInput()
|
||||
{
|
||||
return baseInput;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final Ingredient getAddedInput()
|
||||
{
|
||||
return addedInput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final NonNullList<Ingredient> getIngredients()
|
||||
{
|
||||
NonNullList<Ingredient> list = NonNullList.create();
|
||||
list.add(getBaseInput());
|
||||
list.add(getAddedInput());
|
||||
return list;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final ItemStack getOutput()
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(PacketBuffer buffer)
|
||||
{
|
||||
if (texture != null)
|
||||
{
|
||||
buffer.writeBoolean(true);
|
||||
buffer.writeResourceLocation(texture);
|
||||
} else
|
||||
{
|
||||
buffer.writeBoolean(false);
|
||||
}
|
||||
|
||||
baseInput.write(buffer);
|
||||
addedInput.write(buffer);
|
||||
buffer.writeItemStack(output);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
package wayoftime.bloodmagic.api.impl.recipe;
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import wayoftime.bloodmagic.altar.AltarTier;
|
||||
|
||||
public abstract class RecipeBloodAltar extends BloodMagicRecipe
|
||||
{
|
||||
@Nonnull
|
||||
private final Ingredient input;
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
@Nonnull
|
||||
private final AltarTier minimumTier;
|
||||
@Nonnegative
|
||||
private final int syphon;
|
||||
@Nonnegative
|
||||
private final int consumeRate;
|
||||
@Nonnegative
|
||||
private final int drainRate;
|
||||
|
||||
public RecipeBloodAltar(ResourceLocation id, @Nonnull Ingredient input, @Nonnull ItemStack output, @Nonnegative int minimumTier, @Nonnegative int syphon, @Nonnegative int consumeRate, @Nonnegative int drainRate)
|
||||
{
|
||||
super(id);
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
Preconditions.checkNotNull(output, "output cannot be null.");
|
||||
Preconditions.checkArgument(minimumTier >= 0, "minimumTier cannot be negative.");
|
||||
Preconditions.checkArgument(minimumTier <= AltarTier.MAXTIERS, "minimumTier cannot be higher than max tier");
|
||||
Preconditions.checkArgument(syphon >= 0, "syphon cannot be negative.");
|
||||
Preconditions.checkArgument(consumeRate >= 0, "consumeRate cannot be negative.");
|
||||
Preconditions.checkArgument(drainRate >= 0, "drain cannot be negative.");
|
||||
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.minimumTier = AltarTier.values()[minimumTier];
|
||||
this.syphon = syphon;
|
||||
this.consumeRate = consumeRate;
|
||||
this.drainRate = drainRate;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final Ingredient getInput()
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final NonNullList<Ingredient> getIngredients()
|
||||
{
|
||||
NonNullList<Ingredient> list = NonNullList.create();
|
||||
list.add(getInput());
|
||||
return list;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final ItemStack getOutput()
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public AltarTier getMinimumTier()
|
||||
{
|
||||
return minimumTier;
|
||||
}
|
||||
|
||||
@Nonnegative
|
||||
public final int getSyphon()
|
||||
{
|
||||
return syphon;
|
||||
}
|
||||
|
||||
@Nonnegative
|
||||
public final int getConsumeRate()
|
||||
{
|
||||
return consumeRate;
|
||||
}
|
||||
|
||||
@Nonnegative
|
||||
public final int getDrainRate()
|
||||
{
|
||||
return drainRate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(PacketBuffer buffer)
|
||||
{
|
||||
input.write(buffer);
|
||||
buffer.writeItemStack(output);
|
||||
buffer.writeInt(minimumTier.ordinal());
|
||||
buffer.writeInt(syphon);
|
||||
buffer.writeInt(consumeRate);
|
||||
buffer.writeInt(drainRate);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package wayoftime.bloodmagic.api.impl.recipe;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public abstract class RecipeTartaricForge extends BloodMagicRecipe
|
||||
{
|
||||
@Nonnull
|
||||
private final List<Ingredient> input;
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
@Nonnegative
|
||||
private final double minimumSouls;
|
||||
@Nonnegative
|
||||
private final double soulDrain;
|
||||
|
||||
public RecipeTartaricForge(ResourceLocation id, @Nonnull List<Ingredient> input, @Nonnull ItemStack output, @Nonnegative double minimumSouls, @Nonnegative double soulDrain)
|
||||
{
|
||||
super(id);
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
Preconditions.checkNotNull(output, "output cannot be null.");
|
||||
Preconditions.checkArgument(minimumSouls >= 0, "minimumSouls cannot be negative.");
|
||||
Preconditions.checkArgument(soulDrain >= 0, "soulDrain cannot be negative.");
|
||||
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.minimumSouls = minimumSouls;
|
||||
this.soulDrain = soulDrain;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final List<Ingredient> getInput()
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final ItemStack getOutput()
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
||||
@Nonnegative
|
||||
public final double getMinimumSouls()
|
||||
{
|
||||
return minimumSouls;
|
||||
}
|
||||
|
||||
@Nonnegative
|
||||
public final double getSoulDrain()
|
||||
{
|
||||
return soulDrain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(PacketBuffer buffer)
|
||||
{
|
||||
buffer.writeInt(input.size());
|
||||
for (int i = 0; i < input.size(); i++)
|
||||
{
|
||||
input.get(i).write(buffer);
|
||||
}
|
||||
buffer.writeItemStack(output);
|
||||
buffer.writeDouble(minimumSouls);
|
||||
buffer.writeDouble(soulDrain);
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue