fix retarted teavm String.format bug & clean up stuff

This commit is contained in:
ayunami2000 2022-08-24 20:07:36 -04:00
parent d1daef0c41
commit dc4fec1aaf
11 changed files with 14812 additions and 14801 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1276,8 +1276,8 @@ commands.generic.notFound=Unknown command. Try /help for a list of commands.
commands.generic.num.invalid='%s' is not a valid number commands.generic.num.invalid='%s' is not a valid number
commands.generic.num.tooSmall=The number you have entered (%d) is too small, it must be at least %d commands.generic.num.tooSmall=The number you have entered (%d) is too small, it must be at least %d
commands.generic.num.tooBig=The number you have entered (%d) is too big, it must be at most %d commands.generic.num.tooBig=The number you have entered (%d) is too big, it must be at most %d
commands.generic.double.tooSmall=The number you have entered (%.2f) is too small, it must be at least %.2f commands.generic.double.tooSmall=The number you have entered (%s) is too small, it must be at least %s
commands.generic.double.tooBig=The number you have entered (%.2f) is too big, it must be at most %.2f commands.generic.double.tooBig=The number you have entered (%s) is too big, it must be at most %s
commands.generic.usage=Usage: %s commands.generic.usage=Usage: %s
commands.xp.failure.widthdrawXp=Cannot give player negative experience points commands.xp.failure.widthdrawXp=Cannot give player negative experience points
@ -1339,7 +1339,7 @@ commands.save.flushStart=Flushing all saves...
commands.save.flushEnd=Flushing completed commands.save.flushEnd=Flushing completed
commands.stop.start=Stopping the server commands.stop.start=Stopping the server
commands.tp.success=Teleported %s to %s commands.tp.success=Teleported %s to %s
commands.tp.success.coordinates=Teleported %s to %.2f,%.2f,%.2f commands.tp.success.coordinates=Teleported %s to %s,%s,%s
commands.tp.usage=/tp [target player] <destination player> OR /tp [target player] <x> <y> <z> commands.tp.usage=/tp [target player] <destination player> OR /tp [target player] <x> <y> <z>
commands.tp.notSameDimension=Unable to teleport because players are not in the same dimension commands.tp.notSameDimension=Unable to teleport because players are not in the same dimension
commands.whitelist.list=There are %d (out of %d seen) whitelisted players: commands.whitelist.list=There are %d (out of %d seen) whitelisted players:
@ -1423,7 +1423,7 @@ commands.help.usage=/help [page|command name]
commands.publish.started=Local game hosted on %s commands.publish.started=Local game hosted on %s
commands.publish.failed=Unable to host local game commands.publish.failed=Unable to host local game
commands.debug.start=Started debug profiling commands.debug.start=Started debug profiling
commands.debug.stop=Stopped debug profiling after %.2f seconds (%d ticks) commands.debug.stop=Stopped debug profiling after %s seconds (%d ticks)
commands.debug.notStarted=Can't stop profiling when we haven't started yet! commands.debug.notStarted=Can't stop profiling when we haven't started yet!
commands.debug.usage=/debug <start|stop> commands.debug.usage=/debug <start|stop>
commands.message.usage=/tell <player> <private message ...> commands.message.usage=/tell <player> <private message ...>

View File

@ -32,6 +32,7 @@ public class EAGMinecraftServer extends MinecraftServer {
this.setCanSpawnAnimals(true); this.setCanSpawnAnimals(true);
this.setCanSpawnNPCs(true); this.setCanSpawnNPCs(true);
this.setAllowPvp(true); this.setAllowPvp(true);
this.setAllowFlight(true);
} }
public void mainLoop() { public void mainLoop() {

View File

@ -15,6 +15,7 @@ import net.minecraft.src.NetHandler;
import net.minecraft.src.NetLoginHandler; import net.minecraft.src.NetLoginHandler;
import net.minecraft.src.NetServerHandler; import net.minecraft.src.NetServerHandler;
import net.minecraft.src.Packet; import net.minecraft.src.Packet;
import net.minecraft.src.Packet204ClientInfo;
public class WorkerNetworkManager implements INetworkManager { public class WorkerNetworkManager implements INetworkManager {
@ -94,13 +95,8 @@ public class WorkerNetworkManager implements INetworkManager {
//System.out.println("[Server][" + ipcChannel + "]: packet '" + pkt.getClass().getSimpleName() + "' recieved"); //System.out.println("[Server][" + ipcChannel + "]: packet '" + pkt.getClass().getSimpleName() + "' recieved");
try {
try { try {
pkt.processPacket(theNetHandler); pkt.processPacket(theNetHandler);
} catch (UnknownFormatConversionException breuh) {
System.err.println("!!! 0x" + Integer.toHexString(pkt.getPacketId()) + " class '" + pkt.getClass().getSimpleName() + "' channel 'NET|" + ipcChannel + "' " + breuh.getMessage() + " !!!");
breuh.printStackTrace();
}
}catch(Throwable t) { }catch(Throwable t) {
System.err.println("Could not process minecraft packet 0x" + Integer.toHexString(pkt.getPacketId()) + " class '" + pkt.getClass().getSimpleName() + "' on channel 'NET|" + ipcChannel + "'"); System.err.println("Could not process minecraft packet 0x" + Integer.toHexString(pkt.getPacketId()) + " class '" + pkt.getClass().getSimpleName() + "' on channel 'NET|" + ipcChannel + "'");
t.printStackTrace(); t.printStackTrace();

View File

@ -44,7 +44,7 @@ public class CommandDebug extends CommandBase {
this.saveProfilerResults(var6, var8); this.saveProfilerResults(var6, var8);
MinecraftServer.getServer().theProfiler.profilingEnabled = false; MinecraftServer.getServer().theProfiler.profilingEnabled = false;
notifyAdmins(par1ICommandSender, "commands.debug.stop", notifyAdmins(par1ICommandSender, "commands.debug.stop",
new Object[] { Float.valueOf((float) var6 / 1000.0F), Integer.valueOf(var8) }); new Object[] { Float.valueOf(var6 / 1000.0F), Integer.valueOf(var8) });
return; return;
} }
} }
@ -79,7 +79,7 @@ public class CommandDebug extends CommandBase {
var4.append("Time span: ").append(par1).append(" ms\n"); var4.append("Time span: ").append(par1).append(" ms\n");
var4.append("Tick span: ").append(par3).append(" ticks\n"); var4.append("Tick span: ").append(par3).append(" ticks\n");
var4.append("// This is approximately ") var4.append("// This is approximately ")
.append(String.format("%.2f", new Object[] { Float.valueOf((float) par3 / ((float) par1 / 1000.0F)) })) .append(String.format("%s", new Object[] { Float.valueOf((float) par3 / ((float) par1 / 1000.0F)) }))
.append(" ticks per second. It should be ").append(20).append(" ticks per second\n\n"); .append(" ticks per second. It should be ").append(20).append(" ticks per second\n\n");
var4.append("--- BEGIN PROFILE DUMP ---\n\n"); var4.append("--- BEGIN PROFILE DUMP ---\n\n");
this.getProfileDump(0, "root", var4); this.getProfileDump(0, "root", var4);
@ -93,7 +93,7 @@ public class CommandDebug extends CommandBase {
if (var4 != null && var4.size() >= 3) { if (var4 != null && var4.size() >= 3) {
for (int var5 = 1; var5 < var4.size(); ++var5) { for (int var5 = 1; var5 < var4.size(); ++var5) {
ProfilerResult var6 = (ProfilerResult) var4.get(var5); ProfilerResult var6 = (ProfilerResult) var4.get(var5);
par3StringBuilder.append(String.format("[%02d] ", new Object[] { Integer.valueOf(par1) })); par3StringBuilder.append(String.format("[%d] ", new Object[] { Integer.valueOf(par1) }));
for (int var7 = 0; var7 < par1; ++var7) { for (int var7 = 0; var7 < par1; ++var7) {
par3StringBuilder.append(" "); par3StringBuilder.append(" ");
@ -101,9 +101,9 @@ public class CommandDebug extends CommandBase {
par3StringBuilder.append(var6.field_76331_c); par3StringBuilder.append(var6.field_76331_c);
par3StringBuilder.append(" - "); par3StringBuilder.append(" - ");
par3StringBuilder.append(String.format("%.2f", new Object[] { Double.valueOf(var6.field_76332_a) })); par3StringBuilder.append(String.format("%s", new Object[] { Double.valueOf(var6.field_76332_a) }));
par3StringBuilder.append("%/"); par3StringBuilder.append("%/");
par3StringBuilder.append(String.format("%.2f", new Object[] { Double.valueOf(var6.field_76330_b) })); par3StringBuilder.append(String.format("%s", new Object[] { Double.valueOf(var6.field_76330_b) }));
par3StringBuilder.append("%\n"); par3StringBuilder.append("%\n");
if (!var6.field_76331_c.equals("unspecified")) { if (!var6.field_76331_c.equals("unspecified")) {

View File

@ -1865,7 +1865,7 @@ public abstract class Entity {
} }
public String toString() { public String toString() {
return String.format("%s[\'%s\'/%d, l=\'%s\', x=%.2f, y=%.2f, z=%.2f]", return String.format("%s[\'%s\'/%d, l=\'%s\', x=%s, y=%s, z=%s]",
new Object[] { this.getClass().getSimpleName(), this.getEntityName(), Integer.valueOf(this.entityId), new Object[] { this.getClass().getSimpleName(), this.getEntityName(), Integer.valueOf(this.entityId),
this.worldObj == null ? "~NULL~" : this.worldObj.getWorldInfo().getWorldName(), this.worldObj == null ? "~NULL~" : this.worldObj.getWorldInfo().getWorldName(),
Double.valueOf(this.posX), Double.valueOf(this.posY), Double.valueOf(this.posZ) }); Double.valueOf(this.posX), Double.valueOf(this.posY), Double.valueOf(this.posZ) });

View File

@ -33,8 +33,13 @@ class PlayerInstance {
*/ */
public void addPlayer(EntityPlayerMP par1EntityPlayerMP) { public void addPlayer(EntityPlayerMP par1EntityPlayerMP) {
if (this.players.contains(par1EntityPlayerMP)) { if (this.players.contains(par1EntityPlayerMP)) {
// fuck you teavm...
/*
throw new IllegalStateException("Failed to add player. " + par1EntityPlayerMP + " already is in chunk " throw new IllegalStateException("Failed to add player. " + par1EntityPlayerMP + " already is in chunk "
+ this.currentChunk.chunkXPos + ", " + this.currentChunk.chunkZPos); + this.currentChunk.chunkXPos + ", " + this.currentChunk.chunkZPos);
*/
this.thePlayerManager.getMinecraftServer().getWorldLogAgent().logSevere("Failed to add player. " + par1EntityPlayerMP + " already is in chunk "
+ this.currentChunk.chunkXPos + ", " + this.currentChunk.chunkZPos);
} else { } else {
this.players.add(par1EntityPlayerMP); this.players.add(par1EntityPlayerMP);
par1EntityPlayerMP.loadedChunks.add(this.currentChunk); par1EntityPlayerMP.loadedChunks.add(this.currentChunk);

View File

@ -127,7 +127,9 @@ public class PlayerManager {
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) {
PlayerInstance pi = this.getPlayerInstance(var4, var5, true); PlayerInstance pi = this.getPlayerInstance(var4, var5, true);
if (!pi.hasPlayer(par1EntityPlayerMP)) {
pi.addPlayer(par1EntityPlayerMP); pi.addPlayer(par1EntityPlayerMP);
}
if(!playerInstancesToUpdate.contains(pi)) { if(!playerInstancesToUpdate.contains(pi)) {
playerInstancesToUpdate.add(pi); playerInstancesToUpdate.add(pi);
} }

View File

@ -286,6 +286,12 @@ public class ServerConfigurationManager {
* Called on render distance change * Called on render distance change
*/ */
public void updateOnRenderDistanceChange(EntityPlayerMP par1EntityPlayerMP) { public void updateOnRenderDistanceChange(EntityPlayerMP par1EntityPlayerMP) {
double posX = par1EntityPlayerMP.posX;
double posY = par1EntityPlayerMP.posY;
double posZ = par1EntityPlayerMP.posZ;
float rotationYaw = par1EntityPlayerMP.rotationYaw;
float rotationPitch = par1EntityPlayerMP.rotationPitch;
par1EntityPlayerMP.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(par1EntityPlayerMP, true); par1EntityPlayerMP.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(par1EntityPlayerMP, true);
par1EntityPlayerMP.getServerForPlayer().getEntityTracker().untrackEntity(par1EntityPlayerMP, true); par1EntityPlayerMP.getServerForPlayer().getEntityTracker().untrackEntity(par1EntityPlayerMP, true);
par1EntityPlayerMP.getServerForPlayer().getPlayerManager().removePlayer(par1EntityPlayerMP); par1EntityPlayerMP.getServerForPlayer().getPlayerManager().removePlayer(par1EntityPlayerMP);
@ -293,7 +299,7 @@ public class ServerConfigurationManager {
WorldServer var8 = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension); WorldServer var8 = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension);
par1EntityPlayerMP.setLocationAndAngles(par1EntityPlayerMP.posX, par1EntityPlayerMP.posY, par1EntityPlayerMP.posZ, par1EntityPlayerMP.rotationYaw, par1EntityPlayerMP.rotationPitch); par1EntityPlayerMP.setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch);
var8.theChunkProviderServer.loadChunk((int) par1EntityPlayerMP.posX >> 4, (int) par1EntityPlayerMP.posZ >> 4); var8.theChunkProviderServer.loadChunk((int) par1EntityPlayerMP.posX >> 4, (int) par1EntityPlayerMP.posZ >> 4);
@ -302,13 +308,12 @@ public class ServerConfigurationManager {
par1EntityPlayerMP.playerNetServerHandler.sendPacket(new Packet9Respawn(((par1EntityPlayerMP.dimension + 2) % 3) - 1, par1EntityPlayerMP.playerNetServerHandler.sendPacket(new Packet9Respawn(((par1EntityPlayerMP.dimension + 2) % 3) - 1,
(byte) par1EntityPlayerMP.worldObj.difficultySetting, par1EntityPlayerMP.worldObj.getWorldInfo().getTerrainType(), (byte) par1EntityPlayerMP.worldObj.difficultySetting, par1EntityPlayerMP.worldObj.getWorldInfo().getTerrainType(),
par1EntityPlayerMP.worldObj.getHeight(), par1EntityPlayerMP.theItemInWorldManager.getGameType())); par1EntityPlayerMP.worldObj.getHeight(), par1EntityPlayerMP.theItemInWorldManager.getGameType()));
par1EntityPlayerMP.playerNetServerHandler.setPlayerLocation(par1EntityPlayerMP.posX, par1EntityPlayerMP.posY, par1EntityPlayerMP.posZ, par1EntityPlayerMP.rotationYaw, par1EntityPlayerMP.playerNetServerHandler.setPlayerLocation(posX, posY, posZ, rotationYaw, rotationPitch);
par1EntityPlayerMP.rotationPitch);
par1EntityPlayerMP.playerNetServerHandler.sendPacket(new Packet9Respawn(par1EntityPlayerMP.dimension, par1EntityPlayerMP.playerNetServerHandler.sendPacket(new Packet9Respawn(par1EntityPlayerMP.dimension,
(byte) par1EntityPlayerMP.worldObj.difficultySetting, par1EntityPlayerMP.worldObj.getWorldInfo().getTerrainType(), (byte) par1EntityPlayerMP.worldObj.difficultySetting, par1EntityPlayerMP.worldObj.getWorldInfo().getTerrainType(),
par1EntityPlayerMP.worldObj.getHeight(), par1EntityPlayerMP.theItemInWorldManager.getGameType())); par1EntityPlayerMP.worldObj.getHeight(), par1EntityPlayerMP.theItemInWorldManager.getGameType()));
par1EntityPlayerMP.playerNetServerHandler.setPlayerLocation(par1EntityPlayerMP.posX, par1EntityPlayerMP.posY, par1EntityPlayerMP.posZ, par1EntityPlayerMP.rotationYaw, par1EntityPlayerMP.playerNetServerHandler.setPlayerLocation(posX, posY, posZ, rotationYaw, rotationPitch);
par1EntityPlayerMP.rotationPitch);
this.updateTimeAndWeatherForPlayer(par1EntityPlayerMP, var8); this.updateTimeAndWeatherForPlayer(par1EntityPlayerMP, var8);
this.syncPlayerInventory(par1EntityPlayerMP); this.syncPlayerInventory(par1EntityPlayerMP);
Iterator var6 = par1EntityPlayerMP.getActivePotionEffects().iterator(); Iterator var6 = par1EntityPlayerMP.getActivePotionEffects().iterator();
@ -318,6 +323,7 @@ public class ServerConfigurationManager {
par1EntityPlayerMP.playerNetServerHandler par1EntityPlayerMP.playerNetServerHandler
.sendPacket(new Packet41EntityEffect(par1EntityPlayerMP.entityId, var7)); .sendPacket(new Packet41EntityEffect(par1EntityPlayerMP.entityId, var7));
} }
par1EntityPlayerMP.sendPlayerAbilities();
var8.getPlayerManager().addPlayer(par1EntityPlayerMP); var8.getPlayerManager().addPlayer(par1EntityPlayerMP);
par1EntityPlayerMP.getServerForPlayer().getEntityTracker().trackEntity(par1EntityPlayerMP); par1EntityPlayerMP.getServerForPlayer().getEntityTracker().trackEntity(par1EntityPlayerMP);
this.playerEntityList.add(par1EntityPlayerMP); this.playerEntityList.add(par1EntityPlayerMP);