Removed obsolete API functions and classes.

This commit is contained in:
SirSengir 2012-07-24 12:07:47 +02:00
parent d6fa02ad35
commit 6562aa1810
11 changed files with 3 additions and 619 deletions

View file

@ -38,74 +38,11 @@ public class BuildCraftAPI {
// Other BuildCraft global data
/**
* This does not do anything anymore. Use buildcraft.api.liquids.LiquidManager!
*/
@Deprecated public static LinkedList<LiquidData> liquids = new LinkedList<LiquidData>();
/**
* This does not do anything anymore. Use buildcraft.api.fuels.IronEngineFuel!
*/
@Deprecated public static HashMap<Integer, IronEngineFuel> ironEngineFuel = new HashMap<Integer, IronEngineFuel>();
private static EntityPlayer buildCraftPlayer;
/**
* This does not do anything anymore. Use buildcraft.api.recipes.RefineryRecipe!
*/
@Deprecated private static LinkedList<RefineryRecipe> refineryRecipe = new LinkedList<RefineryRecipe>();
@Deprecated public static Trigger[] triggers = new Trigger[1024];
@Deprecated public static Action[] actions = new Action[1024];
/**
* This does not do anything anymore. Use buildcraft.api.liquids.LiquidManager!
*/
/*
@Deprecated
public static int getLiquidForFilledItem(ItemStack filledItem) {
if (filledItem == null) {
return 0;
}
for (LiquidData d : liquids) {
if (d.filled.itemID == filledItem.itemID && d.filled.getItemDamage() == filledItem.getItemDamage()) {
return d.liquidId;
}
}
return 0;
}*/
/**
* This does not do anything anymore. Use buildcraft.api.liquids.LiquidManager!
*/
/*
@Deprecated
public static ItemStack getFilledItemForLiquid(int liquidId) {
for (LiquidData d : liquids) {
if (d.liquidId == liquidId) {
return d.filled.copy();
}
}
return null;
} */
/**
* This does not do anything anymore. Use buildcraft.api.liquids.LiquidManager!
*/
/*
@Deprecated
public static boolean isLiquid(int blockId) {
if (blockId == 0) {
return false;
}
for (LiquidData d : liquids) {
if (d.liquidId == blockId || d.movingLiquidId == blockId) {
return true;
}
}
return false;
} */
/**
* Return true if the block given in parameter is pass through (e.g. air,
@ -142,50 +79,6 @@ public class BuildCraftAPI {
return buildCraftPlayer;
}
/**
* This does not do anything anymore. Use buildcraft.api.recipes.RefineryRecipe!
*/
@Deprecated
public static void registerRefineryRecipe(RefineryRecipe recipe) {
if (!refineryRecipe.contains(recipe)) {
refineryRecipe.add(recipe);
}
}
/**
* This does not do anything anymore. Use buildcraft.api.recipes.RefineryRecipe!
*/
/*
@Deprecated
public static RefineryRecipe findRefineryRecipe(int liquid1, int qty1, int liquid2, int qty2) {
int l1 = qty1 > 0 ? liquid1 : 0;
int l2 = qty2 > 0 ? liquid2 : 0;
for (RefineryRecipe r : refineryRecipe) {
int src1 = 0;
int src2 = 0;
if (r.sourceId1 == l1) {
src1 = l1;
src2 = l2;
} else if (r.sourceId1 == l2) {
src1 = l2;
src2 = l1;
}
if (src1 == 0) {
continue;
}
if ((r.sourceQty2 == 0 && (src2 == 0 || src2 == src1)) || r.sourceId2 == src2) {
return r;
}
}
return null;
}
*/
public static BlockSignature getBlockSignature(Block block) {
return blockBptProps[0].getSignature(block);
}
@ -202,80 +95,6 @@ public class BuildCraftAPI {
return sig;
}
@Deprecated private static LinkedList<ITriggerProvider> triggerProviders = new LinkedList<ITriggerProvider>();
@Deprecated private static LinkedList<IActionProvider> actionProviders = new LinkedList<IActionProvider>();
@Deprecated
public static void registerTriggerProvider(ITriggerProvider provider) {
if (provider != null && !triggerProviders.contains(provider)) {
triggerProviders.add(provider);
}
}
@Deprecated
public static LinkedList<ITrigger> getNeighborTriggers(Block block, TileEntity entity) {
LinkedList<ITrigger> triggers = new LinkedList<ITrigger>();
for (ITriggerProvider provider : triggerProviders) {
LinkedList<ITrigger> toAdd = provider.getNeighborTriggers(block, entity);
if (toAdd != null) {
for (ITrigger t : toAdd) {
if (!triggers.contains(t)) {
triggers.add(t);
}
}
}
}
return triggers;
}
@Deprecated
public static void registerActionProvider(IActionProvider provider) {
if (provider != null && !actionProviders.contains(provider)) {
actionProviders.add(provider);
}
}
@Deprecated
public static LinkedList<IAction> getNeighborActions(Block block, TileEntity entity) {
LinkedList<IAction> actions = new LinkedList<IAction>();
for (IActionProvider provider : actionProviders) {
LinkedList<IAction> toAdd = provider.getNeighborActions(block, entity);
if (toAdd != null) {
for (IAction t : toAdd) {
if (!actions.contains(t)) {
actions.add(t);
}
}
}
}
return actions;
}
@Deprecated
public static LinkedList<ITrigger> getPipeTriggers(IPipe pipe) {
LinkedList<ITrigger> triggers = new LinkedList<ITrigger>();
for (ITriggerProvider provider : triggerProviders) {
LinkedList<ITrigger> toAdd = provider.getPipeTriggers(pipe);
if (toAdd != null) {
for (ITrigger t : toAdd) {
if (!triggers.contains(t)) {
triggers.add(t);
}
}
}
}
return triggers;
}
static {
for (int i = 0; i < softBlocks.length; ++i) {
softBlocks[i] = false;

View file

@ -1,24 +0,0 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package net.minecraft.src.buildcraft.api;
@Deprecated
public interface ILiquidContainer {
public int fill(Orientations from, int quantity, int id, boolean doFill);
public int empty(int quantityMax, boolean doEmpty);
public int getLiquidQuantity();
public int getLiquidId();
public LiquidSlot[] getLiquidSlots();
}

View file

@ -1,23 +0,0 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package net.minecraft.src.buildcraft.api;
@Deprecated
public interface IPowerReceptor {
public void setPowerProvider(PowerProvider provider);
public PowerProvider getPowerProvider();
public void doWork();
public int powerRequest();
}

View file

@ -1,44 +0,0 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package net.minecraft.src.buildcraft.api;
import net.minecraft.src.IInventory;
import net.minecraft.src.ItemStack;
/**
* Pipes are able to get object in and out tile entities implementing inventory.
* Inventories implementing this interface will allow finer control over what
* can be added / extracted and how.
*/
@Deprecated
public interface ISpecialInventory extends IInventory {
/**
* Tries to add items from. Return true if at least an object can be added,
* false otherwise. Addition is actually done only when doAdd is true,
* otherwise it's just checking the possibility. When doAdd is true,
* stack.stackSize is updated.
*
* from contains the side to which the addition request is made.
*/
public boolean addItem(ItemStack stack, boolean doAdd, Orientations from);
/**
* Extract an item. Inventories implementing this function have their own
* algorithm to extract objects, e.g. to pipes.
*
* If doRemove is false, then the returned stack will not actually remove
* object from the inventory, but just show what can be removed.
*
* from contains the side to which the extraction request is made.
*/
public ItemStack extractItem(boolean doRemove, Orientations from);
}

View file

@ -1,27 +0,0 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package net.minecraft.src.buildcraft.api;
/**
* This does not do anything anymore. Use buildcraft.api.fuels.IronEngineFuel!
*/
@Deprecated
public class IronEngineFuel {
public final int fuelId;
public final int powerPerCycle;
public final int totalBurningTime;
public IronEngineFuel(int fuelId, int powerPerCycle, int totalBurningTime) {
this.fuelId = fuelId;
this.powerPerCycle = powerPerCycle;
this.totalBurningTime = totalBurningTime;
}
}

View file

@ -1,45 +0,0 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package net.minecraft.src.buildcraft.api;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
@Deprecated
public class LiquidData {
public final int liquidId;
public final int movingLiquidId;
public final ItemStack filled;
public final ItemStack container;
public LiquidData(int liquidId, int movingLiquidId, Item filled) {
this.liquidId = liquidId;
this.movingLiquidId = movingLiquidId;
this.filled = new ItemStack(filled, 1);
this.container = new ItemStack(Item.bucketEmpty);
}
public LiquidData(int liquidId, int movingLiquidId, ItemStack filled) {
this.liquidId = liquidId;
this.movingLiquidId = movingLiquidId;
this.filled = filled;
this.container = new ItemStack(Item.bucketEmpty);
}
public LiquidData(int liquidId, int movingLiquidId, ItemStack filled, ItemStack container) {
this.liquidId = liquidId;
this.movingLiquidId = movingLiquidId;
this.filled = filled;
this.container = container;
}
}

View file

@ -1,36 +0,0 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package net.minecraft.src.buildcraft.api;
@Deprecated
public class LiquidSlot {
private int liquidId;
private int liquidQty;
private int capacity;
public LiquidSlot(int liquidId, int liquidQty, int capacity) {
this.liquidId = liquidId;
this.liquidQty = liquidQty;
this.capacity = capacity;
}
public int getLiquidId() {
return liquidId;
}
public int getLiquidQty() {
return liquidQty;
}
public int getCapacity() {
return capacity;
}
}

View file

@ -66,6 +66,7 @@ public class Position {
case XNeg:
z = z - step;
break;
default:
}
}
@ -93,6 +94,7 @@ public class Position {
case XNeg:
x = x - step;
break;
default:
}
}
@ -108,6 +110,7 @@ public class Position {
case XNeg:
y = y + step;
break;
default:
}
}

