improved chunk loading at low render distance
This commit is contained in:
parent
9a85b5e696
commit
82f79f658e
34323
javascript/classes.js
34323
javascript/classes.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -35,6 +35,7 @@ public class EAGMinecraftServer extends MinecraftServer {
|
||||||
|
|
||||||
public void mainLoop() {
|
public void mainLoop() {
|
||||||
if(paused && this.playersOnline.size() <= 1) {
|
if(paused && this.playersOnline.size() <= 1) {
|
||||||
|
lastTick = System.currentTimeMillis();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,11 +80,11 @@ public class IntegratedServer {
|
||||||
if(currentProcess != null) {
|
if(currentProcess != null) {
|
||||||
try {
|
try {
|
||||||
currentProcess.stopServer();
|
currentProcess.stopServer();
|
||||||
currentProcess = null;
|
|
||||||
}catch(Throwable t) {
|
}catch(Throwable t) {
|
||||||
System.err.println("Failed to stop server!");
|
System.err.println("Failed to stop server!");
|
||||||
throwExceptionToClient("Failed to stop server!", t);
|
throwExceptionToClient("Failed to stop server!", t);
|
||||||
}
|
}
|
||||||
|
currentProcess = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,6 +552,9 @@ public class IntegratedServer {
|
||||||
|
|
||||||
if(currentProcess != null) {
|
if(currentProcess != null) {
|
||||||
currentProcess.mainLoop();
|
currentProcess.mainLoop();
|
||||||
|
if(currentProcess.isServerStopped()) {
|
||||||
|
currentProcess = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,11 @@ package net.minecraft.server;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.lax1dude.eaglercraft.sp.IntegratedServer;
|
import net.lax1dude.eaglercraft.sp.IntegratedServer;
|
||||||
|
import net.lax1dude.eaglercraft.sp.SYS;
|
||||||
import net.lax1dude.eaglercraft.sp.WorkerListenThread;
|
import net.lax1dude.eaglercraft.sp.WorkerListenThread;
|
||||||
import net.lax1dude.eaglercraft.sp.VFSSaveHandler;
|
import net.lax1dude.eaglercraft.sp.VFSSaveHandler;
|
||||||
import net.lax1dude.eaglercraft.sp.VFile;
|
import net.lax1dude.eaglercraft.sp.VFile;
|
||||||
|
@ -217,6 +219,10 @@ public abstract class MinecraftServer implements ICommandSender, Runnable {
|
||||||
//this.setUserMessage("menu.generatingTerrain");
|
//this.setUserMessage("menu.generatingTerrain");
|
||||||
byte var6 = 0;
|
byte var6 = 0;
|
||||||
this.setUserMessage("Preparing start region for level " + var6);
|
this.setUserMessage("Preparing start region for level " + var6);
|
||||||
|
|
||||||
|
// Removed 'spawn chunks' for performance, they are unnecessary
|
||||||
|
|
||||||
|
/*
|
||||||
WorldServer var7 = this.worldServers[var6];
|
WorldServer var7 = this.worldServers[var6];
|
||||||
ChunkCoordinates var8 = var7.getSpawnPoint();
|
ChunkCoordinates var8 = var7.getSpawnPoint();
|
||||||
long var9 = System.currentTimeMillis();
|
long var9 = System.currentTimeMillis();
|
||||||
|
@ -236,7 +242,8 @@ public abstract class MinecraftServer implements ICommandSender, Runnable {
|
||||||
var7.theChunkProviderServer.loadChunk(var8.posX + var11 >> 4, var8.posZ + var12 >> 4);
|
var7.theChunkProviderServer.loadChunk(var8.posX + var11 >> 4, var8.posZ + var12 >> 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
this.clearCurrentTask();
|
this.clearCurrentTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,9 +457,10 @@ public abstract class MinecraftServer implements ICommandSender, Runnable {
|
||||||
|
|
||||||
++tpsCounter;
|
++tpsCounter;
|
||||||
long millis = System.currentTimeMillis();
|
long millis = System.currentTimeMillis();
|
||||||
if(millis - tpsTimer >= 1000l) {
|
long elapsed = millis - tpsTimer;
|
||||||
|
if(elapsed >= 1000l) {
|
||||||
tpsTimer = millis;
|
tpsTimer = millis;
|
||||||
tpsMeasure = tpsCounter;
|
tpsMeasure = (int)(tpsCounter * 1000l / elapsed);
|
||||||
IntegratedServer.sendIPCPacket(new IPCPacket14StringList(IPCPacket14StringList.SERVER_TPS, getTPSAndChunkBuffer()));
|
IntegratedServer.sendIPCPacket(new IPCPacket14StringList(IPCPacket14StringList.SERVER_TPS, getTPSAndChunkBuffer()));
|
||||||
tpsCounter = 0;
|
tpsCounter = 0;
|
||||||
}
|
}
|
||||||
|
@ -833,17 +841,12 @@ public abstract class MinecraftServer implements ICommandSender, Runnable {
|
||||||
throw new IllegalArgumentException("variable removed");
|
throw new IllegalArgumentException("variable removed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public ISaveFormat getActiveAnvilConverter() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WARNING : directly calls
|
* WARNING : directly calls
|
||||||
* getActiveAnvilConverter().deleteWorldDirectory(theWorldServer[0].getSaveHandler().getWorldDirectoryName());
|
* getActiveAnvilConverter().deleteWorldDirectory(theWorldServer[0].getSaveHandler().getWorldDirectoryName());
|
||||||
*/
|
*/
|
||||||
public void deleteWorldAndStopServer() {
|
public void deleteWorldAndStopServer() {
|
||||||
this.worldIsBeingDeleted = true;
|
this.worldIsBeingDeleted = true;
|
||||||
this.getActiveAnvilConverter().flushCache();
|
|
||||||
|
|
||||||
for (int var1 = 0; var1 < this.worldServers.length; ++var1) {
|
for (int var1 = 0; var1 < this.worldServers.length; ++var1) {
|
||||||
WorldServer var2 = this.worldServers[var1];
|
WorldServer var2 = this.worldServers[var1];
|
||||||
|
@ -852,9 +855,20 @@ public abstract class MinecraftServer implements ICommandSender, Runnable {
|
||||||
var2.flush();
|
var2.flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getActiveAnvilConverter()
|
String dir = this.worldServers[0].getSaveHandler().getWorldDirectoryName();
|
||||||
.deleteWorldDirectory(this.worldServers[0].getSaveHandler().getWorldDirectoryName());
|
SYS.VFS.deleteFiles(dir);
|
||||||
|
String[] worldsTxt = SYS.VFS.getFile("worlds.txt").getAllLines();
|
||||||
|
if(worldsTxt != null) {
|
||||||
|
LinkedList<String> newWorlds = new LinkedList();
|
||||||
|
for(String str : worldsTxt) {
|
||||||
|
if(!str.equalsIgnoreCase(dir)) {
|
||||||
|
newWorlds.add(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SYS.VFS.getFile("worlds.txt").setAllChars(String.join("\n", newWorlds));
|
||||||
|
}
|
||||||
|
|
||||||
this.initiateShutdown();
|
this.initiateShutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,8 +54,8 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
|
||||||
private int ticksOfInvuln = 60;
|
private int ticksOfInvuln = 60;
|
||||||
|
|
||||||
/** must be between 3>x>15 (strictly between) */
|
/** must be between 3>x>15 (strictly between) */
|
||||||
public int renderDistance = 0;
|
public int renderDistance = 4;
|
||||||
public int lastRenderDistance = 0;
|
public int lastRenderDistance = 4;
|
||||||
public int chatVisibility = 0;
|
public int chatVisibility = 0;
|
||||||
private boolean chatColours = true;
|
private boolean chatColours = true;
|
||||||
|
|
||||||
|
@ -82,7 +82,6 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
|
||||||
super(par2World);
|
super(par2World);
|
||||||
par4ItemInWorldManager.thisPlayerMP = this;
|
par4ItemInWorldManager.thisPlayerMP = this;
|
||||||
this.theItemInWorldManager = par4ItemInWorldManager;
|
this.theItemInWorldManager = par4ItemInWorldManager;
|
||||||
this.renderDistance = this.lastRenderDistance = par1MinecraftServer.getConfigurationManager().getViewDistance();
|
|
||||||
ChunkCoordinates var5 = par2World.getSpawnPoint();
|
ChunkCoordinates var5 = par2World.getSpawnPoint();
|
||||||
int var6 = var5.posX;
|
int var6 = var5.posX;
|
||||||
int var7 = var5.posZ;
|
int var7 = var5.posZ;
|
||||||
|
@ -817,6 +816,12 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
|
||||||
if (var2 > 3 && var2 < 15) {
|
if (var2 > 3 && var2 < 15) {
|
||||||
this.renderDistance = var2;
|
this.renderDistance = var2;
|
||||||
if(this.lastRenderDistance != this.renderDistance) {
|
if(this.lastRenderDistance != this.renderDistance) {
|
||||||
|
if(this.mcServer.isSinglePlayer() && this.mcServer.getServerOwner().equals(this.username)) {
|
||||||
|
for(int i = 0; i < this.mcServer.worldServers.length; ++i) {
|
||||||
|
this.mcServer.worldServers[i].getEntityTracker().setMainRenderDistance(
|
||||||
|
PlayerManager.getFurthestViewableBlock(this.renderDistance));
|
||||||
|
}
|
||||||
|
}
|
||||||
((WorldServer)this.worldObj).getPlayerManager().cycleRenderDistance(this);
|
((WorldServer)this.worldObj).getPlayerManager().cycleRenderDistance(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.minecraft.src;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class EntityTracker {
|
public class EntityTracker {
|
||||||
|
@ -22,6 +23,19 @@ public class EntityTracker {
|
||||||
this.maxTrackingDistanceThreshold = par1WorldServer.getMinecraftServer().getConfigurationManager()
|
this.maxTrackingDistanceThreshold = par1WorldServer.getMinecraftServer().getConfigurationManager()
|
||||||
.getEntityViewDistance();
|
.getEntityViewDistance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMainRenderDistance(int newDistance) {
|
||||||
|
if(this.maxTrackingDistanceThreshold != newDistance) {
|
||||||
|
this.maxTrackingDistanceThreshold = newDistance;
|
||||||
|
List currentTrackedEntities = new ArrayList();
|
||||||
|
currentTrackedEntities.addAll(trackedEntities);
|
||||||
|
for(int i = 0, l = currentTrackedEntities.size(); i < l; ++i) {
|
||||||
|
Entity et = (Entity) currentTrackedEntities.get(i);
|
||||||
|
untrackEntity(et);
|
||||||
|
trackEntity(et);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void trackEntity(Entity par1Entity) {
|
public void trackEntity(Entity par1Entity) {
|
||||||
if (par1Entity instanceof EntityPlayerMP) {
|
if (par1Entity instanceof EntityPlayerMP) {
|
||||||
|
|
|
@ -32,6 +32,8 @@ public class NetLoginHandler extends NetHandler {
|
||||||
|
|
||||||
private int hash = 0;
|
private int hash = 0;
|
||||||
private static int hashBase = 69696969;
|
private static int hashBase = 69696969;
|
||||||
|
|
||||||
|
private int viewDistance = 2;
|
||||||
|
|
||||||
public NetLoginHandler(MinecraftServer par1MinecraftServer, WorkerNetworkManager par2Socket) {
|
public NetLoginHandler(MinecraftServer par1MinecraftServer, WorkerNetworkManager par2Socket) {
|
||||||
this.mcServer = par1MinecraftServer;
|
this.mcServer = par1MinecraftServer;
|
||||||
|
@ -85,6 +87,7 @@ public class NetLoginHandler extends NetHandler {
|
||||||
|
|
||||||
public void handleClientProtocol(Packet2ClientProtocol par1Packet2ClientProtocol) {
|
public void handleClientProtocol(Packet2ClientProtocol par1Packet2ClientProtocol) {
|
||||||
this.clientUsername = par1Packet2ClientProtocol.getUsername();
|
this.clientUsername = par1Packet2ClientProtocol.getUsername();
|
||||||
|
this.viewDistance = par1Packet2ClientProtocol.getViewDistance();
|
||||||
System.out.println("[Server][HANDSHAKE][" + this.clientUsername + "]");
|
System.out.println("[Server][HANDSHAKE][" + this.clientUsername + "]");
|
||||||
|
|
||||||
if (!this.clientUsername.equals(StringUtils.stripControlCodes(this.clientUsername))) {
|
if (!this.clientUsername.equals(StringUtils.stripControlCodes(this.clientUsername))) {
|
||||||
|
@ -129,7 +132,7 @@ public class NetLoginHandler extends NetHandler {
|
||||||
this.kickUser(var1);
|
this.kickUser(var1);
|
||||||
} else {
|
} else {
|
||||||
EntityPlayerMP var2 = this.mcServer.getConfigurationManager().createPlayerForUser(this.clientUsername);
|
EntityPlayerMP var2 = this.mcServer.getConfigurationManager().createPlayerForUser(this.clientUsername);
|
||||||
|
var2.renderDistance = var2.lastRenderDistance = this.viewDistance;
|
||||||
if (var2 != null) {
|
if (var2 != null) {
|
||||||
this.mcServer.getConfigurationManager().initializeConnectionToPlayer(this.myTCPConnection, var2);
|
this.mcServer.getConfigurationManager().initializeConnectionToPlayer(this.myTCPConnection, var2);
|
||||||
}else {
|
}else {
|
||||||
|
|
|
@ -8,7 +8,7 @@ public class Packet2ClientProtocol extends Packet {
|
||||||
private int protocolVersion;
|
private int protocolVersion;
|
||||||
private String username;
|
private String username;
|
||||||
private String serverHost;
|
private String serverHost;
|
||||||
private int serverPort;
|
private int viewDistance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract. Reads the raw packet data from the data stream.
|
* Abstract. Reads the raw packet data from the data stream.
|
||||||
|
@ -17,7 +17,7 @@ public class Packet2ClientProtocol extends Packet {
|
||||||
this.protocolVersion = par1DataInputStream.readByte();
|
this.protocolVersion = par1DataInputStream.readByte();
|
||||||
this.username = readString(par1DataInputStream, 16);
|
this.username = readString(par1DataInputStream, 16);
|
||||||
this.serverHost = readString(par1DataInputStream, 255);
|
this.serverHost = readString(par1DataInputStream, 255);
|
||||||
this.serverPort = par1DataInputStream.readInt();
|
this.viewDistance = par1DataInputStream.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,7 +27,7 @@ public class Packet2ClientProtocol extends Packet {
|
||||||
par1DataOutputStream.writeByte(this.protocolVersion);
|
par1DataOutputStream.writeByte(this.protocolVersion);
|
||||||
writeString(this.username, par1DataOutputStream);
|
writeString(this.username, par1DataOutputStream);
|
||||||
writeString(this.serverHost, par1DataOutputStream);
|
writeString(this.serverHost, par1DataOutputStream);
|
||||||
par1DataOutputStream.writeInt(this.serverPort);
|
par1DataOutputStream.writeInt(this.viewDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,4 +57,9 @@ public class Packet2ClientProtocol extends Packet {
|
||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
return this.username;
|
return this.username;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getViewDistance() {
|
||||||
|
return this.viewDistance;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,9 +88,23 @@ public class PlayerManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cycleRenderDistance(EntityPlayerMP player) {
|
public void cycleRenderDistance(EntityPlayerMP player) {
|
||||||
//System.out.println("" + player.lastRenderDistance + " => " + player.renderDistance);
|
if(player.mcServer.getServerOwner().equals(player.username)) {
|
||||||
removePlayer(player);
|
cycleAllRenderDistance(player);
|
||||||
addPlayer(player);
|
}else {
|
||||||
|
removePlayer(player);
|
||||||
|
addPlayer(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cycleAllRenderDistance(EntityPlayerMP player) {
|
||||||
|
player.mcServer.getConfigurationManager().viewDistance = player.renderDistance;
|
||||||
|
List curList = new ArrayList();
|
||||||
|
curList.addAll(players);
|
||||||
|
for(int i = 0, l = curList.size(); i < l; ++i) {
|
||||||
|
EntityPlayerMP playerReload = (EntityPlayerMP)curList.get(i);
|
||||||
|
removePlayer(playerReload);
|
||||||
|
addPlayer(playerReload);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -103,9 +117,14 @@ public class PlayerManager {
|
||||||
par1EntityPlayerMP.managedPosZ = par1EntityPlayerMP.posZ;
|
par1EntityPlayerMP.managedPosZ = par1EntityPlayerMP.posZ;
|
||||||
|
|
||||||
int rd = par1EntityPlayerMP.lastRenderDistance = par1EntityPlayerMP.renderDistance;
|
int rd = par1EntityPlayerMP.lastRenderDistance = par1EntityPlayerMP.renderDistance;
|
||||||
|
|
||||||
for (int var4 = var2 - rd; var4 <= var2 + rd; ++var4) {
|
for (int var4 = var2 - rd; var4 <= var2 + rd; ++var4) {
|
||||||
for (int var5 = var3 - rd; var5 <= var3 + rd; ++var5) {
|
for (int var5 = var3 - rd; var5 <= var3 + rd; ++var5) {
|
||||||
this.getPlayerInstance(var4, var5, true).addPlayer(par1EntityPlayerMP);
|
PlayerInstance pi = this.getPlayerInstance(var4, var5, true);
|
||||||
|
pi.addPlayer(par1EntityPlayerMP);
|
||||||
|
if(!playerInstancesToUpdate.contains(pi)) {
|
||||||
|
playerInstancesToUpdate.add(pi);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,9 @@ public class ServerConfigurationManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initializeConnectionToPlayer(INetworkManager par1INetworkManager, EntityPlayerMP par2EntityPlayerMP) {
|
public void initializeConnectionToPlayer(INetworkManager par1INetworkManager, EntityPlayerMP par2EntityPlayerMP) {
|
||||||
|
if(par2EntityPlayerMP.username.equals(mcServer.getServerOwner())) {
|
||||||
|
viewDistance = par2EntityPlayerMP.renderDistance;
|
||||||
|
}
|
||||||
NBTTagCompound var3 = this.readPlayerDataFromFile(par2EntityPlayerMP);
|
NBTTagCompound var3 = this.readPlayerDataFromFile(par2EntityPlayerMP);
|
||||||
par2EntityPlayerMP.setWorld(this.mcServer.worldServerForDimension(par2EntityPlayerMP.dimension));
|
par2EntityPlayerMP.setWorld(this.mcServer.worldServerForDimension(par2EntityPlayerMP.dimension));
|
||||||
par2EntityPlayerMP.theItemInWorldManager.setWorld((WorldServer) par2EntityPlayerMP.worldObj);
|
par2EntityPlayerMP.theItemInWorldManager.setWorld((WorldServer) par2EntityPlayerMP.worldObj);
|
||||||
|
|
|
@ -41,14 +41,21 @@ public final class SpawnerAnimals {
|
||||||
int var7;
|
int var7;
|
||||||
|
|
||||||
for (var4 = 0; var4 < par0WorldServer.playerEntities.size(); ++var4) {
|
for (var4 = 0; var4 < par0WorldServer.playerEntities.size(); ++var4) {
|
||||||
EntityPlayer var5 = (EntityPlayer) par0WorldServer.playerEntities.get(var4);
|
EntityPlayerMP var5 = (EntityPlayerMP) par0WorldServer.playerEntities.get(var4);
|
||||||
int var6 = MathHelper.floor_double(var5.posX / 16.0D);
|
int var6 = MathHelper.floor_double(var5.posX / 16.0D);
|
||||||
var7 = MathHelper.floor_double(var5.posZ / 16.0D);
|
var7 = MathHelper.floor_double(var5.posZ / 16.0D);
|
||||||
byte var8 = 8;
|
int var8 = 8;
|
||||||
|
|
||||||
|
if(var5.renderDistance < var8) {
|
||||||
|
var8 = var5.renderDistance;
|
||||||
|
if(var8 < 4) {
|
||||||
|
var8 = 4;
|
||||||
|
} // TODO
|
||||||
|
}
|
||||||
|
|
||||||
for (int var9 = -var8; var9 <= var8; ++var9) {
|
for (int var9 = -var8; var9 <= var8; ++var9) {
|
||||||
for (int var10 = -var8; var10 <= var8; ++var10) {
|
for (int var10 = -var8; var10 <= var8; ++var10) {
|
||||||
boolean var11 = var9 == -var8 || var9 == var8 || var10 == -var8 || var10 == var8;
|
boolean var11 = var8 >= 8 && (var9 == -var8 || var9 == var8 || var10 == -var8 || var10 == var8);
|
||||||
ChunkCoordIntPair var12 = new ChunkCoordIntPair(var9 + var6, var10 + var7);
|
ChunkCoordIntPair var12 = new ChunkCoordIntPair(var9 + var6, var10 + var7);
|
||||||
|
|
||||||
if (!var11) {
|
if (!var11) {
|
||||||
|
@ -114,8 +121,8 @@ public final class SpawnerAnimals {
|
||||||
float var25 = (float) var19;
|
float var25 = (float) var19;
|
||||||
float var26 = (float) var20 + 0.5F;
|
float var26 = (float) var20 + 0.5F;
|
||||||
|
|
||||||
if (par0WorldServer.getClosestPlayer((double) var24, (double) var25,
|
if (par0WorldServer.getClosestPlayerForSpawning((double) var24,
|
||||||
(double) var26, 24.0D) == null) {
|
(double) var25, (double) var26) == null) {
|
||||||
float var27 = var24 - (float) var32.posX;
|
float var27 = var24 - (float) var32.posX;
|
||||||
float var28 = var25 - (float) var32.posY;
|
float var28 = var25 - (float) var32.posY;
|
||||||
float var29 = var26 - (float) var32.posZ;
|
float var29 = var26 - (float) var32.posZ;
|
||||||
|
|
|
@ -2168,16 +2168,20 @@ public abstract class World implements IBlockAccess {
|
||||||
this.activeChunkSet.clear();
|
this.activeChunkSet.clear();
|
||||||
this.theProfiler.startSection("buildList");
|
this.theProfiler.startSection("buildList");
|
||||||
int var1;
|
int var1;
|
||||||
EntityPlayer var2;
|
EntityPlayerMP var2;
|
||||||
int var3;
|
int var3;
|
||||||
int var4;
|
int var4;
|
||||||
|
|
||||||
for (var1 = 0; var1 < this.playerEntities.size(); ++var1) {
|
for (var1 = 0; var1 < this.playerEntities.size(); ++var1) {
|
||||||
var2 = (EntityPlayer) this.playerEntities.get(var1);
|
var2 = (EntityPlayerMP) this.playerEntities.get(var1);
|
||||||
var3 = MathHelper.floor_double(var2.posX / 16.0D);
|
var3 = MathHelper.floor_double(var2.posX / 16.0D);
|
||||||
var4 = MathHelper.floor_double(var2.posZ / 16.0D);
|
var4 = MathHelper.floor_double(var2.posZ / 16.0D);
|
||||||
byte var5 = 7;
|
int var5 = 7;
|
||||||
|
|
||||||
|
if(var2.renderDistance < var5) {
|
||||||
|
var5 = var2.renderDistance - 1;
|
||||||
|
}
|
||||||
|
|
||||||
for (int var6 = -var5; var6 <= var5; ++var6) {
|
for (int var6 = -var5; var6 <= var5; ++var6) {
|
||||||
for (int var7 = -var5; var7 <= var5; ++var7) {
|
for (int var7 = -var5; var7 <= var5; ++var7) {
|
||||||
this.activeChunkSet.add(new ChunkCoordIntPair(var6 + var3, var7 + var4));
|
this.activeChunkSet.add(new ChunkCoordIntPair(var6 + var3, var7 + var4));
|
||||||
|
@ -2195,7 +2199,7 @@ public abstract class World implements IBlockAccess {
|
||||||
|
|
||||||
if (!this.playerEntities.isEmpty()) {
|
if (!this.playerEntities.isEmpty()) {
|
||||||
var1 = this.rand.nextInt(this.playerEntities.size());
|
var1 = this.rand.nextInt(this.playerEntities.size());
|
||||||
var2 = (EntityPlayer) this.playerEntities.get(var1);
|
var2 = (EntityPlayerMP) this.playerEntities.get(var1);
|
||||||
var3 = MathHelper.floor_double(var2.posX) + this.rand.nextInt(11) - 5;
|
var3 = MathHelper.floor_double(var2.posX) + this.rand.nextInt(11) - 5;
|
||||||
var4 = MathHelper.floor_double(var2.posY) + this.rand.nextInt(11) - 5;
|
var4 = MathHelper.floor_double(var2.posY) + this.rand.nextInt(11) - 5;
|
||||||
int var8 = MathHelper.floor_double(var2.posZ) + this.rand.nextInt(11) - 5;
|
int var8 = MathHelper.floor_double(var2.posZ) + this.rand.nextInt(11) - 5;
|
||||||
|
@ -2838,6 +2842,24 @@ public abstract class World implements IBlockAccess {
|
||||||
|
|
||||||
return var11;
|
return var11;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityPlayer getClosestPlayerForSpawning(double par1, double par3, double par5) {
|
||||||
|
double var9 = -1.0D;
|
||||||
|
EntityPlayer var11 = null;
|
||||||
|
|
||||||
|
for (int var12 = 0; var12 < this.playerEntities.size(); ++var12) {
|
||||||
|
EntityPlayerMP var13 = (EntityPlayerMP) this.playerEntities.get(var12);
|
||||||
|
double var14 = var13.getDistanceSq(par1, par3, par5);
|
||||||
|
double par7 = (var13.renderDistance < 6) ? 16.0D : 24.0D;
|
||||||
|
|
||||||
|
if ((par7 < 0.0D || var14 < par7 * par7) && (var9 == -1.0D || var14 < var9)) {
|
||||||
|
var9 = var14;
|
||||||
|
var11 = var13;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return var11;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the closest vulnerable player to this entity within the given radius,
|
* Returns the closest vulnerable player to this entity within the given radius,
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class GuiScreenSingleplayerConnecting extends GuiScreen {
|
||||||
try {
|
try {
|
||||||
netHandler = new NetClientHandler(mc, EaglerProfile.username);
|
netHandler = new NetClientHandler(mc, EaglerProfile.username);
|
||||||
this.mc.setNetManager(netHandler.getNetManager());
|
this.mc.setNetManager(netHandler.getNetManager());
|
||||||
netHandler.addToSendQueue(new Packet2ClientProtocol(61, EaglerProfile.username, "127.0.0.1", 0));
|
netHandler.addToSendQueue(new Packet2ClientProtocol(61, EaglerProfile.username, "127.0.0.1", mc.gameSettings.renderDistance));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
this.mc.displayGuiScreen(new GuiDisconnected(this.menu, "connect.failed", "disconnect.genericReason", "could not create nethandler", ""));
|
this.mc.displayGuiScreen(new GuiDisconnected(this.menu, "connect.failed", "disconnect.genericReason", "could not create nethandler", ""));
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -110,7 +110,13 @@ public class GuiScreenSingleplayerLoading extends GuiScreen {
|
||||||
killTask.enabled = true;
|
killTask.enabled = true;
|
||||||
}
|
}
|
||||||
if(IntegratedServer.didLastCallFail()) {
|
if(IntegratedServer.didLastCallFail()) {
|
||||||
onException.accept(this, IntegratedServer.worldStatusErrors());
|
IPCPacket15ThrowException[] pk = IntegratedServer.worldStatusErrors();
|
||||||
|
if(pk != null) {
|
||||||
|
onException.accept(this, pk);
|
||||||
|
}else {
|
||||||
|
onException.accept(this, new IPCPacket15ThrowException[] { new IPCPacket15ThrowException("Server Crash: State '" +
|
||||||
|
IntegratedState.getStateName(IntegratedServer.statusState()) + "'", new String[0]) });
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(checkTaskComplete.getAsBoolean()) {
|
if(checkTaskComplete.getAsBoolean()) {
|
||||||
|
|
|
@ -145,7 +145,7 @@ public class GameSettings {
|
||||||
public GameSettings(Minecraft par1Minecraft) {
|
public GameSettings(Minecraft par1Minecraft) {
|
||||||
this.keyBindings = new KeyBinding[] { this.keyBindAttack, this.keyBindUseItem, this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump, this.keyBindSneak, this.keyBindDrop, this.keyBindInventory,
|
this.keyBindings = new KeyBinding[] { this.keyBindAttack, this.keyBindUseItem, this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump, this.keyBindSneak, this.keyBindDrop, this.keyBindInventory,
|
||||||
this.keyBindChat, this.keyBindPlayerList, this.keyBindPickBlock, this.keyBindSprint, this.keyBindZoom, this.keyBindFunction };
|
this.keyBindChat, this.keyBindPlayerList, this.keyBindPickBlock, this.keyBindSprint, this.keyBindZoom, this.keyBindFunction };
|
||||||
this.difficulty = 2;
|
this.difficulty = 1;
|
||||||
this.hideGUI = false;
|
this.hideGUI = false;
|
||||||
this.thirdPersonView = 0;
|
this.thirdPersonView = 0;
|
||||||
this.showDebugInfo = false;
|
this.showDebugInfo = false;
|
||||||
|
@ -538,6 +538,7 @@ public class GameSettings {
|
||||||
if(yee.hasKey("voiceSpeakVolume")) voiceSpeakVolume = yee.getFloat("voiceSpeakVolume");
|
if(yee.hasKey("voiceSpeakVolume")) voiceSpeakVolume = yee.getFloat("voiceSpeakVolume");
|
||||||
if(yee.hasKey("voicePTTKey")) voicePTTKey = yee.getInteger("voicePTTKey");
|
if(yee.hasKey("voicePTTKey")) voicePTTKey = yee.getInteger("voicePTTKey");
|
||||||
if(yee.hasKey("voiceListenRadius")) voiceListenRadius = yee.getInteger("voiceListenRadius");
|
if(yee.hasKey("voiceListenRadius")) voiceListenRadius = yee.getInteger("voiceListenRadius");
|
||||||
|
if(yee.hasKey("difficulty")) difficulty = yee.getByte("difficulty");
|
||||||
|
|
||||||
if(voiceListenRadius < 5) voiceListenRadius = 5;
|
if(voiceListenRadius < 5) voiceListenRadius = 5;
|
||||||
else if(voiceListenRadius > 22) voiceListenRadius = 22;
|
else if(voiceListenRadius > 22) voiceListenRadius = 22;
|
||||||
|
@ -612,6 +613,7 @@ public class GameSettings {
|
||||||
yee.setFloat("voiceSpeakVolume", voiceSpeakVolume);
|
yee.setFloat("voiceSpeakVolume", voiceSpeakVolume);
|
||||||
yee.setInteger("voicePTTKey", voicePTTKey);
|
yee.setInteger("voicePTTKey", voicePTTKey);
|
||||||
yee.setInteger("voiceListenRadius", voiceListenRadius);
|
yee.setInteger("voiceListenRadius", voiceListenRadius);
|
||||||
|
yee.setByte("difficulty", (byte)difficulty);
|
||||||
|
|
||||||
for (int var4 = 0; var4 < this.keyBindings.length; ++var4) {
|
for (int var4 = 0; var4 < this.keyBindings.length; ++var4) {
|
||||||
yee.setInteger(keyBindings[var4].keyDescription, keyBindings[var4].keyCode);
|
yee.setInteger(keyBindings[var4].keyDescription, keyBindings[var4].keyCode);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import net.lax1dude.eaglercraft.IntegratedServer;
|
||||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||||
import net.lax1dude.eaglercraft.Voice;
|
import net.lax1dude.eaglercraft.Voice;
|
||||||
import net.lax1dude.eaglercraft.WebsocketNetworkManager;
|
import net.lax1dude.eaglercraft.WebsocketNetworkManager;
|
||||||
|
import net.lax1dude.eaglercraft.WorkerNetworkManager;
|
||||||
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.RateLimit;
|
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.RateLimit;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
||||||
|
@ -89,14 +90,20 @@ public class NetClientHandler extends NetHandler {
|
||||||
this.worldClient = null;
|
this.worldClient = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private GuiScreen backToMenu() {
|
||||||
|
if(netManager instanceof WorkerNetworkManager) {
|
||||||
|
return new GuiMainMenu();
|
||||||
|
}else {
|
||||||
|
return new GuiMultiplayer(new GuiMainMenu());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Processes the packets that have been read since the last call to this
|
* Processes the packets that have been read since the last call to this
|
||||||
* function.
|
* function.
|
||||||
*/
|
*/
|
||||||
public void processReadPackets() {
|
public void processReadPackets() {
|
||||||
if (!this.disconnected && this.netManager != null) {
|
if (this.netManager != null) {
|
||||||
this.netManager.processReadPackets();
|
this.netManager.processReadPackets();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,18 +112,20 @@ public class NetClientHandler extends NetHandler {
|
||||||
RateLimit r = EaglerAdapter.getRateLimitStatus();
|
RateLimit r = EaglerAdapter.getRateLimitStatus();
|
||||||
if(r != null) {
|
if(r != null) {
|
||||||
if(r == RateLimit.NOW_LOCKED) {
|
if(r == RateLimit.NOW_LOCKED) {
|
||||||
this.mc.displayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.ratelimit.ipNowLocked", "disconnect.endOfStream", null));
|
this.mc.displayGuiScreen(new GuiDisconnected(backToMenu(), "disconnect.ratelimit.ipNowLocked", "disconnect.endOfStream", null));
|
||||||
}else if(r == RateLimit.LOCKED) {
|
}else if(r == RateLimit.LOCKED) {
|
||||||
this.mc.displayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.ratelimit.ipLocked", "disconnect.endOfStream", null));
|
this.mc.displayGuiScreen(new GuiDisconnected(backToMenu(), "disconnect.ratelimit.ipLocked", "disconnect.endOfStream", null));
|
||||||
}else if(r == RateLimit.BLOCKED) {
|
}else if(r == RateLimit.BLOCKED) {
|
||||||
this.mc.displayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.ratelimit.ipBlocked", "disconnect.endOfStream", null));
|
this.mc.displayGuiScreen(new GuiDisconnected(backToMenu(), "disconnect.ratelimit.ipBlocked", "disconnect.endOfStream", null));
|
||||||
}else if(r == RateLimit.FAILED_POSSIBLY_LOCKED) {
|
}else if(r == RateLimit.FAILED_POSSIBLY_LOCKED) {
|
||||||
this.mc.displayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.ratelimit.ipFailedPossiblyLocked", "disconnect.endOfStream", null));
|
this.mc.displayGuiScreen(new GuiDisconnected(backToMenu(), "disconnect.ratelimit.ipFailedPossiblyLocked", "disconnect.endOfStream", null));
|
||||||
}else {
|
}else {
|
||||||
this.mc.displayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.disconnected", "RateLimit." + r.name(), null));
|
this.mc.displayGuiScreen(new GuiDisconnected(backToMenu(), "disconnect.disconnected", "RateLimit." + r.name(), null));
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
this.mc.displayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.disconnected", "disconnect.endOfStream", null));
|
if(!(this.mc.currentScreen instanceof GuiDisconnected)) {
|
||||||
|
this.mc.displayGuiScreen(new GuiDisconnected(backToMenu(), "disconnect.disconnected", "disconnect.endOfStream", null));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.disconnected = true;
|
this.disconnected = true;
|
||||||
this.mc.loadWorld((WorldClient) null);
|
this.mc.loadWorld((WorldClient) null);
|
||||||
|
@ -496,12 +505,12 @@ public class NetClientHandler extends NetHandler {
|
||||||
this.mc.loadWorld((WorldClient) null);
|
this.mc.loadWorld((WorldClient) null);
|
||||||
if(par1Packet255KickDisconnect.reason.equalsIgnoreCase("BLOCKED")) {
|
if(par1Packet255KickDisconnect.reason.equalsIgnoreCase("BLOCKED")) {
|
||||||
EaglerAdapter.logRateLimit(netManager.getServerURI(), RateLimit.BLOCKED);
|
EaglerAdapter.logRateLimit(netManager.getServerURI(), RateLimit.BLOCKED);
|
||||||
this.mc.stopServerAndDisplayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.ratelimit.kickBlocked", "disconnect.endOfStream", (Object[])null));
|
this.mc.stopServerAndDisplayGuiScreen(new GuiDisconnected(backToMenu(), "disconnect.ratelimit.kickBlocked", "disconnect.endOfStream", (Object[])null));
|
||||||
}else if(par1Packet255KickDisconnect.reason.equalsIgnoreCase("LOCKED")) {
|
}else if(par1Packet255KickDisconnect.reason.equalsIgnoreCase("LOCKED")) {
|
||||||
EaglerAdapter.logRateLimit(netManager.getServerURI(), RateLimit.LOCKED);
|
EaglerAdapter.logRateLimit(netManager.getServerURI(), RateLimit.LOCKED);
|
||||||
this.mc.stopServerAndDisplayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.ratelimit.kickLocked", "disconnect.endOfStream", (Object[])null));
|
this.mc.stopServerAndDisplayGuiScreen(new GuiDisconnected(backToMenu(), "disconnect.ratelimit.kickLocked", "disconnect.endOfStream", (Object[])null));
|
||||||
}else {
|
}else {
|
||||||
this.mc.stopServerAndDisplayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.disconnected", "disconnect.genericReason", new Object[] { par1Packet255KickDisconnect.reason }));
|
this.mc.stopServerAndDisplayGuiScreen(new GuiDisconnected(backToMenu(), "disconnect.disconnected", "disconnect.genericReason", new Object[] { par1Packet255KickDisconnect.reason }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -509,7 +518,7 @@ public class NetClientHandler extends NetHandler {
|
||||||
if (!this.disconnected) {
|
if (!this.disconnected) {
|
||||||
this.disconnected = true;
|
this.disconnected = true;
|
||||||
this.mc.loadWorld((WorldClient) null);
|
this.mc.loadWorld((WorldClient) null);
|
||||||
this.mc.stopServerAndDisplayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.lost", par1Str, par2ArrayOfObj));
|
this.mc.stopServerAndDisplayGuiScreen(new GuiDisconnected(backToMenu(), "disconnect.lost", par1Str, par2ArrayOfObj));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user