Finalized ARC

Finished 99% of the implementation work for the ARC and recipe system. Still need to populate the recipes (which will require textures for some items have have yet to be added).
This commit is contained in:
WayofTime 2020-10-30 16:41:41 -04:00
parent 9fa68e86ae
commit 1ead4ff820
56 changed files with 945 additions and 129 deletions

View file

@ -50,6 +50,7 @@ public class GeneratorBaseRecipes extends BaseRecipeProvider
ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.BLANK_RITUAL_STONE.get(), 4).key('a', Tags.Items.OBSIDIAN).key('b', BloodMagicItems.REINFORCED_SLATE.get()).key('c', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_APPRENTICE.get())).patternLine("aba").patternLine("bcb").patternLine("aba").addCriterion("has_apprentice_orb", hasItem(BloodMagicItems.APPRENTICE_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("ritual_stone_blank"));
ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.MASTER_RITUAL_STONE.get()).key('a', Tags.Items.OBSIDIAN).key('b', BloodMagicBlocks.BLANK_RITUAL_STONE.get()).key('c', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_MAGICIAN.get())).patternLine("aba").patternLine("bcb").patternLine("aba").addCriterion("has_magician_orb", hasItem(BloodMagicItems.MAGICIAN_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("ritual_stone_master"));
ShapedRecipeBuilder.shapedRecipe(BloodMagicItems.PRIMITIVE_FURNACE_CELL.get()).key('c', Tags.Items.COBBLESTONE).key('f', Tags.Items.STORAGE_BLOCKS_COAL).key('s', Ingredient.fromItems(BloodMagicItems.SLATE.get())).key('o', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_MAGICIAN.get())).patternLine("csc").patternLine("cfc").patternLine("coc").addCriterion("has_magician_orb", hasItem(BloodMagicItems.MAGICIAN_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("primitive_furnace_cell"));
ShapedRecipeBuilder.shapedRecipe(BloodMagicItems.LAVA_CRYSTAL.get()).key('a', Tags.Items.GLASS).key('b', Items.LAVA_BUCKET).key('c', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_WEAK.get())).key('d', Tags.Items.OBSIDIAN).key('e', Tags.Items.GEMS_DIAMOND).patternLine("aba").patternLine("bcb").patternLine("ded").addCriterion("has_weak_orb", hasItem(BloodMagicItems.WEAK_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("lava_crystal"));
// ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.SPEED_RUNE.get()).key('s', Items.GLASS).key('o', Ingredient.fromItems(Items.DIAMOND)).patternLine("sss").patternLine("sos").patternLine("sss").addCriterion("has_diamond", hasItem(Items.DIAMOND)).build(consumer, new ResourceLocation(BloodMagic.MODID, "speed_rune_from_standard"));
// ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.SPEED_RUNE.get()).key('s', Items.GLASS).key('o', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_WEAK.get())).patternLine("sss").patternLine("sos").patternLine("sss").addCriterion("has_diamond", hasItem(Items.DIAMOND)).build(consumer, new ResourceLocation(BloodMagic.MODID, "speed_rune_from_orb"));

View file

@ -5,10 +5,13 @@ import java.nio.file.Path;
import net.minecraft.data.BlockTagsProvider;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.ItemTagsProvider;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.tags.ITag.INamedTag;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.data.ExistingFileHelper;
import wayoftime.bloodmagic.BloodMagic;
import wayoftime.bloodmagic.common.item.BloodMagicItems;
import wayoftime.bloodmagic.common.tags.BloodMagicTags;
public class GeneratorItemTags extends ItemTagsProvider
@ -22,12 +25,22 @@ public class GeneratorItemTags extends ItemTagsProvider
public void registerTags()
{
this.getOrCreateBuilder(BloodMagicTags.ARC_TOOL).add(Items.DIAMOND);
this.registerTool(BloodMagicItems.AIR_INSCRIPTION_TOOL.get(), BloodMagicTags.ARC_TOOL_SIEVE);
this.registerTool(BloodMagicItems.SANGUINE_REVERTER.get(), BloodMagicTags.ARC_TOOL_REVERTER);
this.registerTool(BloodMagicItems.LAVA_CRYSTAL.get(), BloodMagicTags.ARC_TOOL_FURNACE);
this.registerTool(BloodMagicItems.PRIMITIVE_FURNACE_CELL.get(), BloodMagicTags.ARC_TOOL_FURNACE);
// this.getOrCreateBuilder(GOORESISTANT).addTag(BlockTags.DOORS);
// this.getOrCreateBuilder(GOORESISTANT).addTag(BlockTags.BEDS);
// this.getOrCreateBuilder(GOORESISTANT).add(Blocks.PISTON, Blocks.PISTON_HEAD, Blocks.STICKY_PISTON, Blocks.MOVING_PISTON);
}
public void registerTool(Item item, INamedTag<Item> tag)
{
this.getOrCreateBuilder(tag).add(item);
this.getOrCreateBuilder(BloodMagicTags.ARC_TOOL).add(item);
}
/**
* Resolves a Path for the location to save the given tag.
*/

View file

@ -222,6 +222,11 @@ public class GeneratorLanguage extends LanguageProvider
addItem(BloodMagicItems.BASE_RITUAL_DIVINER, "Ritual Diviner");
addItem(BloodMagicItems.DUSK_RITUAL_DIVINER, "Ritual Diviner [Dusk]");
addItem(BloodMagicItems.WEAK_BLOOD_SHARD, "Weak Blood Shard");
addItem(BloodMagicItems.SANGUINE_REVERTER, "Sanguine Reverter");
addItem(BloodMagicItems.PRIMITIVE_FURNACE_CELL, "Primitive Fuel Cell");
// addItem(BloodMagicItems , "");
// JEI

View file

@ -36,7 +36,7 @@ public class ARCRecipeBuilder extends BloodMagicRecipeBuilder<ARCRecipeBuilder>
this.arcTool = arcTool;
this.inputFluid = inputFluid;
this.output = output;
this.outputFluid = outputFluid;
this.outputFluid = outputFluid == null ? FluidStack.EMPTY : outputFluid;
}
public static ARCRecipeBuilder arc(Ingredient input, Ingredient arcTool, FluidStackIngredient inputFluid, ItemStack output, FluidStack outputFluid)
@ -92,7 +92,7 @@ public class ARCRecipeBuilder extends BloodMagicRecipeBuilder<ARCRecipeBuilder>
json.add(Constants.JSON.ADDEDOUTPUT, mainArray);
}
if (outputFluid != null)
if (outputFluid != null && !outputFluid.isEmpty())
json.add(Constants.JSON.OUTPUT_FLUID, SerializerHelper.serializeFluidStack(outputFluid));
json.add(Constants.JSON.OUTPUT, SerializerHelper.serializeItemStack(output));

View file

@ -8,6 +8,7 @@ import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import wayoftime.bloodmagic.BloodMagic;
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
import wayoftime.bloodmagic.common.item.arc.ItemARCToolBase;
import wayoftime.bloodmagic.common.item.sigil.ItemSigilAir;
import wayoftime.bloodmagic.common.item.sigil.ItemSigilBloodLight;
import wayoftime.bloodmagic.common.item.sigil.ItemSigilDivination;
@ -98,6 +99,7 @@ public class BloodMagicItems
public static final RegistryObject<Item> ARCANE_ASHES = BASICITEMS.register("arcaneashes", () -> new ItemArcaneAshes());
public static final RegistryObject<Item> DAGGER_OF_SACRIFICE = BASICITEMS.register("daggerofsacrifice", () -> new ItemDaggerOfSacrifice());
public static final RegistryObject<Item> LAVA_CRYSTAL = BASICITEMS.register("lavacrystal", () -> new ItemLavaCrystal());
public static final RegistryObject<Item> WEAK_BLOOD_SHARD = BASICITEMS.register("weakbloodshard", () -> new ItemBase());
// Ritual stuffs
public static final RegistryObject<Item> WEAK_ACTIVATION_CRYSTAL = BASICITEMS.register("activationcrystalweak", () -> new ItemActivationCrystal(ItemActivationCrystal.CrystalType.WEAK));
@ -136,4 +138,8 @@ public class BloodMagicItems
public static final RegistryObject<Item> SOUL_SNARE = BASICITEMS.register("soulsnare", ItemSoulSnare::new);
public static final RegistryObject<Item> SENTIENT_SWORD = ITEMS.register("soulsword", () -> new ItemSentientSword());
// ARC Tools
public static final RegistryObject<Item> SANGUINE_REVERTER = BASICITEMS.register("sanguinereverter", () -> new ItemARCToolBase(32, 2));
public static final RegistryObject<Item> PRIMITIVE_FURNACE_CELL = BASICITEMS.register("furnacecell_primitive", () -> new ItemARCToolBase(128, 1.25));
}

View file

@ -1,6 +1,11 @@
package wayoftime.bloodmagic.common.item;
import net.minecraft.item.ItemStack;
public interface IARCTool
{
default double getCraftingSpeedMultiplier(ItemStack stack)
{
return 1;
}
}

View file

@ -0,0 +1,23 @@
package wayoftime.bloodmagic.common.item.arc;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import wayoftime.bloodmagic.BloodMagic;
import wayoftime.bloodmagic.common.item.IARCTool;
public class ItemARCToolBase extends Item implements IARCTool
{
private final double craftingMultiplier;
public ItemARCToolBase(int maxDamage, double craftingMultiplier)
{
super(new Item.Properties().maxStackSize(1).group(BloodMagic.TAB).maxDamage(maxDamage));
this.craftingMultiplier = craftingMultiplier;
}
@Override
public double getCraftingSpeedMultiplier(ItemStack stack)
{
return craftingMultiplier;
}
}

View file

@ -0,0 +1,101 @@
package wayoftime.bloodmagic.common.item.inventory;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
public class InventoryWrapper implements IInventory
{
protected int[] syncedSlots = new int[0];
protected NonNullList<ItemStack> inventory;
private int size;
public InventoryWrapper(int size)
{
this.inventory = NonNullList.withSize(size, ItemStack.EMPTY);
this.size = size;
}
@Override
public void clear()
{
this.inventory = NonNullList.withSize(size, ItemStack.EMPTY);
}
@Override
public int getSizeInventory()
{
return size;
}
@Override
public boolean isEmpty()
{
for (ItemStack stack : inventory) if (!stack.isEmpty())
return false;
return true;
}
@Override
public ItemStack getStackInSlot(int index)
{
return inventory.get(index);
}
@Override
public ItemStack decrStackSize(int index, int count)
{
if (!getStackInSlot(index).isEmpty())
{
if (getStackInSlot(index).getCount() <= count)
{
ItemStack itemStack = inventory.get(index);
inventory.set(index, ItemStack.EMPTY);
markDirty();
return itemStack;
}
ItemStack itemStack = inventory.get(index).split(count);
markDirty();
return itemStack;
}
return ItemStack.EMPTY;
}
@Override
public ItemStack removeStackFromSlot(int slot)
{
if (!inventory.get(slot).isEmpty())
{
ItemStack itemStack = inventory.get(slot);
setInventorySlotContents(slot, ItemStack.EMPTY);
return itemStack;
}
return ItemStack.EMPTY;
}
@Override
public void setInventorySlotContents(int slot, ItemStack stack)
{
inventory.set(slot, stack);
if (!stack.isEmpty() && stack.getCount() > getInventoryStackLimit())
stack.setCount(getInventoryStackLimit());
markDirty();
}
@Override
public void markDirty()
{
}
@Override
public boolean isUsableByPlayer(PlayerEntity player)
{
return false;
}
}

View file

