Added routing filters as well as recipes and temp textures.

This commit is contained in:
WayofTime 2016-01-16 11:10:58 -05:00
parent 76dceb3534
commit 815faa2ced
13 changed files with 187 additions and 70 deletions

View file

@ -8,7 +8,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.tile.routing.TileOutputRoutingNode;
import WayofTime.bloodmagic.tile.routing.TileInputRoutingNode;
public class BlockInputRoutingNode extends BlockRoutingNode
{
@ -28,18 +28,18 @@ public class BlockInputRoutingNode extends BlockRoutingNode
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileOutputRoutingNode();
return new TileInputRoutingNode();
}
@Override
//TODO: Combine BlockOutputRoutingNode and BlockInputRoutingNode so they have the same superclass
//TODO: Combine BlockInputRoutingNode and BlockInputRoutingNode so they have the same superclass
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileOutputRoutingNode)
if (tile instanceof TileInputRoutingNode)
{
((TileOutputRoutingNode) tile).removeAllConnections();
((TileOutputRoutingNode) tile).dropItems();
((TileInputRoutingNode) tile).removeAllConnections();
((TileInputRoutingNode) tile).dropItems();
}
super.breakBlock(world, pos, state);
}
@ -47,7 +47,7 @@ public class BlockInputRoutingNode extends BlockRoutingNode
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (world.getTileEntity(pos) instanceof TileOutputRoutingNode)
if (world.getTileEntity(pos) instanceof TileInputRoutingNode)
{
player.openGui(BloodMagic.instance, Constants.Gui.ROUTING_NODE_GUI, world, pos.getX(), pos.getY(), pos.getZ());
}

View file

@ -0,0 +1,13 @@
package WayofTime.bloodmagic.item.routing;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import WayofTime.bloodmagic.routing.IItemFilter;
public interface IItemFilterProvider
{
public IItemFilter getInputItemFilter(ItemStack stack, IInventory inventory, EnumFacing syphonDirection);
public IItemFilter getOutputItemFilter(ItemStack stack, IInventory inventory, EnumFacing syphonDirection);
}

View file

@ -0,0 +1,112 @@
package WayofTime.bloodmagic.item.routing;
import java.util.LinkedList;
import java.util.List;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.item.inventory.ItemInventory;
import WayofTime.bloodmagic.routing.IItemFilter;
import WayofTime.bloodmagic.routing.TestItemFilter;
import WayofTime.bloodmagic.util.GhostItemHelper;
import WayofTime.bloodmagic.util.helper.TextHelper;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ItemRouterFilter extends Item implements IItemFilterProvider
{
public static String[] names = { "exact" };
public ItemRouterFilter()
{
super();
setUnlocalizedName(Constants.Mod.MODID + ".itemFilter.");
setHasSubtypes(true);
setCreativeTab(BloodMagic.tabBloodMagic);
}
@Override
public String getUnlocalizedName(ItemStack stack)
{
return super.getUnlocalizedName(stack) + names[stack.getItemDamage()];
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
{
for (int i = 0; i < names.length; i++)
list.add(new ItemStack(id, 1, i));
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
{
tooltip.add(TextHelper.localize("tooltip.BloodMagic.itemFilter." + names[stack.getItemDamage()]));
super.addInformation(stack, player, tooltip, advanced);
}
@Override
public IItemFilter getInputItemFilter(ItemStack filterStack, IInventory inventory, EnumFacing syphonDirection)
{
IItemFilter testFilter = new TestItemFilter();
List<ItemStack> filteredList = new LinkedList<ItemStack>();
ItemInventory inv = new ItemInventory(filterStack, 9, "");
for (int i = 0; i < inv.getSizeInventory(); i++)
{
ItemStack stack = inv.getStackInSlot(i);
if (stack == null)
{
continue;
}
ItemStack ghostStack = GhostItemHelper.getStackFromGhost(stack);
if (ghostStack.stackSize == 0)
{
ghostStack.stackSize = Integer.MAX_VALUE;
}
filteredList.add(ghostStack);
}
testFilter.initializeFilter(filteredList, inventory, syphonDirection, false);
return testFilter;
}
@Override
public IItemFilter getOutputItemFilter(ItemStack filterStack, IInventory inventory, EnumFacing syphonDirection)
{
IItemFilter testFilter = new TestItemFilter();
List<ItemStack> filteredList = new LinkedList<ItemStack>();
ItemInventory inv = new ItemInventory(filterStack, 9, ""); //TODO: Change to grab the filter from the Item later.
for (int i = 0; i < inv.getSizeInventory(); i++)
{
ItemStack stack = inv.getStackInSlot(i);
if (stack == null)
{
continue;
}
ItemStack ghostStack = GhostItemHelper.getStackFromGhost(stack);
if (ghostStack.stackSize == 0)
{
ghostStack.stackSize = Integer.MAX_VALUE;
}
filteredList.add(ghostStack);
}
testFilter.initializeFilter(filteredList, inventory, syphonDirection, true);
return testFilter;
}
}

View file

@ -33,6 +33,7 @@ import WayofTime.bloodmagic.item.armour.ItemSentientArmour;
import WayofTime.bloodmagic.item.gear.ItemPackSacrifice;
import WayofTime.bloodmagic.item.gear.ItemPackSelfSacrifice;
import WayofTime.bloodmagic.item.routing.ItemNodeRouter;
import WayofTime.bloodmagic.item.routing.ItemRouterFilter;
import WayofTime.bloodmagic.item.sigil.ItemSigilAir;
import WayofTime.bloodmagic.item.sigil.ItemSigilBloodLight;
import WayofTime.bloodmagic.item.sigil.ItemSigilCompression;
@ -133,6 +134,7 @@ public class ModItems
public static Item sentientArmourGem;
public static Item nodeRouter;
public static Item baseItemFilter;
public static Item.ToolMaterial boundToolMaterial = EnumHelper.addToolMaterial("BoundToolMaterial", 4, 0, 10, 8, 50);
public static Item.ToolMaterial soulToolMaterial = EnumHelper.addToolMaterial("SoulToolMaterial", 4, 520, 7, 8, 50);
@ -220,6 +222,7 @@ public class ModItems
sentientArmourGem = registerItem(new ItemSentientArmourGem());
nodeRouter = registerItem(new ItemNodeRouter());
baseItemFilter = registerItem(new ItemRouterFilter());
}
public static void initRenders()
@ -306,6 +309,8 @@ public class ModItems
renderHelper.itemRender(itemComponent, i);
for (int i = 0; i < ItemTelepositionFocus.names.length; i++)
renderHelper.itemRender(telepositionFocus, i);
for (int i = 0; i < ItemRouterFilter.names.length; i++)
renderHelper.itemRender(baseItemFilter, i);
renderHelper.itemRender(bloodShard, 0);
renderHelper.itemRender(bloodShard, 1);
@ -341,6 +346,8 @@ public class ModItems
renderHelper.itemRender(sentientArmourGem, 0, "ItemSentientArmourGem0");
renderHelper.itemRender(sentientArmourGem, 1, "ItemSentientArmourGem1");
renderHelper.itemRender(nodeRouter);
}
private static Item registerItem(Item item, String name)

View file

