Got imprinter working
This commit is contained in:
parent
66f8d8c3df
commit
f9e10fe1cf
8 changed files with 117 additions and 66 deletions
|
@ -1,11 +1,13 @@
|
||||||
package resonantinduction.archaic;
|
package resonantinduction.archaic;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import resonantinduction.archaic.crate.BlockCrate;
|
import resonantinduction.archaic.crate.BlockCrate;
|
||||||
import resonantinduction.archaic.crate.TileCrate;
|
import resonantinduction.archaic.crate.TileCrate;
|
||||||
import resonantinduction.archaic.engineering.BlockEngineeringTable;
|
import resonantinduction.archaic.engineering.BlockEngineeringTable;
|
||||||
import resonantinduction.archaic.engineering.TileEngineeringTable;
|
import resonantinduction.archaic.engineering.TileEngineeringTable;
|
||||||
import resonantinduction.archaic.imprint.BlockImprinter;
|
import resonantinduction.archaic.imprint.BlockImprinter;
|
||||||
|
import resonantinduction.archaic.imprint.ItemBlockImprint;
|
||||||
import resonantinduction.archaic.imprint.TileImprinter;
|
import resonantinduction.archaic.imprint.TileImprinter;
|
||||||
import resonantinduction.core.Reference;
|
import resonantinduction.core.Reference;
|
||||||
import resonantinduction.core.ResonantInduction;
|
import resonantinduction.core.ResonantInduction;
|
||||||
|
@ -51,6 +53,8 @@ public class Archaic
|
||||||
public static Block blockCrate;
|
public static Block blockCrate;
|
||||||
public static Block blockImprinter;
|
public static Block blockImprinter;
|
||||||
|
|
||||||
|
public static Item itemImprint;
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent evt)
|
public void preInit(FMLPreInitializationEvent evt)
|
||||||
{
|
{
|
||||||
|
@ -58,6 +62,8 @@ public class Archaic
|
||||||
blockEngineeringTable = contentRegistry.createTile(BlockEngineeringTable.class, TileEngineeringTable.class);
|
blockEngineeringTable = contentRegistry.createTile(BlockEngineeringTable.class, TileEngineeringTable.class);
|
||||||
blockCrate = contentRegistry.createTile(BlockCrate.class, TileCrate.class);
|
blockCrate = contentRegistry.createTile(BlockCrate.class, TileCrate.class);
|
||||||
blockImprinter = contentRegistry.createTile(BlockImprinter.class, TileImprinter.class);
|
blockImprinter = contentRegistry.createTile(BlockImprinter.class, TileImprinter.class);
|
||||||
|
|
||||||
|
itemImprint = contentRegistry.createItem(ItemBlockImprint.class);
|
||||||
proxy.preInit();
|
proxy.preInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
package resonantinduction.archaic.engineering;
|
package resonantinduction.archaic.engineering;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
@ -16,9 +13,12 @@ import net.minecraft.item.crafting.CraftingManager;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.network.packet.Packet;
|
import net.minecraft.network.packet.Packet;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
import resonantinduction.api.IArmbot;
|
import resonantinduction.api.IArmbot;
|
||||||
import resonantinduction.api.IArmbotUseable;
|
import resonantinduction.api.IArmbotUseable;
|
||||||
import resonantinduction.archaic.imprint.ItemBlockFilter;
|
import resonantinduction.archaic.imprint.ItemBlockImprint;
|
||||||
import resonantinduction.core.ResonantInduction;
|
import resonantinduction.core.ResonantInduction;
|
||||||
import resonantinduction.core.prefab.ContainerFake;
|
import resonantinduction.core.prefab.ContainerFake;
|
||||||
import resonantinduction.electrical.encoder.coding.args.ArgumentData;
|
import resonantinduction.electrical.encoder.coding.args.ArgumentData;
|
||||||
|
@ -28,11 +28,8 @@ import calclavia.lib.prefab.slot.ISlotPickResult;
|
||||||
import calclavia.lib.prefab.tile.TileAdvanced;
|
import calclavia.lib.prefab.tile.TileAdvanced;
|
||||||
import calclavia.lib.utility.AutoCraftingManager;
|
import calclavia.lib.utility.AutoCraftingManager;
|
||||||
import calclavia.lib.utility.AutoCraftingManager.IAutoCrafter;
|
import calclavia.lib.utility.AutoCraftingManager.IAutoCrafter;
|
||||||
import calclavia.lib.utility.LanguageUtility;
|
|
||||||
import calclavia.lib.utility.ListUtility;
|
|
||||||
|
|
||||||
import com.builtbroken.common.Pair;
|
import com.builtbroken.common.Pair;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.io.ByteArrayDataInput;
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
|
|
||||||
public class TileEngineeringTable extends TileAdvanced implements IPacketReceiver, ISidedInventory, IArmbotUseable, ISlotPickResult, IAutoCrafter
|
public class TileEngineeringTable extends TileAdvanced implements IPacketReceiver, ISidedInventory, IArmbotUseable, ISlotPickResult, IAutoCrafter
|
||||||
|
@ -281,9 +278,9 @@ public class TileEngineeringTable extends TileAdvanced implements IPacketReceive
|
||||||
{
|
{
|
||||||
ItemStack filterStack = this.craftingMatrix[imprintInputSlot];
|
ItemStack filterStack = this.craftingMatrix[imprintInputSlot];
|
||||||
|
|
||||||
if (filterStack != null && filterStack.getItem() instanceof ItemBlockFilter)
|
if (filterStack != null && filterStack.getItem() instanceof ItemBlockImprint)
|
||||||
{
|
{
|
||||||
ArrayList<ItemStack> filters = ItemBlockFilter.getFilters(filterStack);
|
Set<ItemStack> filters = ItemBlockImprint.getFilters(filterStack);
|
||||||
|
|
||||||
for (ItemStack outputStack : filters)
|
for (ItemStack outputStack : filters)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package resonantinduction.archaic.imprint;
|
package resonantinduction.archaic.imprint;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -8,10 +9,12 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Icon;
|
import net.minecraft.util.Icon;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
import resonantinduction.core.Reference;
|
import resonantinduction.core.Reference;
|
||||||
import resonantinduction.core.prefab.block.BlockRI;
|
import resonantinduction.core.prefab.block.BlockRI;
|
||||||
import universalelectricity.api.vector.Vector2;
|
import universalelectricity.api.vector.Vector2;
|
||||||
import universalelectricity.api.vector.Vector3;
|
import universalelectricity.api.vector.Vector3;
|
||||||
|
import universalelectricity.api.vector.VectorWorld;
|
||||||
import calclavia.lib.utility.InventoryUtility;
|
import calclavia.lib.utility.InventoryUtility;
|
||||||
import codechicken.multipart.ControlKeyModifer;
|
import codechicken.multipart.ControlKeyModifer;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
@ -63,6 +66,23 @@ public class BlockImprinter extends BlockRI
|
||||||
return this.imprinter_side;
|
return this.imprinter_side;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNeighborBlockChange(World world, int x, int y, int z, int blockID)
|
||||||
|
{
|
||||||
|
TileEntity te = world.getBlockTileEntity(x, y, z);
|
||||||
|
|
||||||
|
if (te instanceof TileImprinter)
|
||||||
|
{
|
||||||
|
TileImprinter tile = (TileImprinter) te;
|
||||||
|
int idOnTop = ((VectorWorld) new VectorWorld(world, x, y, z).modifyPositionFromSide(ForgeDirection.getOrientation(1))).getBlockID();
|
||||||
|
|
||||||
|
if (Block.pistonMoving.blockID == blockID)
|
||||||
|
{
|
||||||
|
tile.onInventoryChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer player, int hitSide, float hitX, float hitY, float hitZ)
|
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer player, int hitSide, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
|
@ -71,13 +91,12 @@ public class BlockImprinter extends BlockRI
|
||||||
if (te instanceof TileImprinter)
|
if (te instanceof TileImprinter)
|
||||||
{
|
{
|
||||||
TileImprinter tile = (TileImprinter) te;
|
TileImprinter tile = (TileImprinter) te;
|
||||||
|
ItemStack current = player.inventory.getCurrentItem();
|
||||||
|
|
||||||
if (hitSide == 1)
|
if (hitSide == 1)
|
||||||
{
|
{
|
||||||
if (!world.isRemote)
|
if (!world.isRemote)
|
||||||
{
|
{
|
||||||
ItemStack current = player.inventory.getCurrentItem();
|
|
||||||
|
|
||||||
Vector2 hitVector = new Vector2(hitX, hitZ);
|
Vector2 hitVector = new Vector2(hitX, hitZ);
|
||||||
double regionLength = 1d / 3d;
|
double regionLength = 1d / 3d;
|
||||||
|
|
||||||
|
@ -148,19 +167,25 @@ public class BlockImprinter extends BlockRI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tile.onInventoryChanged();
|
world.markBlockForUpdate(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (hitSide != 0)
|
else if (hitSide != 0)
|
||||||
{
|
{
|
||||||
if (!world.isRemote)
|
|
||||||
|
ItemStack output = tile.getStackInSlot(9);
|
||||||
|
|
||||||
|
if (output != null)
|
||||||
{
|
{
|
||||||
ItemStack output = tile.getStackInSlot(9);
|
|
||||||
InventoryUtility.dropItemStack(world, new Vector3(player), output, 0);
|
InventoryUtility.dropItemStack(world, new Vector3(player), output, 0);
|
||||||
tile.setInventorySlotContents(9, null);
|
tile.setInventorySlotContents(9, null);
|
||||||
tile.onInventoryChanged();
|
}
|
||||||
|
else if (current != null && current.getItem() instanceof ItemBlockImprint)
|
||||||
|
{
|
||||||
|
tile.setInventorySlotContents(9, current);
|
||||||
|
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
package resonantinduction.archaic.imprint;
|
package resonantinduction.archaic.imprint;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
@ -19,9 +20,14 @@ import resonantinduction.core.Settings;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class ItemBlockFilter extends Item
|
public class ItemBlockImprint extends Item
|
||||||
{
|
{
|
||||||
public ItemBlockFilter(int id)
|
public ItemBlockImprint()
|
||||||
|
{
|
||||||
|
this(Settings.getNextItemID());
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemBlockImprint(int id)
|
||||||
{
|
{
|
||||||
super(Settings.CONFIGURATION.getItem("imprint", id).getInt());
|
super(Settings.CONFIGURATION.getItem("imprint", id).getInt());
|
||||||
this.setUnlocalizedName("imprint");
|
this.setUnlocalizedName("imprint");
|
||||||
|
@ -64,7 +70,7 @@ public class ItemBlockFilter extends Item
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack itemStack, EntityPlayer par2EntityPlayer, List list, boolean par4)
|
public void addInformation(ItemStack itemStack, EntityPlayer par2EntityPlayer, List list, boolean par4)
|
||||||
{
|
{
|
||||||
List<ItemStack> filterItems = getFilters(itemStack);
|
Set<ItemStack> filterItems = getFilters(itemStack);
|
||||||
|
|
||||||
if (filterItems.size() > 0)
|
if (filterItems.size() > 0)
|
||||||
{
|
{
|
||||||
|
@ -80,7 +86,7 @@ public class ItemBlockFilter extends Item
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Saves the list of items to filter out inside. */
|
/** Saves the list of items to filter out inside. */
|
||||||
public static void setFilters(ItemStack itemStack, ArrayList<ItemStack> filterStacks)
|
public static void setFilters(ItemStack itemStack, Set<ItemStack> filterStacks)
|
||||||
{
|
{
|
||||||
if (itemStack.getTagCompound() == null)
|
if (itemStack.getTagCompound() == null)
|
||||||
{
|
{
|
||||||
|
@ -89,23 +95,19 @@ public class ItemBlockFilter extends Item
|
||||||
|
|
||||||
NBTTagList nbt = new NBTTagList();
|
NBTTagList nbt = new NBTTagList();
|
||||||
|
|
||||||
for (int i = 0; i < filterStacks.size(); ++i)
|
for (ItemStack filterStack : filterStacks)
|
||||||
{
|
{
|
||||||
if (filterStacks.get(i) != null)
|
NBTTagCompound newCompound = new NBTTagCompound();
|
||||||
{
|
filterStack.writeToNBT(newCompound);
|
||||||
NBTTagCompound newCompound = new NBTTagCompound();
|
nbt.appendTag(newCompound);
|
||||||
newCompound.setByte("Slot", (byte) i);
|
|
||||||
filterStacks.get(i).writeToNBT(newCompound);
|
|
||||||
nbt.appendTag(newCompound);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
itemStack.getTagCompound().setTag("Items", nbt);
|
itemStack.getTagCompound().setTag("Items", nbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<ItemStack> getFilters(ItemStack itemStack)
|
public static HashSet<ItemStack> getFilters(ItemStack itemStack)
|
||||||
{
|
{
|
||||||
ArrayList<ItemStack> filterStacks = new ArrayList<ItemStack>();
|
HashSet<ItemStack> filterStacks = new HashSet<ItemStack>();
|
||||||
|
|
||||||
if (itemStack.getTagCompound() == null)
|
if (itemStack.getTagCompound() == null)
|
||||||
{
|
{
|
||||||
|
@ -118,7 +120,6 @@ public class ItemBlockFilter extends Item
|
||||||
for (int i = 0; i < tagList.tagCount(); ++i)
|
for (int i = 0; i < tagList.tagCount(); ++i)
|
||||||
{
|
{
|
||||||
NBTTagCompound var4 = (NBTTagCompound) tagList.tagAt(i);
|
NBTTagCompound var4 = (NBTTagCompound) tagList.tagAt(i);
|
||||||
byte var5 = var4.getByte("Slot");
|
|
||||||
filterStacks.add(ItemStack.loadItemStackFromNBT(var4));
|
filterStacks.add(ItemStack.loadItemStackFromNBT(var4));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,20 @@
|
||||||
package resonantinduction.archaic.imprint;
|
package resonantinduction.archaic.imprint;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.Iterator;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
import net.minecraft.inventory.ISidedInventory;
|
||||||
import net.minecraft.inventory.InventoryCrafting;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.CraftingManager;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.network.packet.Packet;
|
import net.minecraft.network.packet.Packet;
|
||||||
import resonantinduction.api.IArmbot;
|
|
||||||
import resonantinduction.api.IArmbotUseable;
|
|
||||||
import resonantinduction.api.events.AutoCraftEvent;
|
|
||||||
import resonantinduction.core.ResonantInduction;
|
import resonantinduction.core.ResonantInduction;
|
||||||
import resonantinduction.electrical.encoder.coding.args.ArgumentData;
|
|
||||||
import universalelectricity.api.vector.Vector3;
|
|
||||||
import calclavia.lib.network.IPacketReceiver;
|
import calclavia.lib.network.IPacketReceiver;
|
||||||
import calclavia.lib.network.PacketHandler;
|
import calclavia.lib.network.PacketHandler;
|
||||||
import calclavia.lib.prefab.slot.ISlotPickResult;
|
|
||||||
import calclavia.lib.prefab.tile.TileAdvanced;
|
import calclavia.lib.prefab.tile.TileAdvanced;
|
||||||
|
|
||||||
import com.builtbroken.common.Pair;
|
|
||||||
import com.google.common.io.ByteArrayDataInput;
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
|
|
||||||
public class TileImprinter extends TileAdvanced implements ISidedInventory, IPacketReceiver
|
public class TileImprinter extends TileAdvanced implements ISidedInventory, IPacketReceiver
|
||||||
|
@ -152,29 +144,57 @@ public class TileImprinter extends TileAdvanced implements ISidedInventory, IPac
|
||||||
/** Makes the stamping recipe for filters */
|
/** Makes the stamping recipe for filters */
|
||||||
ItemStack fitlerStack = this.inventory[9];
|
ItemStack fitlerStack = this.inventory[9];
|
||||||
|
|
||||||
if (fitlerStack != null && fitlerStack.getItem() instanceof ItemBlockFilter)
|
if (fitlerStack != null && fitlerStack.getItem() instanceof ItemBlockImprint)
|
||||||
{
|
{
|
||||||
ItemStack outputStack = fitlerStack.copy();
|
ItemStack outputStack = fitlerStack.copy();
|
||||||
outputStack.stackSize = 1;
|
outputStack.stackSize = 1;
|
||||||
ArrayList<ItemStack> filters = ItemBlockFilter.getFilters(outputStack);
|
Set<ItemStack> filters = ItemBlockImprint.getFilters(outputStack);
|
||||||
boolean filteringItemExists = false;
|
Set<ItemStack> toAdd = new HashSet<ItemStack>();
|
||||||
|
|
||||||
for (ItemStack filteredStack : filters)
|
/** A hashset of to be imprinted items containing NO repeats. */
|
||||||
|
Set<ItemStack> toBeImprinted = new HashSet<ItemStack>();
|
||||||
|
|
||||||
|
check:
|
||||||
|
for (int i = 0; i < 9; i++)
|
||||||
{
|
{
|
||||||
if (filteredStack.isItemEqual(fitlerStack))
|
ItemStack stackInInventory = inventory[i];
|
||||||
|
|
||||||
|
if (stackInInventory != null)
|
||||||
{
|
{
|
||||||
filters.remove(filteredStack);
|
for (ItemStack check : toBeImprinted)
|
||||||
filteringItemExists = true;
|
{
|
||||||
break;
|
if (check.isItemEqual(stackInInventory))
|
||||||
|
continue check;
|
||||||
|
}
|
||||||
|
|
||||||
|
toBeImprinted.add(stackInInventory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!filteringItemExists)
|
for (ItemStack stackInInventory : toBeImprinted)
|
||||||
{
|
{
|
||||||
filters.add(fitlerStack);
|
Iterator<ItemStack> it = filters.iterator();
|
||||||
|
|
||||||
|
boolean removed = false;
|
||||||
|
|
||||||
|
while (it.hasNext())
|
||||||
|
{
|
||||||
|
ItemStack filteredStack = it.next();
|
||||||
|
|
||||||
|
if (filteredStack.isItemEqual(stackInInventory))
|
||||||
|
{
|
||||||
|
it.remove();
|
||||||
|
removed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!removed)
|
||||||
|
toAdd.add(stackInInventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemBlockFilter.setFilters(outputStack, filters);
|
filters.addAll(toAdd);
|
||||||
|
|
||||||
|
ItemBlockImprint.setFilters(outputStack, filters);
|
||||||
this.inventory[9] = outputStack;
|
this.inventory[9] = outputStack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import resonantinduction.api.IFilterable;
|
import resonantinduction.api.IFilterable;
|
||||||
import resonantinduction.archaic.imprint.ItemBlockFilter;
|
import resonantinduction.archaic.imprint.ItemBlockImprint;
|
||||||
import resonantinduction.core.prefab.tile.TileEntityFilterable;
|
import resonantinduction.core.prefab.tile.TileEntityFilterable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,7 +53,7 @@ public abstract class BlockImprintable extends BlockRI
|
||||||
{
|
{
|
||||||
if (player.getCurrentEquippedItem() != null)
|
if (player.getCurrentEquippedItem() != null)
|
||||||
{
|
{
|
||||||
if (player.getCurrentEquippedItem().getItem() instanceof ItemBlockFilter)
|
if (player.getCurrentEquippedItem().getItem() instanceof ItemBlockImprint)
|
||||||
{
|
{
|
||||||
((IFilterable) tileEntity).setFilter(player.getCurrentEquippedItem());
|
((IFilterable) tileEntity).setFilter(player.getCurrentEquippedItem());
|
||||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package resonantinduction.core.prefab.tile;
|
package resonantinduction.core.prefab.tile;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.Set;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
import resonantinduction.api.IFilterable;
|
import resonantinduction.api.IFilterable;
|
||||||
import resonantinduction.archaic.imprint.ItemBlockFilter;
|
import resonantinduction.archaic.imprint.ItemBlockImprint;
|
||||||
import calclavia.lib.prefab.tile.IRotatable;
|
import calclavia.lib.prefab.tile.IRotatable;
|
||||||
|
|
||||||
public abstract class TileEntityFilterable extends TileAssembly implements IRotatable, IFilterable
|
public abstract class TileEntityFilterable extends TileAssembly implements IRotatable, IFilterable
|
||||||
|
@ -41,7 +41,7 @@ public abstract class TileEntityFilterable extends TileAssembly implements IRota
|
||||||
{
|
{
|
||||||
if (this.getFilter() != null && itemStack != null)
|
if (this.getFilter() != null && itemStack != null)
|
||||||
{
|
{
|
||||||
ArrayList<ItemStack> checkStacks = ItemBlockFilter.getFilters(getFilter());
|
Set<ItemStack> checkStacks = ItemBlockImprint.getFilters(getFilter());
|
||||||
|
|
||||||
if (checkStacks != null)
|
if (checkStacks != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package resonantinduction.core.render;
|
package resonantinduction.core.render;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.Set;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
|
@ -8,7 +8,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
import resonantinduction.archaic.imprint.ItemBlockFilter;
|
import resonantinduction.archaic.imprint.ItemBlockImprint;
|
||||||
import resonantinduction.core.prefab.tile.TileEntityFilterable;
|
import resonantinduction.core.prefab.tile.TileEntityFilterable;
|
||||||
import calclavia.lib.render.RenderUtility;
|
import calclavia.lib.render.RenderUtility;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
@ -40,17 +40,20 @@ public abstract class RenderImprintable extends TileEntitySpecialRenderer
|
||||||
{
|
{
|
||||||
if (objectPosition.blockX == tileFilterable.xCoord && objectPosition.blockY == tileFilterable.yCoord && objectPosition.blockZ == tileFilterable.zCoord)
|
if (objectPosition.blockX == tileFilterable.xCoord && objectPosition.blockY == tileFilterable.yCoord && objectPosition.blockZ == tileFilterable.zCoord)
|
||||||
{
|
{
|
||||||
ArrayList<ItemStack> filters = ItemBlockFilter.getFilters(filter);
|
Set<ItemStack> filters = ItemBlockImprint.getFilters(filter);
|
||||||
for (int i = 0; i < filters.size(); i++)
|
|
||||||
|
int i = 0;
|
||||||
|
for (ItemStack filterStack : filters)
|
||||||
{
|
{
|
||||||
if (((TileEntityFilterable) tileEntity).isInverted())
|
if (((TileEntityFilterable) tileEntity).isInverted())
|
||||||
{
|
{
|
||||||
RenderUtility.renderFloatingText(filters.get(i).getTooltip(player, Minecraft.getMinecraft().gameSettings.advancedItemTooltips).get(0).toString(), (float) x + 0.5f, ((float) y + (i * 0.25f)) - 1f, (float) z + 0.5f, 0xFF8888);
|
RenderUtility.renderFloatingText(filterStack.getTooltip(player, Minecraft.getMinecraft().gameSettings.advancedItemTooltips).get(0).toString(), (float) x + 0.5f, ((float) y + (i * 0.25f)) - 1f, (float) z + 0.5f, 0xFF8888);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RenderUtility.renderFloatingText(filters.get(i).getTooltip(player, Minecraft.getMinecraft().gameSettings.advancedItemTooltips).get(0).toString(), (float) x + 0.5f, ((float) y + (i * 0.25f)) - 1f, (float) z + 0.5f, 0x88FF88);
|
RenderUtility.renderFloatingText(filterStack.getTooltip(player, Minecraft.getMinecraft().gameSettings.advancedItemTooltips).get(0).toString(), (float) x + 0.5f, ((float) y + (i * 0.25f)) - 1f, (float) z + 0.5f, 0x88FF88);
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,5 +61,4 @@ public abstract class RenderImprintable extends TileEntitySpecialRenderer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue