update to 1.4.6 lol

Nothing really change for updating to 1.4.5 to 1.4.6 only had to fix 3
errors related to UE Vector3. However i did correct a config file bug as
well as fix pump wire connect to work better.
This commit is contained in:
Rseifert 2012-12-23 07:27:58 -05:00
parent 5787f65148
commit f2c04a007d
3 changed files with 79 additions and 36 deletions

View file

@ -71,36 +71,30 @@ public class BasicUtilitiesMain extends DummyModContainer
public static final String textureFile = "/dark/BasicUtilities/zResources/";
public static final String BlOCK_PNG = "/dark/BasicUtilities/zResources/blocks.png";
public static final String ITEM_PNG = "/dark/generaltextures/Items.png";
public static final Configuration CONFIGURATION = new Configuration(
new File(Loader.instance().getConfigDir(), NAME + ".cfg"));
public static final Configuration CONFIGURATION = new Configuration(new File(Loader.instance().getConfigDir() + "/UniversalElectricity/", NAME + ".cfg"));
// Block and Item vars
public final static int BLOCK_ID_PREFIX = 3000;
public final static int BLOCK_ID_PREFIX = 3100;
public final static int LIQUID_ID_PREFIX = 200;
public final static int ITEM_ID_PREFIX = 10056;
public final static int ITEM_ID_PREFIX = 13200;
public static Block pipe = new BlockPipe(UniversalElectricity.CONFIGURATION.getBlock("Pipe", BLOCK_ID_PREFIX).getInt());
public static Block machine = new BlockMachine(UniversalElectricity.CONFIGURATION.getBlock("MachineSetOne", BLOCK_ID_PREFIX + 1).getInt());
public static Block valve = new BlockValve(UniversalElectricity.CONFIGURATION.getBlock("Valve", BLOCK_ID_PREFIX + 2).getInt());
public static Block rod = new BlockRod(UniversalElectricity.CONFIGURATION.getBlock("MechanicalRod", BLOCK_ID_PREFIX + 3).getInt());
public static Block generator = new BlockGenerator((UniversalElectricity.CONFIGURATION.getBlock("UEGenerator", BLOCK_ID_PREFIX + 4).getInt()));
public static Block eValve = new BlockEValve((UniversalElectricity.CONFIGURATION.getBlock("EValve", BLOCK_ID_PREFIX + 5).getInt()));
public static Block pipe;
public static Block machine;
public static Block valve;
public static Block rod;
public static Block generator;
public static Block eValve;
public static Block SteamBlock;
public static Block oilMoving;
public static Block oilStill;
public static Block SteamBlock = new BlockSteam(UniversalElectricity.CONFIGURATION.getBlock("SteamBlock", LIQUID_ID_PREFIX).getInt());
public static LiquidStack Steam;
public static LiquidStack Oil;
public static Block oilMoving = new BlockOilFlowing(UniversalElectricity.CONFIGURATION.getBlock("Oil_FlowingBU", LIQUID_ID_PREFIX + 1).getInt());
public static Block oilStill = new BlockOilStill(UniversalElectricity.CONFIGURATION.getBlock("Oil_StillBU", LIQUID_ID_PREFIX + 2).getInt());
public static LiquidStack Steam = LiquidDictionary.getOrCreateLiquid("Steam", new LiquidStack(SteamBlock, LiquidContainerRegistry.BUCKET_VOLUME));
public static Item parts = new ItemParts(UniversalElectricity.CONFIGURATION.getItem("Parts", ITEM_ID_PREFIX).getInt());
public static Item itemPipes = new ItemPipe(UniversalElectricity.CONFIGURATION.getItem("PipeItem", ITEM_ID_PREFIX + 1).getInt());
// public static Item itemEValve = new
// ItemEValve(UniversalElectricity.CONFIGURATION.getItem("EValveItem",
// ITEM_ID_PREFIX + 2).getInt());
public static Item gauge = new ItemGuage(UniversalElectricity.CONFIGURATION.getItem("PipeGuage", ITEM_ID_PREFIX + 3).getInt());
public static Item itemOilBucket = new ItemOilBucket(UniversalElectricity.CONFIGURATION.getItem("Oil Bucket", ITEM_ID_PREFIX + 4).getInt(), 4);
public static Item itemTank = new ItemTank(UniversalElectricity.CONFIGURATION.getItem("TankItem", ITEM_ID_PREFIX + 5).getInt());
public static Item parts;
public static Item itemPipes;
public static Item gauge;
public static Item itemOilBucket;
public static Item itemTank;
// mod stuff
@SidedProxy(clientSide = "dark.BasicUtilities.BPClientProxy", serverSide = "dark.BasicUtilities.BPCommonProxy")
public static BPCommonProxy proxy;
@ -112,6 +106,9 @@ public class BasicUtilitiesMain extends DummyModContainer
{
instance = this;
proxy.preInit();
this.loadConfig();
// block registry
GameRegistry.registerBlock(pipe, "multi pipe");
GameRegistry.registerBlock(eValve, ItemEValve.class, "eValve");
GameRegistry.registerBlock(rod, "mech rod");
@ -284,4 +281,33 @@ public class BasicUtilitiesMain extends DummyModContainer
'V', new ItemStack(parts, 1, basicParts.Valve.ordinal()), });
}
}
public void loadConfig()
{
CONFIGURATION.load();
// blocks
pipe = new BlockPipe(this.CONFIGURATION.getBlock("Pipe", BLOCK_ID_PREFIX).getInt());
machine = new BlockMachine(this.CONFIGURATION.getBlock("MachineSetOne", BLOCK_ID_PREFIX + 1).getInt());
// valve = new BlockValve(this.CONFIGURATION.getBlock("Valve",
// BLOCK_ID_PREFIX + 2).getInt());
rod = new BlockRod(this.CONFIGURATION.getBlock("MechanicalRod", BLOCK_ID_PREFIX + 3).getInt());
generator = new BlockGenerator((this.CONFIGURATION.getBlock("UEGenerator", BLOCK_ID_PREFIX + 4).getInt()));
eValve = new BlockEValve((this.CONFIGURATION.getBlock("EValve", BLOCK_ID_PREFIX + 5).getInt()));
// Liquid Blocks
SteamBlock = new BlockSteam(this.CONFIGURATION.getBlock("SteamBlock", LIQUID_ID_PREFIX).getInt());
oilMoving = new BlockOilFlowing(this.CONFIGURATION.getBlock("Oil_FlowingBU", LIQUID_ID_PREFIX + 1).getInt());
oilStill = new BlockOilStill(this.CONFIGURATION.getBlock("Oil_StillBU", LIQUID_ID_PREFIX + 2).getInt());
// Items
parts = new ItemParts(this.CONFIGURATION.getItem("Parts", ITEM_ID_PREFIX).getInt());
itemPipes = new ItemPipe(this.CONFIGURATION.getItem("PipeItem", ITEM_ID_PREFIX + 1).getInt());
// +2 saved for Valve item
gauge = new ItemGuage(this.CONFIGURATION.getItem("PipeGuage", ITEM_ID_PREFIX + 3).getInt());
itemOilBucket = new ItemOilBucket(this.CONFIGURATION.getItem("Oil Bucket", ITEM_ID_PREFIX + 4).getInt(), 4);
itemTank = new ItemTank(this.CONFIGURATION.getItem("TankItem", ITEM_ID_PREFIX + 5).getInt());
// lqiuid registry
Steam = LiquidDictionary.getOrCreateLiquid("Steam", new LiquidStack(SteamBlock, LiquidContainerRegistry.BUCKET_VOLUME));
CONFIGURATION.save();
}
}

View file

@ -31,6 +31,7 @@ import dark.BasicUtilities.BasicUtilitiesMain;
import dark.BasicUtilities.api.IReadOut;
import dark.BasicUtilities.api.ITankOutputer;
import dark.BasicUtilities.api.Liquid;
import dark.Library.Util.MetaGroupingHelper;
public class TileEntityPump extends TileEntityElectricityReceiver implements IPacketReceiver, IReadOut, ITankOutputer
{
@ -48,9 +49,26 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
@Override
public void initiate()
{
ElectricityConnections.registerConnector(this, EnumSet.of(ForgeDirection.getOrientation(this.getBlockMetadata() + 2)));
this.registerConnections();
this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, BasicUtilitiesMain.machine.blockID);
}
//ElectricityConnections.registerConnector(this, EnumSet.of(ForgeDirection.getOrientation(this.getBlockMetadata() - BlockBasicMachine.BATTERY_BOX_METADATA + 2), ForgeDirection.getOrientation(this.getBlockMetadata() - BlockBasicMachine.BATTERY_BOX_METADATA + 2).getOpposite()));
public void registerConnections()
{
int notchMeta = MetaGroupingHelper.getFacingMeta(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
ForgeDirection facing = ForgeDirection.getOrientation(notchMeta).getOpposite();
ForgeDirection[] dirs = new ForgeDirection[]{ForgeDirection.UNKNOWN,ForgeDirection.UNKNOWN,ForgeDirection.UNKNOWN,ForgeDirection.UNKNOWN,ForgeDirection.UNKNOWN,ForgeDirection.UNKNOWN};
ElectricityConnections.registerConnector(this, EnumSet.of(facing.getOpposite()));
for(int i = 2; i<6;i++)
{
ForgeDirection dir = ForgeDirection.getOrientation(i);
if(dir != facing)
{
dirs[i] = dir;
}
}
ElectricityConnections.registerConnector(this, EnumSet.of(dirs[0],dirs[1],dirs[2],dirs[3],dirs[4],dirs[5]));
}
@Override
public void onDisable(int duration)
@ -118,7 +136,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
if (network != null)
{
if (this.canPump(xCoord,yCoord-1,zCoord))
if (this.canPump(xCoord, yCoord - 1, zCoord))
{
network.startRequesting(this, WATTS_PER_TICK / this.getVoltage(), this.getVoltage());
this.joulesReceived = Math.max(Math.min(this.joulesReceived + network.consumeElectricity(this).getWatts(), WATTS_PER_TICK), 0);
@ -128,7 +146,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
network.stopRequesting(this);
}
}
if (this.joulesReceived >= this.WATTS_PER_TICK - 50 && this.canPump(xCoord,yCoord-1,zCoord))
if (this.joulesReceived >= this.WATTS_PER_TICK - 50 && this.canPump(xCoord, yCoord - 1, zCoord))
{
joulesReceived -= this.WATTS_PER_TICK;
@ -154,7 +172,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
// if (this.tank.getLiquid() == null) return false;
if (this.tank.getLiquid() != null && this.tank.getLiquid().amount >= this.wMax) return false;
if (this.isDisabled()) return false;
if(!this.isValidLiquid(Block.blocksList[worldObj.getBlockId(x, y, z)])) return false;
if (!this.isValidLiquid(Block.blocksList[worldObj.getBlockId(x, y, z)])) return false;
return true;
}
@ -169,11 +187,11 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
int bBlock = worldObj.getBlockId(loc.intX(), loc.intY(), loc.intZ());
int meta = worldObj.getBlockMetadata(loc.intX(), loc.intY(), loc.intZ());
Liquid bellow = Liquid.getLiquidTypeByBlock(bBlock);
if(bBlock == Block.waterMoving.blockID ||(bBlock == Block.waterStill.blockID && meta != 0)) return false;
if(bBlock == Block.lavaMoving.blockID ||(bBlock == Block.lavaStill.blockID && meta != 0)) return false;
if (bBlock == Block.waterMoving.blockID || (bBlock == Block.waterStill.blockID && meta != 0)) return false;
if (bBlock == Block.lavaMoving.blockID || (bBlock == Block.lavaStill.blockID && meta != 0)) return false;
if (bBlock == type.liquid.itemID && this.isValidLiquid(Block.blocksList[bBlock]))
{
FMLLog.info("pumping "+bellow.displayerName+" blockID:"+bBlock+" Meta:"+meta);
FMLLog.info("pumping " + bellow.displayerName + " blockID:" + bBlock + " Meta:" + meta);
int f = this.tank.fill(Liquid.getStack(this.type, LiquidContainerRegistry.BUCKET_VOLUME), true);
if (f > 0) worldObj.setBlockWithNotify(loc.intX(), loc.intY(), loc.intZ(), 0);
percentPumped = 0;
@ -292,9 +310,8 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
private boolean isValidLiquid(Block block)
{
if(block == null) return false;
if (block == null) return false;
return Liquid.getLiquidFromBlock(block.blockID) != null;
}
}

View file

@ -88,7 +88,7 @@ public class TileEntityRod extends TileEntity implements IPacketReceiver, IForce
{
Packet packet = PacketManager.getPacket(BasicUtilitiesMain.CHANNEL, this, new Object[]
{ force });
PacketManager.sendPacketToClients(packet, worldObj, Vector3.get(this), 40);
PacketManager.sendPacketToClients(packet, worldObj, new Vector3(this), 40);
}
this.pForce = this.force;
}