mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-27 15:23:16 +00:00
v5.5.4 Beta #6
*A new model for the Metallurgic Infuser. *Fixed and made better the auto-updater. *Reverted to LiquidSlot-based tank on the Bio-Generator. *Sustained liquid in the Electrolytic Separator and Electric Pump. *Better liquid cleanups. Still need to add recipe for Electric Pump!
This commit is contained in:
1 parent
4cebdea5a0
commit
5f496a00ec
27 files changed
+886
-187
No files matched your search
@@ -14,6 +14,7 @@ import universalelectricity.core.electricity.ElectricityPack;
|
||||
import universalelectricity.core.item.IItemElectric;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.common.ISustainedInventory;
|
||||
import mekanism.common.ISustainedTank;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.TileEntityElectricBlock;
|
||||
import mekanism.generators.common.BlockGenerator.GeneratorType;
|
||||
@@ -26,6 +27,8 @@ import net.minecraft.nbt.NBTTagFloat;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.liquids.LiquidDictionary;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
/**
|
||||
* Item class for handling multiple generator block IDs.
|
||||
@@ -38,7 +41,7 @@ import net.minecraft.world.World;
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
public class ItemBlockGenerator extends ItemBlock implements IItemElectric, ICustomElectricItem, ISustainedInventory
|
||||
public class ItemBlockGenerator extends ItemBlock implements IItemElectric, ICustomElectricItem, ISustainedInventory, ISustainedTank
|
||||
{
|
||||
public Block metaBlock;
|
||||
|
||||
@@ -104,6 +107,15 @@ public class ItemBlockGenerator extends ItemBlock implements IItemElectric, ICus
|
||||
else {
|
||||
list.add(EnumColor.BRIGHT_GREEN + "Stored Energy: " + EnumColor.GREY + ElectricityDisplay.getDisplayShort(getJoules(itemstack), ElectricUnit.JOULES));
|
||||
list.add(EnumColor.BRIGHT_GREEN + "Voltage: " + EnumColor.GREY + getVoltage(itemstack) + "v");
|
||||
|
||||
if(hasTank(itemstack))
|
||||
{
|
||||
if(getLiquidStack(itemstack) != null)
|
||||
{
|
||||
list.add(EnumColor.PINK + LiquidDictionary.findLiquidName(getLiquidStack(itemstack)) + ": " + EnumColor.GREY + getLiquidStack(itemstack).amount + "mB");
|
||||
}
|
||||
}
|
||||
|
||||
list.add(EnumColor.AQUA + "Inventory: " + EnumColor.GREY + (getInventory(itemstack) != null && getInventory(itemstack).tagList != null && !getInventory(itemstack).tagList.isEmpty()));
|
||||
}
|
||||
}
|
||||
@@ -227,7 +239,17 @@ public class ItemBlockGenerator extends ItemBlock implements IItemElectric, ICus
|
||||
{
|
||||
TileEntityElectricBlock tileEntity = (TileEntityElectricBlock)world.getBlockTileEntity(x, y, z);
|
||||
tileEntity.electricityStored = getJoules(stack);
|
||||
|
||||
((ISustainedInventory)tileEntity).setInventory(getInventory(stack));
|
||||
|
||||
if(tileEntity instanceof ISustainedTank)
|
||||
{
|
||||
if(hasTank(stack) && getLiquidStack(stack) != null)
|
||||
{
|
||||
((ISustainedTank)tileEntity).setLiquidStack(getLiquidStack(stack), stack);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -364,4 +386,52 @@ public class ItemBlockGenerator extends ItemBlock implements IItemElectric, ICus
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLiquidStack(LiquidStack liquidStack, Object... data)
|
||||
{
|
||||
if(liquidStack == null || liquidStack.amount == 0 || liquidStack.itemID == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(data[0] instanceof ItemStack)
|
||||
{
|
||||
ItemStack itemStack = (ItemStack)data[0];
|
||||
|
||||
if(itemStack.stackTagCompound == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
itemStack.stackTagCompound.setTag("liquidTank", liquidStack.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiquidStack getLiquidStack(Object... data)
|
||||
{
|
||||
if(data[0] instanceof ItemStack)
|
||||
{
|
||||
ItemStack itemStack = (ItemStack)data[0];
|
||||
|
||||
if(itemStack.stackTagCompound == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if(itemStack.stackTagCompound.hasKey("liquidTank"))
|
||||
{
|
||||
return LiquidStack.loadLiquidStackFromNBT(itemStack.stackTagCompound.getCompoundTag("liquidTank"));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTank(Object... data)
|
||||
{
|
||||
return data[0] instanceof ItemStack && ((ItemStack)data[0]).getItem() instanceof ISustainedTank && (((ItemStack)data[0]).getItemDamage() == 2);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user