Updating for UE 8.5 lite and forge 4.1
Still have work to do but mostly done
This commit is contained in:
parent
22b872c557
commit
241424ceb5
26 changed files with 176 additions and 182 deletions
|
@ -1,6 +1,12 @@
|
|||
package basicpipes;
|
||||
import java.io.File;
|
||||
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import universalelectricity.BasicComponents;
|
||||
import universalelectricity.network.PacketManager;
|
||||
import basicpipes.pipes.BlockPipe;
|
||||
import basicpipes.pipes.ItemGuage;
|
||||
import basicpipes.pipes.ItemParts;
|
||||
|
@ -8,18 +14,8 @@ import basicpipes.pipes.ItemPipe;
|
|||
import basicpipes.pipes.api.Liquid;
|
||||
import basicpipes.pumps.BlockMachine;
|
||||
import basicpipes.pumps.BlockValve;
|
||||
import basicpipes.pumps.TileEntityPump;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import universalelectricity.basiccomponents.BasicComponents;
|
||||
import universalelectricity.network.PacketManager;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.Mod.PostInit;
|
||||
import cpw.mods.fml.common.Mod.PreInit;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
|
@ -105,14 +101,11 @@ public class BasicPipesMain{
|
|||
public void postInit(FMLPostInitializationEvent event)
|
||||
{
|
||||
proxy.postInit();
|
||||
GameRegistry.addRecipe(new ItemStack(parts, 2,0), new Object[] { "@@@", '@',BasicComponents.itemBronzeIngot});//bronze tube
|
||||
GameRegistry.addRecipe(new ItemStack(parts, 2,1), new Object[] { "@@@", '@',Item.ingotIron});//iron tube
|
||||
GameRegistry.addRecipe(new ItemStack(parts, 2,2), new Object[] { "@@@", '@',Block.obsidian});//obby Tube
|
||||
GameRegistry.addRecipe(new ItemStack(parts, 2,3), new Object[] { "N@N", 'N',Block.netherrack,'@',new ItemStack(parts, 2,2)});//nether tube
|
||||
GameRegistry.addRecipe(new ItemStack(parts, 2,4), new Object[] { "@@","@@", '@',Item.leather});//seal
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(parts, 1,5), new Object[] { new ItemStack(parts, 1,4),new ItemStack(Item.slimeBall, 1)});//stick seal
|
||||
GameRegistry.addRecipe(new ItemStack(parts, 1,6), new Object[] { " @ ","@ @"," @ ", '@',BasicComponents.itemBronzeIngot});//tank
|
||||
GameRegistry.addRecipe(new ItemStack(parts, 1,7), new Object[] { "T@T", 'T',new ItemStack(parts,1,0),'@',Block.lever});//valve
|
||||
//crafting pipes
|
||||
//{"black", "red", "green", "brown", "blue", "purple", "cyan",
|
||||
//"silver", "gray", "pink", "lime", "yellow", "lightBlue", "magenta", "orange", "white"};
|
||||
|
@ -126,6 +119,12 @@ public class BasicPipesMain{
|
|||
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1,3), new Object[] { new ItemStack(parts, 1,1),new ItemStack(parts, 1,4),new ItemStack(Item.dyePowder, 1,0)});
|
||||
//fuel
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1,4), new Object[] { new ItemStack(parts, 1,1),new ItemStack(parts, 1,4),new ItemStack(Item.dyePowder, 1,11)});
|
||||
GameRegistry.addRecipe(new ItemStack(parts, 1,7), new Object[] { "T@T", 'T',new ItemStack(parts,1,0),'@',Block.lever});//valve
|
||||
|
||||
try{
|
||||
GameRegistry.addRecipe(new ItemStack(parts, 2,0), new Object[] { "@@@", '@',BasicComponents.itemBronzeIngot});//bronze tube
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(parts, 1,6), new Object[] { " @ ","@ @"," @ ", '@',BasicComponents.itemBronzeIngot});//tank
|
||||
|
||||
//pump
|
||||
GameRegistry.addRecipe(new ItemStack(machine, 1,0), new Object[] { "@T@","BPB","@M@"
|
||||
|
@ -137,5 +136,11 @@ public class BasicPipesMain{
|
|||
, 'T',new ItemStack(parts, 1,6)
|
||||
});
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
System.out.print("UE based recipes not loaded");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public class ItemGuage extends Item
|
|||
this.setHasSubtypes(true);
|
||||
this.setIconIndex(10);
|
||||
this.setItemName("guage");
|
||||
this.setTabToDisplayOn(CreativeTabs.tabTools);
|
||||
this.setCreativeTab(CreativeTabs.tabTools);
|
||||
}
|
||||
@Override
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
|
@ -43,11 +43,12 @@ public class ItemGuage extends Item
|
|||
{
|
||||
return "guage";
|
||||
}
|
||||
public boolean tryPlaceIntoWorld(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
||||
{
|
||||
if(!par3World.isRemote)
|
||||
{
|
||||
if(par1ItemStack.getItemDamage() == 0)
|
||||
if(itemStack.getItemDamage() == 0)
|
||||
{
|
||||
TileEntity blockEntity = par3World.getBlockTileEntity(par4, par5, par6);
|
||||
if(blockEntity instanceof TileEntityPipe)
|
||||
|
@ -61,7 +62,7 @@ public class ItemGuage extends Item
|
|||
|
||||
print = typeName +" " + steam +" @ "+pressure+"PSI";
|
||||
|
||||
par2EntityPlayer.addChatMessage(print);
|
||||
player.addChatMessage(print);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public class ItemParts extends Item{
|
|||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
this.setMaxStackSize(64);
|
||||
this.setTabToDisplayOn(CreativeTabs.tabMaterials);
|
||||
this.setCreativeTab(CreativeTabs.tabMaterials);
|
||||
}
|
||||
@Override
|
||||
public int getIconFromDamage(int par1)
|
||||
|
@ -45,11 +45,6 @@ public class ItemParts extends Item{
|
|||
par3List.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
public boolean tryPlaceIntoWorld(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
||||
{
|
||||
//TODO add block place event for some items like valves,tanks
|
||||
return false;
|
||||
}
|
||||
public String getTextureFile() {
|
||||
return BasicPipesMain.textureFile+"/Items.png";
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class ItemPipe extends Item
|
|||
this.setHasSubtypes(true);
|
||||
this.setIconIndex(10);
|
||||
this.setItemName("pipe");
|
||||
this.setTabToDisplayOn(CreativeTabs.tabRedstone);
|
||||
this.setCreativeTab(CreativeTabs.tabRedstone);
|
||||
}
|
||||
@Override
|
||||
public int getIconFromDamage(int par1)
|
||||
|
@ -56,7 +56,7 @@ public class ItemPipe extends Item
|
|||
return "Pipes";
|
||||
}
|
||||
@Override
|
||||
public boolean tryPlaceIntoWorld(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
||||
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
||||
{
|
||||
int blockID = par3World.getBlockId(par4, par5, par6);
|
||||
spawnID = BasicPipesMain.pipeID;
|
||||
|
|
|
@ -5,7 +5,6 @@ import net.minecraft.src.NetworkManager;
|
|||
import net.minecraft.src.Packet250CustomPayload;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.Vector3;
|
||||
import universalelectricity.network.IPacketReceiver;
|
||||
import universalelectricity.network.PacketManager;
|
||||
import basicpipes.pipes.api.ILiquidConsumer;
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package basicpipes.pipes.api;
|
||||
|
||||
|
||||
import universalelectricity.basiccomponents.BasicComponents;
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
/**
|
||||
* System too easily reference a liquid type and its info
|
||||
* @author Rseifert
|
||||
|
@ -14,7 +12,7 @@ public enum Liquid {
|
|||
STEAM("Steam",false,true,-1,-1),
|
||||
WATER("Water",false,false,Block.waterStill.blockID,Block.waterMoving.blockID),
|
||||
LAVA("Lava",false,false,Block.lavaStill.blockID,Block.lavaMoving.blockID),
|
||||
OIL("Oil",true,false,BasicComponents.oilStill.blockID,BasicComponents.oilMoving.blockID),
|
||||
OIL("Oil",true,false,-1,-1),//BasicComponents.oilStill.blockID,BasicComponents.oilMoving.blockID),
|
||||
Fuel("Fuel",true,false,-1,-1),
|
||||
Air("Air",false,true,0,-1),
|
||||
Methain("Methain",true,true,-1,-1),
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package basicpipes.pumps;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.src.*;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.src.BlockContainer;
|
||||
import net.minecraft.src.CreativeTabs;
|
||||
import net.minecraft.src.Material;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
import basicpipes.BasicPipesMain;
|
||||
|
||||
public class BlockMachine extends BlockContainer
|
||||
|
|
|
@ -9,7 +9,7 @@ import universalelectricity.UniversalElectricity;
|
|||
|
||||
import basicpipes.BasicPipesMain;
|
||||
|
||||
public class BlockValve extends universalelectricity.extend.BlockMachine
|
||||
public class BlockValve extends universalelectricity.prefab.BlockMachine
|
||||
{
|
||||
|
||||
public BlockValve(int id)
|
||||
|
|
|
@ -2,17 +2,15 @@ package basicpipes.pumps;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import basicpipes.BasicPipesMain;
|
||||
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.CreativeTabs;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemBlock;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.MathHelper;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
import basicpipes.BasicPipesMain;
|
||||
|
||||
public class ItemMachine extends ItemBlock
|
||||
{
|
||||
|
@ -26,7 +24,7 @@ public class ItemMachine extends ItemBlock
|
|||
this.setHasSubtypes(true);
|
||||
this.setIconIndex(10);
|
||||
this.setItemName("Machine");
|
||||
this.setTabToDisplayOn(CreativeTabs.tabRedstone);
|
||||
this.setCreativeTab(CreativeTabs.tabRedstone);
|
||||
}
|
||||
@Override
|
||||
public int getIconFromDamage(int par1)
|
||||
|
@ -56,7 +54,7 @@ public class ItemMachine extends ItemBlock
|
|||
return "Machines";
|
||||
}
|
||||
@Override
|
||||
public boolean tryPlaceIntoWorld(ItemStack itemStack, EntityPlayer player, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
||||
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
||||
{
|
||||
int blockID = par3World.getBlockId(par4, par5, par6);
|
||||
spawnID = BasicPipesMain.machineID;
|
||||
|
|
|
@ -26,7 +26,7 @@ public class ItemValve extends ItemBlock
|
|||
this.setHasSubtypes(true);
|
||||
this.setIconIndex(10);
|
||||
this.setItemName("Machine");
|
||||
this.setTabToDisplayOn(CreativeTabs.tabRedstone);
|
||||
this.setCreativeTab(CreativeTabs.tabRedstone);
|
||||
}
|
||||
@Override
|
||||
public int getIconFromDamage(int par1)
|
||||
|
@ -56,7 +56,7 @@ public class ItemValve extends ItemBlock
|
|||
return "Machines";
|
||||
}
|
||||
@Override
|
||||
public boolean tryPlaceIntoWorld(ItemStack itemStack, EntityPlayer player, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
||||
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
||||
{
|
||||
int blockID = par3World.getBlockId(par4, par5, par6);
|
||||
spawnID = BasicPipesMain.valveID;
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package basicpipes.pumps;
|
||||
|
||||
import basicpipes.pipes.api.ILiquidProducer;
|
||||
import basicpipes.pipes.api.Liquid;
|
||||
import universalelectricity.implement.IElectricityReceiver;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.extend.IElectricUnit;
|
||||
import basicpipes.pipes.api.ILiquidProducer;
|
||||
import basicpipes.pipes.api.Liquid;
|
||||
|
||||
public class TileEntityCondenser extends TileEntity implements ILiquidProducer, IElectricUnit {
|
||||
public class TileEntityCondenser extends TileEntity implements ILiquidProducer, IElectricityReceiver {
|
||||
int tickCount = 0;
|
||||
int waterStored = 0;
|
||||
int energyStored = 0;
|
||||
|
@ -36,7 +36,11 @@ public class TileEntityCondenser extends TileEntity implements ILiquidProducer,
|
|||
}
|
||||
public void updateEntity()
|
||||
{
|
||||
|
||||
if(energyStored > 100 && waterStored < 3)
|
||||
{
|
||||
energyStored -= 100;
|
||||
waterStored += 1;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean canProduceLiquid(Liquid type, ForgeDirection side) {
|
||||
|
@ -57,40 +61,17 @@ public class TileEntityCondenser extends TileEntity implements ILiquidProducer,
|
|||
return false;
|
||||
}
|
||||
@Override
|
||||
public void onUpdate(float amps, float voltage, ForgeDirection side) {
|
||||
// TODO Auto-generated method stub
|
||||
if(energyStored > 100 && waterStored < 10)
|
||||
{
|
||||
energyStored -= 100;
|
||||
waterStored += 1;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public float ampRequest() {
|
||||
public double wattRequest() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection side) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceiveFromSide(ForgeDirection side) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public float getVoltage() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int getTickInterval() {
|
||||
// TODO Auto-generated method stub
|
||||
return 20;
|
||||
}
|
||||
@Override
|
||||
public int presureOutput(Liquid type, ForgeDirection side) {
|
||||
if(type == Liquid.WATER)
|
||||
{
|
||||
|
@ -106,6 +87,22 @@ public class TileEntityCondenser extends TileEntity implements ILiquidProducer,
|
|||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection side) {
|
||||
// TODO Auto-generated method stub
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public double getVoltage() {
|
||||
// TODO Auto-generated method stub
|
||||
return 120;
|
||||
}
|
||||
@Override
|
||||
public void onReceive(TileEntity sender, double amps, double voltage,
|
||||
ForgeDirection side) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
package basicpipes.pumps;
|
||||
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.implement.IElectricityReceiver;
|
||||
import universalelectricity.prefab.TileEntityElectricityReceiver;
|
||||
import basicpipes.pipes.api.ILiquidProducer;
|
||||
import basicpipes.pipes.api.Liquid;
|
||||
import basicpipes.pipes.api.TradeHelper;
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.electricity.TileEntityElectricUnit;
|
||||
import universalelectricity.extend.IElectricUnit;
|
||||
|
||||
public class TileEntityPump extends TileEntityElectricUnit implements ILiquidProducer,IElectricUnit {
|
||||
public class TileEntityPump extends TileEntityElectricityReceiver implements ILiquidProducer,IElectricityReceiver {
|
||||
int dCount = 0;
|
||||
float eStored = 0;
|
||||
float eMax = 2000;
|
||||
|
@ -33,8 +32,8 @@ public class TileEntityPump extends TileEntityElectricUnit implements ILiquidPro
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(float watts, float voltage, ForgeDirection side) {
|
||||
super.onUpdate(watts, voltage, side);
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
sList = TradeHelper.getSourounding(this);
|
||||
int bBlock = worldObj.getBlockId(xCoord, yCoord -1, zCoord);
|
||||
Liquid bellow = Liquid.getLiquidByBlock(bBlock);
|
||||
|
@ -45,13 +44,9 @@ public class TileEntityPump extends TileEntityElectricUnit implements ILiquidPro
|
|||
if(!worldObj.isRemote)
|
||||
{
|
||||
count++;
|
||||
if (ampRequest() > 0 && canConnect(side))
|
||||
{
|
||||
float rejectedElectricity = (float) Math.max((this.eStored + watts) - this.eMax, 0.0);
|
||||
this.eStored = (float) Math.max(this.eStored + watts - rejectedElectricity, 0.0);
|
||||
}
|
||||
|
||||
if(bBlock == type.Still && this.eStored > 200 && this.lStored < this.wMax && count>=2)
|
||||
|
||||
if(bBlock == type.Still && this.eStored > 200 && this.lStored < this.wMax && count>=20)
|
||||
{
|
||||
eStored -= 200;
|
||||
lStored += 1;
|
||||
|
@ -62,10 +57,6 @@ public class TileEntityPump extends TileEntityElectricUnit implements ILiquidPro
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public float ampRequest() {
|
||||
return Math.max(eMax - eStored,0);
|
||||
}
|
||||
@Override
|
||||
public boolean canReceiveFromSide(ForgeDirection side) {
|
||||
if(side != ForgeDirection.DOWN)
|
||||
|
@ -74,17 +65,6 @@ public class TileEntityPump extends TileEntityElectricUnit implements ILiquidPro
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getVoltage() {
|
||||
return 240;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTickInterval() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onProduceLiquid(Liquid type, int maxVol, ForgeDirection side) {
|
||||
if(type == this.type && lStored > 0)
|
||||
|
@ -140,4 +120,20 @@ public class TileEntityPump extends TileEntityElectricUnit implements ILiquidPro
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(TileEntity sender, double watts, double voltage,
|
||||
ForgeDirection side) {
|
||||
if (wattRequest() > 0 && canConnect(side))
|
||||
{
|
||||
float rejectedElectricity = (float) Math.max((this.eStored + watts) - this.eMax, 0.0);
|
||||
this.eStored = (float) Math.max(this.eStored + watts - rejectedElectricity, 0.0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public double wattRequest() {
|
||||
return Math.max(eMax - eStored,0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
package basicpipes.pumps;
|
||||
|
||||
import universalelectricity.Vector3;
|
||||
import basicpipes.pipes.api.ILiquidConsumer;
|
||||
import basicpipes.pipes.api.Liquid;
|
||||
import basicpipes.pipes.api.TradeHelper;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import basicpipes.pipes.TileEntityPipe;
|
||||
import basicpipes.pipes.api.ILiquidConsumer;
|
||||
import basicpipes.pipes.api.Liquid;
|
||||
import basicpipes.pipes.api.TradeHelper;
|
||||
|
||||
public class TileEntityValve extends TileEntity implements ILiquidConsumer {
|
||||
Liquid type = Liquid.DEFUALT;
|
||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraft.src.World;
|
|||
import steampower.boiler.TileEntityBoiler;
|
||||
import steampower.burner.TileEntityFireBox;
|
||||
|
||||
public class BlockMachine extends universalelectricity.extend.BlockMachine
|
||||
public class BlockMachine extends universalelectricity.prefab.BlockMachine
|
||||
{
|
||||
|
||||
private Random furnaceRand = new Random();
|
||||
|
|
|
@ -11,7 +11,7 @@ public class ItemMachine extends ItemBlock {
|
|||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
this.setIconIndex(21);
|
||||
this.setTabToDisplayOn(CreativeTabs.tabBlock);
|
||||
this.setCreativeTab(CreativeTabs.tabBlock);
|
||||
}
|
||||
@Override
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package steampower;
|
||||
import java.io.File;
|
||||
|
||||
import basicpipes.BasicPipesMain;
|
||||
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
@ -11,11 +9,11 @@ import steampower.turbine.BlockGenerator;
|
|||
import steampower.turbine.BlockSteamPiston;
|
||||
import steampower.turbine.ItemEngine;
|
||||
import steampower.turbine.TileEntitytopGen;
|
||||
import universalelectricity.basiccomponents.BasicComponents;
|
||||
import universalelectricity.BasicComponents;
|
||||
import universalelectricity.network.PacketManager;
|
||||
import basicpipes.BasicPipesMain;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.Mod.PostInit;
|
||||
import cpw.mods.fml.common.Mod.PreInit;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
|
@ -96,14 +94,15 @@ public class SteamPowerMain{
|
|||
|
||||
proxy.postInit();
|
||||
//Crafting
|
||||
try{
|
||||
/**
|
||||
* case 0: return new TileEntityGrinder(); <-Removed
|
||||
case 0: return new TileEntityGrinder(); <-Removed
|
||||
case 1: return new TileEntityBoiler();
|
||||
case 2: return new TileEntityFireBox();
|
||||
case 3: return new TileEntityGenerator();
|
||||
case 14: return new TileEntityCondenser();<-Removed
|
||||
case 15: return new TileEntityNuller();<-Just for testing Not craftable
|
||||
*/
|
||||
case 15: return new TileEntityNuller();<-Just for testing Not craftable*/
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(machine, 1, 1), new Object [] {"@T@", "OVO", "@T@",
|
||||
'T',new ItemStack(BasicPipesMain.parts, 1,6),
|
||||
'@',new ItemStack(BasicComponents.itemSteelPlate),
|
||||
|
@ -116,7 +115,12 @@ public class SteamPowerMain{
|
|||
'T',new ItemStack(BasicPipesMain.parts, 1,0),
|
||||
'@',new ItemStack(BasicComponents.itemSteelPlate),
|
||||
'P',Block.pistonBase,
|
||||
'M',new ItemStack(BasicComponents.itemMotor)});
|
||||
'M',new ItemStack(BasicComponents.itemMotor)});}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
System.out.print("UE based recipes not loaded");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
package steampower;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import universalelectricity.electricity.TileEntityElectricUnit;
|
||||
import universalelectricity.extend.IRotatable;
|
||||
import universalelectricity.network.IPacketReceiver;
|
||||
import universalelectricity.network.PacketManager;
|
||||
import net.minecraft.src.*;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.NBTTagList;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.ISidedInventory;
|
||||
public class TileEntityMachine extends TileEntityElectricUnit implements IInventory, ISidedInventory
|
||||
import universalelectricity.network.PacketManager;
|
||||
import universalelectricity.prefab.TileEntityElectricityReceiver;
|
||||
public class TileEntityMachine extends TileEntityElectricityReceiver implements IInventory, ISidedInventory
|
||||
{
|
||||
public int facing = 0;
|
||||
private int count = 0;
|
||||
|
@ -75,13 +76,6 @@ public class TileEntityMachine extends TileEntityElectricUnit implements IInven
|
|||
//vars
|
||||
this.facing = par1NBTTagCompound.getInteger("facing");
|
||||
}
|
||||
|
||||
@Override
|
||||
public float ampRequest() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceiveFromSide(ForgeDirection side) {
|
||||
// TODO Auto-generated method stub
|
||||
|
@ -125,9 +119,9 @@ public class TileEntityMachine extends TileEntityElectricUnit implements IInven
|
|||
return 0;
|
||||
}
|
||||
|
||||
public void onUpdate(float watts, float voltage, ForgeDirection side)
|
||||
public void updateEntity()
|
||||
{
|
||||
super.onUpdate(watts, voltage, side);
|
||||
super.updateEntity();
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
|
@ -255,4 +249,15 @@ public class TileEntityMachine extends TileEntityElectricUnit implements IInven
|
|||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onReceive(TileEntity sender, double amps, double voltage,
|
||||
ForgeDirection side) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
@Override
|
||||
public double wattRequest() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -1,21 +1,21 @@
|
|||
package steampower;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.extend.IElectricUnit;
|
||||
import universalelectricity.implement.IElectricityReceiver;
|
||||
|
||||
public class TileEntityNuller extends TileEntityMachine implements IElectricityReceiver {
|
||||
|
||||
public class TileEntityNuller extends TileEntityMachine implements IElectricUnit {
|
||||
@Override
|
||||
public float ampRequest()
|
||||
{
|
||||
return 200;
|
||||
}
|
||||
@Override
|
||||
public boolean canReceiveFromSide(ForgeDirection side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public double wattRequest()
|
||||
{
|
||||
return 400;
|
||||
}
|
||||
@Override
|
||||
public float getVoltage()
|
||||
public double getVoltage()
|
||||
{
|
||||
return 1000;
|
||||
}
|
||||
|
|
|
@ -117,9 +117,10 @@ public class TileEntityBoiler extends TileEntityMachine implements IPacketReceiv
|
|||
* ticks and creates a new spawn inside its implementation.
|
||||
*/
|
||||
@Override
|
||||
public void onUpdate(float watts, float voltage, ForgeDirection side)
|
||||
public void updateEntity()
|
||||
{
|
||||
|
||||
if(count++ >=20){
|
||||
count = 0;
|
||||
//update/resets connection list
|
||||
TileEntity[] entityList = TradeHelper.getSourounding(this);
|
||||
tankCount = 0;
|
||||
|
@ -155,15 +156,13 @@ public class TileEntityBoiler extends TileEntityMachine implements IPacketReceiv
|
|||
if(!worldObj.isRemote)
|
||||
{
|
||||
|
||||
count++;
|
||||
|
||||
emptyBuckets();
|
||||
if(count >= 16)
|
||||
{
|
||||
|
||||
//adds water from container slot
|
||||
this.waterStored = TradeHelper.shareLiquid(this, Liquid.WATER, false);
|
||||
this.steamStored = TradeHelper.shareLiquid(this, Liquid.STEAM, true);
|
||||
count = 0;
|
||||
}
|
||||
|
||||
|
||||
if(waterStored > 0 && hullHeated && heatStored > heatNeeded)
|
||||
{
|
||||
|
@ -184,7 +183,8 @@ public class TileEntityBoiler extends TileEntityMachine implements IPacketReceiv
|
|||
heatStored += (int) Math.min((int)(random.nextDouble()*10)*getTickInterval(), heatMax);
|
||||
}
|
||||
}
|
||||
super.onUpdate(watts, voltage, side);
|
||||
super.updateEntity();
|
||||
}
|
||||
}
|
||||
private void emptyBuckets()
|
||||
{
|
||||
|
|
|
@ -40,9 +40,12 @@ public class TileEntityFireBox extends TileEntityMachine implements IPacketRecei
|
|||
return 5;
|
||||
|
||||
}
|
||||
public void onUpdate(float watts, float voltage, ForgeDirection side)
|
||||
public void updateEntity()
|
||||
{
|
||||
super.onUpdate(watts, voltage, side);
|
||||
super.updateEntity();
|
||||
if(count++ >= 10)
|
||||
{
|
||||
count = 0;
|
||||
addConnection();
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
|
@ -91,6 +94,7 @@ public class TileEntityFireBox extends TileEntityMachine implements IPacketRecei
|
|||
this.generateRate = Math.max(this.generateRate-5, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//gets all connected fireBoxes and shares its supply of coal
|
||||
public void sharCoal(){
|
||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.src.Material;
|
|||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
|
||||
public class BlockGenerator extends universalelectricity.extend.BlockMachine {
|
||||
public class BlockGenerator extends universalelectricity.prefab.BlockMachine {
|
||||
|
||||
public BlockGenerator(int id) {
|
||||
super("Generator", id, Material.iron);
|
||||
|
|
|
@ -11,7 +11,7 @@ import net.minecraft.src.World;
|
|||
import steampower.SteamPowerMain;
|
||||
import steampower.TileEntityMachine;
|
||||
|
||||
public class BlockSteamPiston extends universalelectricity.extend.BlockMachine{
|
||||
public class BlockSteamPiston extends universalelectricity.prefab.BlockMachine{
|
||||
|
||||
public BlockSteamPiston(int par1) {
|
||||
super("SteamEngine", par1, Material.iron);
|
||||
|
|
|
@ -16,7 +16,7 @@ public class ItemEngine extends Item
|
|||
{
|
||||
super(par1);
|
||||
this.maxStackSize = 5;
|
||||
this.setTabToDisplayOn(CreativeTabs.tabBlock);
|
||||
this.setCreativeTab(CreativeTabs.tabBlock);
|
||||
this.setIconIndex(21);
|
||||
}
|
||||
@Override
|
||||
|
@ -30,7 +30,7 @@ public class ItemEngine extends Item
|
|||
return SteamPowerMain.textureFile+"Items.png";
|
||||
}
|
||||
@Override
|
||||
public boolean tryPlaceIntoWorld(ItemStack par1ItemStack, EntityPlayer ePlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
||||
public boolean onItemUse(ItemStack itemStack, EntityPlayer ePlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
||||
{
|
||||
if (par3World.isRemote)
|
||||
{
|
||||
|
@ -51,7 +51,7 @@ public class ItemEngine extends Item
|
|||
par3World.setBlockAndMetadataWithNotify(par4, par5+1, par6, var11.blockID, 14);
|
||||
par3World.notifyBlocksOfNeighborChange(par4, par5, par6, var11.blockID);
|
||||
par3World.editingBlocks = false;
|
||||
--par1ItemStack.stackSize;
|
||||
--itemStack.stackSize;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,12 +5,11 @@ import net.minecraft.src.NetworkManager;
|
|||
import net.minecraft.src.Packet250CustomPayload;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import steampower.TileEntityMachine;
|
||||
import universalelectricity.extend.IElectricUnit;
|
||||
import universalelectricity.network.IPacketReceiver;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
public class TileEntityGen extends TileEntityMachine implements IPacketReceiver,IElectricUnit
|
||||
public class TileEntityGen extends TileEntityMachine implements IPacketReceiver
|
||||
{
|
||||
|
||||
@Override
|
||||
|
@ -20,14 +19,7 @@ public class TileEntityGen extends TileEntityMachine implements IPacketReceiver,
|
|||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
public void onUpdate(float watts, float voltage, ForgeDirection side)
|
||||
{
|
||||
super.onUpdate(watts, voltage, side);
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public float electricityRequest()
|
||||
|
@ -49,7 +41,7 @@ public class TileEntityGen extends TileEntityMachine implements IPacketReceiver,
|
|||
{
|
||||
return false;
|
||||
}
|
||||
public float getVoltage()
|
||||
public double getVoltage()
|
||||
{
|
||||
return 120;
|
||||
}
|
||||
|
|
|
@ -11,20 +11,18 @@ import net.minecraft.src.Packet250CustomPayload;
|
|||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.ISidedInventory;
|
||||
import steampower.SteamPowerMain;
|
||||
import steampower.TileEntityMachine;
|
||||
import universalelectricity.Vector3;
|
||||
import universalelectricity.electricity.ElectricityManager;
|
||||
import universalelectricity.extend.IElectricUnit;
|
||||
import universalelectricity.extend.TileEntityConductor;
|
||||
import universalelectricity.network.IPacketReceiver;
|
||||
import universalelectricity.prefab.TileEntityConductor;
|
||||
import universalelectricity.prefab.Vector3;
|
||||
import basicpipes.pipes.api.ILiquidConsumer;
|
||||
import basicpipes.pipes.api.ILiquidProducer;
|
||||
import basicpipes.pipes.api.Liquid;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
public class TileEntitySteamPiston extends TileEntityMachine implements IPacketReceiver, IElectricUnit,ILiquidConsumer,ILiquidProducer, IInventory, ISidedInventory
|
||||
public class TileEntitySteamPiston extends TileEntityMachine implements IPacketReceiver,ILiquidConsumer,ILiquidProducer, IInventory, ISidedInventory
|
||||
{
|
||||
//Maximum possible generation rate of watts in SECONDS
|
||||
public int maxGenerateRate = 1000;
|
||||
|
@ -61,10 +59,12 @@ public class TileEntitySteamPiston extends TileEntityMachine implements IPacketR
|
|||
* Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count
|
||||
* ticks and creates a new spawn inside its implementation.
|
||||
*/
|
||||
public void onUpdate(float watts, float voltage, ForgeDirection side)
|
||||
public void updateEntity()
|
||||
{
|
||||
super.onUpdate(watts, voltage, side);
|
||||
count++;
|
||||
super.updateEntity();
|
||||
if(count++ >= 10){
|
||||
count = 0;
|
||||
|
||||
float cPercent = (generateRate/10);
|
||||
int cCount = 1;
|
||||
if(cPercent > 25f)
|
||||
|
@ -98,7 +98,6 @@ public class TileEntitySteamPiston extends TileEntityMachine implements IPacketR
|
|||
{
|
||||
posT = true;
|
||||
}
|
||||
count =0;
|
||||
}
|
||||
TileEntity ent = worldObj.getBlockTileEntity(xCoord, yCoord+1, zCoord);
|
||||
if(ent instanceof TileEntitytopGen)
|
||||
|
@ -110,11 +109,11 @@ public class TileEntitySteamPiston extends TileEntityMachine implements IPacketR
|
|||
//Check nearby blocks and see if the conductor is full. If so, then it is connected
|
||||
for(int i = 0;i<6;i++)
|
||||
{
|
||||
TileEntity tileEntity = Vector3.getUEUnitFromSide(this.worldObj, new Vector3(this.xCoord, this.yCoord, this.zCoord),
|
||||
TileEntity tileEntity = Vector3.getConnectorFromSide(this.worldObj, new Vector3(this.xCoord, this.yCoord, this.zCoord),
|
||||
ForgeDirection.getOrientation(i));
|
||||
if (tileEntity instanceof TileEntityConductor)
|
||||
{
|
||||
if (ElectricityManager.instance.electricityRequired(((TileEntityConductor)tileEntity).connectionID) > 0)
|
||||
if (ElectricityManager.instance.getElectricityRequired(((TileEntityConductor)tileEntity).getConnectionID()) > 0)
|
||||
{
|
||||
this.connectedElectricUnit = (TileEntityConductor)tileEntity;
|
||||
}
|
||||
|
@ -174,7 +173,8 @@ public class TileEntitySteamPiston extends TileEntityMachine implements IPacketR
|
|||
|
||||
if(this.generateRate > 1)
|
||||
{
|
||||
ElectricityManager.instance.produceElectricity(this.connectedElectricUnit, this.generateRate*this.getTickInterval(), this.getVoltage());
|
||||
ElectricityManager.instance.produceElectricity(this, connectedElectricUnit, this.generateRate*this.getTickInterval(), this.getVoltage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,18 +3,17 @@ package steampower.turbine;
|
|||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import steampower.TileEntityMachine;
|
||||
import universalelectricity.extend.IElectricUnit;
|
||||
import basicpipes.pipes.api.ILiquidConsumer;
|
||||
import basicpipes.pipes.api.ILiquidProducer;
|
||||
import basicpipes.pipes.api.Liquid;
|
||||
|
||||
public class TileEntitytopGen extends TileEntityMachine implements IElectricUnit,ILiquidConsumer,ILiquidProducer {
|
||||
public class TileEntitytopGen extends TileEntityMachine implements ILiquidConsumer,ILiquidProducer {
|
||||
public TileEntitySteamPiston genB = null;
|
||||
public void onUpdate(float watts, float voltage, ForgeDirection side)
|
||||
public void updateEntity()
|
||||
{
|
||||
if(!this.worldObj.isRemote)
|
||||
{
|
||||
super.onUpdate(watts, voltage, side);
|
||||
super.updateEntity();
|
||||
TileEntity ent = worldObj.getBlockTileEntity(xCoord, yCoord-1, xCoord);
|
||||
if(ent instanceof TileEntitySteamPiston)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue