Bridging gap between old and new versions of Update Checker

This commit is contained in:
Ellpeck 2015-10-28 18:36:34 +01:00
parent b1d070595b
commit dc6e0b05be
5 changed files with 8 additions and 13 deletions

View file

@ -16,7 +16,6 @@ import ellpeck.actuallyadditions.util.WorldPos;
import ellpeck.actuallyadditions.util.WorldUtil; import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Vec3;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList; import java.util.ArrayList;
@ -123,7 +122,7 @@ public class LaserRelayConnectionHandler{
* (Puts it into the correct network!) * (Puts it into the correct network!)
*/ */
public boolean addConnection(WorldPos firstRelay, WorldPos secondRelay){ public boolean addConnection(WorldPos firstRelay, WorldPos secondRelay){
int distance = (int)Vec3.createVectorHelper(firstRelay.getX(), firstRelay.getY(), firstRelay.getZ()).distanceTo(Vec3.createVectorHelper(secondRelay.getX(), secondRelay.getY(), secondRelay.getZ())); int distance = (int)firstRelay.toVec().distanceTo(secondRelay.toVec());
if(distance > 15 || firstRelay.isEqual(secondRelay) || firstRelay.getWorld() != secondRelay.getWorld()){ if(distance > 15 || firstRelay.isEqual(secondRelay) || firstRelay.getWorld() != secondRelay.getWorld()){
return false; return false;
} }

View file

@ -28,22 +28,16 @@ public class ThreadUpdateChecker extends Thread{
public void run(){ public void run(){
ModUtil.LOGGER.info("Starting Update Check..."); ModUtil.LOGGER.info("Starting Update Check...");
try{ try{
URL newestURL = new URL("https://raw.githubusercontent.com/Ellpeck/ActuallyAdditions/master/update/newestVersion.txt"); URL newestURL = new URL("https://raw.githubusercontent.com/Ellpeck/ActuallyAdditions/master/update/updateVersion.txt");
BufferedReader newestReader = new BufferedReader(new InputStreamReader(newestURL.openStream())); BufferedReader newestReader = new BufferedReader(new InputStreamReader(newestURL.openStream()));
UpdateChecker.updateVersion = newestReader.readLine(); UpdateChecker.updateVersion = newestReader.readLine();
newestReader.close(); newestReader.close();
//Legacy Versions
if(!ModUtil.VERSION.contains("r")){
UpdateChecker.needsUpdateNotify = true;
}
else{
int updateVersion = Integer.parseInt(UpdateChecker.updateVersion.replace("-", "").replace(".", "").replace("r", "")); int updateVersion = Integer.parseInt(UpdateChecker.updateVersion.replace("-", "").replace(".", "").replace("r", ""));
int clientVersion = Integer.parseInt(ModUtil.VERSION.replace("-", "").replace(".", "").replace("r", "")); int clientVersion = Integer.parseInt(ModUtil.VERSION.replace("-", "").replace(".", "").replace("r", ""));
if(updateVersion > clientVersion){ if(updateVersion > clientVersion){
UpdateChecker.needsUpdateNotify = true; UpdateChecker.needsUpdateNotify = true;
} }
}
ModUtil.LOGGER.info("Update Check done!"); ModUtil.LOGGER.info("Update Check done!");
} }

1
update/changelog.txt Normal file
View file

@ -0,0 +1 @@
Laser Relays, out of Beta! +New Update Checker

View file

@ -1 +1 @@
1.7.10-0.0.9.4 1.7.10-1

1
update/updateVersion.txt Normal file
View file

@ -0,0 +1 @@
1.7.10-r1