Donator data is now pulled remotely, digital miner shouldn't halt the game anymore, fixed Electrolytic Separator issue. @pgatt, please test.
This commit is contained in:
parent
74e14284c7
commit
2ec88debdf
6 changed files with 45 additions and 42 deletions
|
@ -35,7 +35,8 @@ public class SalinationControllerRecipeHandler extends BaseRecipeHandler
|
||||||
public static int xOffset = 5;
|
public static int xOffset = 5;
|
||||||
public static int yOffset = 12;
|
public static int yOffset = 12;
|
||||||
|
|
||||||
static {
|
static
|
||||||
|
{
|
||||||
if(recipes.isEmpty())
|
if(recipes.isEmpty())
|
||||||
{
|
{
|
||||||
recipes.put(new FluidStack(FluidRegistry.WATER, 1), new FluidStack(FluidRegistry.getFluid("brine"), 1));
|
recipes.put(new FluidStack(FluidRegistry.WATER, 1), new FluidStack(FluidRegistry.getFluid("brine"), 1));
|
||||||
|
|
|
@ -1215,17 +1215,6 @@ public class Mekanism
|
||||||
PacketHandler.registerPacket(PacketConfigSync.class);
|
PacketHandler.registerPacket(PacketConfigSync.class);
|
||||||
PacketHandler.registerPacket(PacketBoxBlacklist.class);
|
PacketHandler.registerPacket(PacketBoxBlacklist.class);
|
||||||
|
|
||||||
//Donators
|
|
||||||
donators.add("mrgreaper");
|
|
||||||
donators.add("ejmiv89");
|
|
||||||
donators.add("Greylocke");
|
|
||||||
donators.add("darkphan");
|
|
||||||
donators.add("Nephatrine");
|
|
||||||
donators.add("SoldierW518");
|
|
||||||
donators.add("JamesNorth");
|
|
||||||
donators.add("Ozurian");
|
|
||||||
donators.add("Not_Steve");
|
|
||||||
|
|
||||||
//Load proxy
|
//Load proxy
|
||||||
proxy.registerRenderInformation();
|
proxy.registerRenderInformation();
|
||||||
proxy.loadUtilities();
|
proxy.loadUtilities();
|
||||||
|
|
|
@ -20,11 +20,7 @@ public class ThreadGetData extends Thread
|
||||||
{
|
{
|
||||||
Mekanism.latestVersionNumber = MekanismUtils.getLatestVersion();
|
Mekanism.latestVersionNumber = MekanismUtils.getLatestVersion();
|
||||||
Mekanism.recentNews = MekanismUtils.getRecentNews();
|
Mekanism.recentNews = MekanismUtils.getRecentNews();
|
||||||
System.out.println("[Mekanism] Successfully retrieved data from server.");
|
|
||||||
try {
|
MekanismUtils.updateDonators();
|
||||||
finalize();
|
|
||||||
} catch(Throwable t) {
|
|
||||||
System.out.println("[Mekanism] Unable to finalize server data.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,6 +160,11 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||||
int index = oresToMine.nextSetBit(next);
|
int index = oresToMine.nextSetBit(next);
|
||||||
Coord4D coord = getCoordFromIndex(index);
|
Coord4D coord = getCoordFromIndex(index);
|
||||||
|
|
||||||
|
if(index == -1)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if(!coord.exists(worldObj))
|
if(!coord.exists(worldObj))
|
||||||
{
|
{
|
||||||
next = index;
|
next = index;
|
||||||
|
@ -206,9 +211,9 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||||
worldObj.playAuxSFXAtEntity(null, 2001, coord.xCoord, coord.yCoord, coord.zCoord, id + (meta << 12));
|
worldObj.playAuxSFXAtEntity(null, 2001, coord.xCoord, coord.yCoord, coord.zCoord, id + (meta << 12));
|
||||||
|
|
||||||
delay = getDelay();
|
delay = getDelay();
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Integer i : toRemove)
|
for(Integer i : toRemove)
|
||||||
|
|
|
@ -63,9 +63,6 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
||||||
/** Type type of gas this block is dumping. */
|
/** Type type of gas this block is dumping. */
|
||||||
public boolean dumpRight = false;
|
public boolean dumpRight = false;
|
||||||
|
|
||||||
/** Whether to dump excess gas when a tank is full */
|
|
||||||
public boolean dumpExcess = true; // default to true until gui elements added
|
|
||||||
|
|
||||||
public TileEntityElectrolyticSeparator()
|
public TileEntityElectrolyticSeparator()
|
||||||
{
|
{
|
||||||
super("ElectrolyticSeparator", MachineType.ELECTROLYTIC_SEPARATOR.baseEnergy);
|
super("ElectrolyticSeparator", MachineType.ELECTROLYTIC_SEPARATOR.baseEnergy);
|
||||||
|
@ -202,11 +199,6 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
||||||
|
|
||||||
public boolean canFill(ChemicalPair gases)
|
public boolean canFill(ChemicalPair gases)
|
||||||
{
|
{
|
||||||
if(dumpExcess)
|
|
||||||
{
|
|
||||||
return leftTank.canReceiveType(gases.leftGas.getGas()) && rightTank.canReceiveType(gases.rightGas.getGas());
|
|
||||||
}
|
|
||||||
|
|
||||||
return (leftTank.canReceive(gases.leftGas.getGas()) && leftTank.getNeeded() >= gases.leftGas.amount
|
return (leftTank.canReceive(gases.leftGas.getGas()) && leftTank.getNeeded() >= gases.leftGas.amount
|
||||||
&& rightTank.canReceive(gases.rightGas.getGas()) && rightTank.getNeeded() >= gases.rightGas.amount);
|
&& rightTank.canReceive(gases.rightGas.getGas()) && rightTank.getNeeded() >= gases.rightGas.amount);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,8 @@ import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import mekanism.api.Coord4D;
|
import mekanism.api.Coord4D;
|
||||||
import mekanism.api.EnumColor;
|
import mekanism.api.EnumColor;
|
||||||
|
@ -26,9 +24,9 @@ import mekanism.common.IFactory.RecipeType;
|
||||||
import mekanism.common.IInvConfiguration;
|
import mekanism.common.IInvConfiguration;
|
||||||
import mekanism.common.IModule;
|
import mekanism.common.IModule;
|
||||||
import mekanism.common.IRedstoneControl;
|
import mekanism.common.IRedstoneControl;
|
||||||
import mekanism.common.OreDictCache;
|
|
||||||
import mekanism.common.IRedstoneControl.RedstoneControl;
|
import mekanism.common.IRedstoneControl.RedstoneControl;
|
||||||
import mekanism.common.Mekanism;
|
import mekanism.common.Mekanism;
|
||||||
|
import mekanism.common.OreDictCache;
|
||||||
import mekanism.common.PacketHandler;
|
import mekanism.common.PacketHandler;
|
||||||
import mekanism.common.PacketHandler.Transmission;
|
import mekanism.common.PacketHandler.Transmission;
|
||||||
import mekanism.common.Teleporter;
|
import mekanism.common.Teleporter;
|
||||||
|
@ -143,7 +141,7 @@ public final class MekanismUtils
|
||||||
*/
|
*/
|
||||||
public static String getLatestVersion()
|
public static String getLatestVersion()
|
||||||
{
|
{
|
||||||
String[] text = getHTML("http://dl.dropbox.com/u/90411166/Mod%20Versions/Mekanism.txt").split(":");
|
String[] text = merge(getHTML("http://dl.dropbox.com/u/90411166/Mod%20Versions/Mekanism.txt")).split(":");
|
||||||
if(!text[0].contains("UTF-8") && !text[0].contains("HTML") && !text[0].contains("http")) return text[0];
|
if(!text[0].contains("UTF-8") && !text[0].contains("HTML") && !text[0].contains("http")) return text[0];
|
||||||
return "null";
|
return "null";
|
||||||
}
|
}
|
||||||
|
@ -154,46 +152,68 @@ public final class MekanismUtils
|
||||||
*/
|
*/
|
||||||
public static String getRecentNews()
|
public static String getRecentNews()
|
||||||
{
|
{
|
||||||
String[] text = getHTML("http://dl.dropbox.com/u/90411166/Mod%20Versions/Mekanism.txt").split(":");
|
String[] text = merge(getHTML("http://dl.dropbox.com/u/90411166/Mod%20Versions/Mekanism.txt")).split(":");
|
||||||
if(text.length > 1 && !text[1].contains("UTF-8") && !text[1].contains("HTML") && !text[1].contains("http")) return text[1];
|
if(text.length > 1 && !text[1].contains("UTF-8") && !text[1].contains("HTML") && !text[1].contains("http")) return text[1];
|
||||||
return "null";
|
return "null";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void updateDonators()
|
||||||
|
{
|
||||||
|
Mekanism.donators.clear();
|
||||||
|
List<String> text = getHTML("http://dl.dropbox.com/u/90411166/Donators/Mekanism.txt");
|
||||||
|
|
||||||
|
for(String s : text)
|
||||||
|
{
|
||||||
|
Mekanism.donators.add(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns one line of HTML from the url.
|
* Returns one line of HTML from the url.
|
||||||
* @param urlToRead - URL to read from.
|
* @param urlToRead - URL to read from.
|
||||||
* @return HTML text from the url.
|
* @return HTML text from the url.
|
||||||
*/
|
*/
|
||||||
public static String getHTML(String urlToRead)
|
public static List<String> getHTML(String urlToRead)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
URL url;
|
URL url;
|
||||||
HttpURLConnection conn;
|
HttpURLConnection conn;
|
||||||
BufferedReader rd;
|
BufferedReader rd;
|
||||||
String line;
|
String line;
|
||||||
String result = "";
|
List<String> result = new ArrayList<String>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
url = new URL(urlToRead);
|
url = new URL(urlToRead);
|
||||||
conn = (HttpURLConnection) url.openConnection();
|
conn = (HttpURLConnection)url.openConnection();
|
||||||
conn.setRequestMethod("GET");
|
conn.setRequestMethod("GET");
|
||||||
rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||||
|
|
||||||
while((line = rd.readLine()) != null)
|
while((line = rd.readLine()) != null)
|
||||||
{
|
{
|
||||||
result += line;
|
result.add(line.trim());
|
||||||
sb.append(line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rd.close();
|
rd.close();
|
||||||
} catch (Exception e) {
|
} catch(Exception e) {
|
||||||
result = "null";
|
result.clear();
|
||||||
|
result.add("null");
|
||||||
System.err.println("[Mekanism] An error occured while connecting to URL '" + urlToRead + ".'");
|
System.err.println("[Mekanism] An error occured while connecting to URL '" + urlToRead + ".'");
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String merge(List<String> text)
|
||||||
|
{
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
|
for(String s : text)
|
||||||
|
{
|
||||||
|
builder.append(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a Packet3Chat packet to the defined player, with the defined message.
|
* Sends a Packet3Chat packet to the defined player, with the defined message.
|
||||||
* @param player - Player to send packet to.
|
* @param player - Player to send packet to.
|
||||||
|
|
Loading…
Reference in a new issue