etc etc part update to 1.4.5
Update to 1.4.5 as well forge's merged folder system also a part update to using forge's liquid api, the rest will be updated later after basic pipes is finished and can be used as a jar to prevent import issues
|
@ -1,269 +0,0 @@
|
|||
package dark.SteamPower.boiler;
|
||||
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.Packet250CustomPayload;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.prefab.network.IPacketReceiver;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import dark.BasicUtilities.api.IProducer;
|
||||
import dark.BasicUtilities.api.IReadOut;
|
||||
import dark.BasicUtilities.api.IStorageTank;
|
||||
import dark.BasicUtilities.api.Liquid;
|
||||
import dark.BasicUtilities.api.MHelper;
|
||||
import dark.Library.prefab.TileEntityMachine;
|
||||
import dark.SteamPower.SteamPowerMain;
|
||||
|
||||
public class TileEntityBoiler extends TileEntityMachine implements IPacketReceiver, IProducer, IStorageTank, IReadOut
|
||||
{
|
||||
public int steam = 0;
|
||||
public int water = 0;
|
||||
public int heat = 0;
|
||||
public int hullHeat = 0;
|
||||
public int heatMax = 4500;
|
||||
public TileEntity[] connectedBlocks =
|
||||
{ null, null, null, null, null, null };
|
||||
public int tankCount = 0;
|
||||
public int tickCount = 0;
|
||||
|
||||
// -----------------------------
|
||||
// Update stuff
|
||||
// -----------------------------
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
// update connection list used for rendering
|
||||
this.connectedBlocks = MHelper.getSourounding(worldObj, xCoord, yCoord, zCoord);
|
||||
this.tankCount = 0;
|
||||
for (int i = 0; i < connectedBlocks.length; i++)
|
||||
{
|
||||
if (connectedBlocks[i] != null)
|
||||
{
|
||||
tankCount++;
|
||||
}
|
||||
}// end connection update
|
||||
if (tickCount++ >= 10 && !worldObj.isRemote)
|
||||
{
|
||||
tickCount = 0;
|
||||
|
||||
TileEntity ent = worldObj.getBlockTileEntity(xCoord, yCoord - 1, zCoord);
|
||||
if (ent instanceof IProducer && ((IProducer) ent).canProduceLiquid(Liquid.HEAT, ForgeDirection.UP))
|
||||
{
|
||||
this.heat = (int) Math.min(((IProducer) ent).onProduceLiquid(Liquid.HEAT, 250, ForgeDirection.UP) + this.heat, 4500);
|
||||
}
|
||||
else if (worldObj.getBlockId(xCoord, yCoord - 1, zCoord) == Block.lavaStill.blockID)
|
||||
{
|
||||
this.heat = Math.min(90 + heat, 2000);
|
||||
}
|
||||
if (hullHeat < 10000)
|
||||
{
|
||||
int mHeat = 10000 - hullHeat;
|
||||
int hHeat = mHeat - Math.max((mHeat - this.heat), 0);
|
||||
hullHeat = Math.min(hullHeat + hHeat, 10000);
|
||||
this.heat -= hHeat;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (heat >= 2000 && this.water >= 1 && this.steam < this.getLiquidCapacity(Liquid.STEAM))
|
||||
{
|
||||
this.water--;
|
||||
this.steam = Math.min(this.steam + 20, this.getLiquidCapacity(Liquid.STEAM));
|
||||
this.heat -= 2000;
|
||||
}
|
||||
this.hullHeat -= 5;
|
||||
}
|
||||
this.water = MHelper.shareLiquid(worldObj, xCoord, yCoord, zCoord, this.water, this.getLiquidCapacity(Liquid.WATER), Liquid.WATER);
|
||||
this.steam = MHelper.shareLiquid(worldObj, xCoord, yCoord, zCoord, this.steam, this.getLiquidCapacity(Liquid.STEAM), Liquid.STEAM);
|
||||
}
|
||||
super.updateEntity();
|
||||
}
|
||||
|
||||
// -----------------------------
|
||||
// Liquid stuff
|
||||
// -----------------------------
|
||||
@Override
|
||||
public int onReceiveLiquid(Liquid type, int vol, ForgeDirection side)
|
||||
{
|
||||
if (type == Liquid.WATER)
|
||||
{
|
||||
if (this.water < this.getLiquidCapacity(Liquid.WATER))
|
||||
{
|
||||
int rej = Math.max((this.water + vol) - this.getLiquidCapacity(Liquid.WATER), 0);
|
||||
this.water += vol - rej;
|
||||
return rej;
|
||||
}
|
||||
else
|
||||
{
|
||||
TileEntity te = worldObj.getBlockTileEntity(xCoord, yCoord + 1, zCoord);
|
||||
if (te instanceof IStorageTank) { return ((IStorageTank) te).onReceiveLiquid(type, vol, ForgeDirection.UNKNOWN); }
|
||||
}
|
||||
}
|
||||
else if (type == Liquid.STEAM)
|
||||
{
|
||||
if (this.steam < this.getLiquidCapacity(Liquid.STEAM))
|
||||
{
|
||||
int rej = Math.max((this.steam + vol) - this.getLiquidCapacity(Liquid.STEAM), 0);
|
||||
this.steam += vol - rej;
|
||||
return rej;
|
||||
}
|
||||
else
|
||||
{
|
||||
TileEntity te = worldObj.getBlockTileEntity(xCoord, yCoord - 1, zCoord);
|
||||
if (te instanceof IStorageTank) { return ((IStorageTank) te).onReceiveLiquid(type, vol, ForgeDirection.UNKNOWN); }
|
||||
}
|
||||
}
|
||||
return vol;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRecieveLiquid(Liquid type, ForgeDirection s)
|
||||
{
|
||||
if (type == Liquid.WATER)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (type == Liquid.STEAM && s == ForgeDirection.UNKNOWN) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStoredLiquid(Liquid type)
|
||||
{
|
||||
if (type == Liquid.WATER)
|
||||
{
|
||||
return this.water;
|
||||
}
|
||||
else if (type == Liquid.STEAM) { return this.steam; }
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLiquidCapacity(Liquid type)
|
||||
{
|
||||
if (type == Liquid.WATER)
|
||||
{
|
||||
return 14;
|
||||
}
|
||||
else if (type == Liquid.STEAM) { return 140; }
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onProduceLiquid(Liquid type, int vol, ForgeDirection side)
|
||||
{
|
||||
if (type == Liquid.STEAM)
|
||||
{
|
||||
// TODO setup the actual math for this
|
||||
if (vol < this.steam)
|
||||
{
|
||||
this.steam -= vol;
|
||||
return vol;
|
||||
}
|
||||
else if (this.steam >= 1)
|
||||
{
|
||||
this.steam -= 1;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProduceLiquid(Liquid type, ForgeDirection side)
|
||||
{
|
||||
if (type == Liquid.STEAM) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProducePresure(Liquid type, ForgeDirection side)
|
||||
{
|
||||
if (type == Liquid.STEAM) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int presureOutput(Liquid type, ForgeDirection side)
|
||||
{
|
||||
if (type == Liquid.STEAM) { return 100; }
|
||||
return 0;
|
||||
}
|
||||
|
||||
// -----------------------------
|
||||
// Data
|
||||
// -----------------------------
|
||||
public Object[] getSendData()
|
||||
{
|
||||
return new Object[]
|
||||
{ this.water, this.steam, this.heat, this.hullHeat };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePacketData(INetworkManager network, int packetType,
|
||||
Packet250CustomPayload packet, EntityPlayer player,
|
||||
ByteArrayDataInput dataStream)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.water = dataStream.readInt();
|
||||
this.steam = dataStream.readInt();
|
||||
this.heat = dataStream.readInt();
|
||||
this.hullHeat = dataStream.readInt();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
par1NBTTagCompound.setInteger("water", this.water);
|
||||
par1NBTTagCompound.setInteger("steam", this.steam);
|
||||
par1NBTTagCompound.setInteger("heat", this.heat);
|
||||
par1NBTTagCompound.setInteger("hullHeat", this.hullHeat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
this.water = par1NBTTagCompound.getInteger("water");
|
||||
this.steam = par1NBTTagCompound.getInteger("steam");
|
||||
this.heat = par1NBTTagCompound.getInteger("heat");
|
||||
this.hullHeat = par1NBTTagCompound.getInteger("hullHeat");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needUpdate()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getChannel()
|
||||
{
|
||||
return SteamPowerMain.channel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMeterReading(EntityPlayer user, ForgeDirection side)
|
||||
{
|
||||
return this.water + "B WATER " + this.steam + "B STEAM " + this.heat + "/" + this.heatMax + " Heat";
|
||||
}
|
||||
|
||||
}
|
|
@ -1,15 +1,14 @@
|
|||
package dark.SteamPower;
|
||||
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.IBlockAccess;
|
||||
import net.minecraft.src.RenderBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import dark.BasicUtilities.BasicUtilitiesMain;
|
||||
import dark.SteamPower.renders.ModelFurnace;
|
||||
import dark.SteamPower.renders.ModelGenerator;
|
||||
import dark.SteamPower.renders.ModelTank;
|
||||
|
@ -22,7 +21,7 @@ public class ItemRenderHelperS implements ISimpleBlockRenderingHandler {
|
|||
private ModelFurnace modelFurnace = new ModelFurnace();
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
if(block.blockID == SteamPowerMain.heaters.blockID && metadata == 4)
|
||||
if(block.blockID == SteamPowerMain.boilers.blockID && metadata >= 0 && metadata <= 3)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) 0.0F, (float)1F, (float)0.0F);
|
|
@ -2,10 +2,10 @@ package dark.SteamPower;
|
|||
|
||||
import java.io.File;
|
||||
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.CraftingManager;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
|
@ -35,10 +35,11 @@ public class SteamPowerMain
|
|||
static Configuration config = new Configuration((new File(cpw.mods.fml.common.Loader.instance().getConfigDir(), "SteamPower.cfg")));
|
||||
public static final String channel = "SPpack";
|
||||
public static String textureFile = "/dark/SteamPower/textures/";
|
||||
public final static int BLOCK_ID_PREFIX = 3100;
|
||||
// Blocks and items
|
||||
public static Block heaters = new BlockHeaters(Integer.parseInt(config.get(Configuration.CATEGORY_BLOCK, "Burners", 3030).value)).setBlockName("machine");
|
||||
public static Block piston = new BlockSteamPiston(Integer.parseInt(config.get(Configuration.CATEGORY_BLOCK, "SteamPiston", 3031).value)).setBlockName("SteamEngien");
|
||||
public static Block boilers = new BlockBoiler(Integer.parseInt(config.get(Configuration.CATEGORY_BLOCK, "Boilers", 3032).value)).setBlockName("machine");
|
||||
public static Block heaters = new BlockHeaters(Integer.parseInt(config.get(Configuration.CATEGORY_BLOCK, "Burners", BLOCK_ID_PREFIX).value)).setBlockName("machine");
|
||||
public static Block piston = new BlockSteamPiston(Integer.parseInt(config.get(Configuration.CATEGORY_BLOCK, "SteamPiston", BLOCK_ID_PREFIX+1).value)).setBlockName("SteamEngien");
|
||||
public static Block boilers = new BlockBoiler(Integer.parseInt(config.get(Configuration.CATEGORY_BLOCK, "Boilers", BLOCK_ID_PREFIX+2).value)).setBlockName("machine");
|
||||
public static Item itemEngine = new ItemSteamPiston(Integer.parseInt(config.get(Configuration.CATEGORY_ITEM, "SteamPistonItem", 30308).value)).setItemName("SteamEngine");
|
||||
|
||||
public static SteamPowerMain instance;
|
||||
|
@ -58,9 +59,9 @@ public class SteamPowerMain
|
|||
|
||||
proxy.preInit();
|
||||
|
||||
GameRegistry.registerBlock(heaters);
|
||||
GameRegistry.registerBlock(piston);
|
||||
GameRegistry.registerBlock(boilers);
|
||||
GameRegistry.registerBlock(heaters,"heater units");
|
||||
GameRegistry.registerBlock(piston,"steam piston");
|
||||
GameRegistry.registerBlock(boilers,"boiler tanks");
|
||||
}
|
||||
|
||||
@Init
|
|
@ -1,8 +1,8 @@
|
|||
package dark.SteamPower;
|
||||
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import dark.BasicUtilities.mechanical.TileEntityGen;
|
|
@ -2,14 +2,14 @@ package dark.SteamPower.boiler;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.src.CreativeTabs;
|
||||
import net.minecraft.src.EntityLiving;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.Material;
|
||||
import net.minecraft.src.MathHelper;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import universalelectricity.prefab.BlockMachine;
|
||||
import dark.Library.Util.MetaGroupingHelper;
|
||||
import dark.Library.prefab.TileEntityMachine;
|
||||
|
@ -54,17 +54,6 @@ public class BlockBoiler extends BlockMachine
|
|||
{
|
||||
return MetaGroupingHelper.getGroupStartMeta(MetaGroupingHelper.getGrouping(metadata));
|
||||
}
|
||||
|
||||
/**
|
||||
* Called upon block activation (left or right click on the block.). The
|
||||
* three integers represent x,y,z of the block.
|
||||
*/
|
||||
@Override
|
||||
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int meta)
|
||||
{
|
||||
|
@ -87,7 +76,6 @@ public class BlockBoiler extends BlockMachine
|
|||
{
|
||||
int angle = MathHelper.floor_double((user.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
TileEntityMachine ent = (TileEntityMachine) world.getBlockTileEntity(x, y, z);
|
||||
// world.setBlockMetadata(x, y, z, angle);
|
||||
}
|
||||
|
189
src/minecraft/SteamPower/boiler/TileEntityBoiler.java
Normal file
|
@ -0,0 +1,189 @@
|
|||
package dark.SteamPower.boiler;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.liquids.ILiquidTank;
|
||||
import net.minecraftforge.liquids.ITankContainer;
|
||||
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import net.minecraftforge.liquids.LiquidTank;
|
||||
import dark.BasicUtilities.BasicUtilitiesMain;
|
||||
import dark.BasicUtilities.api.IHeatCreator;
|
||||
import dark.BasicUtilities.api.IReadOut;
|
||||
import dark.BasicUtilities.api.Liquid;
|
||||
import dark.BasicUtilities.api.MHelper;
|
||||
import dark.BasicUtilities.pipes.TileEntityPipe;
|
||||
|
||||
public class TileEntityBoiler extends TileEntity implements IReadOut, ITankContainer
|
||||
{
|
||||
public int heat = 0;
|
||||
public int hullHeat = 0;
|
||||
public final int heatMax = 4500;
|
||||
public final int heatGain = 220;
|
||||
public final int heatNeed = 2000;
|
||||
public TileEntity[] connectedBlocks =
|
||||
{ null, null, null, null, null, null };
|
||||
public int tankCount = 0;
|
||||
public int tickCount = 0;
|
||||
|
||||
public LiquidTank SteamTank = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME * 10);
|
||||
public LiquidTank WaterTank = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME * 4);
|
||||
|
||||
// -----------------------------
|
||||
// Update stuff
|
||||
// -----------------------------
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
// update connection list used for rendering
|
||||
if (tickCount-- == 10)
|
||||
{
|
||||
this.connectedBlocks = MHelper.getSourounding(worldObj, xCoord, yCoord, zCoord);
|
||||
this.tankCount = 0;
|
||||
for (int i = 0; i < connectedBlocks.length; i++)
|
||||
{
|
||||
if (!(connectedBlocks[i] instanceof ILiquidTank || connectedBlocks[i] instanceof TileEntityPipe))
|
||||
{
|
||||
connectedBlocks[i] = null;
|
||||
}
|
||||
if (connectedBlocks[i] != null)
|
||||
{
|
||||
tankCount++;
|
||||
}
|
||||
}
|
||||
tickCount = 10;
|
||||
}
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
TileEntity ent = worldObj.getBlockTileEntity(xCoord, yCoord - 1, zCoord);
|
||||
if (ent instanceof IHeatCreator && ((IHeatCreator) ent).canCreatHeat(ForgeDirection.UP))
|
||||
{
|
||||
this.heat = Math.min(heat + Math.max(((IHeatCreator) ent).createHeat(ForgeDirection.UP),0),this.heatMax);
|
||||
}
|
||||
if(this.hullHeat < 10000)
|
||||
{
|
||||
this.hullHeat += this.heat;
|
||||
this.heat = 0;
|
||||
}else
|
||||
if(this.heat >= this.heatNeed)
|
||||
{
|
||||
this.WaterTank.drain(1, true);
|
||||
LiquidStack Stack = Liquid.STEAM.liquid.copy();
|
||||
Stack.amount = LiquidContainerRegistry.BUCKET_VOLUME;
|
||||
this.SteamTank.fill(Stack, true);
|
||||
this.heat -= this.heatNeed;
|
||||
}
|
||||
}
|
||||
|
||||
super.updateEntity();
|
||||
}
|
||||
|
||||
// -----------------------------
|
||||
// Liquid stuff
|
||||
// -----------------------------
|
||||
|
||||
// -----------------------------
|
||||
// Data
|
||||
// -----------------------------
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.writeToNBT(nbt);
|
||||
// liquid saving
|
||||
LiquidStack liquid = this.WaterTank.getLiquid();
|
||||
LiquidStack liquid2 = this.SteamTank.getLiquid();
|
||||
int water = 0;
|
||||
int steam = 0;
|
||||
if (liquid != null) water = liquid.amount;
|
||||
if (liquid2 != null) steam = liquid2.amount;
|
||||
nbt.setInteger("water", water);
|
||||
nbt.setInteger("steam", steam);
|
||||
// tempature saving
|
||||
nbt.setInteger("heat", this.heat);
|
||||
nbt.setInteger("hullHeat", this.hullHeat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
// load up liquids
|
||||
int water = par1NBTTagCompound.getInteger("water");
|
||||
int steam = par1NBTTagCompound.getInteger("steam");
|
||||
this.WaterTank.setLiquid(new LiquidStack(Block.waterStill.blockID, water));
|
||||
this.SteamTank.setLiquid(new LiquidStack(BasicUtilitiesMain.SteamBlock.blockID, steam));
|
||||
// load up heat/temp levels
|
||||
this.heat = par1NBTTagCompound.getInteger("heat");
|
||||
this.hullHeat = par1NBTTagCompound.getInteger("hullHeat");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMeterReading(EntityPlayer user, ForgeDirection side)
|
||||
{
|
||||
String output = " ";
|
||||
LiquidStack liquid = this.WaterTank.getLiquid();
|
||||
LiquidStack liquid2 = this.SteamTank.getLiquid();
|
||||
if (liquid != null) output += (liquid.amount / LiquidContainerRegistry.BUCKET_VOLUME) + "B WATER ";
|
||||
if (liquid2 != null) output += (liquid2.amount / LiquidContainerRegistry.BUCKET_VOLUME) + "B Steam ";
|
||||
if (liquid != null || liquid2 != null) return output;
|
||||
return "messurement error";
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, LiquidStack resource, boolean doFill)
|
||||
{
|
||||
int used = 0;
|
||||
|
||||
if (resource.itemID == Block.waterStill.blockID)
|
||||
{
|
||||
used += WaterTank.fill(resource, doFill);
|
||||
}
|
||||
else if (resource.itemID == BasicUtilitiesMain.Steam.itemID)
|
||||
{
|
||||
used += SteamTank.fill(resource, doFill);
|
||||
}
|
||||
|
||||
return used;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(int tankIndex, LiquidStack resource, boolean doFill)
|
||||
{
|
||||
if (resource.itemID == Block.waterStill.blockID)
|
||||
return WaterTank.fill(resource, doFill);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiquidStack drain(ForgeDirection from, int maxEmpty, boolean doDrain)
|
||||
{
|
||||
return drain(2, maxEmpty, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiquidStack drain(int tankIndex, int maxEmpty, boolean doDrain)
|
||||
{
|
||||
if (tankIndex == 1) return SteamTank.drain(maxEmpty, doDrain);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILiquidTank[] getTanks(ForgeDirection direction)
|
||||
{
|
||||
return new ILiquidTank[]
|
||||
{ SteamTank, WaterTank };
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILiquidTank getTank(ForgeDirection direction, LiquidStack type)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package dark.SteamPower.boiler;
|
||||
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityBoilerPipe extends TileEntity
|
||||
{
|
|
@ -2,14 +2,14 @@ package dark.SteamPower.firebox;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.src.CreativeTabs;
|
||||
import net.minecraft.src.EntityLiving;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.Material;
|
||||
import net.minecraft.src.MathHelper;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import dark.Library.Util.MetaGroupingHelper;
|
||||
import dark.Library.prefab.TileEntityMachine;
|
||||
import dark.SteamPower.ItemRenderHelperS;
|
||||
|
@ -59,7 +59,7 @@ public class BlockHeaters extends universalelectricity.prefab.BlockMachine
|
|||
* three integers represent x,y,z of the block.
|
||||
*/
|
||||
@Override
|
||||
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer player)
|
||||
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
TileEntity blockEntity = (TileEntity) world.getBlockTileEntity(x, y, z);
|
||||
if (!world.isRemote && !player.isSneaking() && blockEntity instanceof TileEntityFireBox)
|
|
@ -1,10 +1,10 @@
|
|||
package dark.SteamPower.firebox;
|
||||
|
||||
import net.minecraft.src.Container;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.InventoryPlayer;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.Slot;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerFireBox extends Container
|
||||
{
|
|
@ -2,10 +2,10 @@ package dark.SteamPower.firebox;
|
|||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import net.minecraft.src.GuiContainer;
|
||||
import net.minecraft.src.InventoryPlayer;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.StatCollector;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
|
@ -1,27 +1,26 @@
|
|||
package dark.SteamPower.firebox;
|
||||
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.Packet250CustomPayload;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.ISidedInventory;
|
||||
import universalelectricity.prefab.network.IPacketReceiver;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import dark.BasicUtilities.api.IProducer;
|
||||
import dark.BasicUtilities.api.Liquid;
|
||||
import dark.BasicUtilities.api.IHeatCreator;
|
||||
import dark.BasicUtilities.api.MHelper;
|
||||
import dark.Library.prefab.TileEntityMachine;
|
||||
import dark.SteamPower.SteamPowerMain;
|
||||
import dark.SteamPower.boiler.TileEntityBoiler;
|
||||
|
||||
public class TileEntityFireBox extends TileEntityMachine implements IPacketReceiver, IInventory, ISidedInventory, IProducer
|
||||
public class TileEntityFireBox extends TileEntityMachine implements IPacketReceiver, IInventory, ISidedInventory, IHeatCreator
|
||||
{
|
||||
// max heat generated per second
|
||||
|
||||
|
@ -240,28 +239,16 @@ public class TileEntityFireBox extends TileEntityMachine implements IPacketRecei
|
|||
}
|
||||
|
||||
@Override
|
||||
public int onProduceLiquid(Liquid type, int maxVol, ForgeDirection side)
|
||||
public boolean canCreatHeat(ForgeDirection dir)
|
||||
{
|
||||
if (type == Liquid.HEAT) { return Math.min(this.generateRate, maxVol); }
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProduceLiquid(Liquid type, ForgeDirection side)
|
||||
{
|
||||
if (type == Liquid.HEAT) { return true; }
|
||||
if(dir == ForgeDirection.UP) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProducePresure(Liquid type, ForgeDirection side)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int presureOutput(Liquid type, ForgeDirection side)
|
||||
public int createHeat(ForgeDirection dir)
|
||||
{
|
||||
if(dir == ForgeDirection.UP) return this.generateRate;
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package dark.SteamPower.firebox;
|
||||
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityLavaBuffer extends TileEntity
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
package dark.SteamPower.firebox;
|
||||
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityLiquidBurner extends TileEntity
|
||||
{
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
package dark.SteamPower.renders;
|
||||
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.ModelBase;
|
||||
import net.minecraft.src.ModelRenderer;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelCenterTank extends ModelBase
|
||||
{
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
package dark.SteamPower.renders;
|
||||
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.ModelBase;
|
||||
import net.minecraft.src.ModelRenderer;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelCornerTank extends ModelBase
|
||||
{
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
package dark.SteamPower.renders;
|
||||
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.ModelBase;
|
||||
import net.minecraft.src.ModelRenderer;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelEngine extends ModelBase
|
||||
{
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
package dark.SteamPower.renders;
|
||||
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.ModelBase;
|
||||
import net.minecraft.src.ModelRenderer;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelFurnace extends ModelBase
|
||||
{
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
package dark.SteamPower.renders;
|
||||
|
||||
import net.minecraft.src.ModelBase;
|
||||
import net.minecraft.src.ModelRenderer;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelGearPiston extends ModelBase
|
||||
{
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
package dark.SteamPower.renders;
|
||||
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.ModelBase;
|
||||
import net.minecraft.src.ModelRenderer;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelGenerator extends ModelBase
|
||||
{
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
package dark.SteamPower.renders;
|
||||
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.ModelBase;
|
||||
import net.minecraft.src.ModelRenderer;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelTank extends ModelBase
|
||||
{
|
|
@ -1,7 +1,7 @@
|
|||
package dark.SteamPower.renders;
|
||||
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package dark.SteamPower.renders;
|
||||
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package dark.SteamPower.renders;
|
||||
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package dark.SteamPower.renders;
|
||||
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
|
@ -2,11 +2,11 @@ package dark.SteamPower.steamengine;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.Material;
|
||||
import net.minecraft.src.MathHelper;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import dark.SteamPower.SteamPowerMain;
|
||||
|
||||
public class BlockSteamPiston extends universalelectricity.prefab.BlockMachine
|
||||
|
@ -19,19 +19,9 @@ public class BlockSteamPiston extends universalelectricity.prefab.BlockMachine
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onMachineActivated(World par1World, int x, int y, int z,
|
||||
EntityPlayer par5EntityPlayer)
|
||||
public boolean onUseWrench(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUseWrench(World par1World, int x, int y, int z,
|
||||
EntityPlayer par5EntityPlayer)
|
||||
{
|
||||
int angle = MathHelper
|
||||
.floor_double((par5EntityPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int angle = MathHelper.floor_double((par5EntityPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int metadata = par1World.getBlockMetadata(x, y, z);
|
||||
if (metadata < 3)
|
||||
{
|
||||
|
@ -97,7 +87,9 @@ public class BlockSteamPiston extends universalelectricity.prefab.BlockMachine
|
|||
public TileEntity createNewTileEntity(World world, int metadata)
|
||||
{
|
||||
if (metadata >= 0 && metadata < 4) { return new TileEntitySteamPiston(); }
|
||||
if (metadata == 14) {}
|
||||
if (metadata == 14)
|
||||
{
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -2,14 +2,13 @@ package dark.SteamPower.steamengine;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.CreativeTabs;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.Material;
|
||||
import net.minecraft.src.MathHelper;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import dark.SteamPower.SteamPowerMain;
|
||||
|
||||
public class ItemSteamPiston extends Item {
|
|
@ -1,24 +1,21 @@
|
|||
package dark.SteamPower.steamengine;
|
||||
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.Packet250CustomPayload;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.prefab.network.IPacketReceiver;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import dark.BasicUtilities.api.IConsumer;
|
||||
import dark.BasicUtilities.api.IForce;
|
||||
import dark.BasicUtilities.api.IProducer;
|
||||
import dark.BasicUtilities.api.IReadOut;
|
||||
import dark.BasicUtilities.api.Liquid;
|
||||
import dark.Library.prefab.TileEntityMachine;
|
||||
import dark.SteamPower.SteamPowerMain;
|
||||
|
||||
public class TileEntitySteamPiston extends TileEntityMachine implements IPacketReceiver, IConsumer, IProducer, IForce, IReadOut
|
||||
public class TileEntitySteamPiston extends TileEntityMachine implements IPacketReceiver,IForce, IReadOut
|
||||
{
|
||||
public int force = 0;
|
||||
public int aForce = 0;
|
||||
|
@ -182,83 +179,6 @@ public class TileEntitySteamPiston extends TileEntityMachine implements IPacketR
|
|||
this.bForce = force;
|
||||
return aForce;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onProduceLiquid(Liquid type, int vol, ForgeDirection side)
|
||||
{
|
||||
if (type == Liquid.WATER)
|
||||
{
|
||||
if (this.water > 0)
|
||||
{
|
||||
this.water -= 1;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProduceLiquid(Liquid type, ForgeDirection side)
|
||||
{
|
||||
if (type == Liquid.WATER) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProducePresure(Liquid type, ForgeDirection side)
|
||||
{
|
||||
if (type == Liquid.WATER) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int presureOutput(Liquid type, ForgeDirection side)
|
||||
{
|
||||
if (type == Liquid.WATER) { return 32; }
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onReceiveLiquid(Liquid type, int vol, ForgeDirection side)
|
||||
{
|
||||
if (type == Liquid.STEAM)
|
||||
{
|
||||
int rejectedSteam = Math.max((this.steam + vol) - this.maxSteam, 0);
|
||||
this.steam += vol - rejectedSteam;
|
||||
return rejectedSteam;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRecieveLiquid(Liquid type, ForgeDirection forgeDirection)
|
||||
{
|
||||
if (type == Liquid.STEAM) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStoredLiquid(Liquid type)
|
||||
{
|
||||
if (type == Liquid.WATER)
|
||||
{
|
||||
return this.water;
|
||||
}
|
||||
else if (type == Liquid.STEAM) { return this.steam; }
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLiquidCapacity(Liquid type)
|
||||
{
|
||||
if (type == Liquid.WATER)
|
||||
{
|
||||
return this.maxWater;
|
||||
}
|
||||
else if (type == Liquid.STEAM) { return this.maxSteam; }
|
||||
return 0;
|
||||
}
|
||||
|
||||
// -------------------
|
||||
// Data
|
||||
// ----------------
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 706 B After Width: | Height: | Size: 706 B |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 658 B After Width: | Height: | Size: 658 B |
BIN
src/minecraft/generaltextures/GearShaftPiston.png
Normal file
After Width: | Height: | Size: 706 B |
BIN
src/minecraft/generaltextures/Items.png
Normal file
After Width: | Height: | Size: 28 KiB |