@ -157,7 +157,7 @@ public class ModRecipes
TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModItems.sentientSword), 0, 0, new ItemStack(ModItems.soulGem), new ItemStack(Items.iron_sword));
TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModItems.sentientBow), 70, 0, new ItemStack(Items.bow), new ItemStack(ModItems.soulGem, 1, 1), Items.string, Items.string);
TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModItems.arcaneAshes), 0, 0, "dustRedstone", "dyeWhite", new ItemStack(Items.gunpowder), Items.coal);
TartaricForgeRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_WATER), 10, 3, "sugar", new ItemStack(Items.water_bucket), new ItemStack(Items.water_bucket));
TartaricForgeRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_WATER), 10, 3, new ItemStack(Items.sugar), new ItemStack(Items.water_bucket), new ItemStack(Items.water_bucket));
TartaricForgeRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_LAVA), 32, 10, Items.lava_bucket, "dustRedstone", "cobblestone", "blockCoal");
TartaricForgeRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_VOID), 64, 10, Items.bucket, Items.string, Items.string, Items.gunpowder);
TartaricForgeRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_GROWTH), 128, 20, "treeSapling", "treeSapling", Items.reeds, Items.sugar);
@ -167,5 +167,12 @@ public class ModRecipes
TartaricForgeRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_AFFINITY), 300, 30, ModItems.sigilWater, ModItems.sigilAir, ModItems.sigilLava, Blocks.obsidian);
TartaricForgeRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_SUPPRESSION), 500, 50, ModBlocks.teleposer, Items.water_bucket, Items.lava_bucket, Items.blaze_rod);
TartaricForgeRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BINDING), 400, 10, "dustGlowstone", "dustRedstone", "nuggetGold", Items.gunpowder);
TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModItems.baseItemFilter), 400, 10, new ItemStack(Blocks.glass), new ItemStack(Blocks.cobblestone), new ItemStack(ModItems.slate));
TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModItems.nodeRouter), 400, 5, Items.stick, new ItemStack(ModItems.slate, 1, 1), "gemLapis", "gemLapis");
TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModBlocks.itemRoutingNode), 400, 5, "dustGlowstone", "dustRedstone", "blockGlass", "stone");
TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModBlocks.outputRoutingNode), 400, 25, "dustGlowstone", "dustRedstone", "ingotIron", new ItemStack(ModBlocks.itemRoutingNode));
TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModBlocks.inputRoutingNode), 400, 25, "dustGlowstone", "dustRedstone", "ingotGold", new ItemStack(ModBlocks.itemRoutingNode));
TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModBlocks.masterRoutingNode), 400, 200, "blockIron", "gemDiamond", new ItemStack(ModItems.slate, 1, 2));
}
}

View file

@ -7,6 +7,7 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import WayofTime.bloodmagic.item.inventory.ItemInventory;
import WayofTime.bloodmagic.item.routing.IItemFilterProvider;
import WayofTime.bloodmagic.util.GhostItemHelper;
import WayofTime.bloodmagic.util.Utils;
@ -169,7 +170,7 @@ public class ContainerItemRoutingNode extends Container
} else if (index > 0)
{
// return null;
if (true) // Change to check item is a filter
if (itemstack1.getItem() instanceof IItemFilterProvider) // Change to check item is a filter
{
if (!this.mergeItemStack(itemstack1, 0, 1, false))
{
@ -219,7 +220,7 @@ public class ContainerItemRoutingNode extends Container
@Override
public boolean isItemValid(ItemStack itemStack)
{
return true; //TODO: Create a new Item that holds the filter.
return itemStack.getItem() instanceof IItemFilterProvider; //TODO: Create a new Item that holds the filter.
}
@Override

View file

@ -1,17 +1,12 @@
package WayofTime.bloodmagic.tile.routing;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import WayofTime.bloodmagic.item.inventory.ItemInventory;
import WayofTime.bloodmagic.item.routing.IItemFilterProvider;
import WayofTime.bloodmagic.routing.IInputItemRoutingNode;
import WayofTime.bloodmagic.routing.IItemFilter;
import WayofTime.bloodmagic.routing.TestItemFilter;
import WayofTime.bloodmagic.util.GhostItemHelper;
public class TileInputRoutingNode extends TileFilteredRoutingNode implements IInputItemRoutingNode
{
@ -31,37 +26,17 @@ public class TileInputRoutingNode extends TileFilteredRoutingNode implements IIn
{
ItemStack filterStack = this.getFilterStack(side);
if (filterStack == null)
if (filterStack == null || !(filterStack.getItem() instanceof IItemFilterProvider))
{
return null;
}
IItemFilterProvider filter = (IItemFilterProvider) filterStack.getItem();
TileEntity tile = worldObj.getTileEntity(pos.offset(side));
if (tile instanceof IInventory)
{
IItemFilter testFilter = new TestItemFilter();
List<ItemStack> filteredList = new LinkedList<ItemStack>();
ItemInventory inv = new ItemInventory(filterStack, 9, ""); //TODO: Change to grab the filter from the Item later.
for (int i = 0; i < inv.getSizeInventory(); i++)
{
ItemStack stack = inv.getStackInSlot(i);
if (stack == null)
{
continue;
}
ItemStack ghostResult = GhostItemHelper.getStackFromGhost(stack);
// if (ghostResult.stackSize == 0)
// {
// ghostResult.stackSize = Int.MaxValue();
// }
filteredList.add(ghostResult);
}
testFilter.initializeFilter(filteredList, (IInventory) tile, side.getOpposite(), false);
return testFilter;
return filter.getInputItemFilter(filterStack, (IInventory) tile, side.getOpposite());
}
return null;

View file

@ -1,17 +1,12 @@
package WayofTime.bloodmagic.tile.routing;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import WayofTime.bloodmagic.item.inventory.ItemInventory;
import WayofTime.bloodmagic.item.routing.IItemFilterProvider;
import WayofTime.bloodmagic.routing.IItemFilter;
import WayofTime.bloodmagic.routing.IOutputItemRoutingNode;
import WayofTime.bloodmagic.routing.TestItemFilter;
import WayofTime.bloodmagic.util.GhostItemHelper;
public class TileOutputRoutingNode extends TileFilteredRoutingNode implements IOutputItemRoutingNode
{
@ -31,37 +26,17 @@ public class TileOutputRoutingNode extends TileFilteredRoutingNode implements IO
{
ItemStack filterStack = this.getFilterStack(side);
if (filterStack == null)
if (filterStack == null || !(filterStack.getItem() instanceof IItemFilterProvider))
{
return null;
}
IItemFilterProvider filter = (IItemFilterProvider) filterStack.getItem();
TileEntity tile = worldObj.getTileEntity(pos.offset(side));
if (tile instanceof IInventory)
{
IItemFilter testFilter = new TestItemFilter();
List<ItemStack> filteredList = new LinkedList<ItemStack>();
ItemInventory inv = new ItemInventory(filterStack, 9, ""); //TODO: Change to grab the filter from the Item later.
for (int i = 0; i < inv.getSizeInventory(); i++)
{
ItemStack stack = inv.getStackInSlot(i);
if (stack == null)
{
continue;
}
ItemStack ghostStack = GhostItemHelper.getStackFromGhost(stack);
if (ghostStack.stackSize == 0)
{
ghostStack.stackSize = Integer.MAX_VALUE;
}
filteredList.add(ghostStack);
}
testFilter.initializeFilter(filteredList, (IInventory) tile, side.getOpposite(), true);
return testFilter;
return filter.getOutputItemFilter(filterStack, (IInventory) tile, side.getOpposite());
}
return null;

View file

@ -120,6 +120,9 @@ item.BloodMagic.soulGem.grand.name=Grand Tartaric Gem
item.BloodMagic.soulSnare.base.name=Rudimentary Snare
item.BloodMagic.sentientBow.name=Sentient Bow
item.BloodMagic.nodeRouter.name=Node Router
item.BloodMagic.itemFilter.exact.name=Precise Item Filter
# Blocks
tile.BloodMagic.fluid.lifeEssence.name=Life Essence
@ -159,6 +162,11 @@ tile.BloodMagic.phantomBlock.name=Phantom Block
tile.BloodMagic.teleposer.name=Teleposer
tile.BloodMagic.soulForge.name=Hellfire Forge
tile.BloodMagic.masterRouting.name=Master Routing Node
tile.BloodMagic.outputRouting.name=Output Routing Node
tile.BloodMagic.inputRouting.name=Input Routing Node
tile.BloodMagic.itemRouting.name=Routing Node
# Tooltips
tooltip.BloodMagic.orb.desc=Stores raw Life Essence
tooltip.BloodMagic.orb.owner=Added by: %s
@ -254,6 +262,8 @@ tooltip.BloodMagic.soulGem.greater=A gem used to contain a greater amount of wil
tooltip.BloodMagic.soulGem.grand=A gem used to contain a large amount of will
tooltip.BloodMagic.soulSnare.desc=Throw at a monster and then kill them to obtain their demonic will
tooltip.BloodMagic.itemFilter.exact=Will make sure the items match precisely.
# Ritual
ritual.BloodMagic.testRitual=Test Ritual
ritual.BloodMagic.waterRitual=Ritual of the Full Spring

View file

@ -0,0 +1,11 @@
{
"parent":"bloodmagic:item/ItemModelBase",
"textures": {
"layer0":"bloodmagic:items/NodeRouter"
}
}

View file

@ -0,0 +1,6 @@
{
"parent":"bloodmagic:item/ItemModelBase",
"textures": {
"layer0":"bloodmagic:items/ItemRouterFilterExact"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B