mirror of
https://git.zelz.net/catfoolyou/Project164.git
synced 2025-12-14 08:47:40 +00:00
Remove garbage, fix imports
This commit is contained in:
@@ -13,7 +13,6 @@ import net.minecraft.src.AxisAlignedBB;
|
||||
import net.minecraft.src.ChunkCoordinates;
|
||||
import net.minecraft.src.CommandBase;
|
||||
import net.minecraft.src.ConvertingProgressUpdate;
|
||||
import net.minecraft.src.CrashReport;
|
||||
import net.minecraft.src.DispenserBehaviors;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.EnumGameType;
|
||||
@@ -24,13 +23,10 @@ import net.minecraft.src.IProgressUpdate;
|
||||
import net.minecraft.src.ISaveFormat;
|
||||
import net.minecraft.src.ISaveHandler;
|
||||
import net.minecraft.src.IUpdatePlayerListBox;
|
||||
import net.minecraft.src.MathHelper;
|
||||
import net.minecraft.src.MinecraftException;
|
||||
import net.minecraft.src.Packet;
|
||||
import net.minecraft.src.Packet4UpdateTime;
|
||||
import net.minecraft.src.Profiler;
|
||||
import net.minecraft.src.RConConsoleSource;
|
||||
import net.minecraft.src.ReportedException;
|
||||
import net.minecraft.src.ServerCommandManager;
|
||||
import net.minecraft.src.ServerConfigurationManager;
|
||||
import net.minecraft.src.World;
|
||||
@@ -462,38 +458,13 @@ public abstract class MinecraftServer implements ICommandSender, Runnable
|
||||
Thread.sleep(1L);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.finalTick((CrashReport)null);
|
||||
}
|
||||
}
|
||||
catch (Throwable var48)
|
||||
{
|
||||
var48.printStackTrace();
|
||||
this.getLogAgent().logSevereException("Encountered an unexpected exception " + var48.getClass().getSimpleName(), var48);
|
||||
CrashReport var2 = null;
|
||||
|
||||
if (var48 instanceof ReportedException)
|
||||
{
|
||||
var2 = this.addServerInfoToCrashReport(((ReportedException)var48).getCrashReport());
|
||||
}
|
||||
else
|
||||
{
|
||||
var2 = this.addServerInfoToCrashReport(new CrashReport("Exception in server tick loop", var48));
|
||||
}
|
||||
|
||||
File var3 = new File(new File(this.getDataDirectory(), "crash-reports"), "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-server.txt");
|
||||
|
||||
if (var2.saveToFile(var3, this.getLogAgent()))
|
||||
{
|
||||
this.getLogAgent().logSevere("This crash report has been saved to: " + var3.getAbsolutePath());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.getLogAgent().logSevere("We were unable to save this crash report to disk.");
|
||||
}
|
||||
|
||||
this.finalTick(var2);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -518,11 +489,6 @@ public abstract class MinecraftServer implements ICommandSender, Runnable
|
||||
return new File(".");
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on exit from the main run() loop.
|
||||
*/
|
||||
protected void finalTick(CrashReport par1CrashReport) {}
|
||||
|
||||
/**
|
||||
* Directly calls System.exit(0), instantly killing the program.
|
||||
*/
|
||||
@@ -594,29 +560,10 @@ public abstract class MinecraftServer implements ICommandSender, Runnable
|
||||
}
|
||||
|
||||
this.theProfiler.startSection("tick");
|
||||
CrashReport var6;
|
||||
|
||||
try
|
||||
{
|
||||
var4.tick();
|
||||
}
|
||||
catch (Throwable var8)
|
||||
{
|
||||
var6 = CrashReport.makeCrashReport(var8, "Exception ticking world");
|
||||
var4.addWorldInfoToCrashReport(var6);
|
||||
throw new ReportedException(var6);
|
||||
}
|
||||
var4.tick();
|
||||
|
||||
try
|
||||
{
|
||||
var4.updateEntities();
|
||||
}
|
||||
catch (Throwable var7)
|
||||
{
|
||||
var6 = CrashReport.makeCrashReport(var7, "Exception ticking world entities");
|
||||
var4.addWorldInfoToCrashReport(var6);
|
||||
throw new ReportedException(var6);
|
||||
}
|
||||
var4.updateEntities();
|
||||
|
||||
this.theProfiler.endSection();
|
||||
this.theProfiler.startSection("tracker");
|
||||
@@ -742,13 +689,6 @@ public abstract class MinecraftServer implements ICommandSender, Runnable
|
||||
return "";
|
||||
}
|
||||
|
||||
public String executeCommand(String par1Str)
|
||||
{
|
||||
RConConsoleSource.consoleBuffer.resetLog();
|
||||
this.commandManager.executeCommand(RConConsoleSource.consoleBuffer, par1Str);
|
||||
return RConConsoleSource.consoleBuffer.getChatBuffer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if debugging is enabled, false otherwise.
|
||||
*/
|
||||
@@ -781,14 +721,6 @@ public abstract class MinecraftServer implements ICommandSender, Runnable
|
||||
return "vanilla";
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the server info, including from theWorldServer, to the crash report.
|
||||
*/
|
||||
public CrashReport addServerInfoToCrashReport(CrashReport par1CrashReport)
|
||||
{
|
||||
return par1CrashReport;
|
||||
}
|
||||
|
||||
/**
|
||||
* If par2Str begins with /, then it searches for commands, otherwise it returns players.
|
||||
*/
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.regex.Pattern;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
public class BanEntry
|
||||
{
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.io.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
public class BanList
|
||||
{
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
public class BiomeCache
|
||||
{
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
public abstract class BiomeGenBase
|
||||
{
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.List;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Block
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.Iterator;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
public class BlockBed extends BlockDirectional
|
||||
{
|
||||
/** Maps the foot-of-bed block to the head-of-bed block. */
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.List;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class BlockButton extends Block
|
||||
{
|
||||
/** Whether this button is sensible to arrows, used by wooden buttons. */
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.Iterator;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
public class BlockChest extends BlockContainer
|
||||
{
|
||||
private final EaglercraftRandom random = new EaglercraftRandom();
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.List;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockHopper extends BlockContainer
|
||||
{
|
||||
private final EaglercraftRandom field_94457_a = new EaglercraftRandom();
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.List;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockLeaves extends BlockLeavesBase
|
||||
{
|
||||
public static final String[] LEAF_TYPES = new String[] {"oak", "spruce", "birch", "jungle"};
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.List;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockLog extends BlockRotatedPillar
|
||||
{
|
||||
/** The type of tree this log came from. */
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.List;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockPane extends Block
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.List;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockSapling extends BlockFlower
|
||||
{
|
||||
public static final String[] WOOD_TYPES = new String[] {"oak", "spruce", "birch", "jungle"};
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.List;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockStairs extends Block
|
||||
{
|
||||
private static final int[][] field_72159_a = new int[][] {{2, 6}, {3, 7}, {2, 3}, {6, 7}, {0, 4}, {1, 5}, {0, 1}, {4, 5}};
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.List;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockStep extends BlockHalfSlab
|
||||
{
|
||||
/** The list of the types of step blocks. */
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class Chunk
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -101,19 +101,7 @@ public class ChunkProviderServer implements IChunkProvider
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
var5 = this.currentChunkProvider.provideChunk(par1, par2);
|
||||
}
|
||||
catch (Throwable var9)
|
||||
{
|
||||
CrashReport var7 = CrashReport.makeCrashReport(var9, "Exception generating new chunk");
|
||||
CrashReportCategory var8 = var7.makeCategory("Chunk to be generated");
|
||||
var8.addCrashSection("Location", String.format("%d,%d", new Object[] {Integer.valueOf(par1), Integer.valueOf(par2)}));
|
||||
var8.addCrashSection("Position hash", Long.valueOf(var3));
|
||||
var8.addCrashSection("Generator", this.currentChunkProvider.makeString());
|
||||
throw new ReportedException(var7);
|
||||
}
|
||||
var5 = this.currentChunkProvider.provideChunk(par1, par2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
public abstract class CommandBase implements ICommand
|
||||
{
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
public class CommandDebug extends CommandBase
|
||||
{
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.List;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CommandGive extends CommandBase
|
||||
{
|
||||
public String getCommandName()
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
public class CommandHelp extends CommandBase
|
||||
{
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.List;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CommandTime extends CommandBase
|
||||
{
|
||||
public String getCommandName()
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.List;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CommandXP extends CommandBase
|
||||
{
|
||||
public String getCommandName()
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
public abstract class Container
|
||||
{
|
||||
|
||||
@@ -1,299 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class CrashReport
|
||||
{
|
||||
/** Description of the crash report. */
|
||||
private final String description;
|
||||
|
||||
/** The Throwable that is the "cause" for this crash and Crash Report. */
|
||||
private final Throwable cause;
|
||||
private final CrashReportCategory field_85061_c = new CrashReportCategory(this, "System Details");
|
||||
|
||||
/** Holds the keys and values of all crash report sections. */
|
||||
private final List crashReportSections = new ArrayList();
|
||||
|
||||
/** File of crash report. */
|
||||
private File crashReportFile;
|
||||
private boolean field_85059_f = true;
|
||||
private StackTraceElement[] field_85060_g = new StackTraceElement[0];
|
||||
|
||||
public CrashReport(String par1Str, Throwable par2Throwable)
|
||||
{
|
||||
this.description = par1Str;
|
||||
this.cause = par2Throwable;
|
||||
this.populateEnvironment();
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates this crash report with initial information about the running server and operating system / java
|
||||
* environment
|
||||
*/
|
||||
private void populateEnvironment()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the Crash Report.
|
||||
*/
|
||||
public String getDescription()
|
||||
{
|
||||
return this.description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Throwable object that is the cause for the crash and Crash Report.
|
||||
*/
|
||||
public Throwable getCrashCause()
|
||||
{
|
||||
return this.cause;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the various sections of the crash report into the given StringBuilder
|
||||
*/
|
||||
public void getSectionsInStringBuilder(StringBuilder par1StringBuilder)
|
||||
{
|
||||
if (this.field_85060_g != null && this.field_85060_g.length > 0)
|
||||
{
|
||||
par1StringBuilder.append("-- Head --\n");
|
||||
par1StringBuilder.append("Stacktrace:\n");
|
||||
StackTraceElement[] var2 = this.field_85060_g;
|
||||
int var3 = var2.length;
|
||||
|
||||
for (int var4 = 0; var4 < var3; ++var4)
|
||||
{
|
||||
StackTraceElement var5 = var2[var4];
|
||||
par1StringBuilder.append("\t").append("at ").append(var5.toString());
|
||||
par1StringBuilder.append("\n");
|
||||
}
|
||||
|
||||
par1StringBuilder.append("\n");
|
||||
}
|
||||
|
||||
Iterator var6 = this.crashReportSections.iterator();
|
||||
|
||||
while (var6.hasNext())
|
||||
{
|
||||
CrashReportCategory var7 = (CrashReportCategory)var6.next();
|
||||
var7.func_85072_a(par1StringBuilder);
|
||||
par1StringBuilder.append("\n\n");
|
||||
}
|
||||
|
||||
this.field_85061_c.func_85072_a(par1StringBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the stack trace of the Throwable that caused this crash report, or if that fails, the cause .toString().
|
||||
*/
|
||||
public String getCauseStackTraceOrString()
|
||||
{
|
||||
StringWriter var1 = null;
|
||||
PrintWriter var2 = null;
|
||||
String var3 = this.cause.toString();
|
||||
|
||||
try
|
||||
{
|
||||
var1 = new StringWriter();
|
||||
var2 = new PrintWriter(var1);
|
||||
this.cause.printStackTrace(var2);
|
||||
var3 = var1.toString();
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (var1 != null)
|
||||
{
|
||||
var1.close();
|
||||
}
|
||||
|
||||
if (var2 != null)
|
||||
{
|
||||
var2.close();
|
||||
}
|
||||
}
|
||||
catch (IOException var10)
|
||||
{
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the complete report with headers, stack trace, and different sections as a string.
|
||||
*/
|
||||
public String getCompleteReport()
|
||||
{
|
||||
StringBuilder var1 = new StringBuilder();
|
||||
var1.append("---- Minecraft Crash Report ----\n");
|
||||
var1.append("// ");
|
||||
var1.append(getWittyComment());
|
||||
var1.append("\n\n");
|
||||
var1.append("Time: ");
|
||||
var1.append((new SimpleDateFormat()).format(new Date()));
|
||||
var1.append("\n");
|
||||
var1.append("Description: ");
|
||||
var1.append(this.description);
|
||||
var1.append("\n\n");
|
||||
var1.append(this.getCauseStackTraceOrString());
|
||||
var1.append("\n\nA detailed walkthrough of the error, its code path and all known details is as follows:\n");
|
||||
|
||||
for (int var2 = 0; var2 < 87; ++var2)
|
||||
{
|
||||
var1.append("-");
|
||||
}
|
||||
|
||||
var1.append("\n\n");
|
||||
this.getSectionsInStringBuilder(var1);
|
||||
return var1.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the file this crash report is saved into.
|
||||
*/
|
||||
public File getFile()
|
||||
{
|
||||
return this.crashReportFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the complete crash report to the given File.
|
||||
*/
|
||||
public boolean saveToFile(File par1File, ILogAgent par2ILogAgent)
|
||||
{
|
||||
if (this.crashReportFile != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (par1File.getParentFile() != null)
|
||||
{
|
||||
par1File.getParentFile().mkdirs();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
FileWriter var3 = new FileWriter(par1File);
|
||||
var3.write(this.getCompleteReport());
|
||||
var3.close();
|
||||
this.crashReportFile = par1File;
|
||||
return true;
|
||||
}
|
||||
catch (Throwable var4)
|
||||
{
|
||||
par2ILogAgent.logSevereException("Could not save crash report to " + par1File, var4);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CrashReportCategory getCategory()
|
||||
{
|
||||
return this.field_85061_c;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a CrashReportCategory
|
||||
*/
|
||||
public CrashReportCategory makeCategory(String par1Str)
|
||||
{
|
||||
return this.makeCategoryDepth(par1Str, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a CrashReportCategory for the given stack trace depth
|
||||
*/
|
||||
public CrashReportCategory makeCategoryDepth(String par1Str, int par2)
|
||||
{
|
||||
CrashReportCategory var3 = new CrashReportCategory(this, par1Str);
|
||||
|
||||
if (this.field_85059_f)
|
||||
{
|
||||
int var4 = var3.func_85073_a(par2);
|
||||
StackTraceElement[] var5 = this.cause.getStackTrace();
|
||||
StackTraceElement var6 = null;
|
||||
StackTraceElement var7 = null;
|
||||
|
||||
if (var5 != null && var5.length - var4 < var5.length)
|
||||
{
|
||||
var6 = var5[var5.length - var4];
|
||||
|
||||
if (var5.length + 1 - var4 < var5.length)
|
||||
{
|
||||
var7 = var5[var5.length + 1 - var4];
|
||||
}
|
||||
}
|
||||
|
||||
this.field_85059_f = var3.func_85069_a(var6, var7);
|
||||
|
||||
if (var4 > 0 && !this.crashReportSections.isEmpty())
|
||||
{
|
||||
CrashReportCategory var8 = (CrashReportCategory)this.crashReportSections.get(this.crashReportSections.size() - 1);
|
||||
var8.func_85070_b(var4);
|
||||
}
|
||||
else if (var5 != null && var5.length >= var4)
|
||||
{
|
||||
this.field_85060_g = new StackTraceElement[var5.length - var4];
|
||||
System.arraycopy(var5, 0, this.field_85060_g, 0, this.field_85060_g.length);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.field_85059_f = false;
|
||||
}
|
||||
}
|
||||
|
||||
this.crashReportSections.add(var3);
|
||||
return var3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a random witty comment for inclusion in this CrashReport
|
||||
*/
|
||||
private static String getWittyComment()
|
||||
{
|
||||
String[] var0 = new String[] {"Who set us up the TNT?", "Everything\'s going to plan. No, really, that was supposed to happen.", "Uh... Did I do that?", "Oops.", "Why did you do that?", "I feel sad now :(", "My bad.", "I\'m sorry, Dave.", "I let you down. Sorry :(", "On the bright side, I bought you a teddy bear!", "Daisy, daisy...", "Oh - I know what I did wrong!", "Hey, that tickles! Hehehe!", "I blame Dinnerbone.", "You should try our sister game, Minceraft!", "Don\'t be sad. I\'ll do better next time, I promise!", "Don\'t be sad, have a hug! <3", "I just don\'t know what went wrong :(", "Shall we play a game?", "Quite honestly, I wouldn\'t worry myself about that.", "I bet Cylons wouldn\'t have this problem.", "Sorry :(", "Surprise! Haha. Well, this is awkward.", "Would you like a cupcake?", "Hi. I\'m Minecraft, and I\'m a crashaholic.", "Ooh. Shiny.", "This doesn\'t make any sense!", "Why is it breaking :(", "Don\'t do that.", "Ouch. That hurt :(", "You\'re mean.", "This is a token for 1 free hug. Redeem at your nearest Mojangsta: [~~HUG~~]", "There are four lights!"};
|
||||
|
||||
try
|
||||
{
|
||||
return var0[(int)(System.nanoTime() % (long)var0.length)];
|
||||
}
|
||||
catch (Throwable var2)
|
||||
{
|
||||
return "Witty comment unavailable :(";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a crash report for the exception
|
||||
*/
|
||||
public static CrashReport makeCrashReport(Throwable par0Throwable, String par1Str)
|
||||
{
|
||||
CrashReport var2;
|
||||
|
||||
if (par0Throwable instanceof ReportedException)
|
||||
{
|
||||
var2 = ((ReportedException)par0Throwable).getCrashReport();
|
||||
}
|
||||
else
|
||||
{
|
||||
var2 = new CrashReport(par1Str, par0Throwable);
|
||||
}
|
||||
|
||||
return var2;
|
||||
}
|
||||
}
|
||||
@@ -1,208 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
public class CrashReportCategory
|
||||
{
|
||||
private final CrashReport theCrashReport;
|
||||
private final String field_85076_b;
|
||||
private final List field_85077_c = new ArrayList();
|
||||
private StackTraceElement[] stackTrace = new StackTraceElement[0];
|
||||
|
||||
public CrashReportCategory(CrashReport par1CrashReport, String par2Str)
|
||||
{
|
||||
this.theCrashReport = par1CrashReport;
|
||||
this.field_85076_b = par2Str;
|
||||
}
|
||||
|
||||
public static String func_85074_a(double par0, double par2, double par4)
|
||||
{
|
||||
return String.format("%.2f,%.2f,%.2f - %s", new Object[] {Double.valueOf(par0), Double.valueOf(par2), Double.valueOf(par4), getLocationInfo(MathHelper.floor_double(par0), MathHelper.floor_double(par2), MathHelper.floor_double(par4))});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string with world information on location.Args:x,y,z
|
||||
*/
|
||||
public static String getLocationInfo(int par0, int par1, int par2)
|
||||
{
|
||||
StringBuilder var3 = new StringBuilder();
|
||||
|
||||
try
|
||||
{
|
||||
var3.append(String.format("World: (%d,%d,%d)", new Object[] {Integer.valueOf(par0), Integer.valueOf(par1), Integer.valueOf(par2)}));
|
||||
}
|
||||
catch (Throwable var16)
|
||||
{
|
||||
var3.append("(Error finding world loc)");
|
||||
}
|
||||
|
||||
var3.append(", ");
|
||||
int var4;
|
||||
int var5;
|
||||
int var6;
|
||||
int var7;
|
||||
int var8;
|
||||
int var9;
|
||||
int var10;
|
||||
int var11;
|
||||
int var12;
|
||||
|
||||
try
|
||||
{
|
||||
var4 = par0 >> 4;
|
||||
var5 = par2 >> 4;
|
||||
var6 = par0 & 15;
|
||||
var7 = par1 >> 4;
|
||||
var8 = par2 & 15;
|
||||
var9 = var4 << 4;
|
||||
var10 = var5 << 4;
|
||||
var11 = (var4 + 1 << 4) - 1;
|
||||
var12 = (var5 + 1 << 4) - 1;
|
||||
var3.append(String.format("Chunk: (at %d,%d,%d in %d,%d; contains blocks %d,0,%d to %d,255,%d)", new Object[] {Integer.valueOf(var6), Integer.valueOf(var7), Integer.valueOf(var8), Integer.valueOf(var4), Integer.valueOf(var5), Integer.valueOf(var9), Integer.valueOf(var10), Integer.valueOf(var11), Integer.valueOf(var12)}));
|
||||
}
|
||||
catch (Throwable var15)
|
||||
{
|
||||
var3.append("(Error finding chunk loc)");
|
||||
}
|
||||
|
||||
var3.append(", ");
|
||||
|
||||
try
|
||||
{
|
||||
var4 = par0 >> 9;
|
||||
var5 = par2 >> 9;
|
||||
var6 = var4 << 5;
|
||||
var7 = var5 << 5;
|
||||
var8 = (var4 + 1 << 5) - 1;
|
||||
var9 = (var5 + 1 << 5) - 1;
|
||||
var10 = var4 << 9;
|
||||
var11 = var5 << 9;
|
||||
var12 = (var4 + 1 << 9) - 1;
|
||||
int var13 = (var5 + 1 << 9) - 1;
|
||||
var3.append(String.format("Region: (%d,%d; contains chunks %d,%d to %d,%d, blocks %d,0,%d to %d,255,%d)", new Object[] {Integer.valueOf(var4), Integer.valueOf(var5), Integer.valueOf(var6), Integer.valueOf(var7), Integer.valueOf(var8), Integer.valueOf(var9), Integer.valueOf(var10), Integer.valueOf(var11), Integer.valueOf(var12), Integer.valueOf(var13)}));
|
||||
}
|
||||
catch (Throwable var14)
|
||||
{
|
||||
var3.append("(Error finding world loc)");
|
||||
}
|
||||
|
||||
return var3.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a Crashreport section with the given name with the value set to the result of the given Callable;
|
||||
*/
|
||||
public void addCrashSectionCallable(String par1Str, Callable par2Callable)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.addCrashSection(par1Str, par2Callable.call());
|
||||
}
|
||||
catch (Throwable var4)
|
||||
{
|
||||
this.addCrashSectionThrowable(par1Str, var4);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a Crashreport section with the given name with the given value (convered .toString())
|
||||
*/
|
||||
public void addCrashSection(String par1Str, Object par2Obj)
|
||||
{
|
||||
this.field_85077_c.add(new CrashReportCategoryEntry(par1Str, par2Obj));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a Crashreport section with the given name with the given Throwable
|
||||
*/
|
||||
public void addCrashSectionThrowable(String par1Str, Throwable par2Throwable)
|
||||
{
|
||||
this.addCrashSection(par1Str, par2Throwable);
|
||||
}
|
||||
|
||||
public int func_85073_a(int par1)
|
||||
{
|
||||
StackTraceElement[] var2 = Thread.currentThread().getStackTrace();
|
||||
this.stackTrace = new StackTraceElement[var2.length - 3 - par1];
|
||||
System.arraycopy(var2, 3 + par1, this.stackTrace, 0, this.stackTrace.length);
|
||||
return this.stackTrace.length;
|
||||
}
|
||||
|
||||
public boolean func_85069_a(StackTraceElement par1StackTraceElement, StackTraceElement par2StackTraceElement)
|
||||
{
|
||||
if (this.stackTrace.length != 0 && par1StackTraceElement != null)
|
||||
{
|
||||
StackTraceElement var3 = this.stackTrace[0];
|
||||
|
||||
if (var3.isNativeMethod() == par1StackTraceElement.isNativeMethod() && var3.getClassName().equals(par1StackTraceElement.getClassName()) && var3.getFileName().equals(par1StackTraceElement.getFileName()) && var3.getMethodName().equals(par1StackTraceElement.getMethodName()))
|
||||
{
|
||||
if (par2StackTraceElement != null != this.stackTrace.length > 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (par2StackTraceElement != null && !this.stackTrace[1].equals(par2StackTraceElement))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.stackTrace[0] = par1StackTraceElement;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void func_85070_b(int par1)
|
||||
{
|
||||
StackTraceElement[] var2 = new StackTraceElement[this.stackTrace.length - par1];
|
||||
System.arraycopy(this.stackTrace, 0, var2, 0, var2.length);
|
||||
this.stackTrace = var2;
|
||||
}
|
||||
|
||||
public void func_85072_a(StringBuilder par1StringBuilder)
|
||||
{
|
||||
par1StringBuilder.append("-- ").append(this.field_85076_b).append(" --\n");
|
||||
par1StringBuilder.append("Details:");
|
||||
Iterator var2 = this.field_85077_c.iterator();
|
||||
|
||||
while (var2.hasNext())
|
||||
{
|
||||
CrashReportCategoryEntry var3 = (CrashReportCategoryEntry)var2.next();
|
||||
par1StringBuilder.append("\n\t");
|
||||
par1StringBuilder.append(var3.func_85089_a());
|
||||
par1StringBuilder.append(": ");
|
||||
par1StringBuilder.append(var3.func_85090_b());
|
||||
}
|
||||
|
||||
if (this.stackTrace != null && this.stackTrace.length > 0)
|
||||
{
|
||||
par1StringBuilder.append("\nStacktrace:");
|
||||
StackTraceElement[] var6 = this.stackTrace;
|
||||
int var7 = var6.length;
|
||||
|
||||
for (int var4 = 0; var4 < var7; ++var4)
|
||||
{
|
||||
StackTraceElement var5 = var6[var4];
|
||||
par1StringBuilder.append("\n\tat ");
|
||||
par1StringBuilder.append(var5.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addBlockCrashInfo(CrashReportCategory par0CrashReportCategory, int par1, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
class CrashReportCategoryEntry
|
||||
{
|
||||
private final String field_85092_a;
|
||||
private final String field_85091_b;
|
||||
|
||||
public CrashReportCategoryEntry(String par1Str, Object par2Obj)
|
||||
{
|
||||
this.field_85092_a = par1Str;
|
||||
|
||||
if (par2Obj == null)
|
||||
{
|
||||
this.field_85091_b = "~~NULL~~";
|
||||
}
|
||||
else if (par2Obj instanceof Throwable)
|
||||
{
|
||||
Throwable var3 = (Throwable)par2Obj;
|
||||
this.field_85091_b = "~~ERROR~~ " + var3.getClass().getSimpleName() + ": " + var3.getMessage();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.field_85091_b = par2Obj.toString();
|
||||
}
|
||||
}
|
||||
|
||||
public String func_85089_a()
|
||||
{
|
||||
return this.field_85092_a;
|
||||
}
|
||||
|
||||
public String func_85090_b()
|
||||
{
|
||||
return this.field_85091_b;
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,7 @@ package net.minecraft.src;
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
public class DataWatcher
|
||||
{
|
||||
@@ -111,17 +107,7 @@ public class DataWatcher
|
||||
//this.lock.readLock().lock();
|
||||
WatchableObject var2;
|
||||
|
||||
try
|
||||
{
|
||||
var2 = (WatchableObject)this.watchedObjects.get(Integer.valueOf(par1));
|
||||
}
|
||||
catch (Throwable var6)
|
||||
{
|
||||
CrashReport var4 = CrashReport.makeCrashReport(var6, "Getting synched entity data");
|
||||
CrashReportCategory var5 = var4.makeCategory("Synched entity data");
|
||||
var5.addCrashSection("Data ID", Integer.valueOf(par1));
|
||||
throw new ReportedException(var4);
|
||||
}
|
||||
var2 = (WatchableObject)this.watchedObjects.get(Integer.valueOf(par1));
|
||||
|
||||
//this.lock.readLock().unlock();
|
||||
return var2;
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
class Empty3
|
||||
{
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.List;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EmptyChunk extends Chunk
|
||||
{
|
||||
public EmptyChunk(World par1World, int par2, int par3)
|
||||
|
||||
@@ -16,12 +16,12 @@ public class EnchantmentHelper
|
||||
/**
|
||||
* Used to calculate the extra armor of enchantments on armors equipped on player.
|
||||
*/
|
||||
private static final EnchantmentModifierDamage enchantmentModifierDamage = new EnchantmentModifierDamage((Empty3)null);
|
||||
private static final EnchantmentModifierDamage enchantmentModifierDamage = new EnchantmentModifierDamage(null);
|
||||
|
||||
/**
|
||||
* Used to calculate the (magic) extra damage done by enchantments on current equipped item of player.
|
||||
*/
|
||||
private static final EnchantmentModifierLiving enchantmentModifierLiving = new EnchantmentModifierLiving((Empty3)null);
|
||||
private static final EnchantmentModifierLiving enchantmentModifierLiving = new EnchantmentModifierLiving(null);
|
||||
|
||||
/**
|
||||
* Returns the level of enchantment on the ItemStack passed.
|
||||
|
||||
@@ -23,7 +23,7 @@ final class EnchantmentModifierDamage implements IEnchantmentModifier
|
||||
this.damageModifier += par1Enchantment.calcModifierDamage(par2, this.source);
|
||||
}
|
||||
|
||||
EnchantmentModifierDamage(Empty3 par1Empty3)
|
||||
EnchantmentModifierDamage(Object par1Empty3)
|
||||
{
|
||||
this();
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ final class EnchantmentModifierLiving implements IEnchantmentModifier
|
||||
this.livingModifier += par1Enchantment.calcModifierLiving(par2, this.entityLiving);
|
||||
}
|
||||
|
||||
EnchantmentModifierLiving(Empty3 par1Empty3)
|
||||
EnchantmentModifierLiving(Object par1Empty3)
|
||||
{
|
||||
this();
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.List;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
import net.lax1dude.eaglercraft.ProfileUUID;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class Entity
|
||||
{
|
||||
private static int nextEntityID;
|
||||
@@ -878,10 +879,7 @@ public abstract class Entity
|
||||
}
|
||||
catch (Throwable var34)
|
||||
{
|
||||
CrashReport var41 = CrashReport.makeCrashReport(var34, "Checking entity tile collision");
|
||||
CrashReportCategory var40 = var41.makeCategory("Entity being checked for collision");
|
||||
this.addEntityCrashInfo(var40);
|
||||
throw new ReportedException(var41);
|
||||
|
||||
}
|
||||
|
||||
boolean var39 = this.isWet();
|
||||
@@ -938,17 +936,7 @@ public abstract class Entity
|
||||
|
||||
if (var10 > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
Block.blocksList[var10].onEntityCollidedWithBlock(this.worldObj, var7, var8, var9, this);
|
||||
}
|
||||
catch (Throwable var14)
|
||||
{
|
||||
CrashReport var12 = CrashReport.makeCrashReport(var14, "Colliding entity with tile");
|
||||
CrashReportCategory var13 = var12.makeCategory("Tile being collided with");
|
||||
CrashReportCategory.addBlockCrashInfo(var13, var7, var8, var9, var10, this.worldObj.getBlockMetadata(var7, var8, var9));
|
||||
throw new ReportedException(var12);
|
||||
}
|
||||
Block.blocksList[var10].onEntityCollidedWithBlock(this.worldObj, var7, var8, var9, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1495,10 +1483,6 @@ public abstract class Entity
|
||||
}
|
||||
catch (Throwable var5)
|
||||
{
|
||||
CrashReport var3 = CrashReport.makeCrashReport(var5, "Saving entity NBT");
|
||||
CrashReportCategory var4 = var3.makeCategory("Entity being saved");
|
||||
this.addEntityCrashInfo(var4);
|
||||
throw new ReportedException(var3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1560,10 +1544,7 @@ public abstract class Entity
|
||||
}
|
||||
catch (Throwable var5)
|
||||
{
|
||||
CrashReport var3 = CrashReport.makeCrashReport(var5, "Loading entity NBT");
|
||||
CrashReportCategory var4 = var3.makeCategory("Entity being loaded");
|
||||
this.addEntityCrashInfo(var4);
|
||||
throw new ReportedException(var3);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2349,14 +2330,6 @@ public abstract class Entity
|
||||
return false;
|
||||
}
|
||||
|
||||
public void addEntityCrashInfo(CrashReportCategory par1CrashReportCategory)
|
||||
{
|
||||
par1CrashReportCategory.addCrashSection("Entity ID", Integer.valueOf(this.entityId));
|
||||
par1CrashReportCategory.addCrashSection("Entity\'s Exact location", String.format("%.2f, %.2f, %.2f", new Object[] {Double.valueOf(this.posX), Double.valueOf(this.posY), Double.valueOf(this.posZ)}));
|
||||
par1CrashReportCategory.addCrashSection("Entity\'s Block location", CrashReportCategory.getLocationInfo(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)));
|
||||
par1CrashReportCategory.addCrashSection("Entity\'s Momentum", String.format("%.2f, %.2f, %.2f", new Object[] {Double.valueOf(this.motionX), Double.valueOf(this.motionY), Double.valueOf(this.motionZ)}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether this entity should be rendered as on fire.
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
public class EntityAIMate extends EntityAIBase
|
||||
{
|
||||
|
||||
@@ -299,10 +299,4 @@ public class EntityFallingSand extends Entity
|
||||
return false;
|
||||
}
|
||||
|
||||
public void addEntityCrashInfo(CrashReportCategory par1CrashReportCategory)
|
||||
{
|
||||
super.addEntityCrashInfo(par1CrashReportCategory);
|
||||
par1CrashReportCategory.addCrashSection("Immitating block ID", Integer.valueOf(this.blockID));
|
||||
par1CrashReportCategory.addCrashSection("Immitating block data", Integer.valueOf(this.metadata));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.ProfileUUID;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import net.lax1dude.eaglercraft.ProfileUUID;
|
||||
|
||||
public abstract class EntityLiving extends EntityLivingBase
|
||||
{
|
||||
|
||||
@@ -242,58 +242,48 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting
|
||||
|
||||
public void onUpdateEntity()
|
||||
{
|
||||
try
|
||||
super.onUpdate();
|
||||
|
||||
for (int var1 = 0; var1 < this.inventory.getSizeInventory(); ++var1)
|
||||
{
|
||||
super.onUpdate();
|
||||
ItemStack var6 = this.inventory.getStackInSlot(var1);
|
||||
|
||||
for (int var1 = 0; var1 < this.inventory.getSizeInventory(); ++var1)
|
||||
if (var6 != null && Item.itemsList[var6.itemID].isMap() && this.playerNetServerHandler.packetSize() <= 5)
|
||||
{
|
||||
ItemStack var6 = this.inventory.getStackInSlot(var1);
|
||||
Packet var8 = ((ItemMapBase)Item.itemsList[var6.itemID]).createMapDataPacket(var6, this.worldObj, this);
|
||||
|
||||
if (var6 != null && Item.itemsList[var6.itemID].isMap() && this.playerNetServerHandler.packetSize() <= 5)
|
||||
if (var8 != null)
|
||||
{
|
||||
Packet var8 = ((ItemMapBase)Item.itemsList[var6.itemID]).createMapDataPacket(var6, this.worldObj, this);
|
||||
|
||||
if (var8 != null)
|
||||
{
|
||||
this.playerNetServerHandler.sendPacketToPlayer(var8);
|
||||
}
|
||||
this.playerNetServerHandler.sendPacketToPlayer(var8);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.getHealth() != this.lastHealth || this.lastFoodLevel != this.foodStats.getFoodLevel() || this.foodStats.getSaturationLevel() == 0.0F != this.wasHungry)
|
||||
{
|
||||
this.playerNetServerHandler.sendPacketToPlayer(new Packet8UpdateHealth(this.getHealth(), this.foodStats.getFoodLevel(), this.foodStats.getSaturationLevel()));
|
||||
this.lastHealth = this.getHealth();
|
||||
this.lastFoodLevel = this.foodStats.getFoodLevel();
|
||||
this.wasHungry = this.foodStats.getSaturationLevel() == 0.0F;
|
||||
}
|
||||
|
||||
if (this.getHealth() + this.getAbsorptionAmount() != this.field_130068_bO)
|
||||
{
|
||||
this.field_130068_bO = this.getHealth() + this.getAbsorptionAmount();
|
||||
Collection var5 = this.getWorldScoreboard().func_96520_a(ScoreObjectiveCriteria.health);
|
||||
Iterator var7 = var5.iterator();
|
||||
|
||||
while (var7.hasNext())
|
||||
{
|
||||
ScoreObjective var9 = (ScoreObjective)var7.next();
|
||||
this.getWorldScoreboard().func_96529_a(this.getEntityName(), var9).func_96651_a(Arrays.asList(new EntityPlayer[] {this}));
|
||||
}
|
||||
}
|
||||
|
||||
if (this.experienceTotal != this.lastExperience)
|
||||
{
|
||||
this.lastExperience = this.experienceTotal;
|
||||
this.playerNetServerHandler.sendPacketToPlayer(new Packet43Experience(this.experience, this.experienceTotal, this.experienceLevel));
|
||||
}
|
||||
}
|
||||
catch (Throwable var4)
|
||||
|
||||
if (this.getHealth() != this.lastHealth || this.lastFoodLevel != this.foodStats.getFoodLevel() || this.foodStats.getSaturationLevel() == 0.0F != this.wasHungry)
|
||||
{
|
||||
CrashReport var2 = CrashReport.makeCrashReport(var4, "Ticking player");
|
||||
CrashReportCategory var3 = var2.makeCategory("Player being ticked");
|
||||
this.addEntityCrashInfo(var3);
|
||||
throw new ReportedException(var2);
|
||||
this.playerNetServerHandler.sendPacketToPlayer(new Packet8UpdateHealth(this.getHealth(), this.foodStats.getFoodLevel(), this.foodStats.getSaturationLevel()));
|
||||
this.lastHealth = this.getHealth();
|
||||
this.lastFoodLevel = this.foodStats.getFoodLevel();
|
||||
this.wasHungry = this.foodStats.getSaturationLevel() == 0.0F;
|
||||
}
|
||||
|
||||
if (this.getHealth() + this.getAbsorptionAmount() != this.field_130068_bO)
|
||||
{
|
||||
this.field_130068_bO = this.getHealth() + this.getAbsorptionAmount();
|
||||
Collection var5 = this.getWorldScoreboard().func_96520_a(ScoreObjectiveCriteria.health);
|
||||
Iterator var7 = var5.iterator();
|
||||
|
||||
while (var7.hasNext())
|
||||
{
|
||||
ScoreObjective var9 = (ScoreObjective)var7.next();
|
||||
this.getWorldScoreboard().func_96529_a(this.getEntityName(), var9).func_96651_a(Arrays.asList(new EntityPlayer[] {this}));
|
||||
}
|
||||
}
|
||||
|
||||
if (this.experienceTotal != this.lastExperience)
|
||||
{
|
||||
this.lastExperience = this.experienceTotal;
|
||||
this.playerNetServerHandler.sendPacketToPlayer(new Packet43Experience(this.experience, this.experienceTotal, this.experienceLevel));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1034,16 +1034,7 @@ public class EntityRenderer
|
||||
{
|
||||
EaglerAdapter.glClear(EaglerAdapter.GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
try
|
||||
{
|
||||
this.mc.currentScreen.drawScreen(var16, var17, par1);
|
||||
}
|
||||
catch (Throwable var12)
|
||||
{
|
||||
CrashReport var10 = CrashReport.makeCrashReport(var12, "Rendering screen");
|
||||
CrashReportCategory var11 = var10.makeCategory("Screen render details");
|
||||
throw new ReportedException(var10);
|
||||
}
|
||||
this.mc.currentScreen.drawScreen(var16, var17, par1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.ProfileUUID;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import net.lax1dude.eaglercraft.ProfileUUID;
|
||||
|
||||
public class EntityWitch extends EntityMob implements IRangedAttackMob
|
||||
{
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.Calendar;
|
||||
import net.lax1dude.eaglercraft.ProfileUUID;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
public class EntityZombie extends EntityMob
|
||||
{
|
||||
protected static final Attribute field_110186_bp = (new RangedAttribute("zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).func_111117_a("Spawn Reinforcements Chance");
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class Explosion
|
||||
{
|
||||
/** whether or not the explosion sets fire to blocks around it */
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.EaglerImage;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||
import net.minecraft.src.Minecraft;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class FontRenderer {
|
||||
/** Array of width of all the characters in default.png */
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
|
||||
public class GLAllocation {
|
||||
private static final Map field_74531_a = new HashMap();
|
||||
private static final List field_74530_b = new ArrayList();
|
||||
|
||||
@@ -3,7 +3,6 @@ package net.minecraft.src;
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.IntegratedServer;
|
||||
import net.lax1dude.eaglercraft.LocalStorageManager;
|
||||
import net.minecraft.src.Minecraft;
|
||||
|
||||
public class GameSettings {
|
||||
private static final String[] RENDER_DISTANCES = new String[] { "options.renderDistance.far", "options.renderDistance.normal", "options.renderDistance.short", "options.renderDistance.tiny" };
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
|
||||
public class Gui
|
||||
{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
|
||||
public class GuiBeacon extends GuiContainer
|
||||
{
|
||||
private static final TextureLocation beaconGuiTextures = new TextureLocation("textures/gui/container/beacon.png");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
|
||||
public class GuiButton extends Gui
|
||||
{
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
|
||||
public class GuiChat extends GuiScreen {
|
||||
private String field_73898_b = "";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
|
||||
public class GuiChest extends GuiContainer
|
||||
{
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public abstract class GuiContainer extends GuiScreen
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
|
||||
public class GuiCrafting extends GuiContainer
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
|
||||
public class GuiDispenser extends GuiContainer
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
|
||||
public class GuiFurnace extends GuiContainer
|
||||
{
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.Iterator;
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
public class GuiGameOver extends GuiScreen
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
|
||||
public class GuiHopper extends GuiContainer
|
||||
{
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.*;
|
||||
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.lax1dude.eaglercraft.*;
|
||||
|
||||
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||
|
||||
public class GuiIngame extends Gui
|
||||
{
|
||||
private static final TextureLocation vignetteTexPath = new TextureLocation("textures/misc/vignette.png");
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.*;
|
||||
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import net.lax1dude.eaglercraft.*;
|
||||
import net.lax1dude.eaglercraft.IntegratedServer;
|
||||
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||
import net.minecraft.src.Minecraft;
|
||||
|
||||
public class GuiMainMenu extends GuiScreen {
|
||||
|
||||
/** The RNG used by the Main Menu Screen. */
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
|
||||
public class GuiMerchant extends GuiContainer
|
||||
{
|
||||
private static final TextureLocation merchantGuiTextures = new TextureLocation("textures/gui/container/villager.png");
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
|
||||
public class GuiNewChat extends Gui
|
||||
{
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
import net.minecraft.src.Minecraft;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiParticle extends Gui {
|
||||
private List particles = new ArrayList();
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GuiRepair extends GuiContainer implements ICrafting
|
||||
{
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||
import net.minecraft.src.Minecraft;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiScreen extends Gui {
|
||||
public static final boolean isMacOs = Minecraft.getOs() == EnumOS.MACOS;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.minecraft.src.Minecraft;
|
||||
|
||||
public class GuiSlider2 extends GuiButton {
|
||||
/** The value of this slider control. */
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||
import net.minecraft.src.Minecraft;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class GuiSlot {
|
||||
protected final Minecraft mc;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||
|
||||
abstract class GuiSlotStats extends GuiSlot
|
||||
{
|
||||
protected int field_77262_g;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||
|
||||
public class GuiStats extends GuiScreen
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||
|
||||
public class GuiTextField extends Gui
|
||||
{
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import net.lax1dude.eaglercraft.*;
|
||||
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.lax1dude.eaglercraft.*;
|
||||
|
||||
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||
|
||||
public class GuiWinGame extends GuiScreen
|
||||
{
|
||||
private static final TextureLocation minecraftLogoTexture = new TextureLocation("textures/gui/title/minecraft.png");
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.Date;
|
||||
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
class GuiWorldSlot extends GuiSlot
|
||||
{
|
||||
final GuiSelectWorld parentWorldGui;
|
||||
|
||||
@@ -387,58 +387,47 @@ public class InventoryPlayer implements IInventory
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
int var2;
|
||||
|
||||
if (par1ItemStack.isItemDamaged())
|
||||
{
|
||||
int var2;
|
||||
var2 = this.getFirstEmptyStack();
|
||||
|
||||
if (par1ItemStack.isItemDamaged())
|
||||
if (var2 >= 0)
|
||||
{
|
||||
var2 = this.getFirstEmptyStack();
|
||||
|
||||
if (var2 >= 0)
|
||||
{
|
||||
this.mainInventory[var2] = ItemStack.copyItemStack(par1ItemStack);
|
||||
this.mainInventory[var2].animationsToGo = 5;
|
||||
par1ItemStack.stackSize = 0;
|
||||
return true;
|
||||
}
|
||||
else if (this.player.capabilities.isCreativeMode)
|
||||
{
|
||||
par1ItemStack.stackSize = 0;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.mainInventory[var2] = ItemStack.copyItemStack(par1ItemStack);
|
||||
this.mainInventory[var2].animationsToGo = 5;
|
||||
par1ItemStack.stackSize = 0;
|
||||
return true;
|
||||
}
|
||||
else if (this.player.capabilities.isCreativeMode)
|
||||
{
|
||||
par1ItemStack.stackSize = 0;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
var2 = par1ItemStack.stackSize;
|
||||
par1ItemStack.stackSize = this.storePartialItemStack(par1ItemStack);
|
||||
}
|
||||
while (par1ItemStack.stackSize > 0 && par1ItemStack.stackSize < var2);
|
||||
|
||||
if (par1ItemStack.stackSize == var2 && this.player.capabilities.isCreativeMode)
|
||||
{
|
||||
par1ItemStack.stackSize = 0;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return par1ItemStack.stackSize < var2;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Throwable var5)
|
||||
else
|
||||
{
|
||||
CrashReport var3 = CrashReport.makeCrashReport(var5, "Adding item to inventory");
|
||||
CrashReportCategory var4 = var3.makeCategory("Item being added");
|
||||
var4.addCrashSection("Item ID", Integer.valueOf(par1ItemStack.itemID));
|
||||
var4.addCrashSection("Item data", Integer.valueOf(par1ItemStack.getItemDamage()));
|
||||
throw new ReportedException(var3);
|
||||
do
|
||||
{
|
||||
var2 = par1ItemStack.stackSize;
|
||||
par1ItemStack.stackSize = this.storePartialItemStack(par1ItemStack);
|
||||
}
|
||||
while (par1ItemStack.stackSize > 0 && par1ItemStack.stackSize < var2);
|
||||
|
||||
if (par1ItemStack.stackSize == var2 && this.player.capabilities.isCreativeMode)
|
||||
{
|
||||
par1ItemStack.stackSize = 0;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return par1ItemStack.stackSize < var2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.List;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
import net.lax1dude.eaglercraft.ProfileUUID;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Item
|
||||
{
|
||||
protected static final ProfileUUID field_111210_e = ProfileUUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
public class ItemPotion extends Item
|
||||
{
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public final class ItemStack
|
||||
{
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.logging.ConsoleHandler;
|
||||
import java.util.logging.FileHandler;
|
||||
import java.util.logging.Handler;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.*;
|
||||
|
||||
public class LogAgent implements ILogAgent
|
||||
{
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
public class MapData extends WorldSavedData
|
||||
{
|
||||
|
||||
@@ -1,15 +1,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class MapStorage
|
||||
{
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.*;
|
||||
import net.lax1dude.eaglercraft.IntegratedServer;
|
||||
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||
import net.lax1dude.eaglercraft.glemu.FixedFunctionShader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
import javax.imageio.ImageIO;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
public class Minecraft
|
||||
{
|
||||
@@ -30,8 +27,6 @@ public class Minecraft
|
||||
private boolean hasCrashed;
|
||||
private boolean isGonnaTakeDatScreenShot = false;
|
||||
|
||||
/** Instance of CrashReport. */
|
||||
private CrashReport crashReporter;
|
||||
public int displayWidth;
|
||||
public int displayHeight;
|
||||
private Timer timer = new Timer(20.0F);
|
||||
@@ -93,8 +88,7 @@ public class Minecraft
|
||||
private ISaveFormat saveLoader;
|
||||
|
||||
/**
|
||||
* This is set to fpsCounter every debug screen update, and is shown on the debug screen. It's also sent as part of
|
||||
* the usage snooping.
|
||||
* This is set to fpsCounter every debug screen update, and is shown on the debug screen.
|
||||
*/
|
||||
public static int debugFPS;
|
||||
|
||||
@@ -108,16 +102,6 @@ public class Minecraft
|
||||
*/
|
||||
private boolean refreshTexturePacksScheduled;
|
||||
|
||||
/** Stat file writer */
|
||||
//public StatFileWriter statFileWriter;
|
||||
private String serverName;
|
||||
private int serverPort;
|
||||
|
||||
/**
|
||||
* Makes sure it doesn't keep taking screenshots when both buttons are down.
|
||||
*/
|
||||
boolean isTakingScreenshot;
|
||||
|
||||
/**
|
||||
* Does the actual gameplay have focus. If so then mouse and keys will effect the player instead of menus.
|
||||
*/
|
||||
@@ -172,43 +156,12 @@ public class Minecraft
|
||||
this.tempDisplayHeight = 480;
|
||||
this.fullscreen = false;
|
||||
Packet3Chat.maxChatLength = 32767;
|
||||
this.startTimerHackThread();
|
||||
this.displayWidth = 854;
|
||||
this.displayHeight = 480;
|
||||
this.fullscreen = false;
|
||||
theMinecraft = this;
|
||||
}
|
||||
|
||||
private void startTimerHackThread()
|
||||
{
|
||||
ThreadClientSleep var1 = new ThreadClientSleep(this, "Timer hack thread");
|
||||
var1.setDaemon(true);
|
||||
var1.start();
|
||||
}
|
||||
|
||||
public void crashed(CrashReport par1CrashReport)
|
||||
{
|
||||
this.hasCrashed = true;
|
||||
this.crashReporter = par1CrashReport;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper around displayCrashReportInternal
|
||||
*/
|
||||
public void displayCrashReport(CrashReport par1CrashReport)
|
||||
{
|
||||
System.out.println(par1CrashReport.getCompleteReport());
|
||||
|
||||
System.out.println("#@?@# Game crashed! Crash report could not be saved. #@?@#");
|
||||
System.exit(-2);
|
||||
}
|
||||
|
||||
public void setServer(String par1Str, int par2)
|
||||
{
|
||||
this.serverName = par1Str;
|
||||
this.serverPort = par2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the game: initializes the canvas, the title, the settings, etcetera.
|
||||
*/
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
public abstract class ModelBase
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
public class ModelGhast extends ModelBase
|
||||
{
|
||||
|
||||
@@ -84,19 +84,8 @@ public abstract class NBTBase
|
||||
String var3 = par0DataInput.readUTF();
|
||||
NBTBase var4 = newTag(var2, var3);
|
||||
|
||||
try
|
||||
{
|
||||
var4.load(par0DataInput, par1);
|
||||
return var4;
|
||||
}
|
||||
catch (IOException var8)
|
||||
{
|
||||
CrashReport var6 = CrashReport.makeCrashReport(var8, "Loading NBT data");
|
||||
CrashReportCategory var7 = var6.makeCategory("NBT Tag");
|
||||
var7.addCrashSection("Tag name", var3);
|
||||
var7.addCrashSection("Tag type", Byte.valueOf(var2));
|
||||
throw new ReportedException(var6);
|
||||
}
|
||||
var4.load(par0DataInput, par1);
|
||||
return var4;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -195,14 +195,7 @@ public class NBTTagCompound extends NBTBase
|
||||
*/
|
||||
public byte getByte(String par1Str)
|
||||
{
|
||||
try
|
||||
{
|
||||
return !this.tagMap.containsKey(par1Str) ? 0 : ((NBTTagByte)this.tagMap.get(par1Str)).data;
|
||||
}
|
||||
catch (ClassCastException var3)
|
||||
{
|
||||
throw new ReportedException(this.createCrashReport(par1Str, 1, var3));
|
||||
}
|
||||
return !this.tagMap.containsKey(par1Str) ? 0 : ((NBTTagByte)this.tagMap.get(par1Str)).data;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -210,14 +203,7 @@ public class NBTTagCompound extends NBTBase
|
||||
*/
|
||||
public short getShort(String par1Str)
|
||||
{
|
||||
try
|
||||
{
|
||||
return !this.tagMap.containsKey(par1Str) ? 0 : ((NBTTagShort)this.tagMap.get(par1Str)).data;
|
||||
}
|
||||
catch (ClassCastException var3)
|
||||
{
|
||||
throw new ReportedException(this.createCrashReport(par1Str, 2, var3));
|
||||
}
|
||||
return !this.tagMap.containsKey(par1Str) ? 0 : ((NBTTagShort)this.tagMap.get(par1Str)).data;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -225,14 +211,7 @@ public class NBTTagCompound extends NBTBase
|
||||
*/
|
||||
public int getInteger(String par1Str)
|
||||
{
|
||||
try
|
||||
{
|
||||
return !this.tagMap.containsKey(par1Str) ? 0 : ((NBTTagInt)this.tagMap.get(par1Str)).data;
|
||||
}
|
||||
catch (ClassCastException var3)
|
||||
{
|
||||
throw new ReportedException(this.createCrashReport(par1Str, 3, var3));
|
||||
}
|
||||
return !this.tagMap.containsKey(par1Str) ? 0 : ((NBTTagInt)this.tagMap.get(par1Str)).data;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,14 +219,7 @@ public class NBTTagCompound extends NBTBase
|
||||
*/
|
||||
public long getLong(String par1Str)
|
||||
{
|
||||
try
|
||||
{
|
||||
return !this.tagMap.containsKey(par1Str) ? 0L : ((NBTTagLong)this.tagMap.get(par1Str)).data;
|
||||
}
|
||||
catch (ClassCastException var3)
|
||||
{
|
||||
throw new ReportedException(this.createCrashReport(par1Str, 4, var3));
|
||||
}
|
||||
return !this.tagMap.containsKey(par1Str) ? 0L : ((NBTTagLong)this.tagMap.get(par1Str)).data;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -255,14 +227,7 @@ public class NBTTagCompound extends NBTBase
|
||||
*/
|
||||
public float getFloat(String par1Str)
|
||||
{
|
||||
try
|
||||
{
|
||||
return !this.tagMap.containsKey(par1Str) ? 0.0F : ((NBTTagFloat)this.tagMap.get(par1Str)).data;
|
||||
}
|
||||
catch (ClassCastException var3)
|
||||
{
|
||||
throw new ReportedException(this.createCrashReport(par1Str, 5, var3));
|
||||
}
|
||||
return !this.tagMap.containsKey(par1Str) ? 0.0F : ((NBTTagFloat)this.tagMap.get(par1Str)).data;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -270,14 +235,7 @@ public class NBTTagCompound extends NBTBase
|
||||
*/
|
||||
public double getDouble(String par1Str)
|
||||
{
|
||||
try
|
||||
{
|
||||
return !this.tagMap.containsKey(par1Str) ? 0.0D : ((NBTTagDouble)this.tagMap.get(par1Str)).data;
|
||||
}
|
||||
catch (ClassCastException var3)
|
||||
{
|
||||
throw new ReportedException(this.createCrashReport(par1Str, 6, var3));
|
||||
}
|
||||
return !this.tagMap.containsKey(par1Str) ? 0.0D : ((NBTTagDouble)this.tagMap.get(par1Str)).data;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -285,14 +243,7 @@ public class NBTTagCompound extends NBTBase
|
||||
*/
|
||||
public String getString(String par1Str)
|
||||
{
|
||||
try
|
||||
{
|
||||
return !this.tagMap.containsKey(par1Str) ? "" : ((NBTTagString)this.tagMap.get(par1Str)).data;
|
||||
}
|
||||
catch (ClassCastException var3)
|
||||
{
|
||||
throw new ReportedException(this.createCrashReport(par1Str, 8, var3));
|
||||
}
|
||||
return !this.tagMap.containsKey(par1Str) ? "" : ((NBTTagString)this.tagMap.get(par1Str)).data;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -300,14 +251,7 @@ public class NBTTagCompound extends NBTBase
|
||||
*/
|
||||
public byte[] getByteArray(String par1Str)
|
||||
{
|
||||
try
|
||||
{
|
||||
return !this.tagMap.containsKey(par1Str) ? new byte[0] : ((NBTTagByteArray)this.tagMap.get(par1Str)).byteArray;
|
||||
}
|
||||
catch (ClassCastException var3)
|
||||
{
|
||||
throw new ReportedException(this.createCrashReport(par1Str, 7, var3));
|
||||
}
|
||||
return !this.tagMap.containsKey(par1Str) ? new byte[0] : ((NBTTagByteArray)this.tagMap.get(par1Str)).byteArray;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -315,14 +259,7 @@ public class NBTTagCompound extends NBTBase
|
||||
*/
|
||||
public int[] getIntArray(String par1Str)
|
||||
{
|
||||
try
|
||||
{
|
||||
return !this.tagMap.containsKey(par1Str) ? new int[0] : ((NBTTagIntArray)this.tagMap.get(par1Str)).intArray;
|
||||
}
|
||||
catch (ClassCastException var3)
|
||||
{
|
||||
throw new ReportedException(this.createCrashReport(par1Str, 11, var3));
|
||||
}
|
||||
return !this.tagMap.containsKey(par1Str) ? new int[0] : ((NBTTagIntArray)this.tagMap.get(par1Str)).intArray;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -331,14 +268,7 @@ public class NBTTagCompound extends NBTBase
|
||||
*/
|
||||
public NBTTagCompound getCompoundTag(String par1Str)
|
||||
{
|
||||
try
|
||||
{
|
||||
return !this.tagMap.containsKey(par1Str) ? new NBTTagCompound(par1Str) : (NBTTagCompound)this.tagMap.get(par1Str);
|
||||
}
|
||||
catch (ClassCastException var3)
|
||||
{
|
||||
throw new ReportedException(this.createCrashReport(par1Str, 10, var3));
|
||||
}
|
||||
return !this.tagMap.containsKey(par1Str) ? new NBTTagCompound(par1Str) : (NBTTagCompound)this.tagMap.get(par1Str);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -346,14 +276,7 @@ public class NBTTagCompound extends NBTBase
|
||||
*/
|
||||
public NBTTagList getTagList(String par1Str)
|
||||
{
|
||||
try
|
||||
{
|
||||
return !this.tagMap.containsKey(par1Str) ? new NBTTagList(par1Str) : (NBTTagList)this.tagMap.get(par1Str);
|
||||
}
|
||||
catch (ClassCastException var3)
|
||||
{
|
||||
throw new ReportedException(this.createCrashReport(par1Str, 9, var3));
|
||||
}
|
||||
return !this.tagMap.containsKey(par1Str) ? new NBTTagList(par1Str) : (NBTTagList)this.tagMap.get(par1Str);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -394,22 +317,6 @@ public class NBTTagCompound extends NBTBase
|
||||
return this.tagMap.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a crash report which indicates a NBT read error.
|
||||
*/
|
||||
private CrashReport createCrashReport(String par1Str, int par2, ClassCastException par3ClassCastException)
|
||||
{
|
||||
CrashReport var4 = CrashReport.makeCrashReport(par3ClassCastException, "Reading NBT data");
|
||||
CrashReportCategory var5 = var4.makeCategoryDepth("Corrupt NBT tag", 1);
|
||||
var5.addCrashSection("Tag name", par1Str);
|
||||
|
||||
if (this.getName() != null && this.getName().length() > 0)
|
||||
{
|
||||
var5.addCrashSection("Tag parent", this.getName());
|
||||
}
|
||||
|
||||
return var4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a clone of the tag.
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.*;
|
||||
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.RateLimit;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.lax1dude.eaglercraft.*;
|
||||
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.RateLimit;
|
||||
import org.json.JSONObject;
|
||||
import java.util.*;
|
||||
|
||||
public class NetClientHandler extends NetHandler {
|
||||
/** True if kicked or disconnected from the server. */
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.Socket;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
public abstract class Packet
|
||||
{
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.ProfileUUID;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import net.lax1dude.eaglercraft.ProfileUUID;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class Potion
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
public class RConConsoleSource implements ICommandSender
|
||||
{
|
||||
/** only ever used by MinecraftServer.executeCommand */
|
||||
public static final RConConsoleSource consoleBuffer = new RConConsoleSource();
|
||||
|
||||
/** RCon string buffer for log. */
|
||||
private StringBuffer buffer = new StringBuffer();
|
||||
|
||||
/**
|
||||
* Clears the RCon log
|
||||
*/
|
||||
public void resetLog()
|
||||
{
|
||||
this.buffer.setLength(0);
|
||||
}
|
||||
|
||||
public String getChatBuffer()
|
||||
{
|
||||
return this.buffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of this command sender (usually username, but possibly "Rcon")
|
||||
*/
|
||||
public String getCommandSenderName()
|
||||
{
|
||||
return "Rcon";
|
||||
}
|
||||
|
||||
public void sendChatToPlayer(String par1ChatMessageComponent)
|
||||
{
|
||||
this.buffer.append(par1ChatMessageComponent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the command sender is allowed to use the given command.
|
||||
*/
|
||||
public boolean canCommandSenderUseCommand(int par1, String par2Str)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the position for this command sender.
|
||||
*/
|
||||
public ChunkCoordinates getPlayerCoordinates()
|
||||
{
|
||||
return new ChunkCoordinates(0, 0, 0);
|
||||
}
|
||||
|
||||
public World getEntityWorld()
|
||||
{
|
||||
return MinecraftServer.getServer().getEntityWorld();
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class RConOutputStream
|
||||
{
|
||||
/** Output stream */
|
||||
private ByteArrayOutputStream byteArrayOutput;
|
||||
|
||||
/** ByteArrayOutputStream wrapper */
|
||||
private DataOutputStream output;
|
||||
|
||||
public RConOutputStream(int par1)
|
||||
{
|
||||
this.byteArrayOutput = new ByteArrayOutputStream(par1);
|
||||
this.output = new DataOutputStream(this.byteArrayOutput);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the given byte array to the output stream
|
||||
*/
|
||||
public void writeByteArray(byte[] par1ArrayOfByte) throws IOException
|
||||
{
|
||||
this.output.write(par1ArrayOfByte, 0, par1ArrayOfByte.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the given String to the output stream
|
||||
*/
|
||||
public void writeString(String par1Str) throws IOException
|
||||
{
|
||||
this.output.writeBytes(par1Str);
|
||||
this.output.write(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the given int to the output stream
|
||||
*/
|
||||
public void writeInt(int par1) throws IOException
|
||||
{
|
||||
this.output.write(par1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the given short to the output stream
|
||||
*/
|
||||
public void writeShort(short par1) throws IOException
|
||||
{
|
||||
this.output.writeShort(Short.reverseBytes(par1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the contents of the output stream as a byte array
|
||||
*/
|
||||
public byte[] toByteArray()
|
||||
{
|
||||
return this.byteArrayOutput.toByteArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the byte array output.
|
||||
*/
|
||||
public void reset()
|
||||
{
|
||||
this.byteArrayOutput.reset();
|
||||
}
|
||||
}
|
||||
@@ -1,226 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.DatagramSocket;
|
||||
import java.net.ServerSocket;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class RConThreadBase implements Runnable
|
||||
{
|
||||
/** True if the Thread is running, false otherwise */
|
||||
protected boolean running;
|
||||
|
||||
/** Reference to the IServer object. */
|
||||
protected IServer server;
|
||||
|
||||
/** Thread for this runnable class */
|
||||
protected Thread rconThread;
|
||||
protected int field_72615_d = 5;
|
||||
|
||||
/** A list of registered DatagramSockets */
|
||||
protected List socketList = new ArrayList();
|
||||
|
||||
/** A list of registered ServerSockets */
|
||||
protected List serverSocketList = new ArrayList();
|
||||
|
||||
RConThreadBase(IServer par1IServer)
|
||||
{
|
||||
this.server = par1IServer;
|
||||
|
||||
if (this.server.isDebuggingEnabled())
|
||||
{
|
||||
this.logWarning("Debugging is enabled, performance maybe reduced!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Thread object from this class and starts running
|
||||
*/
|
||||
public synchronized void startThread()
|
||||
{
|
||||
this.rconThread = new Thread(this);
|
||||
this.rconThread.start();
|
||||
this.running = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the Thread is running, false otherwise
|
||||
*/
|
||||
public boolean isRunning()
|
||||
{
|
||||
return this.running;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log debug message
|
||||
*/
|
||||
protected void logDebug(String par1Str)
|
||||
{
|
||||
this.server.logDebug(par1Str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log information message
|
||||
*/
|
||||
protected void logInfo(String par1Str)
|
||||
{
|
||||
this.server.logInfo(par1Str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log warning message
|
||||
*/
|
||||
protected void logWarning(String par1Str)
|
||||
{
|
||||
this.server.logWarning(par1Str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log severe error message
|
||||
*/
|
||||
protected void logSevere(String par1Str)
|
||||
{
|
||||
this.server.logSevere(par1Str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of players on the server
|
||||
*/
|
||||
protected int getNumberOfPlayers()
|
||||
{
|
||||
return this.server.getCurrentPlayerCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a DatagramSocket with this thread
|
||||
*/
|
||||
protected void registerSocket(DatagramSocket par1DatagramSocket)
|
||||
{
|
||||
this.logDebug("registerSocket: " + par1DatagramSocket);
|
||||
this.socketList.add(par1DatagramSocket);
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the specified DatagramSocket
|
||||
*/
|
||||
protected boolean closeSocket(DatagramSocket par1DatagramSocket, boolean par2)
|
||||
{
|
||||
this.logDebug("closeSocket: " + par1DatagramSocket);
|
||||
|
||||
if (null == par1DatagramSocket)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean var3 = false;
|
||||
|
||||
if (!par1DatagramSocket.isClosed())
|
||||
{
|
||||
par1DatagramSocket.close();
|
||||
var3 = true;
|
||||
}
|
||||
|
||||
if (par2)
|
||||
{
|
||||
this.socketList.remove(par1DatagramSocket);
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the specified ServerSocket
|
||||
*/
|
||||
protected boolean closeServerSocket(ServerSocket par1ServerSocket)
|
||||
{
|
||||
return this.closeServerSocket_do(par1ServerSocket, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the specified ServerSocket
|
||||
*/
|
||||
protected boolean closeServerSocket_do(ServerSocket par1ServerSocket, boolean par2)
|
||||
{
|
||||
this.logDebug("closeSocket: " + par1ServerSocket);
|
||||
|
||||
if (null == par1ServerSocket)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean var3 = false;
|
||||
|
||||
try
|
||||
{
|
||||
if (!par1ServerSocket.isClosed())
|
||||
{
|
||||
par1ServerSocket.close();
|
||||
var3 = true;
|
||||
}
|
||||
}
|
||||
catch (IOException var5)
|
||||
{
|
||||
this.logWarning("IO: " + var5.getMessage());
|
||||
}
|
||||
|
||||
if (par2)
|
||||
{
|
||||
this.serverSocketList.remove(par1ServerSocket);
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes all of the opened sockets
|
||||
*/
|
||||
protected void closeAllSockets()
|
||||
{
|
||||
this.closeAllSockets_do(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes all of the opened sockets
|
||||
*/
|
||||
protected void closeAllSockets_do(boolean par1)
|
||||
{
|
||||
int var2 = 0;
|
||||
Iterator var3 = this.socketList.iterator();
|
||||
|
||||
while (var3.hasNext())
|
||||
{
|
||||
DatagramSocket var4 = (DatagramSocket)var3.next();
|
||||
|
||||
if (this.closeSocket(var4, false))
|
||||
{
|
||||
++var2;
|
||||
}
|
||||
}
|
||||
|
||||
this.socketList.clear();
|
||||
var3 = this.serverSocketList.iterator();
|
||||
|
||||
while (var3.hasNext())
|
||||
{
|
||||
ServerSocket var5 = (ServerSocket)var3.next();
|
||||
|
||||
if (this.closeServerSocket_do(var5, false))
|
||||
{
|
||||
++var2;
|
||||
}
|
||||
}
|
||||
|
||||
this.serverSocketList.clear();
|
||||
|
||||
if (par1 && 0 < var2)
|
||||
{
|
||||
this.logWarning("Force closed " + var2 + " sockets");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,195 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketTimeoutException;
|
||||
|
||||
public class RConThreadClient extends RConThreadBase
|
||||
{
|
||||
/**
|
||||
* True if the client has succefssfully logged into the RCon, otherwise false
|
||||
*/
|
||||
private boolean loggedIn;
|
||||
|
||||
/** The client's Socket connection */
|
||||
private Socket clientSocket;
|
||||
|
||||
/** A buffer for incoming Socket data */
|
||||
private byte[] buffer = new byte[1460];
|
||||
|
||||
/** The RCon password */
|
||||
private String rconPassword;
|
||||
|
||||
RConThreadClient(IServer par1IServer, Socket par2Socket)
|
||||
{
|
||||
super(par1IServer);
|
||||
this.clientSocket = par2Socket;
|
||||
|
||||
try
|
||||
{
|
||||
this.clientSocket.setSoTimeout(0);
|
||||
}
|
||||
catch (Exception var4)
|
||||
{
|
||||
this.running = false;
|
||||
}
|
||||
|
||||
this.rconPassword = par1IServer.getStringProperty("rcon.password", "");
|
||||
this.logInfo("Rcon connection from: " + par2Socket.getInetAddress());
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
if (!this.running)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
BufferedInputStream var1 = new BufferedInputStream(this.clientSocket.getInputStream());
|
||||
int var2 = var1.read(this.buffer, 0, 1460);
|
||||
|
||||
if (10 <= var2)
|
||||
{
|
||||
byte var3 = 0;
|
||||
int var4 = RConUtils.getBytesAsLEInt(this.buffer, 0, var2);
|
||||
|
||||
if (var4 != var2 - 4)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int var21 = var3 + 4;
|
||||
int var5 = RConUtils.getBytesAsLEInt(this.buffer, var21, var2);
|
||||
var21 += 4;
|
||||
int var6 = RConUtils.getRemainingBytesAsLEInt(this.buffer, var21);
|
||||
var21 += 4;
|
||||
|
||||
switch (var6)
|
||||
{
|
||||
case 2:
|
||||
if (this.loggedIn)
|
||||
{
|
||||
String var8 = RConUtils.getBytesAsString(this.buffer, var21, var2);
|
||||
|
||||
try
|
||||
{
|
||||
this.sendMultipacketResponse(var5, this.server.executeCommand(var8));
|
||||
}
|
||||
catch (Exception var16)
|
||||
{
|
||||
this.sendMultipacketResponse(var5, "Error executing: " + var8 + " (" + var16.getMessage() + ")");
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
this.sendLoginFailedResponse();
|
||||
continue;
|
||||
|
||||
case 3:
|
||||
String var7 = RConUtils.getBytesAsString(this.buffer, var21, var2);
|
||||
int var10000 = var21 + var7.length();
|
||||
|
||||
if (0 != var7.length() && var7.equals(this.rconPassword))
|
||||
{
|
||||
this.loggedIn = true;
|
||||
this.sendResponse(var5, 2, "");
|
||||
continue;
|
||||
}
|
||||
|
||||
this.loggedIn = false;
|
||||
this.sendLoginFailedResponse();
|
||||
continue;
|
||||
|
||||
default:
|
||||
this.sendMultipacketResponse(var5, String.format("Unknown request %s", new Object[] {Integer.toHexString(var6)}));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SocketTimeoutException var17)
|
||||
{
|
||||
}
|
||||
catch (IOException var18)
|
||||
{
|
||||
}
|
||||
catch (Exception var19)
|
||||
{
|
||||
System.out.println(var19);
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.closeSocket();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the given response message to the client
|
||||
*/
|
||||
private void sendResponse(int par1, int par2, String par3Str) throws IOException
|
||||
{
|
||||
ByteArrayOutputStream var4 = new ByteArrayOutputStream(1248);
|
||||
DataOutputStream var5 = new DataOutputStream(var4);
|
||||
byte[] var6 = par3Str.getBytes("UTF-8");
|
||||
var5.writeInt(Integer.reverseBytes(var6.length + 10));
|
||||
var5.writeInt(Integer.reverseBytes(par1));
|
||||
var5.writeInt(Integer.reverseBytes(par2));
|
||||
var5.write(var6);
|
||||
var5.write(0);
|
||||
var5.write(0);
|
||||
this.clientSocket.getOutputStream().write(var4.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the standard RCon 'authorization failed' response packet
|
||||
*/
|
||||
private void sendLoginFailedResponse() throws IOException
|
||||
{
|
||||
this.sendResponse(-1, 2, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits the response message into individual packets and sends each one
|
||||
*/
|
||||
private void sendMultipacketResponse(int par1, String par2Str) throws IOException
|
||||
{
|
||||
int var3 = par2Str.length();
|
||||
|
||||
do
|
||||
{
|
||||
int var4 = 4096 <= var3 ? 4096 : var3;
|
||||
this.sendResponse(par1, 0, par2Str.substring(0, var4));
|
||||
par2Str = par2Str.substring(var4);
|
||||
var3 = par2Str.length();
|
||||
}
|
||||
while (0 != var3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the client socket
|
||||
*/
|
||||
private void closeSocket()
|
||||
{
|
||||
if (null != this.clientSocket)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.clientSocket.close();
|
||||
}
|
||||
catch (IOException var2)
|
||||
{
|
||||
this.logWarning("IO: " + var2.getMessage());
|
||||
}
|
||||
|
||||
this.clientSocket = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class RConThreadMain extends RConThreadBase
|
||||
{
|
||||
/** Port RCon is running on */
|
||||
private int rconPort;
|
||||
|
||||
/** Port the server is running on */
|
||||
private int serverPort;
|
||||
|
||||
/** Hostname RCon is running on */
|
||||
private String hostname;
|
||||
|
||||
/** The RCon ServerSocket. */
|
||||
private ServerSocket serverSocket;
|
||||
|
||||
/** The RCon password */
|
||||
private String rconPassword;
|
||||
|
||||
/** A map of client addresses to their running Threads */
|
||||
private Map clientThreads;
|
||||
|
||||
public RConThreadMain(IServer par1IServer)
|
||||
{
|
||||
super(par1IServer);
|
||||
this.rconPort = par1IServer.getIntProperty("rcon.port", 0);
|
||||
this.rconPassword = par1IServer.getStringProperty("rcon.password", "");
|
||||
this.hostname = par1IServer.getHostname();
|
||||
this.serverPort = par1IServer.getPort();
|
||||
|
||||
if (0 == this.rconPort)
|
||||
{
|
||||
this.rconPort = this.serverPort + 10;
|
||||
this.logInfo("Setting default rcon port to " + this.rconPort);
|
||||
par1IServer.setProperty("rcon.port", Integer.valueOf(this.rconPort));
|
||||
|
||||
if (0 == this.rconPassword.length())
|
||||
{
|
||||
par1IServer.setProperty("rcon.password", "");
|
||||
}
|
||||
|
||||
par1IServer.saveProperties();
|
||||
}
|
||||
|
||||
if (0 == this.hostname.length())
|
||||
{
|
||||
this.hostname = "0.0.0.0";
|
||||
}
|
||||
|
||||
this.initClientThreadList();
|
||||
this.serverSocket = null;
|
||||
}
|
||||
|
||||
private void initClientThreadList()
|
||||
{
|
||||
this.clientThreads = new HashMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up the clientThreads map by removing client Threads that are not running
|
||||
*/
|
||||
private void cleanClientThreadsMap()
|
||||
{
|
||||
Iterator var1 = this.clientThreads.entrySet().iterator();
|
||||
|
||||
while (var1.hasNext())
|
||||
{
|
||||
Entry var2 = (Entry)var1.next();
|
||||
|
||||
if (!((RConThreadClient)var2.getValue()).isRunning())
|
||||
{
|
||||
var1.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
this.logInfo("RCON running on " + this.hostname + ":" + this.rconPort);
|
||||
|
||||
try
|
||||
{
|
||||
while (this.running)
|
||||
{
|
||||
try
|
||||
{
|
||||
Socket var1 = this.serverSocket.accept();
|
||||
var1.setSoTimeout(500);
|
||||
RConThreadClient var2 = new RConThreadClient(this.server, var1);
|
||||
var2.startThread();
|
||||
this.clientThreads.put(var1.getRemoteSocketAddress(), var2);
|
||||
this.cleanClientThreadsMap();
|
||||
}
|
||||
catch (SocketTimeoutException var7)
|
||||
{
|
||||
this.cleanClientThreadsMap();
|
||||
}
|
||||
catch (IOException var8)
|
||||
{
|
||||
if (this.running)
|
||||
{
|
||||
this.logInfo("IO: " + var8.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.closeServerSocket(this.serverSocket);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Thread object from this class and starts running
|
||||
*/
|
||||
public void startThread()
|
||||
{
|
||||
if (0 == this.rconPassword.length())
|
||||
{
|
||||
this.logWarning("No rcon password set in \'" + this.server.getSettingsFilename() + "\', rcon disabled!");
|
||||
}
|
||||
else if (0 < this.rconPort && 65535 >= this.rconPort)
|
||||
{
|
||||
if (!this.running)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.serverSocket = new ServerSocket(this.rconPort, 0, InetAddress.getByName(this.hostname));
|
||||
this.serverSocket.setSoTimeout(500);
|
||||
super.startThread();
|
||||
}
|
||||
catch (IOException var2)
|
||||
{
|
||||
this.logWarning("Unable to initialise rcon on " + this.hostname + ":" + this.rconPort + " : " + var2.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.logWarning("Invalid rcon port " + this.rconPort + " found in \'" + this.server.getSettingsFilename() + "\', rcon disabled!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,409 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.DatagramPacket;
|
||||
import java.net.DatagramSocket;
|
||||
import java.net.InetAddress;
|
||||
import java.net.PortUnreachableException;
|
||||
import java.net.SocketAddress;
|
||||
import java.net.SocketException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
public class RConThreadQuery extends RConThreadBase
|
||||
{
|
||||
/** The time of the last client auth check */
|
||||
private long lastAuthCheckTime;
|
||||
|
||||
/** The RCon query port */
|
||||
private int queryPort;
|
||||
|
||||
/** Port the server is running on */
|
||||
private int serverPort;
|
||||
|
||||
/** The maximum number of players allowed on the server */
|
||||
private int maxPlayers;
|
||||
|
||||
/** The current server message of the day */
|
||||
private String serverMotd;
|
||||
|
||||
/** The name of the currently loaded world */
|
||||
private String worldName;
|
||||
|
||||
/** The remote socket querying the server */
|
||||
private DatagramSocket querySocket;
|
||||
|
||||
/** A buffer for incoming DatagramPackets */
|
||||
private byte[] buffer = new byte[1460];
|
||||
|
||||
/** Storage for incoming DatagramPackets */
|
||||
private DatagramPacket incomingPacket;
|
||||
private Map field_72644_p;
|
||||
|
||||
/** The hostname of this query server */
|
||||
private String queryHostname;
|
||||
|
||||
/** The hostname of the running server */
|
||||
private String serverHostname;
|
||||
|
||||
/** A map of SocketAddress objects to RConThreadQueryAuth objects */
|
||||
private Map queryClients;
|
||||
|
||||
/**
|
||||
* The time that this RConThreadQuery was constructed, from (new Date()).getTime()
|
||||
*/
|
||||
private long time;
|
||||
|
||||
/** The RConQuery output stream */
|
||||
private RConOutputStream output;
|
||||
|
||||
/** The time of the last query response sent */
|
||||
private long lastQueryResponseTime;
|
||||
|
||||
public RConThreadQuery(IServer par1IServer)
|
||||
{
|
||||
super(par1IServer);
|
||||
this.queryPort = par1IServer.getIntProperty("query.port", 0);
|
||||
this.serverHostname = par1IServer.getHostname();
|
||||
this.serverPort = par1IServer.getPort();
|
||||
this.serverMotd = par1IServer.getServerMOTD();
|
||||
this.maxPlayers = par1IServer.getMaxPlayers();
|
||||
this.worldName = par1IServer.getFolderName();
|
||||
this.lastQueryResponseTime = 0L;
|
||||
this.queryHostname = "0.0.0.0";
|
||||
|
||||
if (0 != this.serverHostname.length() && !this.queryHostname.equals(this.serverHostname))
|
||||
{
|
||||
this.queryHostname = this.serverHostname;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.serverHostname = "0.0.0.0";
|
||||
|
||||
try
|
||||
{
|
||||
InetAddress var2 = InetAddress.getLocalHost();
|
||||
this.queryHostname = var2.getHostAddress();
|
||||
}
|
||||
catch (UnknownHostException var3)
|
||||
{
|
||||
this.logWarning("Unable to determine local host IP, please set server-ip in \'" + par1IServer.getSettingsFilename() + "\' : " + var3.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if (0 == this.queryPort)
|
||||
{
|
||||
this.queryPort = this.serverPort;
|
||||
this.logInfo("Setting default query port to " + this.queryPort);
|
||||
par1IServer.setProperty("query.port", Integer.valueOf(this.queryPort));
|
||||
par1IServer.setProperty("debug", Boolean.valueOf(false));
|
||||
par1IServer.saveProperties();
|
||||
}
|
||||
|
||||
this.field_72644_p = new HashMap();
|
||||
this.output = new RConOutputStream(1460);
|
||||
this.queryClients = new HashMap();
|
||||
this.time = (new Date()).getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a byte array as a DatagramPacket response to the client who sent the given DatagramPacket
|
||||
*/
|
||||
private void sendResponsePacket(byte[] par1ArrayOfByte, DatagramPacket par2DatagramPacket) throws IOException
|
||||
{
|
||||
this.querySocket.send(new DatagramPacket(par1ArrayOfByte, par1ArrayOfByte.length, par2DatagramPacket.getSocketAddress()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses an incoming DatagramPacket, returning true if the packet was valid
|
||||
*/
|
||||
private boolean parseIncomingPacket(DatagramPacket par1DatagramPacket) throws IOException
|
||||
{
|
||||
byte[] var2 = par1DatagramPacket.getData();
|
||||
int var3 = par1DatagramPacket.getLength();
|
||||
SocketAddress var4 = par1DatagramPacket.getSocketAddress();
|
||||
this.logDebug("Packet len " + var3 + " [" + var4 + "]");
|
||||
|
||||
if (3 <= var3 && -2 == var2[0] && -3 == var2[1])
|
||||
{
|
||||
this.logDebug("Packet \'" + RConUtils.getByteAsHexString(var2[2]) + "\' [" + var4 + "]");
|
||||
|
||||
switch (var2[2])
|
||||
{
|
||||
case 0:
|
||||
if (!this.verifyClientAuth(par1DatagramPacket).booleanValue())
|
||||
{
|
||||
this.logDebug("Invalid challenge [" + var4 + "]");
|
||||
return false;
|
||||
}
|
||||
else if (15 == var3)
|
||||
{
|
||||
this.sendResponsePacket(this.createQueryResponse(par1DatagramPacket), par1DatagramPacket);
|
||||
this.logDebug("Rules [" + var4 + "]");
|
||||
}
|
||||
else
|
||||
{
|
||||
RConOutputStream var5 = new RConOutputStream(1460);
|
||||
var5.writeInt(0);
|
||||
var5.writeByteArray(this.getRequestID(par1DatagramPacket.getSocketAddress()));
|
||||
var5.writeString(this.serverMotd);
|
||||
var5.writeString("SMP");
|
||||
var5.writeString(this.worldName);
|
||||
var5.writeString(Integer.toString(this.getNumberOfPlayers()));
|
||||
var5.writeString(Integer.toString(this.maxPlayers));
|
||||
var5.writeShort((short)this.serverPort);
|
||||
var5.writeString(this.queryHostname);
|
||||
this.sendResponsePacket(var5.toByteArray(), par1DatagramPacket);
|
||||
this.logDebug("Status [" + var4 + "]");
|
||||
}
|
||||
|
||||
case 9:
|
||||
this.sendAuthChallenge(par1DatagramPacket);
|
||||
this.logDebug("Challenge [" + var4 + "]");
|
||||
return true;
|
||||
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.logDebug("Invalid packet [" + var4 + "]");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a query response as a byte array for the specified query DatagramPacket
|
||||
*/
|
||||
private byte[] createQueryResponse(DatagramPacket par1DatagramPacket) throws IOException
|
||||
{
|
||||
long var2 = MinecraftServer.getSystemTimeMillis();
|
||||
|
||||
if (var2 < this.lastQueryResponseTime + 5000L)
|
||||
{
|
||||
byte[] var7 = this.output.toByteArray();
|
||||
byte[] var8 = this.getRequestID(par1DatagramPacket.getSocketAddress());
|
||||
var7[1] = var8[0];
|
||||
var7[2] = var8[1];
|
||||
var7[3] = var8[2];
|
||||
var7[4] = var8[3];
|
||||
return var7;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.lastQueryResponseTime = var2;
|
||||
this.output.reset();
|
||||
this.output.writeInt(0);
|
||||
this.output.writeByteArray(this.getRequestID(par1DatagramPacket.getSocketAddress()));
|
||||
this.output.writeString("splitnum");
|
||||
this.output.writeInt(128);
|
||||
this.output.writeInt(0);
|
||||
this.output.writeString("hostname");
|
||||
this.output.writeString(this.serverMotd);
|
||||
this.output.writeString("gametype");
|
||||
this.output.writeString("SMP");
|
||||
this.output.writeString("game_id");
|
||||
this.output.writeString("MINECRAFT");
|
||||
this.output.writeString("version");
|
||||
this.output.writeString(this.server.getMinecraftVersion());
|
||||
this.output.writeString("plugins");
|
||||
this.output.writeString(this.server.getPlugins());
|
||||
this.output.writeString("map");
|
||||
this.output.writeString(this.worldName);
|
||||
this.output.writeString("numplayers");
|
||||
this.output.writeString("" + this.getNumberOfPlayers());
|
||||
this.output.writeString("maxplayers");
|
||||
this.output.writeString("" + this.maxPlayers);
|
||||
this.output.writeString("hostport");
|
||||
this.output.writeString("" + this.serverPort);
|
||||
this.output.writeString("hostip");
|
||||
this.output.writeString(this.queryHostname);
|
||||
this.output.writeInt(0);
|
||||
this.output.writeInt(1);
|
||||
this.output.writeString("player_");
|
||||
this.output.writeInt(0);
|
||||
String[] var4 = this.server.getAllUsernames();
|
||||
byte var5 = (byte)var4.length;
|
||||
|
||||
for (byte var6 = (byte)(var5 - 1); var6 >= 0; --var6)
|
||||
{
|
||||
this.output.writeString(var4[var6]);
|
||||
}
|
||||
|
||||
this.output.writeInt(0);
|
||||
return this.output.toByteArray();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the request ID provided by the authorized client
|
||||
*/
|
||||
private byte[] getRequestID(SocketAddress par1SocketAddress)
|
||||
{
|
||||
return ((RConThreadQueryAuth)this.queryClients.get(par1SocketAddress)).getRequestId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the client has a valid auth, otherwise false
|
||||
*/
|
||||
private Boolean verifyClientAuth(DatagramPacket par1DatagramPacket)
|
||||
{
|
||||
SocketAddress var2 = par1DatagramPacket.getSocketAddress();
|
||||
|
||||
if (!this.queryClients.containsKey(var2))
|
||||
{
|
||||
return Boolean.valueOf(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] var3 = par1DatagramPacket.getData();
|
||||
return ((RConThreadQueryAuth)this.queryClients.get(var2)).getRandomChallenge() != RConUtils.getBytesAsBEint(var3, 7, par1DatagramPacket.getLength()) ? Boolean.valueOf(false) : Boolean.valueOf(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an auth challenge DatagramPacket to the client and adds the client to the queryClients map
|
||||
*/
|
||||
private void sendAuthChallenge(DatagramPacket par1DatagramPacket) throws IOException
|
||||
{
|
||||
RConThreadQueryAuth var2 = new RConThreadQueryAuth(this, par1DatagramPacket);
|
||||
this.queryClients.put(par1DatagramPacket.getSocketAddress(), var2);
|
||||
this.sendResponsePacket(var2.getChallengeValue(), par1DatagramPacket);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all clients whose auth is no longer valid
|
||||
*/
|
||||
private void cleanQueryClientsMap()
|
||||
{
|
||||
if (this.running)
|
||||
{
|
||||
long var1 = MinecraftServer.getSystemTimeMillis();
|
||||
|
||||
if (var1 >= this.lastAuthCheckTime + 30000L)
|
||||
{
|
||||
this.lastAuthCheckTime = var1;
|
||||
Iterator var3 = this.queryClients.entrySet().iterator();
|
||||
|
||||
while (var3.hasNext())
|
||||
{
|
||||
Entry var4 = (Entry)var3.next();
|
||||
|
||||
if (((RConThreadQueryAuth)var4.getValue()).hasExpired(var1).booleanValue())
|
||||
{
|
||||
var3.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
this.logInfo("Query running on " + this.serverHostname + ":" + this.queryPort);
|
||||
this.lastAuthCheckTime = MinecraftServer.getSystemTimeMillis();
|
||||
this.incomingPacket = new DatagramPacket(this.buffer, this.buffer.length);
|
||||
|
||||
try
|
||||
{
|
||||
while (this.running)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.querySocket.receive(this.incomingPacket);
|
||||
this.cleanQueryClientsMap();
|
||||
this.parseIncomingPacket(this.incomingPacket);
|
||||
}
|
||||
catch (SocketTimeoutException var7)
|
||||
{
|
||||
this.cleanQueryClientsMap();
|
||||
}
|
||||
catch (PortUnreachableException var8)
|
||||
{
|
||||
;
|
||||
}
|
||||
catch (IOException var9)
|
||||
{
|
||||
this.stopWithException(var9);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.closeAllSockets();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Thread object from this class and starts running
|
||||
*/
|
||||
public void startThread()
|
||||
{
|
||||
if (!this.running)
|
||||
{
|
||||
if (0 < this.queryPort && 65535 >= this.queryPort)
|
||||
{
|
||||
if (this.initQuerySystem())
|
||||
{
|
||||
super.startThread();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.logWarning("Invalid query port " + this.queryPort + " found in \'" + this.server.getSettingsFilename() + "\' (queries disabled)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the query server and reports the given Exception
|
||||
*/
|
||||
private void stopWithException(Exception par1Exception)
|
||||
{
|
||||
if (this.running)
|
||||
{
|
||||
this.logWarning("Unexpected exception, buggy JRE? (" + par1Exception.toString() + ")");
|
||||
|
||||
if (!this.initQuerySystem())
|
||||
{
|
||||
this.logSevere("Failed to recover from buggy JRE, shutting down!");
|
||||
this.running = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the query system by binding it to a port
|
||||
*/
|
||||
private boolean initQuerySystem()
|
||||
{
|
||||
try
|
||||
{
|
||||
this.querySocket = new DatagramSocket(this.queryPort, InetAddress.getByName(this.serverHostname));
|
||||
this.registerSocket(this.querySocket);
|
||||
this.querySocket.setSoTimeout(500);
|
||||
return true;
|
||||
}
|
||||
catch (SocketException var2)
|
||||
{
|
||||
this.logWarning("Unable to initialise query system on " + this.serverHostname + ":" + this.queryPort + " (Socket): " + var2.getMessage());
|
||||
}
|
||||
catch (UnknownHostException var3)
|
||||
{
|
||||
this.logWarning("Unable to initialise query system on " + this.serverHostname + ":" + this.queryPort + " (Unknown Host): " + var3.getMessage());
|
||||
}
|
||||
catch (Exception var4)
|
||||
{
|
||||
this.logWarning("Unable to initialise query system on " + this.serverHostname + ":" + this.queryPort + " (E): " + var4.getMessage());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.net.DatagramPacket;
|
||||
import java.util.Date;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
class RConThreadQueryAuth
|
||||
{
|
||||
/** The creation timestamp for this auth */
|
||||
private long timestamp;
|
||||
|
||||
/** A random challenge */
|
||||
private int randomChallenge;
|
||||
|
||||
/** A client-provided request ID associated with this query. */
|
||||
private byte[] requestId;
|
||||
|
||||
/** A unique string of bytes used to verify client auth */
|
||||
private byte[] challengeValue;
|
||||
|
||||
/** The request ID stored as a String */
|
||||
private String requestIdAsString;
|
||||
|
||||
/** The RConThreadQuery that this is probably an inner class of */
|
||||
final RConThreadQuery queryThread;
|
||||
|
||||
public RConThreadQueryAuth(RConThreadQuery par1RConThreadQuery, DatagramPacket par2DatagramPacket)
|
||||
{
|
||||
this.queryThread = par1RConThreadQuery;
|
||||
this.timestamp = (new Date()).getTime();
|
||||
byte[] var3 = par2DatagramPacket.getData();
|
||||
this.requestId = new byte[4];
|
||||
this.requestId[0] = var3[3];
|
||||
this.requestId[1] = var3[4];
|
||||
this.requestId[2] = var3[5];
|
||||
this.requestId[3] = var3[6];
|
||||
this.requestIdAsString = new String(this.requestId);
|
||||
this.randomChallenge = (new EaglercraftRandom()).nextInt(16777216);
|
||||
this.challengeValue = String.format("\t%s%d\u0000", new Object[] {this.requestIdAsString, Integer.valueOf(this.randomChallenge)}).getBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the auth's creation timestamp is less than the given time, otherwise false
|
||||
*/
|
||||
public Boolean hasExpired(long par1)
|
||||
{
|
||||
return Boolean.valueOf(this.timestamp < par1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the random challenge number assigned to this auth
|
||||
*/
|
||||
public int getRandomChallenge()
|
||||
{
|
||||
return this.randomChallenge;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the auth challenge value
|
||||
*/
|
||||
public byte[] getChallengeValue()
|
||||
{
|
||||
return this.challengeValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the request ID provided by the client.
|
||||
*/
|
||||
public byte[] getRequestId()
|
||||
{
|
||||
return this.requestId;
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
public class RConUtils
|
||||
{
|
||||
/** Translation array of decimal to hex digits */
|
||||
public static char[] hexDigits = new char[] {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
|
||||
|
||||
/**
|
||||
* Read a null-terminated string from the given byte array
|
||||
*/
|
||||
public static String getBytesAsString(byte[] par0ArrayOfByte, int par1, int par2)
|
||||
{
|
||||
int var3 = par2 - 1;
|
||||
int var4;
|
||||
|
||||
for (var4 = par1 > var3 ? var3 : par1; 0 != par0ArrayOfByte[var4] && var4 < var3; ++var4)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return new String(par0ArrayOfByte, par1, var4 - par1, "UTF-8");
|
||||
}
|
||||
catch (UnsupportedEncodingException var6)
|
||||
{
|
||||
var6.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read 4 bytes from the
|
||||
*/
|
||||
public static int getRemainingBytesAsLEInt(byte[] par0ArrayOfByte, int par1)
|
||||
{
|
||||
return getBytesAsLEInt(par0ArrayOfByte, par1, par0ArrayOfByte.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read 4 bytes from the given array in little-endian format and return them as an int
|
||||
*/
|
||||
public static int getBytesAsLEInt(byte[] par0ArrayOfByte, int par1, int par2)
|
||||
{
|
||||
return 0 > par2 - par1 - 4 ? 0 : par0ArrayOfByte[par1 + 3] << 24 | (par0ArrayOfByte[par1 + 2] & 255) << 16 | (par0ArrayOfByte[par1 + 1] & 255) << 8 | par0ArrayOfByte[par1] & 255;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read 4 bytes from the given array in big-endian format and return them as an int
|
||||
*/
|
||||
public static int getBytesAsBEint(byte[] par0ArrayOfByte, int par1, int par2)
|
||||
{
|
||||
return 0 > par2 - par1 - 4 ? 0 : par0ArrayOfByte[par1] << 24 | (par0ArrayOfByte[par1 + 1] & 255) << 16 | (par0ArrayOfByte[par1 + 2] & 255) << 8 | par0ArrayOfByte[par1 + 3] & 255;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a String representation of the byte in hexadecimal format
|
||||
*/
|
||||
public static String getByteAsHexString(byte par0)
|
||||
{
|
||||
return "" + hexDigits[(par0 & 240) >>> 4] + hexDigits[par0 & 15];
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,12 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.zip.DeflaterOutputStream;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.InflaterInputStream;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
public class RegionFile
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
|
||||
public abstract class Render
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
|
||||
public class RenderArrow extends Render
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
|
||||
public class RenderBat extends RenderLiving
|
||||
{
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
|
||||
public class RenderBiped extends RenderLiving
|
||||
{
|
||||
protected ModelBiped modelBipedMain;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user