1e5c47ad3f
Moved some stuff around, and made LiquidHandler able to be used in the api folder to help other people work with this mod. The api is not actual needed to work with this mod but it contains helpers to make life easier. Also added a method to LiquidHandler to get the name of a LiquidStack which for some reason can't be directly gotten from the liquidStack itself. Too get it i had to iterate over the hashMap used to store liquids. If the LiquidStack is linked to a LiquidData it will use the LiquidData name first. Also removed PipeInstance since its not actual needed anymore now that PipeColor is directly linked the pipe as well as the PipeBlock metadata.
44 lines
1.5 KiB
Java
44 lines
1.5 KiB
Java
package liquidmechanics.common.handlers;
|
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
import liquidmechanics.api.helpers.LiquidHandler;
|
|
import liquidmechanics.api.helpers.PipeColor;
|
|
import liquidmechanics.common.tileentity.TileEntityPipe;
|
|
import liquidmechanics.common.tileentity.TileEntityTank;
|
|
|
|
/**
|
|
* used to help convert older system to newer systems.
|
|
*/
|
|
public class UpdateConverter
|
|
{
|
|
public static void convert(TileEntityPipe pipe, NBTTagCompound nbt)
|
|
{
|
|
Boolean converted24 = nbt.getBoolean("converted");
|
|
Boolean converted25 = nbt.getBoolean("converted025");
|
|
if (!converted24)
|
|
{
|
|
pipe.setColor(PipeColor.get(LiquidHandler.getFromMeta(nbt.getInteger("type"))));
|
|
}
|
|
else if (converted24 && !converted25)
|
|
{
|
|
pipe.setColor(PipeColor.get(LiquidHandler.get(nbt.getString("name"))));
|
|
}
|
|
nbt.setBoolean("converted", true);
|
|
nbt.setBoolean("converted025", true);
|
|
}
|
|
public static void convert(TileEntityTank pipe, NBTTagCompound nbt)
|
|
{
|
|
Boolean converted24 = nbt.getBoolean("converted");
|
|
Boolean converted25 = nbt.getBoolean("converted025");
|
|
if (!converted24)
|
|
{
|
|
pipe.setColor(PipeColor.get(LiquidHandler.getFromMeta(nbt.getInteger("type"))));
|
|
}
|
|
else if (converted24 && !converted25)
|
|
{
|
|
pipe.setColor(PipeColor.get(LiquidHandler.get(nbt.getString("name"))));
|
|
}
|
|
nbt.setBoolean("converted", true);
|
|
nbt.setBoolean("converted025", true);
|
|
}
|
|
}
|