Fix for new Liquid API

This commit is contained in:
Christian 2012-11-14 21:33:09 -05:00
parent 26173cf35c
commit 15bcb22032
15 changed files with 46 additions and 49 deletions

View file

@ -69,8 +69,8 @@ import net.minecraft.src.ItemStack;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.Property;
import net.minecraftforge.liquids.LiquidData;
import net.minecraftforge.liquids.LiquidManager;
import net.minecraftforge.liquids.LiquidContainerData;
import net.minecraftforge.liquids.LiquidItemRegistry;
import net.minecraftforge.liquids.LiquidStack;
@Mod(name="BuildCraft", version=Version.VERSION, useMetadata = false, modid = "BuildCraft|Core", dependencies="required-after:Forge@[6.3.0.0,)")
@ -232,10 +232,6 @@ public class BuildCraftCore {
@Init
public void initialize(FMLInitializationEvent evt) {
//MinecraftForge.registerConnectionHandler(new ConnectionHandler());
LiquidManager.liquids.add(new LiquidData(new LiquidStack(Block.waterStill, LiquidManager.BUCKET_VOLUME), new LiquidStack(Block.waterMoving, LiquidManager.BUCKET_VOLUME), new ItemStack(Item.bucketWater), new ItemStack(Item.bucketEmpty)));
LiquidManager.liquids.add(new LiquidData(new LiquidStack(Block.waterStill, LiquidManager.BUCKET_VOLUME), new LiquidStack(Block.waterMoving, LiquidManager.BUCKET_VOLUME), new ItemStack(Item.potion), new ItemStack(Item.glassBottle)));
LiquidManager.liquids.add(new LiquidData(new LiquidStack(Block.lavaStill, LiquidManager.BUCKET_VOLUME), new LiquidStack(Block.lavaMoving, LiquidManager.BUCKET_VOLUME), new ItemStack(Item.bucketLava), new ItemStack(Item.bucketEmpty)));
ActionManager.registerTriggerProvider(new DefaultTriggerProvider());
ActionManager.registerActionProvider(new DefaultActionProvider());

View file

@ -53,8 +53,8 @@ import net.minecraft.src.Material;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.Property;
import net.minecraftforge.liquids.LiquidData;
import net.minecraftforge.liquids.LiquidManager;
import net.minecraftforge.liquids.LiquidContainerData;
import net.minecraftforge.liquids.LiquidItemRegistry;
import net.minecraftforge.liquids.LiquidStack;
@Mod(name="BuildCraft Energy", version=Version.VERSION, useMetadata = false, modid = "BuildCraft|Energy", dependencies = DefaultProps.DEPENDENCY_CORE)
@ -153,10 +153,10 @@ public class BuildCraftEnergy {
IronEngineFuel.fuels.add(new IronEngineFuel(fuel.shiftedIndex, 6, 100000));
// Iron Engine Coolants
IronEngineCoolant.coolants.add(new IronEngineCoolant(new LiquidStack(Block.waterStill, LiquidManager.BUCKET_VOLUME), 1.0f));
IronEngineCoolant.coolants.add(new IronEngineCoolant(new LiquidStack(Block.waterStill, LiquidItemRegistry.BUCKET_VOLUME), 1.0f));
LiquidManager.liquids.add(new LiquidData(new LiquidStack(oilStill, LiquidManager.BUCKET_VOLUME), new LiquidStack(oilMoving, LiquidManager.BUCKET_VOLUME), new ItemStack(bucketOil), new ItemStack(Item.bucketEmpty)));
LiquidManager.liquids.add(new LiquidData(new LiquidStack(fuel, LiquidManager.BUCKET_VOLUME), new LiquidStack(fuel, LiquidManager.BUCKET_VOLUME), new ItemStack(bucketFuel), new ItemStack(Item.bucketEmpty)));
LiquidItemRegistry.registerLiquid(new LiquidContainerData(new LiquidStack(oilStill, LiquidItemRegistry.BUCKET_VOLUME), new ItemStack(bucketOil), new ItemStack(Item.bucketEmpty)));
LiquidItemRegistry.registerLiquid(new LiquidContainerData(new LiquidStack(fuel, LiquidItemRegistry.BUCKET_VOLUME), new ItemStack(bucketFuel), new ItemStack(Item.bucketEmpty)));
}
public static void loadRecipes() {

View file

@ -15,7 +15,7 @@ import net.minecraft.src.World;
public class BuildCraftAPI {
@Deprecated
// To be removed, see LiquidManager
// To be removed, see LiquidItemRegistry
public static final int BUCKET_VOLUME = 1000;
public static final int LAST_ORIGINAL_BLOCK = 122;
public static final int LAST_ORIGINAL_ITEM = 126;

View file

@ -11,7 +11,7 @@ package buildcraft.api.fuels;
import java.util.LinkedList;
import net.minecraftforge.liquids.LiquidManager;
import net.minecraftforge.liquids.LiquidItemRegistry;
import net.minecraftforge.liquids.LiquidStack;
@ -38,7 +38,7 @@ public class IronEngineFuel {
public final int totalBurningTime;
public IronEngineFuel(int liquidId, float powerPerCycle, int totalBurningTime) {
this(new LiquidStack(liquidId, LiquidManager.BUCKET_VOLUME, 0), powerPerCycle, totalBurningTime);
this(new LiquidStack(liquidId, LiquidItemRegistry.BUCKET_VOLUME, 0), powerPerCycle, totalBurningTime);
}
public IronEngineFuel(LiquidStack liquid, float powerPerCycle, int totalBurningTime) {
this.liquid = liquid;

View file

@ -16,7 +16,8 @@ import net.minecraft.src.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidManager;
import net.minecraftforge.liquids.LiquidItemRegistry;
import net.minecraftforge.liquids.LiquidStack;
public class TriggerLiquidContainer extends Trigger {
@ -72,10 +73,10 @@ public class TriggerLiquidContainer extends Trigger {
if (tile instanceof ITankContainer) {
ITankContainer container = (ITankContainer) tile;
int seachedLiquidId = 0;
LiquidStack searchedLiquid = null;
if (parameter != null && parameter.getItem() != null)
seachedLiquidId = LiquidManager.getLiquidIDForFilledItem(parameter.getItem());
searchedLiquid = LiquidItemRegistry.getLiquidForFilledItem(parameter.getItem());
ILiquidTank[] liquids = container.getTanks(ForgeDirection.UNKNOWN);
@ -96,7 +97,7 @@ public class TriggerLiquidContainer extends Trigger {
case Contains:
for (ILiquidTank c : liquids)
if (c.getLiquid() != null && c.getLiquid().amount != 0)
if (seachedLiquidId == 0 || seachedLiquidId == c.getLiquid().itemID)
if (searchedLiquid == null || searchedLiquid.isLiquidEqual(c.getLiquid()))
return true;
return false;
@ -106,7 +107,7 @@ public class TriggerLiquidContainer extends Trigger {
if (c.getLiquid() == null || c.getLiquid().amount == 0)
return true;
else if (c.getLiquid().amount < c.getCapacity())
if (seachedLiquidId == 0 || seachedLiquidId == c.getLiquid().itemID)
if (searchedLiquid == null || searchedLiquid.isLiquidEqual(c.getLiquid()))
return true;
return false;

View file

@ -10,7 +10,7 @@
package buildcraft.energy;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.LiquidManager;
import net.minecraftforge.liquids.LiquidItemRegistry;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.liquids.LiquidTank;
import buildcraft.api.fuels.IronEngineCoolant;
@ -26,7 +26,7 @@ import net.minecraft.src.NBTTagCompound;
public class EngineIron extends Engine {
public static int MAX_LIQUID = LiquidManager.BUCKET_VOLUME * 10;
public static int MAX_LIQUID = LiquidItemRegistry.BUCKET_VOLUME * 10;
public static int MAX_HEAT = 100000;
public static int COOLANT_THRESHOLD = 49000;
@ -106,7 +106,7 @@ public class EngineIron extends Engine {
burnTime--;
} else {
liquidQty--;
burnTime = currentFuel.totalBurningTime / LiquidManager.BUCKET_VOLUME;
burnTime = currentFuel.totalBurningTime / LiquidItemRegistry.BUCKET_VOLUME;
}
currentOutput = currentFuel.powerPerCycle;
@ -130,11 +130,11 @@ public class EngineIron extends Engine {
LiquidStack liquid = null;
if (Block.ice.blockID == itemInInventory.itemID && heat > COOLANT_THRESHOLD)
{
liquid = LiquidManager.getLiquidForFilledItem(new ItemStack(Item.bucketWater));
liquid = LiquidItemRegistry.getLiquidForFilledItem(new ItemStack(Item.bucketWater));
}
else
{
liquid = LiquidManager.getLiquidForFilledItem(itemInInventory);
liquid = LiquidItemRegistry.getLiquidForFilledItem(itemInInventory);
}
if (liquid != null) {

View file

@ -23,7 +23,7 @@ import net.minecraft.src.World;
import buildcraft.BuildCraftCore;
import buildcraft.BuildCraftFactory;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.LiquidManager;
import net.minecraftforge.liquids.LiquidItemRegistry;
import net.minecraftforge.liquids.LiquidStack;
import buildcraft.api.core.Position;
import buildcraft.api.tools.IToolWrench;
@ -105,7 +105,7 @@ public class BlockRefinery extends BlockContainer {
return true;
} else {
LiquidStack liquid = LiquidManager.getLiquidForFilledItem(entityplayer.getCurrentEquippedItem());
LiquidStack liquid = LiquidItemRegistry.getLiquidForFilledItem(entityplayer.getCurrentEquippedItem());
if (liquid != null) {
int qty = ((TileRefinery) world.getBlockTileEntity(i, j, k)).fill(ForgeDirection.UNKNOWN, liquid, true);

View file

@ -13,7 +13,7 @@ import java.util.ArrayList;
import buildcraft.BuildCraftCore;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.LiquidManager;
import net.minecraftforge.liquids.LiquidItemRegistry;
import net.minecraftforge.liquids.LiquidStack;
import buildcraft.core.DefaultProps;
import buildcraft.core.utils.Utils;
@ -93,7 +93,7 @@ public class BlockTank extends BlockContainer {
ItemStack current = entityplayer.inventory.getCurrentItem();
if (current != null) {
LiquidStack liquid = LiquidManager.getLiquidForFilledItem(current);
LiquidStack liquid = LiquidItemRegistry.getLiquidForFilledItem(current);
TileTank tank = (TileTank) world.getBlockTileEntity(i, j, k);
@ -113,9 +113,9 @@ public class BlockTank extends BlockContainer {
LiquidStack available = tank.getTanks(ForgeDirection.UNKNOWN)[0].getLiquid();
if(available != null){
ItemStack filled = LiquidManager.fillLiquidContainer(available, current);
ItemStack filled = LiquidItemRegistry.fillLiquidContainer(available, current);
liquid = LiquidManager.getLiquidForFilledItem(filled);
liquid = LiquidItemRegistry.getLiquidForFilledItem(filled);
if(liquid != null) {
if (!BuildCraftCore.debugMode && !entityplayer.capabilities.isCreativeMode){

View file

@ -16,7 +16,7 @@ import java.util.TreeSet;
import buildcraft.BuildCraftCore;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidManager;
import net.minecraftforge.liquids.LiquidItemRegistry;
import net.minecraftforge.liquids.LiquidStack;
import buildcraft.api.core.Position;
import buildcraft.api.power.IPowerProvider;
@ -95,7 +95,7 @@ public class TilePump extends TileMachine implements IMachine, IPowerReceptor {
worldObj.setBlockWithNotify(index.i, index.j, index.k, 0);
}
internalLiquid = internalLiquid += LiquidManager.BUCKET_VOLUME;
internalLiquid = internalLiquid += LiquidItemRegistry.BUCKET_VOLUME;
if (CoreProxy.proxy.isSimulating(worldObj)) {
sendNetworkUpdate();

View file

@ -13,7 +13,7 @@ import buildcraft.BuildCraftCore;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidManager;
import net.minecraftforge.liquids.LiquidItemRegistry;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.liquids.LiquidTank;
import buildcraft.api.core.SafeTimeTracker;
@ -35,7 +35,7 @@ public class TileRefinery extends TileMachine implements ITankContainer, IPowerR
private int[] filters = new int[2];
public static int LIQUID_PER_SLOT = LiquidManager.BUCKET_VOLUME * 4;
public static int LIQUID_PER_SLOT = LiquidItemRegistry.BUCKET_VOLUME * 4;
public static class Slot {

View file

@ -12,7 +12,7 @@ import buildcraft.BuildCraftCore;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidManager;
import net.minecraftforge.liquids.LiquidItemRegistry;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.liquids.LiquidTank;
import buildcraft.api.core.SafeTimeTracker;
@ -26,7 +26,7 @@ import net.minecraft.src.TileEntity;
public class TileTank extends TileBuildCraft implements ITankContainer
{
public final ILiquidTank tank = new LiquidTank(LiquidManager.BUCKET_VOLUME * 16);
public final LiquidTank tank = new LiquidTank(LiquidItemRegistry.BUCKET_VOLUME * 16);
public boolean hasUpdate = false;
public SafeTimeTracker tracker = new SafeTimeTracker();
@ -225,7 +225,7 @@ public class TileTank extends TileBuildCraft implements ITankContainer
@Override
public ILiquidTank[] getTanks(ForgeDirection direction)
{
ILiquidTank compositeTank = new LiquidTank(tank.getCapacity());
LiquidTank compositeTank = new LiquidTank(tank.getCapacity());
TileTank tile = getBottomTank();

View file

@ -11,7 +11,7 @@ package buildcraft.factory.gui;
import net.minecraft.src.InventoryPlayer;
import net.minecraft.src.ItemStack;
import net.minecraftforge.liquids.LiquidManager;
import net.minecraftforge.liquids.LiquidItemRegistry;
import net.minecraftforge.liquids.LiquidStack;
import org.lwjgl.opengl.GL11;
@ -80,9 +80,9 @@ public class GuiRefinery extends GuiAdvancedInterface {
slot = slots[position];
if (slot != null) {
int liquidId = LiquidManager.getLiquidIDForFilledItem(mc.thePlayer.inventory.getItemStack());
LiquidStack liquid = LiquidItemRegistry.getLiquidForFilledItem(mc.thePlayer.inventory.getItemStack());
container.setFilter(position, liquidId, 0);
container.setFilter(position, liquid.itemID, liquid.itemMeta);
}
}
@ -102,8 +102,8 @@ public class GuiRefinery extends GuiAdvancedInterface {
if (filter1 != null)
liquid1Id = filter1.itemID;
RefineryRecipe recipe = RefineryRecipe.findRefineryRecipe(new LiquidStack(liquid0Id, LiquidManager.BUCKET_VOLUME, 0),
new LiquidStack(liquid1Id, LiquidManager.BUCKET_VOLUME, 0));
RefineryRecipe recipe = RefineryRecipe.findRefineryRecipe(new LiquidStack(liquid0Id, LiquidItemRegistry.BUCKET_VOLUME, 0),
new LiquidStack(liquid1Id, LiquidItemRegistry.BUCKET_VOLUME, 0));
if (recipe != null)
((ItemSlot) slots[2]).stack = recipe.result.asItemStack();

View file

@ -13,7 +13,7 @@ import buildcraft.BuildCraftCore;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidManager;
import net.minecraftforge.liquids.LiquidItemRegistry;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.liquids.LiquidTank;
import buildcraft.api.core.SafeTimeTracker;
@ -126,7 +126,7 @@ public class PipeTransportLiquids extends PipeTransport implements ITankContaine
* The amount of liquid contained by a pipe section. For simplicity, all
* pipe sections are assumed to be of the same volume.
*/
public static int LIQUID_IN_PIPE = LiquidManager.BUCKET_VOLUME / 4;
public static int LIQUID_IN_PIPE = LiquidItemRegistry.BUCKET_VOLUME / 4;
public static short INPUT_TTL = 60; //100
public static short OUTPUT_TTL = 80; //80
public static short OUTPUT_COOLDOWN = 30; //30

View file

@ -10,7 +10,7 @@ package buildcraft.transport.pipes;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidManager;
import net.minecraftforge.liquids.LiquidItemRegistry;
import net.minecraftforge.liquids.LiquidStack;
import buildcraft.api.core.Position;
import buildcraft.api.power.IPowerProvider;
@ -68,8 +68,8 @@ public class PipeLiquidsWood extends Pipe implements IPowerReceptor {
if (!PipeManager.canExtractLiquids(this, w, (int) pos.x, (int) pos.y, (int) pos.z))
return;
if (liquidToExtract <= LiquidManager.BUCKET_VOLUME)
liquidToExtract += powerProvider.useEnergy(1, 1, true) * LiquidManager.BUCKET_VOLUME;
if (liquidToExtract <= LiquidItemRegistry.BUCKET_VOLUME)
liquidToExtract += powerProvider.useEnergy(1, 1, true) * LiquidItemRegistry.BUCKET_VOLUME;
}
}

View file

@ -11,7 +11,7 @@ package buildcraft.transport.triggers;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.LiquidManager;
import net.minecraftforge.liquids.LiquidItemRegistry;
import net.minecraftforge.liquids.LiquidStack;
import buildcraft.api.gates.ITriggerParameter;
import buildcraft.api.gates.Trigger;
@ -100,7 +100,7 @@ public class TriggerPipeContents extends Trigger implements ITriggerPipe {
LiquidStack searchedLiquid = null;
if (parameter != null && parameter.getItem() != null)
searchedLiquid = LiquidManager.getLiquidForFilledItem(parameter.getItem());
searchedLiquid = LiquidItemRegistry.getLiquidForFilledItem(parameter.getItem());
if (kind == Kind.Empty) {
for (ILiquidTank b : transportLiquids.getTanks(ForgeDirection.UNKNOWN))