@ -1,6 +1,7 @@
package wayoftime.bloodmagic.common.item.sigil;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.IGrowable;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
@ -64,7 +65,7 @@ public class ItemSigilGreenGrove extends ItemSigilToggleableBase
// if (!BloodMagicAPI.INSTANCE.getBlacklist().getGreenGrove().contains(state))
{
if (state.getBlock() instanceof IGrowable)
if (state.getBlock() instanceof IGrowable && state.getBlock() != Blocks.GRASS_BLOCK)
{
if (worldIn.rand.nextInt(50) == 0)
{

View file

@ -3,16 +3,12 @@ package wayoftime.bloodmagic.common.recipe;
import java.util.function.Consumer;
import net.minecraft.data.IFinishedRecipe;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.crafting.Ingredient;
import net.minecraftforge.common.Tags;
import net.minecraftforge.fluids.FluidStack;
import wayoftime.bloodmagic.BloodMagic;
import wayoftime.bloodmagic.api.event.recipes.FluidStackIngredient;
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
import wayoftime.bloodmagic.common.data.recipe.builder.ARCRecipeBuilder;
import wayoftime.bloodmagic.common.item.BloodMagicItems;
import wayoftime.bloodmagic.common.tags.BloodMagicTags;
public class ARCRecipeProvider implements ISubRecipeProvider
{
@ -20,7 +16,12 @@ public class ARCRecipeProvider implements ISubRecipeProvider
public void addRecipes(Consumer<IFinishedRecipe> consumer)
{
String basePath = "arc/";
ARCRecipeBuilder.arc(Ingredient.fromTag(Tags.Items.GEMS_DIAMOND), Ingredient.fromTag(Tags.Items.BONES), null, new ItemStack(BloodMagicBlocks.BLOOD_ALTAR.get()), null).addRandomOutput(new ItemStack(Items.DIAMOND), 0.5).build(consumer, BloodMagic.rl(basePath + "test1"));
ARCRecipeBuilder.arc(Ingredient.fromTag(Tags.Items.GEMS_DIAMOND), Ingredient.fromItems(Items.ACACIA_BOAT), FluidStackIngredient.from(Fluids.LAVA, 1000), new ItemStack(BloodMagicBlocks.BLOOD_ALTAR.get()), new FluidStack(Fluids.WATER, 100)).build(consumer, BloodMagic.rl(basePath + "test2"));
// ARCRecipeBuilder.arc(Ingredient.fromTag(Tags.Items.GEMS_DIAMOND), Ingredient.fromTag(Tags.Items.BONES), null, new ItemStack(BloodMagicBlocks.BLOOD_ALTAR.get()), null).addRandomOutput(new ItemStack(Items.DIAMOND, 2), 0.5).build(consumer, BloodMagic.rl(basePath + "test1"));
// ARCRecipeBuilder.arc(Ingredient.fromTag(Tags.Items.GEMS_DIAMOND), Ingredient.fromTag(Tags.Items.BONES), null, new ItemStack(BloodMagicBlocks.BLOOD_ALTAR.get()), null).addRandomOutput(new ItemStack(Items.DIAMOND, 5), 0.5).build(consumer, BloodMagic.rl(basePath + "test3"));
// ARCRecipeBuilder.arc(Ingredient.fromTag(Tags.Items.GEMS_DIAMOND), Ingredient.fromItems(Items.ACACIA_BOAT), FluidStackIngredient.from(Fluids.LAVA, 1000), new ItemStack(BloodMagicBlocks.BLOOD_ALTAR.get()), new FluidStack(Fluids.WATER, 100)).build(consumer, BloodMagic.rl(basePath + "test2"));
// ARCRecipeBuilder.arc(Ingredient.fromTag(Tags.Items.NETHERRACK), Ingredient.fromTag(BloodMagicTags.ARC_TOOL_REVERTER), FluidStackIngredient.from(Fluids.LAVA, 1000), new ItemStack(BloodMagicBlocks.BLOOD_ALTAR.get()), new FluidStack(Fluids.WATER, 100)).addRandomOutput(new ItemStack(BloodMagicItems.SLATE.get()), 0.2).addRandomOutput(new ItemStack(BloodMagicItems.REINFORCED_SLATE.get()), 0.1).addRandomOutput(new ItemStack(BloodMagicItems.IMBUED_SLATE.get()), 0.001).build(consumer, BloodMagic.rl(basePath + "test4"));
ARCRecipeBuilder.arc(Ingredient.fromItems(BloodMagicItems.IMBUED_SLATE.get()), Ingredient.fromTag(BloodMagicTags.ARC_TOOL_REVERTER), null, new ItemStack(BloodMagicItems.WEAK_BLOOD_SHARD.get()), null).addRandomOutput(new ItemStack(BloodMagicItems.WEAK_BLOOD_SHARD.get()), 0.2).build(consumer, BloodMagic.rl(basePath + "weakbloodshard"));
}
}

View file

@ -32,6 +32,8 @@ public class TartaricForgeRecipeProvider implements ISubRecipeProvider
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicItems.REAGENT_GROWTH.get()), 128, 20, Ingredient.fromTag(ItemTags.SAPLINGS), Ingredient.fromTag(ItemTags.SAPLINGS), Ingredient.fromItems(Items.SUGAR_CANE), Ingredient.fromItems(Items.SUGAR)).build(consumer, BloodMagic.rl(basePath + "reagent_growth"));
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicItems.REAGENT_MAGNETISM.get()), 600, 10, Ingredient.fromTag(Tags.Items.STRING), Ingredient.fromTag(Tags.Items.INGOTS_GOLD), Ingredient.fromTag(Tags.Items.INGOTS_GOLD), Ingredient.fromTag(Tags.Items.STORAGE_BLOCKS_IRON)).build(consumer, BloodMagic.rl(basePath + "reagent_magnetism"));
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicItems.REAGENT_FAST_MINER.get()), 128, 20, Ingredient.fromItems(Items.IRON_PICKAXE), Ingredient.fromItems(Items.IRON_AXE), Ingredient.fromItems(Items.IRON_SHOVEL), Ingredient.fromTag(Tags.Items.GUNPOWDER)).build(consumer, BloodMagic.rl(basePath + "reagent_fastminer"));
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicItems.SANGUINE_REVERTER.get()), 350, 30, Ingredient.fromItems(Items.SHEARS), Ingredient.fromTag(Tags.Items.STONE), Ingredient.fromItems(BloodMagicItems.IMBUED_SLATE.get()), Ingredient.fromTag(Tags.Items.INGOTS_IRON)).build(consumer, BloodMagic.rl(basePath + "sanguine_reverter"));
}
}

View file

@ -84,14 +84,15 @@ public class ARCRecipeSerializer<RECIPE extends RecipeARC> extends ForgeRegistry
inputFluidIng = FluidStackIngredient.deserialize(inputFluid);
}
FluidStack outputFluid = null;
FluidStack outputFluidStack = FluidStack.EMPTY;
if (json.has(Constants.JSON.OUTPUT_FLUID))
{
outputFluid = SerializerHelper.deserializeFluid(json);
JsonObject outputFluid = JSONUtils.getJsonObject(json, Constants.JSON.OUTPUT_FLUID).getAsJsonObject();
outputFluidStack = SerializerHelper.deserializeFluid(outputFluid);
}
return this.factory.create(recipeId, inputIng, toolIng, inputFluidIng, output, addedItems, outputFluid);
return this.factory.create(recipeId, inputIng, toolIng, inputFluidIng, output, addedItems, outputFluidStack);
}
@Override

View file

@ -9,4 +9,5 @@ public class BloodMagicTags
public static final ITag.INamedTag<Item> ARC_TOOL = ItemTags.makeWrapperTag("bloodmagic:arc_tool");
public static final ITag.INamedTag<Item> ARC_TOOL_FURNACE = ItemTags.makeWrapperTag("bloodmagic:arc_tool_furnace");
public static final ITag.INamedTag<Item> ARC_TOOL_SIEVE = ItemTags.makeWrapperTag("bloodmagic:arc_tool_sieve");
public static final ITag.INamedTag<Item> ARC_TOOL_REVERTER = ItemTags.makeWrapperTag("bloodmagic:arc_tool_reverter");
}