View file

@ -1,57 +0,0 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package net.minecraft.src.buildcraft.api;
import net.minecraft.src.NBTTagCompound;
@Deprecated
public abstract class PowerFramework {
static private String baseNBTName = "net.minecraft.src.buildcarft.Power";
public static PowerFramework currentFramework;
public abstract PowerProvider createPowerProvider();
public void loadPowerProvider(IPowerReceptor receptor, NBTTagCompound compound) {
PowerProvider provider = createPowerProvider();
if (compound.hasKey(baseNBTName)) {
NBTTagCompound cpt = compound.getCompoundTag(baseNBTName);
if (cpt.getString("class").equals(this.getClass().getName())) {
provider.readFromNBT(cpt.getCompoundTag("contents"));
}
}
receptor.setPowerProvider(provider);
}
public void savePowerProvider(IPowerReceptor receptor, NBTTagCompound compound) {
PowerProvider provider = receptor.getPowerProvider();
if (provider == null) {
return;
}
NBTTagCompound cpt = new NBTTagCompound();
cpt.setString("class", this.getClass().getName());
NBTTagCompound contents = new NBTTagCompound();
provider.writeToNBT(contents);
cpt.setTag("contents", contents);
compound.setTag(baseNBTName, cpt);
}
}

View file

@ -1,146 +0,0 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package net.minecraft.src.buildcraft.api;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.TileEntity;
import net.minecraft.src.buildcraft.api.Orientations;
import net.minecraft.src.buildcraft.api.SafeTimeTracker;
import net.minecraft.src.buildcraft.api.TileNetworkData;
@Deprecated
public abstract class PowerProvider {
public int latency;
public int minEnergyReceived;
public int maxEnergyReceived;
public int maxEnergyStored;
public @TileNetworkData int minActivationEnergy;
public @TileNetworkData float energyStored = 0;
protected int powerLoss = 1;
protected int powerLossRegularity = 100;
public SafeTimeTracker timeTracker = new SafeTimeTracker();
public SafeTimeTracker energyLossTracker = new SafeTimeTracker();
public int[] powerSources = { 0, 0, 0, 0, 0, 0 };
public void configure(int latency, int minEnergyReceived, int maxEnergyReceived, int minActivationEnergy, int maxStoredEnergy) {
this.latency = latency;
this.minEnergyReceived = minEnergyReceived;
this.maxEnergyReceived = maxEnergyReceived;
this.maxEnergyStored = maxStoredEnergy;
this.minActivationEnergy = minActivationEnergy;
}
public void configurePowerPerdition(int powerLoss, int powerLossRegularity) {
this.powerLoss = powerLoss;
this.powerLossRegularity = powerLossRegularity;
}
public final boolean update(IPowerReceptor receptor) {
if (!preConditions(receptor)) {
return false;
}
TileEntity tile = (TileEntity) receptor;
boolean result = false;
if (energyStored >= minActivationEnergy) {
if (latency == 0) {
receptor.doWork();
result = true;
} else {
if (timeTracker.markTimeIfDelay(tile.worldObj, latency)) {
receptor.doWork();
result = true;
}
}
}
if (powerLoss > 0 && energyLossTracker.markTimeIfDelay(tile.worldObj, powerLossRegularity)) {
energyStored -= powerLoss;
if (energyStored < 0) {
energyStored = 0;
}
}
for (int i = 0; i < 6; ++i) {
if (powerSources[i] > 0) {
powerSources[i]--;
}
}
return result;
}
public boolean preConditions(IPowerReceptor receptor) {
return true;
}
public float useEnergy(float min, float max, boolean doUse) {
float result = 0;
if (energyStored >= min) {
if (energyStored <= max) {
result = energyStored;
if (doUse) {
energyStored = 0;
}
} else {
result = max;
if (doUse) {
energyStored -= max;
}
}
}
return result;
}
public void readFromNBT(NBTTagCompound nbttagcompound) {
latency = nbttagcompound.getInteger("latency");
minEnergyReceived = nbttagcompound.getInteger("minEnergyReceived");
maxEnergyReceived = nbttagcompound.getInteger("maxEnergyReceived");
maxEnergyStored = nbttagcompound.getInteger("maxStoreEnergy");
minActivationEnergy = nbttagcompound.getInteger("minActivationEnergy");
try {
energyStored = nbttagcompound.getFloat("storedEnergy");
} catch (Throwable c) {
energyStored = 0;
}
}
public void writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setInteger("latency", latency);
nbttagcompound.setInteger("minEnergyReceived", minEnergyReceived);
nbttagcompound.setInteger("maxEnergyReceived", maxEnergyReceived);
nbttagcompound.setInteger("maxStoreEnergy", maxEnergyStored);
nbttagcompound.setInteger("minActivationEnergy", minActivationEnergy);
nbttagcompound.setFloat("storedEnergy", energyStored);
}
public void receiveEnergy(float quantity, Orientations from) {
powerSources[from.ordinal()] = 2;
energyStored += quantity;
if (energyStored > maxEnergyStored) {
energyStored = maxEnergyStored;
}
}
public boolean isPowerSource(Orientations from) {
return powerSources[from.ordinal()] != 0;
}
}

View file

@ -1,36 +0,0 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package net.minecraft.src.buildcraft.api;
@Deprecated
public class RefineryRecipe {
public final int sourceId1;
public final int sourceId2;
public final int sourceQty1;
public final int sourceQty2;
public final int energy;
public final int resultId;
public final int resultQty;
public final int delay;
public RefineryRecipe(int sourceId1, int sourceQty1, int sourceId2, int sourceQty2, int energy, int resultId, int resultQty,
int delay) {
this.sourceId1 = sourceId1;
this.sourceId2 = sourceId2;
this.sourceQty1 = sourceQty1;
this.sourceQty2 = sourceQty2;
this.energy = energy;
this.resultId = resultId;
this.resultQty = resultQty;
this.delay = delay;
}
}