More sigils

Deleted weird file
This commit is contained in:
Arcaratus 2015-12-28 19:09:51 -05:00
parent 0ec0570d1a
commit b96725fe98
31 changed files with 1011 additions and 53 deletions

View file

@ -26,7 +26,7 @@ public interface IBloodAltar {
int getBufferCapacity();
void sacrificialDaggerCall(int amount, boolean b);
void sacrificialDaggerCall(int amount, boolean isSacrifice);
void startCycle();

View file

@ -0,0 +1,14 @@
package WayofTime.bloodmagic.api.compress;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public abstract class CompressionHandler {
/**
* Called to look at the inventory and syphons the required stack. Returns resultant stack if successful, and null if not.
* @param inv The inventory iterated through
* @return The result of the compression
*/
public abstract ItemStack compressInventory(ItemStack[] inv, World world);
}

View file

@ -0,0 +1,57 @@
package WayofTime.bloodmagic.api.compress;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* A registry aimed to help compress items in an inventory into its compressible form.
*/
public class CompressionRegistry {
public static List<CompressionHandler> compressionRegistry = new ArrayList<CompressionHandler>();
public static Map<ItemStack, Integer> thresholdMap = new HashMap<ItemStack, Integer>();
public static void registerHandler(CompressionHandler handler) {
compressionRegistry.add(handler);
}
/**
* Registers an item so that it only compresses while above this threshold
*
* @param stack item/block to be compressed
* @param threshold amount that is to be compressed
*/
public static void registerItemThreshold(ItemStack stack, int threshold) {
thresholdMap.put(stack, threshold);
}
public static ItemStack compressInventory(ItemStack[] inv, World world) {
for (CompressionHandler handler : compressionRegistry) {
ItemStack stack = handler.compressInventory(inv, world);
if (stack != null) {
return stack;
}
}
return null;
}
public static int getItemThreshold(ItemStack stack) {
for (Map.Entry<ItemStack, Integer> entry : thresholdMap.entrySet()) {
if (areItemStacksEqual(entry.getKey(), stack)) {
return entry.getValue();
}
}
return 0;
}
public static boolean areItemStacksEqual(ItemStack stack, ItemStack compressedStack) {
return stack.isItemEqual(compressedStack) && (stack.getTagCompound() == null ? compressedStack.getTagCompound() == null : stack.getTagCompound().equals(compressedStack.getTagCompound()));
}
}