Moved API to resources
This commit is contained in:
parent
8e7d051e76
commit
3f60b225bd
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,10 +0,0 @@
|
|||
package resonantengine.api.armor;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IAntiPoisonArmor extends IArmorSet {
|
||||
boolean isProtectedFromPoison(ItemStack var1, EntityLivingBase var2, String var3);
|
||||
|
||||
void onProtectFromPoison(ItemStack var1, EntityLivingBase var2, String var3);
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package resonantengine.api.armor;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
|
||||
public interface IArmorSet {
|
||||
int getArmorType();
|
||||
|
||||
boolean isPartOfSet(ItemStack var1, ItemStack var2);
|
||||
|
||||
boolean areAllPartsNeeded(ItemStack var1, EntityLivingBase var2, DamageSource var3, Object... var4);
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package resonantengine.api.armor;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IInsulatedArmor extends IArmorSet {
|
||||
float onElectricalDamage(ItemStack var1, EntityLivingBase var2, Object var3, long var4, float var6);
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package resonantengine.api.edx.machine;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IReactor {
|
||||
void heat(double var1);
|
||||
|
||||
World world();
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package resonantengine.api.edx.machine;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IReactorComponent {
|
||||
void onReact(ItemStack var1, IReactor var2);
|
||||
}
|
|
@ -1,110 +0,0 @@
|
|||
package resonantengine.api.edx.recipe;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public final class MachineRecipes {
|
||||
public static MachineRecipes instance = new MachineRecipes();
|
||||
private final Map recipes = new HashMap();
|
||||
|
||||
public RecipeResource getResourceFromObject(Object obj) {
|
||||
if (obj instanceof String) {
|
||||
return new RecipeResource.OreDictResource((String)obj);
|
||||
} else if (obj instanceof Block) {
|
||||
return new RecipeResource.ItemStackResource(new ItemStack((Block)obj));
|
||||
} else if (obj instanceof Item) {
|
||||
return new RecipeResource.ItemStackResource(new ItemStack((Item)obj));
|
||||
} else if (obj instanceof ItemStack) {
|
||||
return new RecipeResource.ItemStackResource((ItemStack)obj);
|
||||
} else if (obj instanceof FluidStack) {
|
||||
return new RecipeResource.FluidStackResource((FluidStack)obj);
|
||||
} else {
|
||||
return obj instanceof RecipeResource ? (RecipeResource)obj : null;
|
||||
}
|
||||
}
|
||||
|
||||
public void addRecipe(String machine, Object inputObj, Object... outputObj) {
|
||||
this.addRecipe(machine, new Object[]{inputObj}, outputObj);
|
||||
}
|
||||
|
||||
public void addRecipe(String machine, Object[] inputObj, Object[] outputObj) {
|
||||
RecipeResource[] inputs = new RecipeResource[inputObj.length];
|
||||
|
||||
for(int i = 0; i < inputs.length; ++i) {
|
||||
RecipeResource input = this.getResourceFromObject(inputObj[i]);
|
||||
if (input == null) {
|
||||
throw new RuntimeException("Tried to add invalid " + machine + " recipe input: " + inputObj[i]);
|
||||
}
|
||||
|
||||
inputs[i] = input;
|
||||
}
|
||||
|
||||
RecipeResource[] outputs = new RecipeResource[outputObj.length];
|
||||
|
||||
for(int i = 0; i < outputs.length; ++i) {
|
||||
RecipeResource output = this.getResourceFromObject(outputObj[i]);
|
||||
if (output == null) {
|
||||
throw new RuntimeException("Tried to add invalid " + machine + " recipe output: " + outputObj[i]);
|
||||
}
|
||||
|
||||
outputs[i] = output;
|
||||
}
|
||||
|
||||
this.addRecipe(machine, inputs, outputs);
|
||||
}
|
||||
|
||||
public void addRecipe(String machine, RecipeResource[] input, RecipeResource[] output) {
|
||||
this.getRecipes(machine).put(input, output);
|
||||
}
|
||||
|
||||
public void removeRecipe(String machine, RecipeResource[] input) {
|
||||
this.getRecipes(machine).remove(input);
|
||||
}
|
||||
|
||||
public Map getRecipes(String machine) {
|
||||
machine = machine.toLowerCase(Locale.ENGLISH);
|
||||
if (!this.recipes.containsKey(machine)) {
|
||||
this.recipes.put(machine, new HashMap());
|
||||
}
|
||||
|
||||
return (Map)this.recipes.get(machine);
|
||||
}
|
||||
|
||||
public RecipeResource[] getOutput(String machine, RecipeResource... input) {
|
||||
Iterator it = this.getRecipes(machine).entrySet().iterator();
|
||||
|
||||
Entry entry;
|
||||
RecipeResource[] compare;
|
||||
RecipeResource[] copyA;
|
||||
RecipeResource[] copyB;
|
||||
do {
|
||||
if (!it.hasNext()) {
|
||||
return new RecipeResource[0];
|
||||
}
|
||||
|
||||
entry = (Entry)it.next();
|
||||
compare = (RecipeResource[])entry.getKey();
|
||||
copyA = (RecipeResource[])Arrays.copyOf(input, input.length);
|
||||
copyB = (RecipeResource[])Arrays.copyOf(compare, compare.length);
|
||||
Arrays.sort(copyA);
|
||||
Arrays.sort(copyB);
|
||||
} while(!Arrays.equals(compare, input) && !Arrays.equals(copyA, copyB));
|
||||
|
||||
return (RecipeResource[])entry.getValue();
|
||||
}
|
||||
|
||||
public RecipeResource[] getOutput(String machine, Object... inputs) {
|
||||
RecipeResource[] resourceInputs = new RecipeResource[inputs.length];
|
||||
|
||||
for(int i = 0; i < inputs.length; ++i) {
|
||||
resourceInputs[i] = this.getResourceFromObject(inputs[i]);
|
||||
}
|
||||
|
||||
return this.getOutput(machine, resourceInputs);
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package resonantengine.api.edx.recipe;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class QuantumAssemblerRecipes {
|
||||
public static final List RECIPES = new ArrayList();
|
||||
|
||||
public static boolean hasItemStack(ItemStack itemStack) {
|
||||
Iterator i$ = RECIPES.iterator();
|
||||
|
||||
ItemStack output;
|
||||
do {
|
||||
if (!i$.hasNext()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
output = (ItemStack)i$.next();
|
||||
} while(!output.isItemEqual(itemStack));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void addRecipe(ItemStack itemStack) {
|
||||
if (itemStack != null && itemStack.isStackable()) {
|
||||
RECIPES.add(itemStack);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,135 +0,0 @@
|
|||
package resonantengine.api.edx.recipe;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
public abstract class RecipeResource {
|
||||
public final boolean hasChance;
|
||||
public final float chance;
|
||||
|
||||
protected RecipeResource() {
|
||||
this.hasChance = false;
|
||||
this.chance = 100.0F;
|
||||
}
|
||||
|
||||
protected RecipeResource(float chance) {
|
||||
this.hasChance = true;
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
public boolean hasChance() {
|
||||
return this.hasChance;
|
||||
}
|
||||
|
||||
public float getChance() {
|
||||
return this.chance;
|
||||
}
|
||||
|
||||
public abstract ItemStack getItemStack();
|
||||
|
||||
public static class FluidStackResource extends RecipeResource {
|
||||
public final FluidStack fluidStack;
|
||||
|
||||
public FluidStackResource(FluidStack fs) {
|
||||
this.fluidStack = fs;
|
||||
}
|
||||
|
||||
public FluidStackResource(FluidStack fs, float chance) {
|
||||
super(chance);
|
||||
this.fluidStack = fs;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof RecipeResource.FluidStackResource) {
|
||||
return this.equals(((RecipeResource.FluidStackResource)obj).fluidStack);
|
||||
} else {
|
||||
return obj instanceof FluidStack ? ((FluidStack)obj).equals(this.fluidStack) : false;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "[FluidStackResource: " + this.fluidStack.getFluid().getName() + "]";
|
||||
}
|
||||
}
|
||||
|
||||
public static class OreDictResource extends RecipeResource {
|
||||
public final String name;
|
||||
|
||||
public OreDictResource(String s) {
|
||||
this.name = s;
|
||||
if (OreDictionary.getOres(this.name).size() <= 0) {
|
||||
throw new RuntimeException("Added invalid OreDictResource recipe: " + this.name);
|
||||
}
|
||||
}
|
||||
|
||||
public OreDictResource(String s, float chance) {
|
||||
super(chance);
|
||||
this.name = s;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof RecipeResource.OreDictResource) {
|
||||
return this.name.equals(((RecipeResource.OreDictResource)obj).name);
|
||||
} else if (obj instanceof RecipeResource.ItemStackResource) {
|
||||
return this.equals(((RecipeResource.ItemStackResource)obj).itemStack);
|
||||
} else {
|
||||
if (obj instanceof ItemStack) {
|
||||
Iterator i$ = OreDictionary.getOres(this.name).iterator();
|
||||
|
||||
while(i$.hasNext()) {
|
||||
ItemStack is = (ItemStack)i$.next();
|
||||
if (is.isItemEqual((ItemStack)obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return ((ItemStack)OreDictionary.getOres(this.name).get(0)).copy();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "[OreDictResource: " + this.name + "]";
|
||||
}
|
||||
}
|
||||
|
||||
public static class ItemStackResource extends RecipeResource {
|
||||
public final ItemStack itemStack;
|
||||
|
||||
public ItemStackResource(ItemStack is) {
|
||||
this.itemStack = is;
|
||||
}
|
||||
|
||||
public ItemStackResource(ItemStack is, float chance) {
|
||||
super(chance);
|
||||
this.itemStack = is;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof RecipeResource.ItemStackResource) {
|
||||
return this.itemStack.isItemEqual(((RecipeResource.ItemStackResource)obj).itemStack);
|
||||
} else {
|
||||
return obj instanceof ItemStack ? this.itemStack.isItemEqual((ItemStack)obj) : false;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return this.itemStack.copy();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "[ItemStackResource: " + this.itemStack.toString() + "]";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package resonantengine.api.edx.recipe;
|
||||
|
||||
public enum RecipeType {
|
||||
GRINDER,
|
||||
SIFTER,
|
||||
MIXER,
|
||||
SMELTER,
|
||||
SAWMILL;
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
package resonantengine.api.event;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.event.world.ChunkEvent;
|
||||
|
||||
public abstract class ChunkModifiedEvent extends ChunkEvent {
|
||||
public ChunkModifiedEvent(Chunk chunk) {
|
||||
super(chunk);
|
||||
}
|
||||
|
||||
public static class ChunkSetBlockEvent extends ChunkModifiedEvent {
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final int z;
|
||||
public final int blockMetadata;
|
||||
public final Block block;
|
||||
|
||||
public ChunkSetBlockEvent(Chunk chunk, int chunkX, int y, int chunkZ, Block block, int blockMetadata) {
|
||||
super(chunk);
|
||||
this.x = (chunk.xPosition << 4) + chunkX;
|
||||
this.y = y;
|
||||
this.z = (chunk.zPosition << 4) + chunkZ;
|
||||
this.block = block;
|
||||
this.blockMetadata = blockMetadata;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
package resonantengine.api.event;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
|
||||
public abstract class PlasmaEvent extends WorldEvent {
|
||||
public PlasmaEvent(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public static class SpawnPlasmaEvent extends PlasmaEvent {
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final int z;
|
||||
public final int temperature;
|
||||
|
||||
public SpawnPlasmaEvent(World world, int x, int y, int z, int temperature) {
|
||||
super(world);
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.temperature = temperature;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package resonantengine.api.graph;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public interface IGraph {
|
||||
Set getNodes();
|
||||
|
||||
void add(Object var1);
|
||||
|
||||
void remove(Object var1);
|
||||
|
||||
void reconstruct();
|
||||
|
||||
void deconstruct();
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package resonantengine.api.graph;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import resonantengine.api.graph.node.INode;
|
||||
|
||||
public interface INodeProvider {
|
||||
<N extends INode> N getNode(Class<? extends N> var1, ForgeDirection var2);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package resonantengine.api.graph;
|
||||
|
||||
public interface IUpdate {
|
||||
void update(double var1);
|
||||
|
||||
int updatePeriod();
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package resonantengine.api.graph.node;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IEnergyNode extends INode {
|
||||
double addEnergy(ForgeDirection var1, double var2, boolean var4);
|
||||
|
||||
double removeEnergy(ForgeDirection var1, double var2, boolean var4);
|
||||
|
||||
double getEnergy(ForgeDirection var1);
|
||||
|
||||
double getEnergyCapacity(ForgeDirection var1);
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package resonantengine.api.graph.node;
|
||||
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import resonantengine.api.misc.ISave;
|
||||
|
||||
public interface IExternalInventory extends ISidedInventory, ISave {
|
||||
ItemStack[] getContainedItems();
|
||||
|
||||
void clear();
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package resonantengine.api.graph.node;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IFlow {
|
||||
double getFlow(NodeType var1, ForgeDirection var2);
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package resonantengine.api.graph.node;
|
||||
|
||||
import resonantengine.api.graph.INodeProvider;
|
||||
|
||||
public interface INode {
|
||||
void reconstruct();
|
||||
|
||||
void deconstruct();
|
||||
|
||||
INodeProvider getParent();
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
package resonantengine.api.graph.node;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
public interface INodeConnector extends INode {
|
||||
boolean canConnect(Object var1, ForgeDirection var2);
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
Set connections();
|
||||
|
||||
Map directionMap();
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue