Compare commits

...

2 Commits

Author SHA1 Message Date
PeytonPlayz595
a4c4ca9652 Did some things 2024-03-18 01:26:45 -04:00
PeytonPlayz595
0c9cf255cf womp womp 2024-03-17 23:07:03 -04:00
118 changed files with 7596 additions and 11797 deletions

View File

@ -1,2 +1,2 @@
@echo off
java -jar desktopRuntime/eclipseProject/jars/CompilePackage.jar "desktopRuntime/resources/" "js/resources.mc"
java -jar desktopRuntime/eclipseProject/jars/CompilePackage.jar "desktopRuntime/resources/" "web/resources.mc"

View File

@ -1,2 +1,2 @@
#!/bin/sh
java -jar desktopRuntime/eclipseProject/jars/CompilePackage.jar "desktopRuntime/resources/" "js/resources.mc"
java -jar desktopRuntime/eclipseProject/jars/CompilePackage.jar "desktopRuntime/resources/" "web/resources.mc"

View File

@ -20,9 +20,11 @@ The textures are compiled into `resources.mc` using [Laxdude](https://github.com
As of right now there is no system to compile an offline download, so you will have to manually copy and paste the javascript from `web/js/app.js` into the HTML file, for the `resources.mc` just encode the file using [Base64](https://www.base64encode.org/) and paste it into the assets div.
# Muliplayer
Multiplayer has been removed because I am too lazy to rewrite it, unless you're planning on porting it yourself, do NOT ask for multiplayer, it will NOT be added anytime soon!
Multiplayer has been successfully rewritten and thoroughly tested. It seems to be pretty stable but it had to be removed due to a glitch in Singleplayer's chunk loading, the issue lies within Alpha's multiplayer code somewhere and I am unable to pinpoint the exact cause of the issue so until I am able to figure it out, multiplayer will not be avalible.
If you do want to try to port it then I would recommend using a diff of Alpha v1.2.6 and this project to port the original code back over, all packet classes and networking code has been completely removed.
If you are really impatient and cannot wait then go through the commit history and find commit 62af5c9 titled "oops" and download the offline download from there, **THIS VERSION IS BUGGED AND CHUNK LOADING IN SINGLEPLAYER IS EXTREMELY BUGGY, SOME CHUNKS MAY NOT EVEN SAVE AT ALL!**
If you do decide to use this version (not recommended) just download the Alpha v1.2.6 server software from web archive and use websockify to proxy it to websockets.
# Texture Packs
This is pretty much self explanitory, just make sure the textures have the same structure as in `resources/`, and then add it to a ZIP file, if a texture pack does not work then most likely it is not for this version of Minecraft. You're probably gonna have to make your own texture pack, texture packs for Alpha are very rare these days.

View File

@ -1,9 +1,7 @@
// eaglercraft opengl 1.3 emulation
// copyright (c) 2020 calder young
// creative commons BY-NC 4.0
// copyright (c) 2020-2023 lax1dude
#line 7
#line 4
precision highp int;
precision highp sampler2D;
@ -99,6 +97,8 @@ in vec2 v_texture0;
out vec4 fragColor;
#define TEX_MAT3x2(mat4In) mat3x2(mat4In[0].xy,mat4In[1].xy,mat4In[3].xy)
void main(){
#ifdef CC_a_color
vec4 color = colorUniform * v_color;
@ -108,9 +108,9 @@ void main(){
#ifdef CC_unit0
#ifdef CC_a_texture0
color *= texture(tex0, (matrix_t * vec4(v_texture0, 0.0, 1.0)).xy).rgba;
color *= texture(tex0, (TEX_MAT3x2(matrix_t) * vec3(v_texture0, 1.0)).xy).rgba;
#else
color *= texture(tex0, (matrix_t * vec4(texCoordV0, 0.0, 1.0)).xy).rgba;
color *= texture(tex0, (TEX_MAT3x2(matrix_t) * vec3(texCoordV0, 1.0)).xy).rgba;
#endif
#endif
@ -133,7 +133,7 @@ void main(){
#ifdef CC_fog
float dist = sqrt(dot(v_position, v_position));
float i = (fogMode == 1) ? clamp((dist - fogStart) / (fogEnd - fogStart), 0.0, 1.0) : clamp(1.0 - pow(2.718, -(fogDensity * dist)), 0.0, 1.0);
float i = (fogMode == 1) ? clamp((dist - fogStart) / (fogEnd - fogStart), 0.0, 1.0) : clamp(1.0 - exp(-(fogDensity * dist)), 0.0, 1.0);
color.rgb = mix(color.rgb, fogColor.xyz, i * fogColor.a);
#endif
@ -141,4 +141,3 @@ void main(){
}
#endif

View File

@ -1,9 +1,7 @@
// eaglercraft opengl 1.3 emulation
// copyright (c) 2020 calder young
// creative commons BY-NC 4.0
// copyright (c) 2020-2023 lax1dude
#line 7
#line 4
precision highp int;
precision highp sampler2D;
@ -99,6 +97,8 @@ in vec2 v_texture0;
out vec4 fragColor;
#define TEX_MAT3x2(mat4In) mat3x2(mat4In[0].xy,mat4In[1].xy,mat4In[3].xy)
void main(){
#ifdef CC_a_color
vec4 color = colorUniform * v_color;
@ -108,9 +108,9 @@ void main(){
#ifdef CC_unit0
#ifdef CC_a_texture0
color *= texture(tex0, (matrix_t * vec4(v_texture0, 0.0, 1.0)).xy).rgba;
color *= texture(tex0, (TEX_MAT3x2(matrix_t) * vec3(v_texture0, 1.0)).xy).rgba;
#else
color *= texture(tex0, (matrix_t * vec4(texCoordV0, 0.0, 1.0)).xy).rgba;
color *= texture(tex0, (TEX_MAT3x2(matrix_t) * vec3(texCoordV0, 1.0)).xy).rgba;
#endif
#endif
@ -133,7 +133,7 @@ void main(){
#ifdef CC_fog
float dist = sqrt(dot(v_position, v_position));
float i = (fogMode == 1) ? clamp((dist - fogStart) / (fogEnd - fogStart), 0.0, 1.0) : clamp(1.0 - pow(2.718, -(fogDensity * dist)), 0.0, 1.0);
float i = (fogMode == 1) ? clamp((dist - fogStart) / (fogEnd - fogStart), 0.0, 1.0) : clamp(1.0 - exp(-(fogDensity * dist)), 0.0, 1.0);
color.rgb = mix(color.rgb, fogColor.xyz, i * fogColor.a);
#endif
@ -141,4 +141,3 @@ void main(){
}
#endif

View File

@ -18,11 +18,10 @@ public class GameSettings {
File file1 = new File("filesystem");
File file = new File(file1, "options.txt");
if(!file.exists()) {
file.createNewFile();
return;
}
byte[] fileData = new byte[(int) file.length()];
byte[] fileData = new byte[0];
try (FileInputStream fis = new FileInputStream(file)) {
fis.read(fileData);
} catch(IOException e) {
@ -94,10 +93,6 @@ public class GameSettings {
Minecraft.getMinecraft().gameSettings.field_12259_z = var3[1];
}
if(var3[0].equals("username")) {
Minecraft.getMinecraft().gameSettings.username = var3[1];
}
for(int var4 = 0; var4 < Minecraft.getMinecraft().gameSettings.keyBindings.length; ++var4) {
if(var3[0].equals("key_" + Minecraft.getMinecraft().gameSettings.keyBindings[var4].keyDescription)) {
Minecraft.getMinecraft().gameSettings.keyBindings[var4].keyCode = Integer.parseInt(var3[1]);
@ -129,12 +124,6 @@ public class GameSettings {
var1.println("difficulty:" + Minecraft.getMinecraft().gameSettings.difficulty);
var1.println("fancyGraphics:" + Minecraft.getMinecraft().gameSettings.fancyGraphics);
var1.println("skin:" + Minecraft.getMinecraft().gameSettings.skin);
if(Minecraft.getMinecraft().gameSettings.field_12259_z.length() != 0) {
var1.println("lastServer:" + Minecraft.getMinecraft().gameSettings.field_12259_z);
}
if(Minecraft.getMinecraft().gameSettings.username.length() != 0) {
var1.println("username:" + Minecraft.getMinecraft().gameSettings.username);
}
for(int var2 = 0; var2 < Minecraft.getMinecraft().gameSettings.keyBindings.length; ++var2) {
var1.println("key_" + Minecraft.getMinecraft().gameSettings.keyBindings[var2].keyDescription + ":" + Minecraft.getMinecraft().gameSettings.keyBindings[var2].keyCode);

View File

@ -44,8 +44,6 @@ import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.filechooser.FileFilter;
import org.java_websocket.client.WebSocketClient;
import org.java_websocket.handshake.ServerHandshake;
import org.lwjgl.LWJGLException;
import org.lwjgl.Sys;
import org.lwjgl.input.Keyboard;
@ -212,6 +210,7 @@ public class EaglerAdapterImpl2 {
public static final int _wGL_ELEMENT_ARRAY_BUFFER = GL15.GL_ELEMENT_ARRAY_BUFFER;
public static final int _wGL_STATIC_DRAW = GL15.GL_STATIC_DRAW;
public static final int _wGL_DYNAMIC_DRAW = GL15.GL_DYNAMIC_DRAW;
public static final int _wGL_STREAM_DRAW = GL15.GL_STREAM_DRAW;
public static final int _wGL_INVALID_ENUM = GL11.GL_INVALID_ENUM;
public static final int _wGL_INVALID_VALUE = GL11.GL_INVALID_VALUE;
public static final int _wGL_INVALID_OPERATION = GL11.GL_INVALID_OPERATION;
@ -532,6 +531,10 @@ public class EaglerAdapterImpl2 {
GL15.glBufferData(p1, p2, p3);
}
public static final void _wglBufferData00(int p1, long len, int p3) {
GL15.glBufferData(p1, len, p3);
}
public static final void _wglBufferSubData0(int p1, int p2, IntBuffer p3) {
GL15.glBufferSubData(p1, p2, p3);
}
@ -676,6 +679,10 @@ public class EaglerAdapterImpl2 {
GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, p1, GL11.GL_TEXTURE_2D, p2.obj, 0);
}
public static final void _wglFramebufferTexture2D(int p1, TextureGL p2, int lvl) {
GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, p1, GL11.GL_TEXTURE_2D, p2.obj, lvl);
}
public static final RenderbufferGL _wglCreateRenderBuffer() {
return new RenderbufferGL(GL30.glGenRenderbuffers());
}
@ -748,7 +755,8 @@ public class EaglerAdapterImpl2 {
try {
BufferedImage img = ImageIO.read(new ByteArrayInputStream(data));
int[] pxls = img.getRGB(0, 0, img.getWidth(), img.getHeight(), null, 0, img.getWidth());
return new EaglerImage(pxls, img.getWidth(), img.getHeight(), true);
IntBuffer buffer = IntBuffer.wrap(pxls);
return new EaglerImage(buffer, img.getWidth(), img.getHeight(), true);
} catch (IOException e) {
System.err.println("Could not load PNG file:");
e.printStackTrace();
@ -1080,188 +1088,6 @@ public class EaglerAdapterImpl2 {
Display.sync(performanceToFps);
}
private static final Set<String> rateLimitedAddresses = new HashSet();
private static final Set<String> blockedAddresses = new HashSet();
private static WebSocketClient clientSocket = null;
private static final Object socketSync = new Object();
private static LinkedList<byte[]> readPackets = new LinkedList();
private static class EaglerSocketClient extends WebSocketClient {
private Exception currentException = null;
private boolean wasAbleToConnect = false;
private String serverUriString;
private boolean socketIsAlive = false;
public EaglerSocketClient(URI serverUri, String str) throws IOException, InterruptedException {
super(serverUri);
this.setTcpNoDelay(true);
this.setConnectionLostTimeout(5);
System.out.println("[ws] connecting to " + serverUri.toString());
rateLimitStatus = null;
if (!this.connectBlocking(5, TimeUnit.SECONDS)) {
synchronized (socketSync) {
if (rateLimitStatus == null) {
if (blockedAddresses.contains(str)) {
rateLimitStatus = RateLimit.BLOCKED;
} else if (rateLimitedAddresses.contains(str)) {
rateLimitStatus = RateLimit.FAILED_POSSIBLY_LOCKED;
} else {
rateLimitStatus = RateLimit.FAILED;
}
}
}
throw new IOException("could not connect socket", currentException);
}
serverUriString = str;
}
@Override
public void onClose(int arg0, String arg1, boolean arg2) {
synchronized (socketSync) {
readPackets.clear();
System.out.println("[ws] disconnecting - " + currentException);
currentException = null;
if (!wasAbleToConnect && rateLimitStatus == null) {
if (blockedAddresses.contains(serverUriString)) {
rateLimitStatus = RateLimit.LOCKED;
} else if (rateLimitedAddresses.contains(serverUriString)) {
rateLimitStatus = RateLimit.FAILED_POSSIBLY_LOCKED;
} else {
rateLimitStatus = RateLimit.FAILED;
}
} else if (!socketIsAlive && (blockedAddresses.contains(serverUriString)
|| rateLimitedAddresses.contains(serverUriString))) {
rateLimitStatus = RateLimit.LOCKED;
}
}
}
@Override
public void onError(Exception arg0) {
currentException = arg0;
}
@Override
public void onMessage(String arg0) {
wasAbleToConnect = true;
synchronized (socketSync) {
if (arg0.equalsIgnoreCase("BLOCKED")) {
rateLimitedAddresses.add(serverUriString);
if (rateLimitStatus == null) {
rateLimitStatus = RateLimit.BLOCKED;
}
} else if (arg0.equalsIgnoreCase("LOCKED")) {
blockedAddresses.add(serverUriString);
rateLimitedAddresses.add(serverUriString);
if (rateLimitStatus == null) {
rateLimitStatus = RateLimit.NOW_LOCKED;
}
}
}
this.close();
currentException = null;
}
@Override
public void onMessage(ByteBuffer arg0) {
wasAbleToConnect = true;
synchronized (socketSync) {
readPackets.add(arg0.array());
}
currentException = null;
}
@Override
public void onOpen(ServerHandshake arg0) {
System.out.println("[ws] connected.");
}
}
public static final boolean startConnection(String uri) {
if (clientSocket != null) {
clientSocket.close();
}
rateLimitStatus = null;
try {
clientSocket = new EaglerSocketClient(new URI(uri), uri);
return true;
} catch (InterruptedException e) {
clientSocket = null;
} catch (URISyntaxException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return false;
}
public static final void endConnection() {
synchronized (socketSync) {
if (clientSocket.isOpen()) {
clientSocket.close();
}
clientSocket = null;
readPackets.clear();
}
}
public static final boolean connectionOpen() {
return clientSocket != null && clientSocket.isOpen();
}
public static final void writePacket(byte[] packet) {
if (clientSocket != null && clientSocket.isOpen()) {
clientSocket.send(ByteBuffer.wrap(packet));
}
}
public static final byte[] readPacket() {
synchronized (socketSync) {
if (!readPackets.isEmpty()) {
return readPackets.remove(0);
}
}
return null;
}
private static RateLimit rateLimitStatus = null;
public static enum RateLimit {
NONE, FAILED, BLOCKED, FAILED_POSSIBLY_LOCKED, LOCKED, NOW_LOCKED;
}
public static final RateLimit getRateLimitStatus() {
RateLimit l = rateLimitStatus;
rateLimitStatus = null;
return l;
}
public static final void logRateLimit(String addr, RateLimit l) {
synchronized (socketSync) {
if (l == RateLimit.LOCKED) {
blockedAddresses.add(addr);
} else {
rateLimitedAddresses.add(addr);
}
}
}
public static final RateLimit checkRateLimitHistory(String addr) {
synchronized (socketSync) {
if (blockedAddresses.contains(addr)) {
return RateLimit.LOCKED;
} else if (rateLimitedAddresses.contains(addr)) {
return RateLimit.BLOCKED;
} else {
return RateLimit.NONE;
}
}
}
public static final byte[] loadLocalStorage(String key) {
try {
File f = new File("_eagstorage." + key + ".dat");

View File

@ -6,19 +6,12 @@ import java.util.*;
public class ChunkLoader implements IChunkLoader {
public ChunkLoader(String file, boolean flag) {
if(file != null) {
File file1 = new File("filesystem");
saveDir = new File(file1, file);
} else {
saveDir = null;
}
createIfNecessary = flag;
}
private File chunkFileForXZ(int i, int j) {
if(saveDir == null) {
return null;
}
String s = (new StringBuilder()).append("c.").append(Integer.toString(i, 36)).append(".").append(Integer.toString(j, 36)).append(".dat").toString();
String s1 = Integer.toString(i & 0x3f, 36);
String s2 = Integer.toString(j & 0x3f, 36);
@ -47,9 +40,6 @@ public class ChunkLoader implements IChunkLoader {
}
public Chunk loadChunk(World world, int i, int j) {
if(saveDir == null) {
return null;
}
File file = chunkFileForXZ(i, j);
if (file != null && file.exists()) {
try {
@ -84,9 +74,6 @@ public class ChunkLoader implements IChunkLoader {
}
public void saveChunk(World world, Chunk chunk) {
if(saveDir == null) {
return;
}
world.func_663_l();
File file = chunkFileForXZ(chunk.xPosition, chunk.zPosition);
if (file.exists()) {

View File

@ -2,11 +2,15 @@ package net.PeytonPlayz585.glemu;
import static net.PeytonPlayz585.opengl.GL11.*;
import java.util.ArrayList;
import java.util.List;
import net.PeytonPlayz585.glemu.vector.*;
public class FixedFunctionShader {
private static final FixedFunctionShader[] instances = new FixedFunctionShader[128];
private static final List<FixedFunctionShader> instanceList = new ArrayList();
public static void refreshCoreGL() {
for (int i = 0; i < instances.length; ++i) {
@ -15,6 +19,7 @@ public class FixedFunctionShader {
instances[i] = null;
}
}
instanceList.clear();
shaderSource = null;
}
@ -59,6 +64,7 @@ public class FixedFunctionShader {
}
s = new FixedFunctionShader(i, CC_a_color, CC_a_normal, CC_a_texture0, CC_lighting, CC_fog, CC_alphatest, CC_unit0);
instances[i] = s;
instanceList.add(s);
}
return s;
}
@ -102,8 +108,7 @@ public class FixedFunctionShader {
private final int attributeIndexesToEnable;
public final BufferArrayGL genericArray;
public final BufferGL genericBuffer;
public final StreamBuffer streamBuffer;
public boolean bufferIsInitialized = false;
private FixedFunctionShader(int j, boolean CC_a_color, boolean CC_a_normal, boolean CC_a_texture0,
@ -226,11 +231,11 @@ public class FixedFunctionShader {
_wglUniform1i(_wglGetUniformLocation(globject, "tex0"), 0);
u_texCoordV0 = _wglGetUniformLocation(globject, "texCoordV0");
genericArray = _wglCreateVertexArray();
genericBuffer = _wglCreateBuffer();
_wglBindVertexArray(genericArray);
_wglBindBuffer(_wGL_ARRAY_BUFFER, genericBuffer);
streamBuffer = new StreamBuffer(0x8000, 3, 8, (vertexArray, vertexBuffer) -> {
_wglBindVertexArray0(vertexArray);
_wglBindBuffer(_wGL_ARRAY_BUFFER, vertexBuffer);
setupArrayForProgram();
});
}
@ -259,6 +264,13 @@ public class FixedFunctionShader {
}
public static void optimize() {
FixedFunctionShader pp;
for(int i = 0, l = instanceList.size(); i < l; ++i) {
instanceList.get(i).streamBuffer.optimize();
}
}
private float[] modelBuffer = new float[16];
private float[] projectionBuffer = new float[16];
private float[] textureBuffer = new float[16];

View File

@ -0,0 +1,72 @@
package net.PeytonPlayz585.glemu;
import static net.PeytonPlayz585.opengl.GL11.*;
import java.nio.ByteBuffer;
public class GameOverlayFramebuffer {
private long age = -1l;
private int currentWidth = -1;
private int currentHeight = -1;
private FramebufferGL framebuffer = null;
private TextureGL framebufferColor = null;
private RenderbufferGL depthBuffer = null;
public void beginRender(int width, int height) {
if(framebuffer == null) {
framebuffer = _wglCreateFramebuffer();
depthBuffer = _wglCreateRenderBuffer();
framebufferColor = _wglGenTextures();
_wglBindFramebuffer(_wGL_FRAMEBUFFER, framebuffer);
glBindTexture(_wGL_TEXTURE_2D, framebufferColor);
_wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
_wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
_wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
_wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
_wglFramebufferTexture2D(_wGL_COLOR_ATTACHMENT0, framebufferColor, 0);
_wglBindRenderbuffer(depthBuffer);
_wglFramebufferRenderbuffer(_wGL_DEPTH_ATTACHMENT, depthBuffer);
}
if(currentWidth != width || currentHeight != height) {
currentWidth = width;
currentHeight = height;
glBindTexture(_wGL_TEXTURE_2D, framebufferColor);
_wglTexImage2D(_wGL_TEXTURE_2D, 0, _wGL_RGBA8, width, height, 0, _wGL_RGBA, _wGL_UNSIGNED_BYTE, (ByteBuffer)null);
_wglBindRenderbuffer(depthBuffer);
_wglRenderbufferStorage(0x81A5, width, height);
}
_wglBindFramebuffer(_wGL_FRAMEBUFFER, framebuffer);
}
public void endRender() {
_wglBindFramebuffer(_wGL_FRAMEBUFFER, null);
age = System.currentTimeMillis();
}
public long getAge() {
return age == -1l ? -1l : (System.currentTimeMillis() - age);
}
public void bindTexture() {
glBindTexture(_wGL_TEXTURE_2D, framebufferColor);
}
public void destroy() {
if(framebuffer != null) {
_wglDeleteFramebuffer(framebuffer);
_wglDeleteRenderbuffer(depthBuffer);
_wglDeleteTextures(framebufferColor);
framebuffer = null;
depthBuffer = null;
framebufferColor = null;
age = -1l;
_wglBindFramebuffer(_wGL_FRAMEBUFFER, null);
}
}
}

View File

@ -0,0 +1,130 @@
package net.PeytonPlayz585.glemu;
import static net.PeytonPlayz585.opengl.GL11.*;
public class StreamBuffer {
public final int initialSize;
public final int initialCount;
public final int maxCount;
protected StreamBufferInstance[] buffers;
protected int currentBufferId = 0;
protected int overflowCounter = 0;
protected final IStreamBufferInitializer initializer;
public static class StreamBufferInstance {
public BufferArrayGL vertexArray = null;
public BufferGL vertexBuffer = null;
protected int vertexBufferSize = 0;
public boolean bindQuad16 = false;
public boolean bindQuad32 = false;
public BufferArrayGL getVertexArray() {
return vertexArray;
}
public BufferGL getVertexBuffer() {
return vertexBuffer;
}
}
public static interface IStreamBufferInitializer {
void initialize(BufferArrayGL vertexArray, BufferGL vertexBuffer);
}
public StreamBuffer(int initialSize, int initialCount, int maxCount, IStreamBufferInitializer initializer) {
this.buffers = new StreamBufferInstance[initialCount];
for(int i = 0; i < this.buffers.length; ++i) {
this.buffers[i] = new StreamBufferInstance();
}
this.initialSize = initialSize;
this.initialCount = initialCount;
this.maxCount = maxCount;
this.initializer = initializer;
}
public StreamBufferInstance getBuffer(int requiredMemory) {
StreamBufferInstance next = buffers[(currentBufferId++) % buffers.length];
if(next.vertexBuffer == null) {
next.vertexBuffer = _wglCreateBuffer();
}
if(next.vertexArray == null) {
next.vertexArray = _wglCreateVertexArray();
initializer.initialize(next.vertexArray, next.vertexBuffer);
}
if(next.vertexBufferSize < requiredMemory) {
int newSize = (requiredMemory & 0xFFFFF000) + 0x2000;
_wglBindBuffer(_wGL_ARRAY_BUFFER, next.vertexBuffer);
_wglBufferData00(_wGL_ARRAY_BUFFER, newSize, _wGL_STREAM_DRAW);
next.vertexBufferSize = newSize;
}
return next;
}
public void optimize() {
overflowCounter += currentBufferId - buffers.length;
if(overflowCounter < -25) {
int newCount = buffers.length - 1 + ((overflowCounter + 25) / 5);
if(newCount < initialCount) {
newCount = initialCount;
}
if(newCount < buffers.length) {
StreamBufferInstance[] newArray = new StreamBufferInstance[newCount];
for(int i = 0; i < buffers.length; ++i) {
if(i < newArray.length) {
newArray[i] = buffers[i];
}else {
if(buffers[i].vertexArray != null) {
_wglDeleteVertexArray(buffers[i].vertexArray);
}
if(buffers[i].vertexBuffer != null) {
_wglDeleteBuffer(buffers[i].vertexBuffer);
}
}
}
buffers = newArray;
}
overflowCounter = 0;
}else if(overflowCounter > 15) {
int newCount = buffers.length + 1 + ((overflowCounter - 15) / 5);
if(newCount > maxCount) {
newCount = maxCount;
}
if(newCount > buffers.length) {
StreamBufferInstance[] newArray = new StreamBufferInstance[newCount];
for(int i = 0; i < newArray.length; ++i) {
if(i < buffers.length) {
newArray[i] = buffers[i];
}else {
newArray[i] = new StreamBufferInstance();
}
}
buffers = newArray;
}
overflowCounter = 0;
}
currentBufferId = 0;
}
public void destroy() {
for(int i = 0; i < buffers.length; ++i) {
StreamBufferInstance next = buffers[i];
if(next.vertexArray != null) {
_wglDeleteVertexArray(next.vertexArray);
}
if(next.vertexBuffer != null) {
_wglDeleteBuffer(next.vertexBuffer);
}
}
buffers = new StreamBufferInstance[initialCount];
for(int i = 0; i < buffers.length; ++i) {
buffers[i] = new StreamBufferInstance();
}
}
}

View File

@ -15,6 +15,8 @@ import net.minecraft.src.GLAllocation;
import net.minecraft.src.Vec3D;
import net.PeytonPlayz585.glemu.vector.*;
import static net.PeytonPlayz585.glemu.StreamBuffer.StreamBufferInstance;
public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
public static final int GL_ZERO = RealOpenGLEnums.GL_ZERO;
@ -547,8 +549,18 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
public static final void glBlendFunc(int p1, int p2) {
fogPremultiply = (p1 == GL_ONE && p2 == GL_ONE_MINUS_SRC_ALPHA);
if(overlayFBOBlending) {
_wglBlendFuncSeparate(p1, p2, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
}else {
_wglBlendFunc(p1, p2);
}
}
private static boolean overlayFBOBlending = false;
public static final void enableOverlayFramebufferBlending(boolean en) {
overlayFBOBlending = en;
}
public static final void glBlendFuncSeparate(int p1, int p2, int p3, int p4) {
fogPremultiply = (p3 == GL_ONE && p4 == GL_ONE_MINUS_SRC_ALPHA);
@ -568,6 +580,10 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
_wglBindTexture(_wGL_TEXTURE_2D, t);
}
public static final void glBindTexture(int p1, TextureGL p2) {
_wglBindTexture(_wGL_TEXTURE_2D, p2);
}
public static final void glCopyTexSubImage2D(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8) {
_wglCopyTexSubImage2D(_wGL_TEXTURE_2D, p2, p3, p4, p5, p6, p7, p8);
}
@ -672,6 +688,18 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
}
}
public static final void flushDisplayList(int p1) {
DisplayList d = displayListsInitialized.get(p1);
if (d != null) {
if (d.glbuffer != null) {
_wglDeleteBuffer(d.glbuffer);
_wglDeleteVertexArray(d.glarray);
d.glbuffer = null;
d.glarray = null;
}
}
}
public static final void glColor3f(float p1, float p2, float p3) {
colorR = p1;
colorG = p2;
@ -836,13 +864,15 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
System.err.println("only GL_QUADS supported in a display list");
}
} else {
bytesUploaded += _wArrayByteLength(buffer);
int bl = _wArrayByteLength(buffer);
bytesUploaded += bl;
vertexDrawn += p3;
bindTheShader();
_wglBindVertexArray0(shader.genericArray);
_wglBindBuffer(_wGL_ARRAY_BUFFER, shader.genericBuffer);
StreamBufferInstance sb = shader.streamBuffer.getBuffer(bl);
_wglBindVertexArray0(sb.vertexArray);
_wglBindBuffer(_wGL_ARRAY_BUFFER, sb.vertexBuffer);
if (!shader.bufferIsInitialized) {
shader.bufferIsInitialized = true;
_wglBufferData(_wGL_ARRAY_BUFFER, blankUploadArray, _wGL_DYNAMIC_DRAW);
@ -1179,6 +1209,10 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
}
}
public static final void optimize() {
FixedFunctionShader.optimize();
}
private static long lastBandwidthReset = 0l;
private static int lastBandwidth = 0;

View File

@ -1,43 +1,55 @@
package net.lax1dude.eaglercraft;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.IntBuffer;
public class EaglerImage {
public final int[] data;
public final IntBuffer data;
public final int w;
public final int h;
public final boolean alpha;
private final int wh;
public EaglerImage(int pw, int ph, boolean palpha) {
this.w = pw;
this.h = ph;
this.alpha = palpha;
this.data = new int[pw * ph];
this.data = IntBuffer.allocate(pw * ph);
this.wh = pw * ph;
}
public EaglerImage(int[] pdata, int pw, int ph, boolean palpha) {
if (pdata.length != pw * ph) {
throw new IllegalArgumentException("array size does not equal image size");
public EaglerImage(IntBuffer pdata, int pw, int ph, boolean palpha) {
if (pdata.capacity() != pw * ph) {
throw new IllegalArgumentException("buffer capacity does not equal image size");
}
this.w = pw;
this.h = ph;
this.alpha = palpha;
if (!palpha) {
for (int i = 0; i < pdata.length; ++i) {
pdata[i] = pdata[i] | 0xFF000000;
w = pw;
h = ph;
alpha = palpha;
wh = pw * ph;
if (!alpha) {
for (int i = 0; i < wh; ++i) {
pdata.put(i, pdata.get(i) | 0xFF000000);
}
pdata.rewind();
}
this.data = pdata;
data = pdata;
}
public EaglerImage getSubImage(int x, int y, int pw, int ph) {
int[] img = new int[pw * ph];
for (int i = 0; i < ph; ++i) {
System.arraycopy(data, (i + y) * this.w + x, img, i * pw, pw);
}
return new EaglerImage(img, pw, ph, alpha);
int start = y * w + x;
IntBuffer subBuffer = data.slice();
subBuffer.position(start);
subBuffer.limit(start + pw * ph);
int[] temp = new int[pw * ph];
subBuffer.get(temp);
IntBuffer newBuffer = IntBuffer.wrap(temp);
return new EaglerImage(newBuffer, pw, ph, alpha);
}
public int[] data() {
int[] array = new int[wh];
data.rewind();
data.get(array);
return array;
}
}

View File

@ -14,7 +14,6 @@ import net.minecraft.src.EntityRenderer;
import net.minecraft.src.FontRenderer;
import net.minecraft.src.GLAllocation;
import net.minecraft.src.GameSettings;
import net.minecraft.src.GuiChat;
import net.minecraft.src.GuiConflictWarning;
import net.minecraft.src.GuiGameOver;
import net.minecraft.src.GuiIngame;
@ -108,6 +107,8 @@ public class Minecraft implements Runnable {
private int field_6300_ab = 0;
private static Minecraft mc;
public static int debugFPS;
public Minecraft() {
new ThreadSleepForever(this, "Timer hack thread");
this.displayWidth = GL11.getCanvasWidth();
@ -118,8 +119,7 @@ public class Minecraft implements Runnable {
public void startGame() {
RenderManager.instance.field_4236_f = new ItemRenderer(this);
new GameSettings(this);
this.gameSettings.loadOptions();
this.gameSettings = new GameSettings(this);
this.texturePackList = new TexturePackList(this);
this.renderEngine = new RenderEngine(texturePackList, this.gameSettings);
this.fontRenderer = new FontRenderer(this.gameSettings, "/font/default.png", this.renderEngine);
@ -192,6 +192,7 @@ public class Minecraft implements Runnable {
GL11.glAlphaFunc(516, 0.1F);
GL11.glFlush();
GL11.updateDisplay();
GL11.optimize();
}
public void func_6274_a(int var1, int var2, int var3, int var4, int var5, int var6) {
@ -277,12 +278,6 @@ public class Minecraft implements Runnable {
try {
this.runTick();
} catch(ArrayIndexOutOfBoundsException e) {
if(this.isMultiplayerWorld()) {
continue;
} else {
e.printStackTrace();
}
} catch (MinecraftException var14) {
this.theWorld = null;
this.func_6261_a((World)null);
@ -294,15 +289,11 @@ public class Minecraft implements Runnable {
this.sndManager.func_338_a(this.thePlayer, this.timer.renderPartialTicks);
this.checkGLError("Pre render");
GL11.glEnable(GL11.GL_TEXTURE_2D);
if(this.theWorld != null && !this.theWorld.multiplayerWorld) {
if(this.theWorld != null) {
while(this.theWorld.func_6465_g()) {
}
}
if(this.theWorld != null && this.theWorld.multiplayerWorld) {
this.theWorld.func_6465_g();
}
if(this.gameSettings.limitFramerate) {
try {
Thread.sleep(5L);
@ -320,15 +311,7 @@ public class Minecraft implements Runnable {
this.field_6327_b.func_6467_a(this.timer.renderPartialTicks);
}
try {
this.field_9243_r.func_4136_b(this.timer.renderPartialTicks);
} catch(ArrayIndexOutOfBoundsException e) {
if(this.isMultiplayerWorld()) {
continue;
} else {
e.printStackTrace();
}
}
}
if(!GL11.isFocused()) {
@ -365,11 +348,14 @@ public class Minecraft implements Runnable {
}
this.checkGLError("Post render");
GL11.optimize();
++var3;
for(this.field_6316_m = !this.isMultiplayerWorld() && this.currentScreen != null && this.currentScreen.doesGuiPauseGame(); System.currentTimeMillis() >= var1 + 1000L; var3 = 0) {
for(this.field_6316_m = true && this.currentScreen != null && this.currentScreen.doesGuiPauseGame(); System.currentTimeMillis() >= var1 + 1000L;) {
this.field_6292_I = var3 + " fps, " + WorldRenderer.field_1762_b + " chunk updates";
WorldRenderer.field_1762_b = 0;
debugFPS = var3;
var3 = 0;
var1 += 1000L;
}
}
@ -452,7 +438,7 @@ public class Minecraft implements Runnable {
public void shutdown() {
System.out.println("Stopping!");
if(this.theWorld != null && !this.isMultiplayerWorld()) {
if(this.theWorld != null) {
this.theWorld.saveLevel();
this.theWorld.chunkProvider.saveChunks(false, (IProgressUpdate)null);
}
@ -729,10 +715,6 @@ public class Minecraft implements Runnable {
if(Keyboard.getEventKey() == this.gameSettings.keyBindDrop.keyCode) {
this.thePlayer.dropPlayerItemWithRandomChoice(this.thePlayer.inventory.decrStackSize(this.thePlayer.inventory.currentItem, 1), false);
}
if(this.isMultiplayerWorld() && Keyboard.getEventKey() == this.gameSettings.keyBindChat.keyCode) {
this.displayGuiScreen(new GuiChat());
}
}
for(int var4 = 0; var4 < 9; ++var4) {
@ -792,9 +774,6 @@ public class Minecraft implements Runnable {
}
this.theWorld.difficultySetting = this.gameSettings.difficulty;
if(this.theWorld.multiplayerWorld) {
this.theWorld.difficultySetting = 3;
}
if(!this.field_6316_m) {
this.field_9243_r.func_911_a();
@ -808,7 +787,7 @@ public class Minecraft implements Runnable {
this.theWorld.func_633_c();
}
if(!this.field_6316_m || this.isMultiplayerWorld()) {
if(!this.field_6316_m) {
this.theWorld.tick();
}
@ -824,10 +803,6 @@ public class Minecraft implements Runnable {
this.field_6287_N = System.currentTimeMillis();
}
public boolean isMultiplayerWorld() {
return this.theWorld != null && this.theWorld.multiplayerWorld;
}
public void func_6247_b(String var1) {
this.func_6261_a((World)null);
System.gc();
@ -894,20 +869,15 @@ public class Minecraft implements Runnable {
System.out.println("Player is " + this.thePlayer);
if(var1 != null) {
this.field_6327_b.func_717_a(var1);
if(!this.isMultiplayerWorld()) {
//if(!this.isMultiplayerWorld()) {
if(var3 == null) {
this.thePlayer = (EntityPlayerSP)var1.func_4085_a(EntityPlayerSP.class);
}
} else if(this.thePlayer != null) {
this.thePlayer.preparePlayerToSpawn();
if(var1 != null) {
var1.entityJoinedWorld(this.thePlayer);
}
}
//}
if(!var1.multiplayerWorld) {
//if(!var1.multiplayerWorld) {
this.func_6255_d(var2);
}
//}
System.out.println("Player is now " + this.thePlayer);
if(this.thePlayer == null) {

View File

@ -290,7 +290,7 @@ public class Block {
}
public void dropBlockAsItemWithChance(World var1, int var2, int var3, int var4, int var5, float var6) {
if(!var1.multiplayerWorld) {
//if(!var1.multiplayerWorld) {
int var7 = this.quantityDropped(var1.rand);
for(int var8 = 0; var8 < var7; ++var8) {
@ -308,7 +308,7 @@ public class Block {
}
}
}
//}
}
public float func_227_a(Entity var1) {

View File

@ -132,9 +132,9 @@ public class BlockButton extends Block {
}
public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) {
if(var1.multiplayerWorld) {
return true;
} else {
//if(var1.multiplayerWorld) {
//return true;
//} else {
int var6 = var1.getBlockMetadata(var2, var3, var4);
int var7 = var6 & 7;
int var8 = 8 - (var6 & 8);
@ -160,7 +160,7 @@ public class BlockButton extends Block {
var1.scheduleBlockUpdate(var2, var3, var4, this.blockID);
return true;
}
}
//}
}
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
@ -203,7 +203,7 @@ public class BlockButton extends Block {
}
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
if(!var1.multiplayerWorld) {
//if(!var1.multiplayerWorld) {
int var6 = var1.getBlockMetadata(var2, var3, var4);
if((var6 & 8) != 0) {
var1.setBlockMetadataWithNotify(var2, var3, var4, var6 & 7);
@ -224,7 +224,7 @@ public class BlockButton extends Block {
var1.playSoundEffect((double)var2 + 0.5D, (double)var3 + 0.5D, (double)var4 + 0.5D, "random.click", 0.3F, 0.5F);
var1.func_701_b(var2, var3, var4, var2, var3, var4);
}
}
//}
}
public void func_237_e() {

View File

@ -84,7 +84,7 @@ public class BlockCrops extends BlockFlower {
public void onBlockDestroyedByPlayer(World var1, int var2, int var3, int var4, int var5) {
super.onBlockDestroyedByPlayer(var1, var2, var3, var4, var5);
if(!var1.multiplayerWorld) {
//if(!var1.multiplayerWorld) {
for(int var6 = 0; var6 < 3; ++var6) {
if(var1.rand.nextInt(15) <= var5) {
float var7 = 0.7F;
@ -96,7 +96,7 @@ public class BlockCrops extends BlockFlower {
var1.entityJoinedWorld(var11);
}
}
}
//}
}

View File

@ -33,12 +33,12 @@ public class BlockJukeBox extends Block {
}
public void dropBlockAsItemWithChance(World var1, int var2, int var3, int var4, int var5, float var6) {
if(!var1.multiplayerWorld) {
//if(!var1.multiplayerWorld) {
if(var5 > 0) {
this.ejectRecord(var1, var2, var3, var4, var5);
}
super.dropBlockAsItemWithChance(var1, var2, var3, var4, var5, var6);
}
//}
}
}

View File

@ -133,9 +133,9 @@ public class BlockLever extends Block {
}
public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) {
if(var1.multiplayerWorld) {
return true;
} else {
//if(var1.multiplayerWorld) {
//return true;
//} else {
int var6 = var1.getBlockMetadata(var2, var3, var4);
int var7 = var6 & 7;
int var8 = 8 - (var6 & 8);
@ -156,7 +156,7 @@ public class BlockLever extends Block {
}
return true;
}
//}
}
public void onBlockRemoval(World var1, int var2, int var3, int var4) {

View File

@ -52,15 +52,15 @@ public class BlockMinecartTrack extends Block {
}
public void onBlockAdded(World var1, int var2, int var3, int var4) {
if(!var1.multiplayerWorld) {
//if(!var1.multiplayerWorld) {
var1.setBlockMetadataWithNotify(var2, var3, var4, 15);
this.func_4031_h(var1, var2, var3, var4);
}
//}
}
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
if(!var1.multiplayerWorld) {
//if(!var1.multiplayerWorld) {
int var6 = var1.getBlockMetadata(var2, var3, var4);
boolean var7 = false;
if(!var1.isBlockOpaqueCube(var2, var3 - 1, var4)) {
@ -90,12 +90,12 @@ public class BlockMinecartTrack extends Block {
this.func_4031_h(var1, var2, var3, var4);
}
}
//}
}
private void func_4031_h(World var1, int var2, int var3, int var4) {
if(!var1.multiplayerWorld) {
//if(!var1.multiplayerWorld) {
(new MinecartTrackLogic(this, var1, var2, var3, var4)).func_792_a(var1.isBlockIndirectlyGettingPowered(var2, var3, var4));
}
//}
}
}

View File

@ -131,9 +131,9 @@ public class BlockPortal extends BlockBreakable {
}
public void onEntityCollidedWithBlock(World var1, int var2, int var3, int var4, Entity var5) {
if(!var1.multiplayerWorld) {
//if(!var1.multiplayerWorld) {
var5.func_4039_q();
}
//}
}
public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) {

View File

@ -51,19 +51,19 @@ public class BlockPressurePlate extends Block {
}
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
if(!var1.multiplayerWorld) {
//if(!var1.multiplayerWorld) {
if(var1.getBlockMetadata(var2, var3, var4) != 0) {
this.setStateIfMobInteractsWithPlate(var1, var2, var3, var4);
}
}
//}
}
public void onEntityCollidedWithBlock(World var1, int var2, int var3, int var4, Entity var5) {
if(!var1.multiplayerWorld) {
//if(!var1.multiplayerWorld) {
if(var1.getBlockMetadata(var2, var3, var4) != 1) {
this.setStateIfMobInteractsWithPlate(var1, var2, var3, var4);
}
}
//}
}
private void setStateIfMobInteractsWithPlate(World var1, int var2, int var3, int var4) {

View File

@ -149,7 +149,7 @@ public class BlockRedstoneWire extends Block {
public void onBlockAdded(World var1, int var2, int var3, int var4) {
super.onBlockAdded(var1, var2, var3, var4);
if(!var1.multiplayerWorld) {
//if(!var1.multiplayerWorld) {
this.updateAndPropagateCurrentStrength(var1, var2, var3, var4);
var1.notifyBlocksOfNeighborChange(var2, var3 + 1, var4, this.blockID);
var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID);
@ -181,12 +181,12 @@ public class BlockRedstoneWire extends Block {
this.notifyWireNeighborsOfNeighborChange(var1, var2, var3 - 1, var4 + 1);
}
}
//}
}
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
super.onBlockRemoval(var1, var2, var3, var4);
if(!var1.multiplayerWorld) {
//if(!var1.multiplayerWorld) {
var1.notifyBlocksOfNeighborChange(var2, var3 + 1, var4, this.blockID);
var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID);
this.updateAndPropagateCurrentStrength(var1, var2, var3, var4);
@ -218,7 +218,7 @@ public class BlockRedstoneWire extends Block {
this.notifyWireNeighborsOfNeighborChange(var1, var2, var3 - 1, var4 + 1);
}
}
//}
}
private int getMaxCurrentStrength(World var1, int var2, int var3, int var4, int var5) {
@ -231,7 +231,7 @@ public class BlockRedstoneWire extends Block {
}
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
if(!var1.multiplayerWorld) {
//if(!var1.multiplayerWorld) {
int var6 = var1.getBlockMetadata(var2, var3, var4);
boolean var7 = this.canPlaceBlockAt(var1, var2, var3, var4);
if(!var7) {
@ -242,7 +242,7 @@ public class BlockRedstoneWire extends Block {
}
super.onNeighborBlockChange(var1, var2, var3, var4, var5);
}
//}
}
public int idDropped(int var1, Random var2) {

View File

@ -30,10 +30,10 @@ public class BlockTNT extends Block {
}
public void onBlockDestroyedByPlayer(World var1, int var2, int var3, int var4, int var5) {
if(!var1.multiplayerWorld) {
//if(!var1.multiplayerWorld) {
EntityTNTPrimed var6 = new EntityTNTPrimed(var1, (double)((float)var2 + 0.5F), (double)((float)var3 + 0.5F), (double)((float)var4 + 0.5F));
var1.entityJoinedWorld(var6);
var1.playSoundAtEntity(var6, "random.fuse", 1.0F, 1.0F);
}
//}
}
}

View File

@ -264,7 +264,7 @@ public class Chunk {
int var9 = this.xPosition * 16 + var1;
int var10 = this.zPosition * 16 + var3;
this.blocks[var1 << 11 | var3 << 7 | var2] = var6;
if(var8 != 0 && !this.worldObj.multiplayerWorld) {
if(var8 != 0) {
Block.blocksList[var8].onBlockRemoval(this.worldObj, var9, var2, var10);
}
@ -319,7 +319,7 @@ public class Chunk {
this.worldObj.func_616_a(EnumSkyBlock.Sky, var8, var2, var9, var8, var2, var9);
this.worldObj.func_616_a(EnumSkyBlock.Block, var8, var2, var9, var8, var2, var9);
this.func_996_c(var1, var3);
if(var4 != 0 && !this.worldObj.multiplayerWorld) {
if(var4 != 0) {
Block.blocksList[var4].onBlockAdded(this.worldObj, var8, var2, var9);
}

View File

@ -117,12 +117,9 @@ public class ChunkCache implements IBlockAccess {
}
public boolean isBlockOpaqueCube(int var1, int var2, int var3) {
if(!(this.getBlockId(var1, var2, var3) < 0)) {
Block var4 = Block.blocksList[this.getBlockId(var1, var2, var3)];
return var4 == null ? false : var4.isOpaqueCube();
}
return false;
}
public WorldChunkManager func_4075_a() {
return this.worldObj.func_4075_a();

View File

@ -7,7 +7,7 @@ public class ColorizerFoliage {
public static int func_4146_a(double var0, double var2) {
if(field_6529_a == null) {
field_6529_a = GL11.loadPNG(GL11.loadResourceBytes("/misc/foliagecolor.png")).data;
field_6529_a = GL11.loadPNG(GL11.loadResourceBytes("/misc/foliagecolor.png")).data();
}
var2 *= var0;
int var4 = (int)((1.0D - var0) * 255.0D);

View File

@ -7,7 +7,7 @@ public class ColorizerGrass {
public static int func_4147_a(double var0, double var2) {
if(field_6540_a == null) {
field_6540_a = GL11.loadPNG(GL11.loadResourceBytes("/misc/grasscolor.png")).data;
field_6540_a = GL11.loadPNG(GL11.loadResourceBytes("/misc/grasscolor.png")).data();
}
var2 *= var0;
int var4 = (int)((1.0D - var0) * 255.0D);

View File

@ -190,9 +190,7 @@ public abstract class Entity {
this.field_9307_bi = false;
}
if(this.worldObj.multiplayerWorld) {
this.fire = 0;
} else if(this.fire > 0) {
if(this.fire > 0) {
if(this.isImmuneToFire) {
this.fire -= 4;
if(this.fire < 0) {

View File

@ -232,14 +232,14 @@ public class EntityArrow extends Entity {
}
public void onCollideWithPlayer(EntityPlayer var1) {
if(!this.worldObj.multiplayerWorld) {
//if(!this.worldObj.multiplayerWorld) {
if(this.inGround && this.field_682_g == var1 && this.arrowShake <= 0 && var1.inventory.addItemStackToInventory(new ItemStack(Item.arrow.shiftedIndex, 1))) {
this.worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
var1.func_443_a_(this, 1);
this.setEntityDead();
}
}
//}
}
public float func_392_h_() {

View File

@ -55,7 +55,7 @@ public class EntityBoat extends Entity {
}
public boolean canAttackEntity(Entity var1, int var2) {
if(!this.worldObj.multiplayerWorld && !this.isDead) {
if(!this.isDead) {
this.field_808_c = -this.field_808_c;
this.field_806_b = 10;
this.field_807_a += var2 * 10;
@ -136,41 +136,41 @@ public class EntityBoat extends Entity {
double var8;
double var10;
double var23;
if(this.worldObj.multiplayerWorld) {
if(this.field_9394_d > 0) {
var23 = this.posX + (this.field_9393_e - this.posX) / (double)this.field_9394_d;
var6 = this.posY + (this.field_9392_f - this.posY) / (double)this.field_9394_d;
var8 = this.posZ + (this.field_9391_g - this.posZ) / (double)this.field_9394_d;
//if(this.worldObj.multiplayerWorld) {
//if(this.field_9394_d > 0) {
//var23 = this.posX + (this.field_9393_e - this.posX) / (double)this.field_9394_d;
//var6 = this.posY + (this.field_9392_f - this.posY) / (double)this.field_9394_d;
//var8 = this.posZ + (this.field_9391_g - this.posZ) / (double)this.field_9394_d;
for(var10 = this.field_9390_h - (double)this.rotationYaw; var10 < -180.0D; var10 += 360.0D) {
}
//for(var10 = this.field_9390_h - (double)this.rotationYaw; var10 < -180.0D; var10 += 360.0D) {
//}
while(var10 >= 180.0D) {
var10 -= 360.0D;
}
//while(var10 >= 180.0D) {
//var10 -= 360.0D;
//}
this.rotationYaw = (float)((double)this.rotationYaw + var10 / (double)this.field_9394_d);
this.rotationPitch = (float)((double)this.rotationPitch + (this.field_9389_i - (double)this.rotationPitch) / (double)this.field_9394_d);
--this.field_9394_d;
this.setPosition(var23, var6, var8);
this.setRotation(this.rotationYaw, this.rotationPitch);
} else {
var23 = this.posX + this.motionX;
var6 = this.posY + this.motionY;
var8 = this.posZ + this.motionZ;
this.setPosition(var23, var6, var8);
if(this.onGround) {
this.motionX *= 0.5D;
this.motionY *= 0.5D;
this.motionZ *= 0.5D;
}
//this.rotationYaw = (float)((double)this.rotationYaw + var10 / (double)this.field_9394_d);
//this.rotationPitch = (float)((double)this.rotationPitch + (this.field_9389_i - (double)this.rotationPitch) / (double)this.field_9394_d);
//--this.field_9394_d;
//this.setPosition(var23, var6, var8);
//this.setRotation(this.rotationYaw, this.rotationPitch);
//} else {
//var23 = this.posX + this.motionX;
//var6 = this.posY + this.motionY;
//var8 = this.posZ + this.motionZ;
//this.setPosition(var23, var6, var8);
//if(this.onGround) {
//this.motionX *= 0.5D;
//this.motionY *= 0.5D;
//this.motionZ *= 0.5D;
//}
this.motionX *= (double)0.99F;
this.motionY *= (double)0.95F;
this.motionZ *= (double)0.99F;
}
//this.motionX *= (double)0.99F;
//this.motionY *= (double)0.95F;
//this.motionZ *= (double)0.99F;
//}
} else {
//} else {
var23 = var2 * 2.0D - 1.0D;
this.motionY += (double)0.04F * var23;
if(this.riddenByEntity != null) {
@ -226,7 +226,7 @@ public class EntityBoat extends Entity {
}
if(this.field_9297_aI && var8 > 0.15D) {
if(!this.worldObj.multiplayerWorld) {
//if(!this.worldObj.multiplayerWorld) {
this.setEntityDead();
int var24;
@ -237,7 +237,7 @@ public class EntityBoat extends Entity {
for(var24 = 0; var24 < 2; ++var24) {
this.dropItemWithOffset(Item.stick.shiftedIndex, 1, 0.0F);
}
}
//}
} else {
this.motionX *= (double)0.99F;
this.motionY *= (double)0.95F;
@ -284,7 +284,7 @@ public class EntityBoat extends Entity {
this.riddenByEntity = null;
}
}
//}
}
public void func_366_i_() {
@ -309,9 +309,9 @@ public class EntityBoat extends Entity {
if(this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != var1) {
return true;
} else {
if(!this.worldObj.multiplayerWorld) {
//if(!this.worldObj.multiplayerWorld) {
var1.mountEntity(this);
}
//}
return true;
}

View File

@ -40,7 +40,7 @@ public class EntityChicken extends EntityAnimals {
}
this.field_752_b += this.field_755_h * 2.0F;
if(!this.worldObj.multiplayerWorld && --this.timeUntilNextEgg <= 0) {
if(--this.timeUntilNextEgg <= 0) {
this.worldObj.playSoundAtEntity(this, "mob.chickenplop", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
this.dropItem(Item.egg.shiftedIndex, 1);
this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000;

View File

@ -1,145 +0,0 @@
package net.minecraft.src;
import net.minecraft.client.Minecraft;
public class EntityClientPlayerMP extends EntityPlayerSP {
private NetClientHandler field_797_bg;
private int field_9380_bx = 0;
private double field_9379_by;
private double field_9378_bz;
private double field_9377_bA;
private double field_9376_bB;
private float field_9385_bC;
private float field_9384_bD;
private InventoryPlayer field_9383_bE = new InventoryPlayer((EntityPlayer)null);
private boolean field_9382_bF = false;
private boolean field_9381_bG = false;
private int field_12242_bI = 0;
public EntityClientPlayerMP(Minecraft var1, World var2, Session var3, NetClientHandler var4) {
super(var1, var2, var3, 0);
this.field_797_bg = var4;
}
public boolean canAttackEntity(Entity var1, int var2) {
return false;
}
public void heal(int var1) {
}
public void onUpdate() {
if(this.worldObj.blockExists(MathHelper.floor_double(this.posX), 64, MathHelper.floor_double(this.posZ))) {
super.onUpdate();
this.func_4056_N();
}
}
public void func_6420_o() {
}
public void func_4056_N() {
if(this.field_9380_bx++ == 20) {
this.sendInventoryChanged();
this.field_9380_bx = 0;
}
boolean var1 = this.func_381_o();
if(var1 != this.field_9381_bG) {
if(var1) {
this.field_797_bg.addToSendQueue(new Packet18ArmAnimation(this, 104));
} else {
this.field_797_bg.addToSendQueue(new Packet18ArmAnimation(this, 105));
}
this.field_9381_bG = var1;
}
double var2 = this.posX - this.field_9379_by;
double var4 = this.boundingBox.minY - this.field_9378_bz;
double var6 = this.posY - this.field_9377_bA;
double var8 = this.posZ - this.field_9376_bB;
double var10 = (double)(this.rotationYaw - this.field_9385_bC);
double var12 = (double)(this.rotationPitch - this.field_9384_bD);
boolean var14 = var4 != 0.0D || var6 != 0.0D || var2 != 0.0D || var8 != 0.0D;
boolean var15 = var10 != 0.0D || var12 != 0.0D;
if(this.ridingEntity != null) {
if(var15) {
this.field_797_bg.addToSendQueue(new Packet11PlayerPosition(this.motionX, -999.0D, -999.0D, this.motionZ, this.onGround));
} else {
this.field_797_bg.addToSendQueue(new Packet13PlayerLookMove(this.motionX, -999.0D, -999.0D, this.motionZ, this.rotationYaw, this.rotationPitch, this.onGround));
}
var14 = false;
} else if(var14 && var15) {
this.field_797_bg.addToSendQueue(new Packet13PlayerLookMove(this.posX, this.boundingBox.minY, this.posY, this.posZ, this.rotationYaw, this.rotationPitch, this.onGround));
this.field_12242_bI = 0;
} else if(var14) {
this.field_797_bg.addToSendQueue(new Packet11PlayerPosition(this.posX, this.boundingBox.minY, this.posY, this.posZ, this.onGround));
this.field_12242_bI = 0;
} else if(var15) {
this.field_797_bg.addToSendQueue(new Packet12PlayerLook(this.rotationYaw, this.rotationPitch, this.onGround));
this.field_12242_bI = 0;
} else {
this.field_797_bg.addToSendQueue(new Packet10Flying(this.onGround));
if(this.field_9382_bF == this.onGround && this.field_12242_bI <= 20) {
++this.field_12242_bI;
} else {
this.field_12242_bI = 0;
}
}
this.field_9382_bF = this.onGround;
if(var14) {
this.field_9379_by = this.posX;
this.field_9378_bz = this.boundingBox.minY;
this.field_9377_bA = this.posY;
this.field_9376_bB = this.posZ;
}
if(var15) {
this.field_9385_bC = this.rotationYaw;
this.field_9384_bD = this.rotationPitch;
}
}
private void sendInventoryChanged() {
if(!this.inventory.compareInventory(this.field_9383_bE)) {
this.field_797_bg.addToSendQueue(new Packet5PlayerInventory(-1, this.inventory.mainInventory));
this.field_797_bg.addToSendQueue(new Packet5PlayerInventory(-2, this.inventory.craftingInventory));
this.field_797_bg.addToSendQueue(new Packet5PlayerInventory(-3, this.inventory.armorInventory));
this.field_9383_bE = this.inventory.copyInventory();
}
}
protected void joinEntityItemWithWorld(EntityItem var1) {
Packet21PickupSpawn var2 = new Packet21PickupSpawn(var1);
this.field_797_bg.addToSendQueue(var2);
var1.posX = (double)var2.xPosition / 32.0D;
var1.posY = (double)var2.yPosition / 32.0D;
var1.posZ = (double)var2.zPosition / 32.0D;
var1.motionX = (double)var2.rotation / 128.0D;
var1.motionY = (double)var2.pitch / 128.0D;
var1.motionZ = (double)var2.roll / 128.0D;
}
public void sendChatMessage(String var1) {
this.field_797_bg.addToSendQueue(new Packet3Chat(var1));
}
public void func_457_w() {
super.func_457_w();
this.field_797_bg.addToSendQueue(new Packet18ArmAnimation(this, 1));
}
public void func_9367_r() {
this.sendInventoryChanged();
this.field_797_bg.addToSendQueue(new Packet9());
}
protected void damageEntity(int var1) {
this.health -= var1;
}
}

View File

@ -38,16 +38,16 @@ public class EntityCreeper extends EntityMobs {
public void onUpdate() {
this.lastActiveTime = this.timeSinceIgnited;
if(this.worldObj.multiplayerWorld) {
this.timeSinceIgnited += this.creeperState;
if(this.timeSinceIgnited < 0) {
this.timeSinceIgnited = 0;
}
if(this.timeSinceIgnited >= this.fuseTime) {
this.timeSinceIgnited = this.fuseTime;
}
}
// if(this.worldObj.multiplayerWorld) {
// this.timeSinceIgnited += this.creeperState;
// if(this.timeSinceIgnited < 0) {
// this.timeSinceIgnited = 0;
// }
//
// if(this.timeSinceIgnited >= this.fuseTime) {
// this.timeSinceIgnited = this.fuseTime;
// }
// }
super.onUpdate();
}
@ -63,9 +63,9 @@ public class EntityCreeper extends EntityMobs {
}
this.lastActiveTime = this.timeSinceIgnited;
if(this.worldObj.multiplayerWorld) {
super.func_418_b_();
} else {
//if(this.worldObj.multiplayerWorld) {
//super.func_418_b_();
//} else {
if(this.timeSinceIgnited > 0 && this.creeperState < 0) {
--this.timeSinceIgnited;
}
@ -78,7 +78,7 @@ public class EntityCreeper extends EntityMobs {
if(this.creeperState != 1) {
this.creeperState = -1;
}
}
//}
}

View File

@ -135,7 +135,7 @@ public class EntityFish extends Entity {
this.setPosition(var21, var22, var23);
this.setRotation(this.rotationYaw, this.rotationPitch);
} else {
if(!this.worldObj.multiplayerWorld) {
//if(!this.worldObj.multiplayerWorld) {
ItemStack var1 = this.field_4097_b.getCurrentEquippedItem();
if(this.field_4097_b.isDead || !this.field_4097_b.isEntityAlive() || var1 == null || var1.getItem() != Item.fishingRod || this.getDistanceSqToEntity(this.field_4097_b) > 1024.0D) {
this.setEntityDead();
@ -153,7 +153,7 @@ public class EntityFish extends Entity {
this.field_4096_c = null;
}
}
//}
if(this.field_4098_a > 0) {
--this.field_4098_a;

View File

@ -178,7 +178,7 @@ public class EntityItem extends Entity {
}
public void onCollideWithPlayer(EntityPlayer var1) {
if(!this.worldObj.multiplayerWorld) {
//if(!this.worldObj.multiplayerWorld) {
int var2 = this.item.stackSize;
if(this.field_805_c == 0 && var1.inventory.addItemStackToInventory(this.item)) {
this.worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
@ -186,6 +186,6 @@ public class EntityItem extends Entity {
this.setEntityDead();
}
}
//}
}
}

View File

@ -108,7 +108,7 @@ public class EntityLiving extends Entity {
this.canAttackEntity((Entity)null, 1);
}
if(this.isImmuneToFire || this.worldObj.multiplayerWorld) {
if(this.isImmuneToFire) {
this.fire = 0;
}
@ -299,9 +299,9 @@ public class EntityLiving extends Entity {
}
public boolean canAttackEntity(Entity var1, int var2) {
if(this.worldObj.multiplayerWorld) {
return false;
} else {
//if(this.worldObj.multiplayerWorld) {
//return false;
//} else {
this.field_9344_ag = 0;
if(this.health <= 0) {
return false;
@ -355,7 +355,7 @@ public class EntityLiving extends Entity {
return true;
}
}
//}
}
public void func_9280_g() {
@ -404,7 +404,7 @@ public class EntityLiving extends Entity {
}
this.field_9327_S = true;
if(!this.worldObj.multiplayerWorld) {
//if(!this.worldObj.multiplayerWorld) {
int var2 = this.getDropItemId();
if(var2 > 0) {
int var3 = this.rand.nextInt(3);
@ -413,7 +413,7 @@ public class EntityLiving extends Entity {
this.dropItem(var2, 1);
}
}
}
//}
this.worldObj.func_9425_a(this, (byte)3);
}

View File

@ -65,7 +65,7 @@ public class EntityMinecart extends Entity implements IInventory {
}
public boolean canAttackEntity(Entity var1, int var2) {
if(!this.worldObj.multiplayerWorld && !this.isDead) {
if(!this.isDead) {
this.c = -this.c;
this.b = 10;
this.func_9281_M();
@ -136,30 +136,30 @@ public class EntityMinecart extends Entity implements IInventory {
}
double var7;
if(this.worldObj.multiplayerWorld && this.field_9415_k > 0) {
if(this.field_9415_k > 0) {
double var41 = this.posX + (this.field_9414_l - this.posX) / (double)this.field_9415_k;
double var42 = this.posY + (this.field_9413_m - this.posY) / (double)this.field_9415_k;
double var5 = this.posZ + (this.field_9412_n - this.posZ) / (double)this.field_9415_k;
//if(this.worldObj.multiplayerWorld && this.field_9415_k > 0) {
//if(this.field_9415_k > 0) {
//double var41 = this.posX + (this.field_9414_l - this.posX) / (double)this.field_9415_k;
//double var42 = this.posY + (this.field_9413_m - this.posY) / (double)this.field_9415_k;
//double var5 = this.posZ + (this.field_9412_n - this.posZ) / (double)this.field_9415_k;
for(var7 = this.field_9411_o - (double)this.rotationYaw; var7 < -180.0D; var7 += 360.0D) {
}
//for(var7 = this.field_9411_o - (double)this.rotationYaw; var7 < -180.0D; var7 += 360.0D) {
//}
while(var7 >= 180.0D) {
var7 -= 360.0D;
}
//while(var7 >= 180.0D) {
//var7 -= 360.0D;
//}
this.rotationYaw = (float)((double)this.rotationYaw + var7 / (double)this.field_9415_k);
this.rotationPitch = (float)((double)this.rotationPitch + (this.field_9410_p - (double)this.rotationPitch) / (double)this.field_9415_k);
--this.field_9415_k;
this.setPosition(var41, var42, var5);
this.setRotation(this.rotationYaw, this.rotationPitch);
} else {
this.setPosition(this.posX, this.posY, this.posZ);
this.setRotation(this.rotationYaw, this.rotationPitch);
}
//this.rotationYaw = (float)((double)this.rotationYaw + var7 / (double)this.field_9415_k);
//this.rotationPitch = (float)((double)this.rotationPitch + (this.field_9410_p - (double)this.rotationPitch) / (double)this.field_9415_k);
//--this.field_9415_k;
//this.setPosition(var41, var42, var5);
//this.setRotation(this.rotationYaw, this.rotationPitch);
//} else {
//this.setPosition(this.posX, this.posY, this.posZ);
//this.setRotation(this.rotationYaw, this.rotationPitch);
//}
} else {
//} else {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
@ -408,7 +408,7 @@ public class EntityMinecart extends Entity implements IInventory {
this.worldObj.spawnParticle("largesmoke", this.posX, this.posY + 0.8D, this.posZ, 0.0D, 0.0D, 0.0D);
}
}
//}
}
public Vec3D func_515_a(double var1, double var3, double var5, double var7) {
@ -551,7 +551,7 @@ public class EntityMinecart extends Entity implements IInventory {
}
public void applyEntityCollision(Entity var1) {
if(!this.worldObj.multiplayerWorld) {
//if(!this.worldObj.multiplayerWorld) {
if(var1 != this.riddenByEntity) {
if(var1 instanceof EntityLiving && !(var1 instanceof EntityPlayer) && this.d == 0 && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && var1.ridingEntity == null) {
var1.mountEntity(this);
@ -609,7 +609,7 @@ public class EntityMinecart extends Entity implements IInventory {
}
}
}
//}
}
public int getSizeInventory() {
@ -665,9 +665,9 @@ public class EntityMinecart extends Entity implements IInventory {
return true;
}
if(!this.worldObj.multiplayerWorld) {
//if(!this.worldObj.multiplayerWorld) {
var1.mountEntity(this);
}
//}
} else if(this.d == 1) {
var1.displayGUIChest(this);
} else if(this.d == 2) {

View File

@ -1,102 +0,0 @@
package net.minecraft.src;
public class EntityOtherPlayerMP extends EntityPlayer {
private int field_785_bg;
private double field_784_bh;
private double field_783_bi;
private double field_782_bj;
private double field_780_bk;
private double field_786_bl;
float a = 0.0F;
public EntityOtherPlayerMP(World var1, String var2) {
super(var1);
this.field_771_i = var2;
this.yOffset = 0.0F;
this.field_9286_aZ = 0.0F;
if(var2 != null && var2.length() > 0) {
this.skinUrl = "http://www.minecraft.net/skin/" + var2 + ".png";
System.out.println("Loading texture " + this.skinUrl);
}
this.field_9314_ba = true;
this.field_619_ac = 10.0D;
}
public boolean canAttackEntity(Entity var1, int var2) {
return true;
}
public void setPositionAndRotation2(double var1, double var3, double var5, float var7, float var8, int var9) {
this.yOffset = 0.0F;
this.field_784_bh = var1;
this.field_783_bi = var3;
this.field_782_bj = var5;
this.field_780_bk = (double)var7;
this.field_786_bl = (double)var8;
this.field_785_bg = var9;
}
public void onUpdate() {
super.onUpdate();
this.field_705_Q = this.field_704_R;
double var1 = this.posX - this.prevPosX;
double var3 = this.posZ - this.prevPosZ;
float var5 = MathHelper.sqrt_double(var1 * var1 + var3 * var3) * 4.0F;
if(var5 > 1.0F) {
var5 = 1.0F;
}
this.field_704_R += (var5 - this.field_704_R) * 0.4F;
this.field_703_S += this.field_704_R;
}
public float func_392_h_() {
return 0.0F;
}
public void onLivingUpdate() {
super.func_418_b_();
if(this.field_785_bg > 0) {
double var1 = this.posX + (this.field_784_bh - this.posX) / (double)this.field_785_bg;
double var3 = this.posY + (this.field_783_bi - this.posY) / (double)this.field_785_bg;
double var5 = this.posZ + (this.field_782_bj - this.posZ) / (double)this.field_785_bg;
double var7;
for(var7 = this.field_780_bk - (double)this.rotationYaw; var7 < -180.0D; var7 += 360.0D) {
}
while(var7 >= 180.0D) {
var7 -= 360.0D;
}
this.rotationYaw = (float)((double)this.rotationYaw + var7 / (double)this.field_785_bg);
this.rotationPitch = (float)((double)this.rotationPitch + (this.field_786_bl - (double)this.rotationPitch) / (double)this.field_785_bg);
--this.field_785_bg;
this.setPosition(var1, var3, var5);
this.setRotation(this.rotationYaw, this.rotationPitch);
}
this.field_775_e = this.field_774_f;
float var9 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
float var2 = (float)Math.atan(-this.motionY * (double)0.2F) * 15.0F;
if(var9 > 0.1F) {
var9 = 0.1F;
}
if(!this.onGround || this.health <= 0) {
var9 = 0.0F;
}
if(this.onGround || this.health <= 0) {
var2 = 0.0F;
}
this.field_774_f += (var9 - this.field_774_f) * 0.4F;
this.field_9328_R += (var2 - this.field_9328_R) * 0.8F;
}
public boolean func_381_o() {
return this.field_12240_bw;
}
}

View File

@ -4,6 +4,7 @@ import java.nio.FloatBuffer;
import java.util.List;
import java.util.Random;
import net.PeytonPlayz585.glemu.GameOverlayFramebuffer;
import net.PeytonPlayz585.input.Keyboard;
import net.PeytonPlayz585.input.Mouse;
import net.PeytonPlayz585.opengl.GL11;
@ -27,8 +28,11 @@ public class EntityRenderer {
private float field_1382_n;
private float field_1381_o;
private GameOverlayFramebuffer overlayFramebuffer;
public EntityRenderer(Minecraft var1) {
this.mc = var1;
this.overlayFramebuffer = new GameOverlayFramebuffer();
this.field_1395_a = new ItemRenderer(var1);
}
@ -293,7 +297,43 @@ public class EntityRenderer {
if(this.mc.theWorld != null) {
this.func_4134_c(var1);
if(!(Keyboard.getEventKey() == 33 && Keyboard.isKeyDown(2))) {
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
long framebufferAge = this.overlayFramebuffer.getAge();
if(framebufferAge == -1l || framebufferAge > (Minecraft.debugFPS < 25 ? 125l : 75l)) {
this.overlayFramebuffer.beginRender(mc.displayWidth, mc.displayHeight);
GL11.glColorMask(true, true, true, true);
GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
GL11.enableOverlayFramebufferBlending(true);
this.mc.ingameGUI.renderGameOverlay(var1, this.mc.currentScreen != null, var10, var11);
GL11.enableOverlayFramebufferBlending(false);
this.overlayFramebuffer.endRender();
GL11.glClearColor(this.field_4270_e, this.field_4269_f, this.field_4268_g, 0.0F);
}
this.func_905_b();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
if (Minecraft.getMinecraft().gameSettings.fancyGraphics) {
this.mc.ingameGUI.func_4064_a(this.mc.thePlayer.getEntityBrightness(var1), var8, var9);
}
this.mc.ingameGUI.renderCrossHairs(var8, var9);
this.overlayFramebuffer.bindTexture();
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(false);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(0.0D, (double) var9, -90.0D, 0.0D, 0.0D);
tessellator.addVertexWithUV((double) var8, (double) var9, -90.0D, 1.0D, 0.0D);
tessellator.addVertexWithUV((double) var8, 0.0D, -90.0D, 1.0D, 1.0D);
tessellator.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 1.0D);
tessellator.draw();
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_BLEND);
}
} else {
GL11.glViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);

View File

@ -10,7 +10,7 @@ public class EntitySheep extends EntityAnimals {
}
public boolean canAttackEntity(Entity var1, int var2) {
if(!this.worldObj.multiplayerWorld && !this.sheared && var1 instanceof EntityLiving) {
if(!this.sheared && var1 instanceof EntityLiving) {
this.sheared = true;
int var3 = 1 + this.rand.nextInt(3);

View File

@ -120,7 +120,7 @@ public class EntitySnowball extends Entity {
var2 = Vec3D.createVector(var3.hitVec.xCoord, var3.hitVec.yCoord, var3.hitVec.zCoord);
}
if(!this.worldObj.multiplayerWorld) {
//if(!this.worldObj.multiplayerWorld) {
Entity var4 = null;
List var5 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expands(1.0D, 1.0D, 1.0D));
double var6 = 0.0D;
@ -144,7 +144,7 @@ public class EntitySnowball extends Entity {
if(var4 != null) {
var3 = new MovingObjectPosition(var4);
}
}
//}
if(var3 != null) {
if(var3.entityHit != null && var3.entityHit.canAttackEntity(this.field_811_g, 0)) {

View File

@ -16,7 +16,7 @@ public class FontRenderer {
EaglerImage bufferedimage = GL11.loadPNG(GL11.loadResourceBytes(s));
int i = bufferedimage.w;
int j = bufferedimage.h;
int ai[] = bufferedimage.data;
int ai[] = bufferedimage.data();
for (int k = 0; k < 256; k++) {
int l = k % 16;
int k1 = k / 16;

View File

@ -41,11 +41,10 @@ public class GameSettings {
public int difficulty = 2;
public boolean thirdPersonView = false;
public String field_12259_z = "";
public String username = "";
public GameSettings(Minecraft var1) {
this.mc = var1;
this.mc.gameSettings = this;
this.loadOptions();
}
public GameSettings() {
@ -191,10 +190,6 @@ public class GameSettings {
this.skin = var3[1];
}
if(var3[0].equals("username")) {
this.username = var3[1];
}
if(var3[0].equals("lastServer")) {
this.field_12259_z = var3[1];
}
@ -235,8 +230,6 @@ public class GameSettings {
var1.println("difficulty:" + this.difficulty);
var1.println("fancyGraphics:" + this.fancyGraphics);
var1.println("skin:" + this.skin);
var1.println("lastServer:" + this.field_12259_z);
var1.println("username:" + this.username);
for(int var2 = 0; var2 < this.keyBindings.length; ++var2) {
var1.println("key_" + this.keyBindings[var2].keyDescription + ":" + this.keyBindings[var2].keyCode);

View File

@ -1,65 +0,0 @@
package net.minecraft.src;
import net.minecraft.client.Minecraft;
public class GuiConnecting extends GuiScreen {
private NetClientHandler clientHandler;
private boolean cancelled = false;
public GuiConnecting(Minecraft var1, String var2) {
var1.func_6261_a((World)null);
(new ThreadConnectToServer(this, var1, var2)).start();
}
public void updateScreen() {
if(this.clientHandler != null) {
this.clientHandler.processReadPackets();
}
}
protected void keyTyped(char var1, int var2) {
}
public void initGui() {
this.controlList.clear();
this.controlList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, "Cancel"));
}
protected void actionPerformed(GuiButton var1) {
if(var1.id == 0) {
this.cancelled = true;
if(this.clientHandler != null) {
this.clientHandler.disconnect();
}
this.mc.displayGuiScreen(new GuiMainMenu());
}
}
public void drawScreen(int var1, int var2, float var3) {
this.drawDefaultBackground();
if(this.clientHandler == null) {
this.drawCenteredString(this.fontRenderer, "Connecting to the server...", this.width / 2, this.height / 2 - 50, 16777215);
this.drawCenteredString(this.fontRenderer, "", this.width / 2, this.height / 2 - 10, 16777215);
} else {
this.drawCenteredString(this.fontRenderer, "Logging in...", this.width / 2, this.height / 2 - 50, 16777215);
this.drawCenteredString(this.fontRenderer, this.clientHandler.field_1209_a, this.width / 2, this.height / 2 - 10, 16777215);
}
super.drawScreen(var1, var2, var3);
}
static NetClientHandler setNetClientHandler(GuiConnecting var0, NetClientHandler var1) {
return var0.clientHandler = var1;
}
static boolean isCancelled(GuiConnecting var0) {
return var0.cancelled;
}
static NetClientHandler getNetClientHandler(GuiConnecting var0) {
return var0.clientHandler;
}
}

View File

@ -1,38 +0,0 @@
package net.minecraft.src;
public class GuiDownloadTerrain extends GuiScreen {
private NetClientHandler netHandler;
private int updateCounter = 0;
public GuiDownloadTerrain(NetClientHandler var1) {
this.netHandler = var1;
}
protected void keyTyped(char var1, int var2) {
}
public void initGui() {
this.controlList.clear();
}
public void updateScreen() {
++this.updateCounter;
if(this.updateCounter % 20 == 0) {
this.netHandler.addToSendQueue(new Packet0KeepAlive());
}
if(this.netHandler != null) {
this.netHandler.processReadPackets();
}
}
protected void actionPerformed(GuiButton var1) {
}
public void drawScreen(int var1, int var2, float var3) {
this.drawBackground(0);
this.drawCenteredString(this.fontRenderer, "Downloading terrain", this.width / 2, this.height / 2 - 50, 16777215);
super.drawScreen(var1, var2, var3);
}
}

View File

@ -32,9 +32,6 @@ public class GuiIngame extends Gui {
FontRenderer var8 = this.mc.fontRenderer;
this.mc.field_9243_r.func_905_b();
GL11.glEnable(GL11.GL_BLEND);
if(this.mc.gameSettings.fancyGraphics) {
this.func_4064_a(this.mc.thePlayer.getEntityBrightness(var1), var6, var7);
}
ItemStack var9 = this.mc.thePlayer.inventory.armorItemInSlot(3);
if(!this.mc.gameSettings.thirdPersonView && var9 != null && var9.itemID == Block.pumpkin.blockID) {
@ -54,9 +51,6 @@ public class GuiIngame extends Gui {
this.drawTexturedModalRect(var6 / 2 - 91 - 1 + var11.currentItem * 20, var7 - 22 - 1, 0, 22, 24, 22);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/icons.png"));
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR);
this.drawTexturedModalRect(var6 / 2 - 7, var7 / 2 - 7, 0, 0, 16, 16);
GL11.glDisable(GL11.GL_BLEND);
boolean var12 = this.mc.thePlayer.field_9306_bj / 3 % 2 == 1;
if(this.mc.thePlayer.field_9306_bj < 10) {
var12 = false;
@ -236,7 +230,7 @@ public class GuiIngame extends Gui {
GL11.glDisable(GL11.GL_BLEND);
}
private void func_4063_a(int var1, int var2) {
public void func_4063_a(int var1, int var2) {
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(false);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
@ -256,8 +250,9 @@ public class GuiIngame extends Gui {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
private void func_4064_a(float var1, int var2, int var3) {
var1 = 1.0F - var1;
public void func_4064_a(float var1, int var2, int var3) {
var1 = 1.0F - var1 * 0.5f;
if (var1 < 0.0F) {
var1 = 0.0F;
}
@ -410,4 +405,13 @@ public class GuiIngame extends Gui {
return (red << 16) | (green << 8) | blue;
}
public void renderCrossHairs(int w, int h) {
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/icons.png"));
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR);
this.drawTexturedModalRect(w / 2 - 7, h / 2 - 7, 0, 0, 16, 16);
}
}

View File

@ -12,10 +12,6 @@ public class GuiIngameMenu extends GuiScreen {
this.updateCounter2 = 0;
this.controlList.clear();
this.controlList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 48, "Save and quit to title"));
if(this.mc.isMultiplayerWorld()) {
((GuiButton)this.controlList.get(0)).displayString = "Disconnect";
}
this.controlList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 24, "Back to game"));
this.controlList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96, "Options..."));
}
@ -26,10 +22,6 @@ public class GuiIngameMenu extends GuiScreen {
}
if(var1.id == 1) {
if(this.mc.isMultiplayerWorld()) {
this.mc.theWorld.sendQuittingDisconnectingPacket();
}
Minecraft.getMinecraft().justLeftWorld = true;
this.mc.func_6261_a((World)null);
this.mc.displayGuiScreen(new GuiMainMenu());

View File

@ -73,12 +73,11 @@ public class GuiMainMenu extends GuiScreen {
}
this.controlList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 48, "Singleplayer"));
this.controlList.add(new GuiButton(2, this.width / 2 - 100, this.height / 4 + 72, "Multiplayer"));
this.controlList.add(new GuiButton(3, this.width / 2 - 100, this.height / 4 + 96, "Mods and Texture Packs"));
//GuiButton button;
//this.controlList.add(button = new GuiButton(2, this.width / 2 - 100, this.height / 4 + 72, "Multiplayer"));
//button.enabled = false;
this.controlList.add(new GuiButton(3, this.width / 2 - 100, this.height / 4 + 72, "Mods and Texture Packs"));
this.controlList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, "Options..."));
if(this.mc.field_6320_i == null) {
((GuiButton)this.controlList.get(1)).enabled = false;
}
}
protected void actionPerformed(GuiButton var1) {
@ -91,7 +90,7 @@ public class GuiMainMenu extends GuiScreen {
}
if(var1.id == 2) {
this.mc.displayGuiScreen(new GuiMultiplayer(this));
//this.mc.displayGuiScreen(new GuiMultiplayer(this));
}
if(var1.id == 3) {

View File

@ -1,180 +0,0 @@
package net.minecraft.src;
import net.PeytonPlayz585.input.Keyboard;
import net.minecraft.client.Minecraft;
public class GuiMultiplayer extends GuiScreen {
private GuiScreen updateCounter;
private int parentScreen = 0;
private String serverAddress = "";
private String username = "";
private boolean serverTextBox;
private boolean usernameTextBox;
public GuiMultiplayer(GuiScreen var1) {
this.updateCounter = var1;
}
public void updateScreen() {
++this.parentScreen;
}
public void initGui() {
usernameTextBox = true;
serverTextBox = false;
this.controlList.clear();
this.controlList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, "Connect"));
this.controlList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, "Cancel"));
this.serverAddress = this.mc.gameSettings.field_12259_z.replaceAll("_", ":");
this.username = this.mc.gameSettings.username;
((GuiButton)this.controlList.get(0)).enabled = this.serverAddress.length() > 0 && this.username.length() > 0 && !this.serverAddress.isBlank() && !this.username.isBlank() && !this.serverAddress.isEmpty() && !this.username.isEmpty();
}
protected void actionPerformed(GuiButton var1) {
if(var1.enabled) {
if(var1.id == 1) {
this.mc.displayGuiScreen(this.updateCounter);
} else if(var1.id == 0) {
Minecraft.getMinecraft().field_6320_i = new Session(this.username);
this.mc.gameSettings.field_12259_z = this.serverAddress.replaceAll(":", "_");
this.mc.gameSettings.username = this.username;
this.mc.gameSettings.saveOptions();
String[] var2 = this.serverAddress.split(":");
this.mc.displayGuiScreen(new GuiConnecting(this.mc, serverAddress));
}
}
}
protected void mouseClicked(int var1, int var2, int var3) {
if(var3 == 0) {
if(var1 >= this.width / 2 - 100 && var1 < (this.width / 2 - 100) + 200 && var2 >= this.height / 4 - 10 + 10 + 18 && var2 < (this.height / 4 - 10 + 10 + 18) + 20) {
Keyboard.enableRepeatEvents(true);
usernameTextBox = true;
serverTextBox = false;
} else if(var1 >= this.width / 2 - 100 && var1 < (this.width / 2 - 100) + 200 && var2 >= this.height / 4 - 10 + 50 + 18 && var2 < (this.height / 4 - 10 + 50 + 18) + 20) {
Keyboard.enableRepeatEvents(true);
serverTextBox = true;
usernameTextBox = false;
} else {
Keyboard.enableRepeatEvents(false);
usernameTextBox = false;
serverTextBox = false;
}
}
super.mouseClicked(var1, var2, var3);
}
private int func_4067_a(String var1, int var2) {
try {
return Integer.parseInt(var1.trim());
} catch (Exception var4) {
return var2;
}
}
protected void keyTyped(char var1, int var2) {
if(this.serverTextBox) {
if(var1 == 22) {
String var3 = null;
if(var3 == null) {
var3 = "";
}
int var4 = 32 - this.serverAddress.length();
if(var4 > var3.length()) {
var4 = var3.length();
}
if(var4 > 0) {
this.serverAddress = this.serverAddress + var3.substring(0, var4);
}
}
if(var1 == 13) {
this.actionPerformed((GuiButton)this.controlList.get(0));
}
if(var2 == 14 && this.serverAddress.length() > 0) {
this.serverAddress = this.serverAddress.substring(0, this.serverAddress.length() - 1);
}
if(" !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\'abcdefghijklmnopqrstuvwxyz{|}~\u2302\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb".indexOf(var1) >= 0 && this.serverAddress.length() < 32) {
this.serverAddress = this.serverAddress + var1;
}
((GuiButton)this.controlList.get(0)).enabled = this.serverAddress.length() > 0 && this.username.length() > 0 && !this.serverAddress.isBlank() && !this.username.isBlank() && !this.serverAddress.isEmpty() && !this.username.isEmpty();
} else if(this.usernameTextBox) {
if(var1 == 22) {
String var3 = null;
if(var3 == null) {
var3 = "";
}
int var4 = 16 - this.username.length();
if(var4 > var3.length()) {
var4 = var3.length();
}
if(var4 > 0) {
this.username = this.username + var3.substring(0, var4);
}
}
if(var1 == 13) {
this.actionPerformed((GuiButton)this.controlList.get(0));
}
if(var2 == 14 && this.username.length() > 0) {
this.username = this.username.substring(0, this.username.length() - 1);
}
if(" !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\'abcdefghijklmnopqrstuvwxyz{|}~\u2302\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb".indexOf(var1) >= 0 && this.username.length() < 16) {
if(containsOnlyAZ09("" + var1)) {
this.username = this.username + var1;
}
}
((GuiButton)this.controlList.get(0)).enabled = this.serverAddress.length() > 0 && this.username.length() > 0 && !this.serverAddress.isBlank() && !this.username.isBlank() && !this.serverAddress.isEmpty() && !this.username.isEmpty();
}
}
public void drawScreen(int var1, int var2, float var3) {
this.drawDefaultBackground();
this.drawCenteredString(this.fontRenderer, "Play Multiplayer", this.width / 2, this.height / 4 - 60 + 20, 16777215);
//this.drawString(this.fontRenderer, "Minecraft Multiplayer is currently not finished, but there", this.width / 2 - 140, this.height / 4 - 60 + 60 + 0, 10526880);
//this.drawString(this.fontRenderer, "is some buggy early testing going on.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 9, 10526880);
this.drawString(this.fontRenderer, "Server IP:", this.width / 2 - 100, this.height / 4 - 50 + 60 + 36, 10526880);
this.drawString(this.fontRenderer, "Username:", this.width / 2 - 100, this.height / 4 - 90 + 60 + 36, 10526880);
int var4 = this.width / 2 - 100;
int var5 = this.height / 4 - 10 + 50 + 18;
short var6 = 200;
byte var7 = 20;
this.drawRect(var4 - 1, var5 - 1, var4 + var6 + 1, var5 + var7 + 1, -6250336);
this.drawRect(var4, var5, var4 + var6, var5 + var7, -16777216);
if(this.serverTextBox) {
this.drawString(this.fontRenderer, this.serverAddress + (this.parentScreen / 6 % 2 == 0 ? "_" : ""), var4 + 4, var5 + (var7 - 8) / 2, 14737632);
} else {
this.drawString(this.fontRenderer, this.serverAddress, var4 + 4, var5 + (var7 - 8) / 2, 14737632);
}
int var8 = this.width / 2 - 100;
int var9 = this.height / 4 - 10 + 10 + 18;
short var10 = 200;
byte var11 = 20;
this.drawRect(var8 - 1, var9 - 1, var8 + var10 + 1, var9 + var11 + 1, -6250336);
this.drawRect(var8, var9, var8 + var10, var9 + var11, -16777216);
if(this.usernameTextBox) {
this.drawString(this.fontRenderer, this.username + (this.parentScreen / 6 % 2 == 0 ? "_" : ""), var8 + 4, var9 + (var11 - 8) / 2, 14737632);
} else {
this.drawString(this.fontRenderer, this.username, var8 + 4, var9 + (var11 - 8) / 2, 14737632);
}
super.drawScreen(var1, var2, var3);
}
private boolean containsOnlyAZ09(String input) {
return input.matches("[a-z0-9]+") || input.matches("[A-Z0-9]+");
}
}

View File

@ -30,9 +30,9 @@ public class ItemBoat extends Item {
int var25 = var24.blockX;
int var26 = var24.blockY;
int var27 = var24.blockZ;
if(!var2.multiplayerWorld) {
//if(!var2.multiplayerWorld) {
var2.entityJoinedWorld(new EntityBoat(var2, (double)((float)var25 + 0.5F), (double)((float)var26 + 1.5F), (double)((float)var27 + 0.5F)));
}
//}
--var1.stackSize;
}

View File

@ -9,9 +9,9 @@ public class ItemBow extends Item {
public ItemStack onItemRightClick(ItemStack var1, World var2, EntityPlayer var3) {
if(var3.inventory.consumeInventoryItem(Item.arrow.shiftedIndex)) {
var2.playSoundAtEntity(var3, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F));
if(!var2.multiplayerWorld) {
//if(!var2.multiplayerWorld) {
var2.entityJoinedWorld(new EntityArrow(var2, var3));
}
//}
}
return var1;

View File

@ -21,9 +21,9 @@ public class ItemFishingRod extends Item {
var3.func_457_w();
} else {
var2.playSoundAtEntity(var3, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if(!var2.multiplayerWorld) {
//if(!var2.multiplayerWorld) {
var2.entityJoinedWorld(new EntityFish(var2, var3));
}
//}
var3.func_457_w();
}

View File

@ -15,9 +15,9 @@ public class ItemHoe extends Item {
} else {
Block var10 = Block.tilledField;
var3.playSoundEffect((double)((float)var4 + 0.5F), (double)((float)var5 + 0.5F), (double)((float)var6 + 0.5F), var10.stepSound.func_1145_d(), (var10.stepSound.func_1147_b() + 1.0F) / 2.0F, var10.stepSound.func_1144_c() * 0.8F);
if(var3.multiplayerWorld) {
return true;
} else {
//if(var3.multiplayerWorld) {
//return true;
//} else {
var3.setBlockWithNotify(var4, var5, var6, var10.blockID);
var1.damageItem(1);
if(var3.rand.nextInt(8) == 0 && var8 == Block.grass.blockID) {
@ -35,7 +35,7 @@ public class ItemHoe extends Item {
}
return true;
}
//}
}
}

View File

@ -12,9 +12,9 @@ public class ItemMinecart extends Item {
public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7) {
int var8 = var3.getBlockId(var4, var5, var6);
if(var8 == Block.minecartTrack.blockID) {
if(!var3.multiplayerWorld) {
//(!var3.multiplayerWorld) {
var3.entityJoinedWorld(new EntityMinecart(var3, (double)((float)var4 + 0.5F), (double)((float)var5 + 0.5F), (double)((float)var6 + 0.5F), this.field_317_a));
}
//}
--var1.stackSize;
return true;

View File

@ -9,9 +9,9 @@ public class ItemSnowball extends Item {
public ItemStack onItemRightClick(ItemStack var1, World var2, EntityPlayer var3) {
--var1.stackSize;
var2.playSoundAtEntity(var3, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if(!var2.multiplayerWorld) {
//if(!var2.multiplayerWorld) {
var2.entityJoinedWorld(new EntitySnowball(var2, var3));
}
//}
return var1;
}

View File

@ -1,421 +0,0 @@
package net.minecraft.src;
import java.io.IOException;
import java.net.UnknownHostException;
import java.util.Random;
import net.minecraft.client.Minecraft;
public class NetClientHandler extends NetHandler {
private boolean disconnected = false;
private NetworkManager netManager;
public String field_1209_a;
private Minecraft mc;
private WorldClient worldClient;
private boolean field_1210_g = false;
Random rand = new Random();
public NetClientHandler(Minecraft var1, String var2) throws IOException, UnknownHostException {
this.mc = var1;
this.netManager = new NetworkManager(var2, this);
}
public void processReadPackets() {
if(!this.disconnected) {
this.netManager.readPacket();
}
}
public void handleLogin(Packet1Login var1) {
this.mc.field_6327_b = new PlayerControllerMP(this.mc, this);
this.worldClient = new WorldClient(this, var1.field_4074_d, var1.field_4073_e);
this.worldClient.multiplayerWorld = true;
this.mc.func_6261_a(this.worldClient);
this.mc.displayGuiScreen(new GuiDownloadTerrain(this));
this.mc.thePlayer.field_620_ab = var1.protocolVersion;
System.out.println("clientEntityId: " + var1.protocolVersion);
}
public void handlePickupSpawn(Packet21PickupSpawn var1) {
double var2 = (double)var1.xPosition / 32.0D;
double var4 = (double)var1.yPosition / 32.0D;
double var6 = (double)var1.zPosition / 32.0D;
EntityItem var8 = new EntityItem(this.worldClient, var2, var4, var6, new ItemStack(var1.itemId, var1.count));
var8.motionX = (double)var1.rotation / 128.0D;
var8.motionY = (double)var1.pitch / 128.0D;
var8.motionZ = (double)var1.roll / 128.0D;
var8.field_9303_br = var1.xPosition;
var8.field_9302_bs = var1.yPosition;
var8.field_9301_bt = var1.zPosition;
this.worldClient.func_712_a(var1.entityId, var8);
}
public void handleVehicleSpawn(Packet23VehicleSpawn var1) {
double var2 = (double)var1.xPosition / 32.0D;
double var4 = (double)var1.yPosition / 32.0D;
double var6 = (double)var1.zPosition / 32.0D;
Object var8 = null;
if(var1.type == 10) {
var8 = new EntityMinecart(this.worldClient, var2, var4, var6, 0);
}
if(var1.type == 11) {
var8 = new EntityMinecart(this.worldClient, var2, var4, var6, 1);
}
if(var1.type == 12) {
var8 = new EntityMinecart(this.worldClient, var2, var4, var6, 2);
}
if(var1.type == 90) {
var8 = new EntityFish(this.worldClient, var2, var4, var6);
}
if(var1.type == 60) {
var8 = new EntityArrow(this.worldClient, var2, var4, var6);
}
if(var1.type == 61) {
var8 = new EntitySnowball(this.worldClient, var2, var4, var6);
}
if(var1.type == 1) {
var8 = new EntityBoat(this.worldClient, var2, var4, var6);
}
if(var1.type == 50) {
var8 = new EntityTNTPrimed(this.worldClient, var2, var4, var6);
}
if(var8 != null) {
((Entity)var8).field_9303_br = var1.xPosition;
((Entity)var8).field_9302_bs = var1.yPosition;
((Entity)var8).field_9301_bt = var1.zPosition;
((Entity)var8).rotationYaw = 0.0F;
((Entity)var8).rotationPitch = 0.0F;
((Entity)var8).field_620_ab = var1.entityId;
this.worldClient.func_712_a(var1.entityId, (Entity)var8);
}
}
public void func_6498_a(Packet28 var1) {
Entity var2 = this.func_12246_a(var1.field_6367_a);
if(var2 != null) {
var2.setVelocity((double)var1.field_6366_b / 8000.0D, (double)var1.field_6369_c / 8000.0D, (double)var1.field_6368_d / 8000.0D);
}
}
public void handleNamedEntitySpawn(Packet20NamedEntitySpawn var1) {
double var2 = (double)var1.xPosition / 32.0D;
double var4 = (double)var1.yPosition / 32.0D;
double var6 = (double)var1.zPosition / 32.0D;
float var8 = (float)(var1.rotation * 360) / 256.0F;
float var9 = (float)(var1.pitch * 360) / 256.0F;
EntityOtherPlayerMP var10 = new EntityOtherPlayerMP(this.mc.theWorld, var1.name);
var10.field_9303_br = var1.xPosition;
var10.field_9302_bs = var1.yPosition;
var10.field_9301_bt = var1.zPosition;
int var11 = var1.currentItem;
if(var11 == 0) {
var10.inventory.mainInventory[var10.inventory.currentItem] = null;
} else {
var10.inventory.mainInventory[var10.inventory.currentItem] = new ItemStack(var11);
}
var10.setPositionAndRotation(var2, var4, var6, var8, var9);
this.worldClient.func_712_a(var1.entityId, var10);
}
public void handleEntityTeleport(Packet34EntityTeleport var1) {
Entity var2 = this.func_12246_a(var1.entityId);
if(var2 != null) {
var2.field_9303_br = var1.xPosition;
var2.field_9302_bs = var1.yPosition;
var2.field_9301_bt = var1.zPosition;
double var3 = (double)var2.field_9303_br / 32.0D;
double var5 = (double)var2.field_9302_bs / 32.0D + 1.0D / 64.0D;
double var7 = (double)var2.field_9301_bt / 32.0D;
float var9 = (float)(var1.yaw * 360) / 256.0F;
float var10 = (float)(var1.pitch * 360) / 256.0F;
var2.setPositionAndRotation2(var3, var5, var7, var9, var10, 3);
}
}
public void handleEntity(Packet30Entity var1) {
Entity var2 = this.func_12246_a(var1.entityId);
if(var2 != null) {
var2.field_9303_br += var1.xPosition;
var2.field_9302_bs += var1.yPosition;
var2.field_9301_bt += var1.zPosition;
double var3 = (double)var2.field_9303_br / 32.0D;
double var5 = (double)var2.field_9302_bs / 32.0D + 1.0D / 64.0D;
double var7 = (double)var2.field_9301_bt / 32.0D;
float var9 = var1.rotating ? (float)(var1.yaw * 360) / 256.0F : var2.rotationYaw;
float var10 = var1.rotating ? (float)(var1.pitch * 360) / 256.0F : var2.rotationPitch;
var2.setPositionAndRotation2(var3, var5, var7, var9, var10, 3);
}
}
public void handleDestroyEntity(Packet29DestroyEntity var1) {
this.worldClient.func_710_c(var1.entityId);
}
public void handleFlying(Packet10Flying var1) {
EntityPlayerSP var2 = this.mc.thePlayer;
double var3 = var2.posX;
double var5 = var2.posY;
double var7 = var2.posZ;
float var9 = var2.rotationYaw;
float var10 = var2.rotationPitch;
if(var1.moving) {
var3 = var1.xPosition;
var5 = var1.yPosition;
var7 = var1.zPosition;
}
if(var1.rotating) {
var9 = var1.yaw;
var10 = var1.pitch;
}
var2.field_9287_aY = 0.0F;
var2.motionX = var2.motionY = var2.motionZ = 0.0D;
var2.setPositionAndRotation(var3, var5, var7, var9, var10);
var1.xPosition = var2.posX;
var1.yPosition = var2.boundingBox.minY;
var1.zPosition = var2.posZ;
var1.stance = var2.posY;
this.netManager.addToSendQueue(var1);
if(!this.field_1210_g) {
this.mc.thePlayer.prevPosX = this.mc.thePlayer.posX;
this.mc.thePlayer.prevPosY = this.mc.thePlayer.posY;
this.mc.thePlayer.prevPosZ = this.mc.thePlayer.posZ;
this.field_1210_g = true;
this.mc.displayGuiScreen((GuiScreen)null);
}
}
public void handlePreChunk(Packet50PreChunk var1) {
this.worldClient.func_713_a(var1.xPosition, var1.yPosition, var1.mode);
}
public void handleMultiBlockChange(Packet52MultiBlockChange var1) {
Chunk var2 = this.worldClient.getChunkFromChunkCoords(var1.xPosition, var1.zPosition);
int var3 = var1.xPosition * 16;
int var4 = var1.zPosition * 16;
for(int var5 = 0; var5 < var1.size; ++var5) {
short var6 = var1.coordinateArray[var5];
int var7 = var1.typeArray[var5] & 255;
byte var8 = var1.metadataArray[var5];
int var9 = var6 >> 12 & 15;
int var10 = var6 >> 8 & 15;
int var11 = var6 & 255;
var2.setBlockIDWithMetadata(var9, var11, var10, var7, var8);
this.worldClient.func_711_c(var9 + var3, var11, var10 + var4, var9 + var3, var11, var10 + var4);
this.worldClient.func_701_b(var9 + var3, var11, var10 + var4, var9 + var3, var11, var10 + var4);
}
}
public void handleMapChunk(Packet51MapChunk var1) {
this.worldClient.func_711_c(var1.xPosition, var1.yPosition, var1.zPosition, var1.xPosition + var1.xSize - 1, var1.yPosition + var1.ySize - 1, var1.zPosition + var1.zSize - 1);
this.worldClient.func_693_a(var1.xPosition, var1.yPosition, var1.zPosition, var1.xSize, var1.ySize, var1.zSize, var1.chunk);
}
public void handleBlockChange(Packet53BlockChange var1) {
this.worldClient.func_714_c(var1.xPosition, var1.yPosition, var1.zPosition, var1.type, var1.metadata);
}
public void handleKickDisconnect(Packet255KickDisconnect var1) {
this.netManager.networkShutdown("Got kicked");
this.disconnected = true;
this.mc.func_6261_a((World)null);
this.mc.displayGuiScreen(new GuiConnectFailed("Disconnected by server", var1.reason));
}
public void handleErrorMessage(String var1) {
if(!this.disconnected) {
this.disconnected = true;
this.mc.func_6261_a((World)null);
this.mc.displayGuiScreen(new GuiConnectFailed("Connection lost", var1));
}
}
public void addToSendQueue(Packet var1) {
if(!this.disconnected) {
this.netManager.addToSendQueue(var1);
}
}
public void handleCollect(Packet22Collect var1) {
Entity var2 = this.func_12246_a(var1.collectedEntityId);
Object var3 = (EntityLiving)this.func_12246_a(var1.collectorEntityId);
if(var3 == null) {
var3 = this.mc.thePlayer;
}
if(var2 != null) {
this.worldClient.playSoundAtEntity(var2, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
this.mc.field_6321_h.func_1192_a(new EntityPickupFX(this.mc.theWorld, var2, (Entity)var3, -0.5F));
this.worldClient.func_710_c(var1.collectedEntityId);
}
}
public void handleBlockItemSwitch(Packet16BlockItemSwitch var1) {
Entity var2 = this.func_12246_a(var1.unused);
if(var2 != null) {
EntityPlayer var3 = (EntityPlayer)var2;
int var4 = var1.id;
if(var4 == 0) {
var3.inventory.mainInventory[var3.inventory.currentItem] = null;
} else {
var3.inventory.mainInventory[var3.inventory.currentItem] = new ItemStack(var4);
}
}
}
public void handleChat(Packet3Chat var1) {
this.mc.ingameGUI.addChatMessage(var1.message);
}
public void handleArmAnimation(Packet18ArmAnimation var1) {
Entity var2 = this.func_12246_a(var1.entityId);
if(var2 != null) {
if(var1.animate == 1) {
EntityPlayer var3 = (EntityPlayer)var2;
var3.func_457_w();
} else if(var1.animate == 100) {
var2.field_9300_bu = true;
} else if(var1.animate == 101) {
var2.field_9300_bu = false;
} else if(var1.animate == 102) {
var2.field_9299_bv = true;
} else if(var1.animate == 103) {
var2.field_9299_bv = false;
} else if(var1.animate == 104) {
var2.field_12240_bw = true;
} else if(var1.animate == 105) {
var2.field_12240_bw = false;
} else if(var1.animate == 2) {
var2.func_9280_g();
}
}
}
public void handleAddToInventory(Packet17AddToInventory var1) {
this.mc.thePlayer.inventory.addItemStackToInventory(new ItemStack(var1.id, var1.count, var1.durability));
}
public void handleHandshake(Packet2Handshake var1) {
this.addToSendQueue(new Packet1Login(this.mc.field_6320_i.inventory, "Password", 6));
}
public void disconnect() {
this.disconnected = true;
this.netManager.networkShutdown("Closed");
}
public void handleMobSpawn(Packet24MobSpawn var1) {
double var2 = (double)var1.xPosition / 32.0D;
double var4 = (double)var1.yPosition / 32.0D;
double var6 = (double)var1.zPosition / 32.0D;
float var8 = (float)(var1.yaw * 360) / 256.0F;
float var9 = (float)(var1.pitch * 360) / 256.0F;
EntityLiving var10 = (EntityLiving)EntityList.createEntity(var1.type, this.mc.theWorld);
var10.field_9303_br = var1.xPosition;
var10.field_9302_bs = var1.yPosition;
var10.field_9301_bt = var1.zPosition;
var10.field_620_ab = var1.entityId;
var10.setPositionAndRotation(var2, var4, var6, var8, var9);
var10.field_9343_G = true;
this.worldClient.func_712_a(var1.entityId, var10);
}
public void handleUpdateTime(Packet4UpdateTime var1) {
this.mc.theWorld.setWorldTime(var1.time);
}
public void handlePlayerInventory(Packet5PlayerInventory var1) {
EntityPlayerSP var2 = this.mc.thePlayer;
if(var1.type == -1) {
var2.inventory.mainInventory = var1.stacks;
}
if(var1.type == -2) {
var2.inventory.craftingInventory = var1.stacks;
}
if(var1.type == -3) {
var2.inventory.armorInventory = var1.stacks;
}
}
public void handleComplexEntity(Packet59ComplexEntity var1) {
if(var1.entityNBT.getInteger("x") == var1.xPosition) {
if(var1.entityNBT.getInteger("y") == var1.yPosition) {
if(var1.entityNBT.getInteger("z") == var1.zPosition) {
TileEntity var2 = this.worldClient.getBlockTileEntity(var1.xPosition, var1.yPosition, var1.zPosition);
if(var2 != null) {
try {
var2.readFromNBT(var1.entityNBT);
} catch (Exception var4) {
}
this.worldClient.func_701_b(var1.xPosition, var1.yPosition, var1.zPosition, var1.xPosition, var1.yPosition, var1.zPosition);
}
}
}
}
}
public void handleSpawnPosition(Packet6SpawnPosition var1) {
this.worldClient.spawnX = var1.xPosition;
this.worldClient.spawnY = var1.yPosition;
this.worldClient.spawnZ = var1.zPosition;
}
public void func_6497_a(Packet39 var1) {
Object var2 = this.func_12246_a(var1.field_6365_a);
Entity var3 = this.func_12246_a(var1.field_6364_b);
if(var1.field_6365_a == this.mc.thePlayer.field_620_ab) {
var2 = this.mc.thePlayer;
}
if(var2 != null) {
((Entity)var2).mountEntity(var3);
}
}
public void func_9447_a(Packet38 var1) {
Entity var2 = this.func_12246_a(var1.field_9274_a);
if(var2 != null) {
var2.func_9282_a(var1.field_9273_b);
}
}
private Entity func_12246_a(int var1) {
return (Entity)(var1 == this.mc.thePlayer.field_620_ab ? this.mc.thePlayer : this.worldClient.func_709_b(var1));
}
public void handleHealth(Packet8 var1) {
this.mc.thePlayer.setHealth(var1.healthMP);
}
public void func_9448_a(Packet9 var1) {
this.mc.respawn();
}
public void func_12245_a(Packet60 var1) {
Explosion var2 = new Explosion(this.mc.theWorld, (Entity)null, var1.field_12236_a, var1.field_12235_b, var1.field_12239_c, var1.field_12238_d);
var2.field_12251_g = var1.field_12237_e;
var2.func_12247_b();
}
}

View File

@ -1,140 +0,0 @@
package net.minecraft.src;
public class NetHandler {
public void handleMapChunk(Packet51MapChunk var1) {
}
public void func_4114_b(Packet var1) {
}
public void handleErrorMessage(String var1) {
}
public void handleKickDisconnect(Packet255KickDisconnect var1) {
this.func_4114_b(var1);
}
public void handleLogin(Packet1Login var1) {
this.func_4114_b(var1);
}
public void handleFlying(Packet10Flying var1) {
this.func_4114_b(var1);
}
public void handleMultiBlockChange(Packet52MultiBlockChange var1) {
this.func_4114_b(var1);
}
public void handleBlockDig(Packet14BlockDig var1) {
this.func_4114_b(var1);
}
public void handleBlockChange(Packet53BlockChange var1) {
this.func_4114_b(var1);
}
public void handlePreChunk(Packet50PreChunk var1) {
this.func_4114_b(var1);
}
public void handleNamedEntitySpawn(Packet20NamedEntitySpawn var1) {
this.func_4114_b(var1);
}
public void handleEntity(Packet30Entity var1) {
this.func_4114_b(var1);
}
public void handleEntityTeleport(Packet34EntityTeleport var1) {
this.func_4114_b(var1);
}
public void handlePlace(Packet15Place var1) {
this.func_4114_b(var1);
}
public void handleBlockItemSwitch(Packet16BlockItemSwitch var1) {
this.func_4114_b(var1);
}
public void handleDestroyEntity(Packet29DestroyEntity var1) {
this.func_4114_b(var1);
}
public void handlePickupSpawn(Packet21PickupSpawn var1) {
this.func_4114_b(var1);
}
public void handleCollect(Packet22Collect var1) {
this.func_4114_b(var1);
}
public void handleChat(Packet3Chat var1) {
this.func_4114_b(var1);
}
public void handleAddToInventory(Packet17AddToInventory var1) {
this.func_4114_b(var1);
}
public void handleVehicleSpawn(Packet23VehicleSpawn var1) {
this.func_4114_b(var1);
}
public void handleArmAnimation(Packet18ArmAnimation var1) {
this.func_4114_b(var1);
}
public void handleHandshake(Packet2Handshake var1) {
this.func_4114_b(var1);
}
public void handleMobSpawn(Packet24MobSpawn var1) {
this.func_4114_b(var1);
}
public void handleUpdateTime(Packet4UpdateTime var1) {
this.func_4114_b(var1);
}
public void handlePlayerInventory(Packet5PlayerInventory var1) {
this.func_4114_b(var1);
}
public void handleComplexEntity(Packet59ComplexEntity var1) {
this.func_4114_b(var1);
}
public void handleSpawnPosition(Packet6SpawnPosition var1) {
this.func_4114_b(var1);
}
public void func_6498_a(Packet28 var1) {
this.func_4114_b(var1);
}
public void func_6497_a(Packet39 var1) {
this.func_4114_b(var1);
}
public void func_6499_a(Packet7 var1) {
this.func_4114_b(var1);
}
public void func_9447_a(Packet38 var1) {
this.func_4114_b(var1);
}
public void handleHealth(Packet8 var1) {
this.func_4114_b(var1);
}
public void func_9448_a(Packet9 var1) {
this.func_4114_b(var1);
}
public void func_12245_a(Packet60 var1) {
this.func_4114_b(var1);
}
}

View File

@ -1,234 +0,0 @@
package net.minecraft.src;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import net.PeytonPlayz585.opengl.GL11;
public class NetworkManager {
private Object sendQueueLock = new Object();
private boolean isRunning = true;
private List dataPackets = Collections.synchronizedList(new ArrayList());
private List chunkDataPackets = Collections.synchronizedList(new ArrayList());
private NetHandler netHandler;
private boolean isServerTerminating = false;
private boolean isTerminating = false;
private String terminationReason = "";
private int timeSinceLastRead = 0;
private int sendQueueByteLength = 0;
private int chunkDataSendCounter = 0;
public NetworkManager(String var4, NetHandler var3) throws IOException {
this.netHandler = var3;
String uri = null;
System.out.println(uri);
if(var4.startsWith("ws://")) {
uri = var4.substring(5);
}else if(var4.startsWith("wss://")){
uri = var4.substring(6);
}else if(!var4.contains("://")){
uri = var4;
var4 = "ws://" + var4;
}else {
throw new IOException("Invalid URI Protocol!");
}
if(!GL11.startConnection(var4)) {
//if(!GL11.startConnection(uri)) {
throw new IOException("Websocket to " + uri + " failed!");
//}
}
}
public void addToSendQueue(Packet var1) {
if(!this.isServerTerminating) {
Object var2 = this.sendQueueLock;
synchronized(var2) {
this.sendQueueByteLength += var1.getPacketSize() + 1;
if(var1.isChunkDataPacket) {
this.chunkDataPackets.add(var1);
} else {
this.dataPackets.add(var1);
}
this.sendPacket();
}
}
}
private ByteArrayOutputStream sendBuffer;
private void sendPacket() {
try {
boolean var1 = true;
Packet var2;
Object var3;
if(!this.dataPackets.isEmpty()) {
var1 = false;
var3 = this.sendQueueLock;
synchronized(var3) {
var2 = (Packet)this.dataPackets.remove(0);
this.sendQueueByteLength -= var2.getPacketSize() + 1;
}
sendBuffer = new ByteArrayOutputStream();
DataOutputStream yee = new DataOutputStream(sendBuffer);
Packet.writePacket(var2, yee);
GL11.writePacket(sendBuffer.toByteArray());
}
if((var1 || this.chunkDataSendCounter-- <= 0) && !this.chunkDataPackets.isEmpty()) {
var1 = false;
var3 = this.sendQueueLock;
synchronized(var3) {
var2 = (Packet)this.chunkDataPackets.remove(0);
this.sendQueueByteLength -= var2.getPacketSize() + 1;
}
sendBuffer = new ByteArrayOutputStream();
DataOutputStream yee = new DataOutputStream(sendBuffer);
Packet.writePacket(var2, yee);
GL11.writePacket(sendBuffer.toByteArray());
this.chunkDataSendCounter = 50;
}
if(var1) {
Thread.sleep(10L);
}
} catch (InterruptedException var8) {
} catch (Exception var9) {
if(!this.isTerminating) {
this.onNetworkError(var9);
}
}
}
private ByteBuffer oldChunkBuffer = null;
private LinkedList<ByteBuffer> readChunks = new LinkedList();
public void readPacket() {
if(this.sendQueueByteLength > 1048576) {
this.networkShutdown("Send buffer overflow");
}
readChunks.clear();
if(oldChunkBuffer != null) {
readChunks.add(oldChunkBuffer);
}
byte[] packet;
while((packet = GL11.readPacket()) != null) {
readChunks.add(ByteBuffer.wrap(packet));
}
if(!readChunks.isEmpty()) {
this.timeSinceLastRead = 0;
int cap = 0;
for(ByteBuffer b : readChunks) {
cap += b.limit();
}
ByteBuffer stream = ByteBuffer.allocate(cap);
for(ByteBuffer b : readChunks) {
stream.put(b);
}
stream.flip();
DataInputStream packetStream = new DataInputStream(new ByteBufferDirectInputStream(stream));
//int var1 = 100;
while(stream.hasRemaining()) {
stream.mark();
try {
Packet pkt = Packet.readPacket(packetStream);
if(pkt == null) {
this.networkShutdown("End of Stream");
}
pkt.processPacket(this.netHandler);
} catch (EOFException e) {
stream.reset();
break;
} catch (IOException e) {
continue;
} catch(ArrayIndexOutOfBoundsException e) {
continue;
} catch(NullPointerException e) {
continue;
} catch(Throwable e2) {
e2.printStackTrace();
}
}
if(stream.hasRemaining()) {
oldChunkBuffer = stream.slice();
}else {
oldChunkBuffer = null;
}
} else {
if(this.timeSinceLastRead++ == 1200) {
this.networkShutdown("Timed out");
}
}
if(this.isTerminating && this.readChunks.isEmpty()) {
this.netHandler.handleErrorMessage(this.terminationReason);
}
}
private void onNetworkError(Exception var1) {
var1.printStackTrace();
this.networkShutdown("Internal exception: " + var1.toString());
}
public void networkShutdown(String var1) {
if(this.isRunning) {
this.isTerminating = true;
this.terminationReason = var1;
this.isRunning = false;
if(GL11.connectionOpen()) {
GL11.endConnection();
}
}
}
static boolean isRunning(NetworkManager var0) {
return var0.isRunning;
}
static boolean isServerTerminating(NetworkManager var0) {
return var0.isServerTerminating;
}
static void readNetworkPacket(NetworkManager var0) {
var0.readPacket();
}
static void sendNetworkPacket(NetworkManager var0) {
var0.sendPacket();
}
private static class ByteBufferDirectInputStream extends InputStream {
private ByteBuffer buf;
private ByteBufferDirectInputStream(ByteBuffer b) {
this.buf = b;
}
@Override
public int read() throws IOException {
return buf.remaining() > 0 ? ((int)buf.get() & 0xFF) : -1;
}
@Override
public int available() {
return buf.remaining();
}
}
}

View File

@ -1,110 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public abstract class Packet {
private static Map packetIdToClassMap = new HashMap();
private static Map packetClassToIdMap = new HashMap();
public boolean isChunkDataPacket = false;
static void addIdClassMapping(int var0, Class var1) {
if(packetIdToClassMap.containsKey(Integer.valueOf(var0))) {
throw new IllegalArgumentException("Duplicate packet id:" + var0);
} else if(packetClassToIdMap.containsKey(var1)) {
throw new IllegalArgumentException("Duplicate packet class:" + var1);
} else {
packetIdToClassMap.put(Integer.valueOf(var0), var1);
packetClassToIdMap.put(var1, Integer.valueOf(var0));
}
}
public static Packet getNewPacket(int var0) {
try {
Class var1 = (Class)packetIdToClassMap.get(Integer.valueOf(var0));
return var1 == null ? null : (Packet)var1.newInstance();
} catch (Exception var2) {
var2.printStackTrace();
System.out.println("Skipping packet with id " + var0);
return null;
}
}
public final int getPacketId() {
return ((Integer)packetClassToIdMap.get(this.getClass())).intValue();
}
public static Packet readPacket(DataInputStream var0) throws IOException {
int var1 = var0.read();
if(var1 == -1) {
return null;
} else {
Packet var2 = getNewPacket(var1);
if(var2 == null) {
throw new IOException("Bad packet id " + var1);
} else {
var2.readPacketData(var0);
return var2;
}
}
}
public static void writePacket(Packet var0, DataOutputStream var1) throws IOException {
var1.write(var0.getPacketId());
var0.writePacketData(var1);
}
public abstract void readPacketData(DataInputStream var1) throws IOException;
public abstract void writePacketData(DataOutputStream var1) throws IOException;
public abstract void processPacket(NetHandler var1);
public abstract int getPacketSize();
static {
addIdClassMapping(0, Packet0KeepAlive.class);
addIdClassMapping(1, Packet1Login.class);
addIdClassMapping(2, Packet2Handshake.class);
addIdClassMapping(3, Packet3Chat.class);
addIdClassMapping(4, Packet4UpdateTime.class);
addIdClassMapping(5, Packet5PlayerInventory.class);
addIdClassMapping(6, Packet6SpawnPosition.class);
addIdClassMapping(7, Packet7.class);
addIdClassMapping(8, Packet8.class);
addIdClassMapping(9, Packet9.class);
addIdClassMapping(10, Packet10Flying.class);
addIdClassMapping(11, Packet11PlayerPosition.class);
addIdClassMapping(12, Packet12PlayerLook.class);
addIdClassMapping(13, Packet13PlayerLookMove.class);
addIdClassMapping(14, Packet14BlockDig.class);
addIdClassMapping(15, Packet15Place.class);
addIdClassMapping(16, Packet16BlockItemSwitch.class);
addIdClassMapping(17, Packet17AddToInventory.class);
addIdClassMapping(18, Packet18ArmAnimation.class);
addIdClassMapping(20, Packet20NamedEntitySpawn.class);
addIdClassMapping(21, Packet21PickupSpawn.class);
addIdClassMapping(22, Packet22Collect.class);
addIdClassMapping(23, Packet23VehicleSpawn.class);
addIdClassMapping(24, Packet24MobSpawn.class);
addIdClassMapping(28, Packet28.class);
addIdClassMapping(29, Packet29DestroyEntity.class);
addIdClassMapping(30, Packet30Entity.class);
addIdClassMapping(31, Packet31RelEntityMove.class);
addIdClassMapping(32, Packet32EntityLook.class);
addIdClassMapping(33, Packet33RelEntityMoveLook.class);
addIdClassMapping(34, Packet34EntityTeleport.class);
addIdClassMapping(38, Packet38.class);
addIdClassMapping(39, Packet39.class);
addIdClassMapping(50, Packet50PreChunk.class);
addIdClassMapping(51, Packet51MapChunk.class);
addIdClassMapping(52, Packet52MultiBlockChange.class);
addIdClassMapping(53, Packet53BlockChange.class);
addIdClassMapping(59, Packet59ComplexEntity.class);
addIdClassMapping(60, Packet60.class);
addIdClassMapping(255, Packet255KickDisconnect.class);
}
}

View File

@ -1,20 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet0KeepAlive extends Packet {
public void processPacket(NetHandler var1) {
}
public void readPacketData(DataInputStream var1) throws IOException {
}
public void writePacketData(DataOutputStream var1) throws IOException {
}
public int getPacketSize() {
return 0;
}
}

View File

@ -1,40 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet10Flying extends Packet {
public double xPosition;
public double yPosition;
public double zPosition;
public double stance;
public float yaw;
public float pitch;
public boolean onGround;
public boolean moving;
public boolean rotating;
public Packet10Flying() {
}
public Packet10Flying(boolean var1) {
this.onGround = var1;
}
public void processPacket(NetHandler var1) {
var1.handleFlying(this);
}
public void readPacketData(DataInputStream var1) throws IOException {
this.onGround = var1.read() != 0;
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.write(this.onGround ? 1 : 0);
}
public int getPacketSize() {
return 1;
}
}

View File

@ -1,40 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet11PlayerPosition extends Packet10Flying {
public Packet11PlayerPosition() {
this.moving = true;
}
public Packet11PlayerPosition(double var1, double var3, double var5, double var7, boolean var9) {
this.xPosition = var1;
this.yPosition = var3;
this.stance = var5;
this.zPosition = var7;
this.onGround = var9;
this.moving = true;
}
public void readPacketData(DataInputStream var1) throws IOException {
this.xPosition = var1.readDouble();
this.yPosition = var1.readDouble();
this.stance = var1.readDouble();
this.zPosition = var1.readDouble();
super.readPacketData(var1);
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeDouble(this.xPosition);
var1.writeDouble(this.yPosition);
var1.writeDouble(this.stance);
var1.writeDouble(this.zPosition);
super.writePacketData(var1);
}
public int getPacketSize() {
return 33;
}
}

View File

@ -1,34 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet12PlayerLook extends Packet10Flying {
public Packet12PlayerLook() {
this.rotating = true;
}
public Packet12PlayerLook(float var1, float var2, boolean var3) {
this.yaw = var1;
this.pitch = var2;
this.onGround = var3;
this.rotating = true;
}
public void readPacketData(DataInputStream var1) throws IOException {
this.yaw = var1.readFloat();
this.pitch = var1.readFloat();
super.readPacketData(var1);
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeFloat(this.yaw);
var1.writeFloat(this.pitch);
super.writePacketData(var1);
}
public int getPacketSize() {
return 9;
}
}

View File

@ -1,48 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet13PlayerLookMove extends Packet10Flying {
public Packet13PlayerLookMove() {
this.rotating = true;
this.moving = true;
}
public Packet13PlayerLookMove(double var1, double var3, double var5, double var7, float var9, float var10, boolean var11) {
this.xPosition = var1;
this.yPosition = var3;
this.stance = var5;
this.zPosition = var7;
this.yaw = var9;
this.pitch = var10;
this.onGround = var11;
this.rotating = true;
this.moving = true;
}
public void readPacketData(DataInputStream var1) throws IOException {
this.xPosition = var1.readDouble();
this.yPosition = var1.readDouble();
this.stance = var1.readDouble();
this.zPosition = var1.readDouble();
this.yaw = var1.readFloat();
this.pitch = var1.readFloat();
super.readPacketData(var1);
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeDouble(this.xPosition);
var1.writeDouble(this.yPosition);
var1.writeDouble(this.stance);
var1.writeDouble(this.zPosition);
var1.writeFloat(this.yaw);
var1.writeFloat(this.pitch);
super.writePacketData(var1);
}
public int getPacketSize() {
return 41;
}
}

View File

@ -1,48 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet14BlockDig extends Packet {
public int xPosition;
public int yPosition;
public int zPosition;
public int face;
public int status;
public Packet14BlockDig() {
}
public Packet14BlockDig(int var1, int var2, int var3, int var4, int var5) {
this.status = var1;
this.xPosition = var2;
this.yPosition = var3;
this.zPosition = var4;
this.face = var5;
}
public void readPacketData(DataInputStream var1) throws IOException {
this.status = var1.read();
this.xPosition = var1.readInt();
this.yPosition = var1.read();
this.zPosition = var1.readInt();
this.face = var1.read();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.write(this.status);
var1.writeInt(this.xPosition);
var1.write(this.yPosition);
var1.writeInt(this.zPosition);
var1.write(this.face);
}
public void processPacket(NetHandler var1) {
var1.handleBlockDig(this);
}
public int getPacketSize() {
return 11;
}
}

View File

@ -1,48 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet15Place extends Packet {
public int id;
public int xPosition;
public int yPosition;
public int zPosition;
public int direction;
public Packet15Place() {
}
public Packet15Place(int var1, int var2, int var3, int var4, int var5) {
this.id = var1;
this.xPosition = var2;
this.yPosition = var3;
this.zPosition = var4;
this.direction = var5;
}
public void readPacketData(DataInputStream var1) throws IOException {
this.id = var1.readShort();
this.xPosition = var1.readInt();
this.yPosition = var1.read();
this.zPosition = var1.readInt();
this.direction = var1.read();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeShort(this.id);
var1.writeInt(this.xPosition);
var1.write(this.yPosition);
var1.writeInt(this.zPosition);
var1.write(this.direction);
}
public void processPacket(NetHandler var1) {
var1.handlePlace(this);
}
public int getPacketSize() {
return 12;
}
}

View File

@ -1,36 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet16BlockItemSwitch extends Packet {
public int unused;
public int id;
public Packet16BlockItemSwitch() {
}
public Packet16BlockItemSwitch(int var1, int var2) {
this.unused = var1;
this.id = var2;
}
public void readPacketData(DataInputStream var1) throws IOException {
this.unused = var1.readInt();
this.id = var1.readShort();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeInt(this.unused);
var1.writeShort(this.id);
}
public void processPacket(NetHandler var1) {
var1.handleBlockItemSwitch(this);
}
public int getPacketSize() {
return 6;
}
}

View File

@ -1,31 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet17AddToInventory extends Packet {
public int id;
public int count;
public int durability;
public void readPacketData(DataInputStream var1) throws IOException {
this.id = var1.readShort();
this.count = var1.readByte();
this.durability = var1.readShort();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeShort(this.id);
var1.writeByte(this.count);
var1.writeShort(this.durability);
}
public void processPacket(NetHandler var1) {
var1.handleAddToInventory(this);
}
public int getPacketSize() {
return 5;
}
}

View File

@ -1,36 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet18ArmAnimation extends Packet {
public int entityId;
public int animate;
public Packet18ArmAnimation() {
}
public Packet18ArmAnimation(Entity var1, int var2) {
this.entityId = var1.field_620_ab;
this.animate = var2;
}
public void readPacketData(DataInputStream var1) throws IOException {
this.entityId = var1.readInt();
this.animate = var1.readByte();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeInt(this.entityId);
var1.writeByte(this.animate);
}
public void processPacket(NetHandler var1) {
var1.handleArmAnimation(this);
}
public int getPacketSize() {
return 5;
}
}

View File

@ -1,46 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet1Login extends Packet {
public int protocolVersion;
public String username;
public String password;
public long field_4074_d;
public byte field_4073_e;
public Packet1Login() {
}
public Packet1Login(String var1, String var2, int var3) {
this.username = var1;
this.password = var2;
this.protocolVersion = var3;
}
public void readPacketData(DataInputStream var1) throws IOException {
this.protocolVersion = var1.readInt();
this.username = var1.readUTF();
this.password = var1.readUTF();
this.field_4074_d = var1.readLong();
this.field_4073_e = var1.readByte();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeInt(this.protocolVersion);
var1.writeUTF(this.username);
var1.writeUTF(this.password);
var1.writeLong(this.field_4074_d);
var1.writeByte(this.field_4073_e);
}
public void processPacket(NetHandler var1) {
var1.handleLogin(this);
}
public int getPacketSize() {
return 4 + this.username.length() + this.password.length() + 4 + 5;
}
}

View File

@ -1,61 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet20NamedEntitySpawn extends Packet {
public int entityId;
public String name;
public int xPosition;
public int yPosition;
public int zPosition;
public byte rotation;
public byte pitch;
public int currentItem;
public Packet20NamedEntitySpawn() {
}
public Packet20NamedEntitySpawn(EntityPlayer var1) {
this.entityId = var1.field_620_ab;
this.name = var1.field_771_i;
this.xPosition = MathHelper.floor_double(var1.posX * 32.0D);
this.yPosition = MathHelper.floor_double(var1.posY * 32.0D);
this.zPosition = MathHelper.floor_double(var1.posZ * 32.0D);
this.rotation = (byte)((int)(var1.rotationYaw * 256.0F / 360.0F));
this.pitch = (byte)((int)(var1.rotationPitch * 256.0F / 360.0F));
ItemStack var2 = var1.inventory.getCurrentItem();
this.currentItem = var2 == null ? 0 : var2.itemID;
}
public void readPacketData(DataInputStream var1) throws IOException {
this.entityId = var1.readInt();
this.name = var1.readUTF();
this.xPosition = var1.readInt();
this.yPosition = var1.readInt();
this.zPosition = var1.readInt();
this.rotation = var1.readByte();
this.pitch = var1.readByte();
this.currentItem = var1.readShort();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeInt(this.entityId);
var1.writeUTF(this.name);
var1.writeInt(this.xPosition);
var1.writeInt(this.yPosition);
var1.writeInt(this.zPosition);
var1.writeByte(this.rotation);
var1.writeByte(this.pitch);
var1.writeShort(this.currentItem);
}
public void processPacket(NetHandler var1) {
var1.handleNamedEntitySpawn(this);
}
public int getPacketSize() {
return 28;
}
}

View File

@ -1,64 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet21PickupSpawn extends Packet {
public int entityId;
public int xPosition;
public int yPosition;
public int zPosition;
public byte rotation;
public byte pitch;
public byte roll;
public int itemId;
public int count;
public Packet21PickupSpawn() {
}
public Packet21PickupSpawn(EntityItem var1) {
this.entityId = var1.field_620_ab;
this.itemId = var1.item.itemID;
this.count = var1.item.stackSize;
this.xPosition = MathHelper.floor_double(var1.posX * 32.0D);
this.yPosition = MathHelper.floor_double(var1.posY * 32.0D);
this.zPosition = MathHelper.floor_double(var1.posZ * 32.0D);
this.rotation = (byte)((int)(var1.motionX * 128.0D));
this.pitch = (byte)((int)(var1.motionY * 128.0D));
this.roll = (byte)((int)(var1.motionZ * 128.0D));
}
public void readPacketData(DataInputStream var1) throws IOException {
this.entityId = var1.readInt();
this.itemId = var1.readShort();
this.count = var1.readByte();
this.xPosition = var1.readInt();
this.yPosition = var1.readInt();
this.zPosition = var1.readInt();
this.rotation = var1.readByte();
this.pitch = var1.readByte();
this.roll = var1.readByte();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeInt(this.entityId);
var1.writeShort(this.itemId);
var1.writeByte(this.count);
var1.writeInt(this.xPosition);
var1.writeInt(this.yPosition);
var1.writeInt(this.zPosition);
var1.writeByte(this.rotation);
var1.writeByte(this.pitch);
var1.writeByte(this.roll);
}
public void processPacket(NetHandler var1) {
var1.handlePickupSpawn(this);
}
public int getPacketSize() {
return 22;
}
}

View File

@ -1,28 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet22Collect extends Packet {
public int collectedEntityId;
public int collectorEntityId;
public void readPacketData(DataInputStream var1) throws IOException {
this.collectedEntityId = var1.readInt();
this.collectorEntityId = var1.readInt();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeInt(this.collectedEntityId);
var1.writeInt(this.collectorEntityId);
}
public void processPacket(NetHandler var1) {
var1.handleCollect(this);
}
public int getPacketSize() {
return 8;
}
}

View File

@ -1,37 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet23VehicleSpawn extends Packet {
public int entityId;
public int xPosition;
public int yPosition;
public int zPosition;
public int type;
public void readPacketData(DataInputStream var1) throws IOException {
this.entityId = var1.readInt();
this.type = var1.readByte();
this.xPosition = var1.readInt();
this.yPosition = var1.readInt();
this.zPosition = var1.readInt();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeInt(this.entityId);
var1.writeByte(this.type);
var1.writeInt(this.xPosition);
var1.writeInt(this.yPosition);
var1.writeInt(this.zPosition);
}
public void processPacket(NetHandler var1) {
var1.handleVehicleSpawn(this);
}
public int getPacketSize() {
return 17;
}
}

View File

@ -1,56 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet24MobSpawn extends Packet {
public int entityId;
public byte type;
public int xPosition;
public int yPosition;
public int zPosition;
public byte yaw;
public byte pitch;
public Packet24MobSpawn() {
}
public Packet24MobSpawn(EntityLiving var1) {
this.entityId = var1.field_620_ab;
this.type = (byte)EntityList.getEntityID(var1);
this.xPosition = MathHelper.floor_double(var1.posX * 32.0D);
this.yPosition = MathHelper.floor_double(var1.posY * 32.0D);
this.zPosition = MathHelper.floor_double(var1.posZ * 32.0D);
this.yaw = (byte)((int)(var1.rotationYaw * 256.0F / 360.0F));
this.pitch = (byte)((int)(var1.rotationPitch * 256.0F / 360.0F));
}
public void readPacketData(DataInputStream var1) throws IOException {
this.entityId = var1.readInt();
this.type = var1.readByte();
this.xPosition = var1.readInt();
this.yPosition = var1.readInt();
this.zPosition = var1.readInt();
this.yaw = var1.readByte();
this.pitch = var1.readByte();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeInt(this.entityId);
var1.writeByte(this.type);
var1.writeInt(this.xPosition);
var1.writeInt(this.yPosition);
var1.writeInt(this.zPosition);
var1.writeByte(this.yaw);
var1.writeByte(this.pitch);
}
public void processPacket(NetHandler var1) {
var1.handleMobSpawn(this);
}
public int getPacketSize() {
return 19;
}
}

View File

@ -1,32 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet255KickDisconnect extends Packet {
public String reason;
public Packet255KickDisconnect() {
}
public Packet255KickDisconnect(String var1) {
this.reason = var1;
}
public void readPacketData(DataInputStream var1) throws IOException {
this.reason = var1.readUTF();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeUTF(this.reason);
}
public void processPacket(NetHandler var1) {
var1.handleKickDisconnect(this);
}
public int getPacketSize() {
return this.reason.length();
}
}

View File

@ -1,73 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet28 extends Packet {
public int field_6367_a;
public int field_6366_b;
public int field_6369_c;
public int field_6368_d;
public Packet28() {
}
public Packet28(Entity var1) {
this(var1.field_620_ab, var1.motionX, var1.motionY, var1.motionZ);
}
public Packet28(int var1, double var2, double var4, double var6) {
this.field_6367_a = var1;
double var8 = 3.9D;
if(var2 < -var8) {
var2 = -var8;
}
if(var4 < -var8) {
var4 = -var8;
}
if(var6 < -var8) {
var6 = -var8;
}
if(var2 > var8) {
var2 = var8;
}
if(var4 > var8) {
var4 = var8;
}
if(var6 > var8) {
var6 = var8;
}
this.field_6366_b = (int)(var2 * 8000.0D);
this.field_6369_c = (int)(var4 * 8000.0D);
this.field_6368_d = (int)(var6 * 8000.0D);
}
public void readPacketData(DataInputStream var1) throws IOException {
this.field_6367_a = var1.readInt();
this.field_6366_b = var1.readShort();
this.field_6369_c = var1.readShort();
this.field_6368_d = var1.readShort();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeInt(this.field_6367_a);
var1.writeShort(this.field_6366_b);
var1.writeShort(this.field_6369_c);
var1.writeShort(this.field_6368_d);
}
public void processPacket(NetHandler var1) {
var1.func_6498_a(this);
}
public int getPacketSize() {
return 10;
}
}

View File

@ -1,25 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet29DestroyEntity extends Packet {
public int entityId;
public void readPacketData(DataInputStream var1) throws IOException {
this.entityId = var1.readInt();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeInt(this.entityId);
}
public void processPacket(NetHandler var1) {
var1.handleDestroyEntity(this);
}
public int getPacketSize() {
return 4;
}
}

View File

@ -1,32 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet2Handshake extends Packet {
public String username;
public Packet2Handshake() {
}
public Packet2Handshake(String var1) {
this.username = var1;
}
public void readPacketData(DataInputStream var1) throws IOException {
this.username = var1.readUTF();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeUTF(this.username);
}
public void processPacket(NetHandler var1) {
var1.handleHandshake(this);
}
public int getPacketSize() {
return 4 + this.username.length() + 4;
}
}

View File

@ -1,31 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet30Entity extends Packet {
public int entityId;
public byte xPosition;
public byte yPosition;
public byte zPosition;
public byte yaw;
public byte pitch;
public boolean rotating = false;
public void readPacketData(DataInputStream var1) throws IOException {
this.entityId = var1.readInt();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeInt(this.entityId);
}
public void processPacket(NetHandler var1) {
var1.handleEntity(this);
}
public int getPacketSize() {
return 4;
}
}

View File

@ -1,25 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet31RelEntityMove extends Packet30Entity {
public void readPacketData(DataInputStream var1) throws IOException {
super.readPacketData(var1);
this.xPosition = var1.readByte();
this.yPosition = var1.readByte();
this.zPosition = var1.readByte();
}
public void writePacketData(DataOutputStream var1) throws IOException {
super.writePacketData(var1);
var1.writeByte(this.xPosition);
var1.writeByte(this.yPosition);
var1.writeByte(this.zPosition);
}
public int getPacketSize() {
return 7;
}
}

View File

@ -1,27 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet32EntityLook extends Packet30Entity {
public Packet32EntityLook() {
this.rotating = true;
}
public void readPacketData(DataInputStream var1) throws IOException {
super.readPacketData(var1);
this.yaw = var1.readByte();
this.pitch = var1.readByte();
}
public void writePacketData(DataOutputStream var1) throws IOException {
super.writePacketData(var1);
var1.writeByte(this.yaw);
var1.writeByte(this.pitch);
}
public int getPacketSize() {
return 6;
}
}

View File

@ -1,33 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet33RelEntityMoveLook extends Packet30Entity {
public Packet33RelEntityMoveLook() {
this.rotating = true;
}
public void readPacketData(DataInputStream var1) throws IOException {
super.readPacketData(var1);
this.xPosition = var1.readByte();
this.yPosition = var1.readByte();
this.zPosition = var1.readByte();
this.yaw = var1.readByte();
this.pitch = var1.readByte();
}
public void writePacketData(DataOutputStream var1) throws IOException {
super.writePacketData(var1);
var1.writeByte(this.xPosition);
var1.writeByte(this.yPosition);
var1.writeByte(this.zPosition);
var1.writeByte(this.yaw);
var1.writeByte(this.pitch);
}
public int getPacketSize() {
return 9;
}
}

View File

@ -1,52 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet34EntityTeleport extends Packet {
public int entityId;
public int xPosition;
public int yPosition;
public int zPosition;
public byte yaw;
public byte pitch;
public Packet34EntityTeleport() {
}
public Packet34EntityTeleport(Entity var1) {
this.entityId = var1.field_620_ab;
this.xPosition = MathHelper.floor_double(var1.posX * 32.0D);
this.yPosition = MathHelper.floor_double(var1.posY * 32.0D);
this.zPosition = MathHelper.floor_double(var1.posZ * 32.0D);
this.yaw = (byte)((int)(var1.rotationYaw * 256.0F / 360.0F));
this.pitch = (byte)((int)(var1.rotationPitch * 256.0F / 360.0F));
}
public void readPacketData(DataInputStream var1) throws IOException {
this.entityId = var1.readInt();
this.xPosition = var1.readInt();
this.yPosition = var1.readInt();
this.zPosition = var1.readInt();
this.yaw = (byte)var1.read();
this.pitch = (byte)var1.read();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeInt(this.entityId);
var1.writeInt(this.xPosition);
var1.writeInt(this.yPosition);
var1.writeInt(this.zPosition);
var1.write(this.yaw);
var1.write(this.pitch);
}
public void processPacket(NetHandler var1) {
var1.handleEntityTeleport(this);
}
public int getPacketSize() {
return 34;
}
}

View File

@ -1,28 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet38 extends Packet {
public int field_9274_a;
public byte field_9273_b;
public void readPacketData(DataInputStream var1) throws IOException {
this.field_9274_a = var1.readInt();
this.field_9273_b = var1.readByte();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeInt(this.field_9274_a);
var1.writeByte(this.field_9273_b);
}
public void processPacket(NetHandler var1) {
var1.func_9447_a(this);
}
public int getPacketSize() {
return 5;
}
}

View File

@ -1,28 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet39 extends Packet {
public int field_6365_a;
public int field_6364_b;
public int getPacketSize() {
return 8;
}
public void readPacketData(DataInputStream var1) throws IOException {
this.field_6365_a = var1.readInt();
this.field_6364_b = var1.readInt();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeInt(this.field_6365_a);
var1.writeInt(this.field_6364_b);
}
public void processPacket(NetHandler var1) {
var1.func_6497_a(this);
}
}

View File

@ -1,32 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet3Chat extends Packet {
public String message;
public Packet3Chat() {
}
public Packet3Chat(String var1) {
this.message = var1;
}
public void readPacketData(DataInputStream var1) throws IOException {
this.message = var1.readUTF();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeUTF(this.message);
}
public void processPacket(NetHandler var1) {
var1.handleChat(this);
}
public int getPacketSize() {
return this.message.length();
}
}

View File

@ -1,25 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet4UpdateTime extends Packet {
public long time;
public void readPacketData(DataInputStream var1) throws IOException {
this.time = var1.readLong();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeLong(this.time);
}
public void processPacket(NetHandler var1) {
var1.handleUpdateTime(this);
}
public int getPacketSize() {
return 8;
}
}

View File

@ -1,31 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet50PreChunk extends Packet {
public int xPosition;
public int yPosition;
public boolean mode;
public void readPacketData(DataInputStream var1) throws IOException {
this.xPosition = var1.readInt();
this.yPosition = var1.readInt();
this.mode = var1.read() != 0;
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeInt(this.xPosition);
var1.writeInt(this.yPosition);
var1.write(this.mode ? 1 : 0);
}
public void processPacket(NetHandler var1) {
var1.handlePreChunk(this);
}
public int getPacketSize() {
return 9;
}
}

View File

@ -1,65 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.zip.DataFormatException;
import java.util.zip.Inflater;
public class Packet51MapChunk extends Packet {
public int xPosition;
public int yPosition;
public int zPosition;
public int xSize;
public int ySize;
public int zSize;
public byte[] chunk;
private int chunkSize;
public Packet51MapChunk() {
this.isChunkDataPacket = true;
}
public void readPacketData(DataInputStream var1) throws IOException {
this.xPosition = var1.readInt();
this.yPosition = var1.readShort();
this.zPosition = var1.readInt();
this.xSize = var1.read() + 1;
this.ySize = var1.read() + 1;
this.zSize = var1.read() + 1;
int var2 = var1.readInt();
byte[] var3 = new byte[var2];
var1.readFully(var3);
this.chunk = new byte[this.xSize * this.ySize * this.zSize * 5 / 2];
Inflater var4 = new Inflater();
var4.setInput(var3);
try {
var4.inflate(this.chunk);
} catch (DataFormatException var9) {
throw new IOException("Bad compressed data format");
} finally {
var4.end();
}
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeInt(this.xPosition);
var1.writeShort(this.yPosition);
var1.writeInt(this.zPosition);
var1.write(this.xSize - 1);
var1.write(this.ySize - 1);
var1.write(this.zSize - 1);
var1.writeInt(this.chunkSize);
var1.write(this.chunk, 0, this.chunkSize);
}
public void processPacket(NetHandler var1) {
var1.handleMapChunk(this);
}
public int getPacketSize() {
return 17 + this.chunkSize;
}
}

View File

@ -1,55 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet52MultiBlockChange extends Packet {
public int xPosition;
public int zPosition;
public short[] coordinateArray;
public byte[] typeArray;
public byte[] metadataArray;
public int size;
public Packet52MultiBlockChange() {
this.isChunkDataPacket = true;
}
public void readPacketData(DataInputStream var1) throws IOException {
this.xPosition = var1.readInt();
this.zPosition = var1.readInt();
this.size = var1.readShort() & '\uffff';
this.coordinateArray = new short[this.size];
this.typeArray = new byte[this.size];
this.metadataArray = new byte[this.size];
for(int var2 = 0; var2 < this.size; ++var2) {
this.coordinateArray[var2] = var1.readShort();
}
var1.readFully(this.typeArray);
var1.readFully(this.metadataArray);
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeInt(this.xPosition);
var1.writeInt(this.zPosition);
var1.writeShort((short)this.size);
for(int var2 = 0; var2 < this.size; ++var2) {
var1.writeShort(this.coordinateArray[var2]);
}
var1.write(this.typeArray);
var1.write(this.metadataArray);
}
public void processPacket(NetHandler var1) {
var1.handleMultiBlockChange(this);
}
public int getPacketSize() {
return 10 + this.size * 4;
}
}

View File

@ -1,41 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet53BlockChange extends Packet {
public int xPosition;
public int yPosition;
public int zPosition;
public int type;
public int metadata;
public Packet53BlockChange() {
this.isChunkDataPacket = true;
}
public void readPacketData(DataInputStream var1) throws IOException {
this.xPosition = var1.readInt();
this.yPosition = var1.read();
this.zPosition = var1.readInt();
this.type = var1.read();
this.metadata = var1.read();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeInt(this.xPosition);
var1.write(this.yPosition);
var1.writeInt(this.zPosition);
var1.write(this.type);
var1.write(this.metadata);
}
public void processPacket(NetHandler var1) {
var1.handleBlockChange(this);
}
public int getPacketSize() {
return 11;
}
}

View File

@ -1,59 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet59ComplexEntity extends Packet {
public int xPosition;
public int yPosition;
public int zPosition;
public byte[] entityData;
public NBTTagCompound entityNBT;
public Packet59ComplexEntity() {
this.isChunkDataPacket = true;
}
public Packet59ComplexEntity(int var1, int var2, int var3, TileEntity var4) {
this.isChunkDataPacket = true;
this.xPosition = var1;
this.yPosition = var2;
this.zPosition = var3;
this.entityNBT = new NBTTagCompound();
var4.writeToNBT(this.entityNBT);
try {
this.entityData = CompressedStreamTools.func_1142_a(this.entityNBT);
} catch (IOException var6) {
var6.printStackTrace();
}
}
public void readPacketData(DataInputStream var1) throws IOException {
this.xPosition = var1.readInt();
this.yPosition = var1.readShort();
this.zPosition = var1.readInt();
int var2 = var1.readShort() & '\uffff';
this.entityData = new byte[var2];
var1.readFully(this.entityData);
this.entityNBT = CompressedStreamTools.func_1140_a(this.entityData);
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeInt(this.xPosition);
var1.writeShort(this.yPosition);
var1.writeInt(this.zPosition);
var1.writeShort((short)this.entityData.length);
var1.write(this.entityData);
}
public void processPacket(NetHandler var1) {
var1.handleComplexEntity(this);
}
public int getPacketSize() {
return this.entityData.length + 2 + 10;
}
}

View File

@ -1,63 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet5PlayerInventory extends Packet {
public int type;
public ItemStack[] stacks;
public Packet5PlayerInventory() {
}
public Packet5PlayerInventory(int var1, ItemStack[] var2) {
this.type = var1;
this.stacks = new ItemStack[var2.length];
for(int var3 = 0; var3 < this.stacks.length; ++var3) {
this.stacks[var3] = var2[var3] == null ? null : var2[var3].copy();
}
}
public void readPacketData(DataInputStream var1) throws IOException {
this.type = var1.readInt();
short var2 = var1.readShort();
this.stacks = new ItemStack[var2];
for(int var3 = 0; var3 < var2; ++var3) {
short var4 = var1.readShort();
if(var4 >= 0) {
byte var5 = var1.readByte();
short var6 = var1.readShort();
this.stacks[var3] = new ItemStack(var4, var5, var6);
}
}
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeInt(this.type);
var1.writeShort(this.stacks.length);
for(int var2 = 0; var2 < this.stacks.length; ++var2) {
if(this.stacks[var2] == null) {
var1.writeShort(-1);
} else {
var1.writeShort((short)this.stacks[var2].itemID);
var1.writeByte((byte)this.stacks[var2].stackSize);
var1.writeShort((short)this.stacks[var2].itemDamage);
}
}
}
public void processPacket(NetHandler var1) {
var1.handlePlayerInventory(this);
}
public int getPacketSize() {
return 6 + this.stacks.length * 5;
}
}

View File

@ -1,67 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
public class Packet60 extends Packet {
public double field_12236_a;
public double field_12235_b;
public double field_12239_c;
public float field_12238_d;
public Set field_12237_e;
public void readPacketData(DataInputStream var1) throws IOException {
this.field_12236_a = var1.readDouble();
this.field_12235_b = var1.readDouble();
this.field_12239_c = var1.readDouble();
this.field_12238_d = var1.readFloat();
int var2 = var1.readInt();
this.field_12237_e = new HashSet();
int var3 = (int)this.field_12236_a;
int var4 = (int)this.field_12235_b;
int var5 = (int)this.field_12239_c;
for(int var6 = 0; var6 < var2; ++var6) {
int var7 = var1.readByte() + var3;
int var8 = var1.readByte() + var4;
int var9 = var1.readByte() + var5;
this.field_12237_e.add(new ChunkPosition(var7, var8, var9));
}
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeDouble(this.field_12236_a);
var1.writeDouble(this.field_12235_b);
var1.writeDouble(this.field_12239_c);
var1.writeFloat(this.field_12238_d);
var1.writeInt(this.field_12237_e.size());
int var2 = (int)this.field_12236_a;
int var3 = (int)this.field_12235_b;
int var4 = (int)this.field_12239_c;
Iterator var5 = this.field_12237_e.iterator();
while(var5.hasNext()) {
ChunkPosition var6 = (ChunkPosition)var5.next();
int var7 = var6.x - var2;
int var8 = var6.y - var3;
int var9 = var6.z - var4;
var1.writeByte(var7);
var1.writeByte(var8);
var1.writeByte(var9);
}
}
public void processPacket(NetHandler var1) {
var1.func_12245_a(this);
}
public int getPacketSize() {
return 32 + this.field_12237_e.size() * 3;
}
}

View File

@ -1,31 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet6SpawnPosition extends Packet {
public int xPosition;
public int yPosition;
public int zPosition;
public void readPacketData(DataInputStream var1) throws IOException {
this.xPosition = var1.readInt();
this.yPosition = var1.readInt();
this.zPosition = var1.readInt();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeInt(this.xPosition);
var1.writeInt(this.yPosition);
var1.writeInt(this.zPosition);
}
public void processPacket(NetHandler var1) {
var1.handleSpawnPosition(this);
}
public int getPacketSize() {
return 12;
}
}

View File

@ -1,40 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet7 extends Packet {
public int field_9277_a;
public int field_9276_b;
public int field_9278_c;
public Packet7() {
}
public Packet7(int var1, int var2, int var3) {
this.field_9277_a = var1;
this.field_9276_b = var2;
this.field_9278_c = var3;
}
public void readPacketData(DataInputStream var1) throws IOException {
this.field_9277_a = var1.readInt();
this.field_9276_b = var1.readInt();
this.field_9278_c = var1.readByte();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeInt(this.field_9277_a);
var1.writeInt(this.field_9276_b);
var1.writeByte(this.field_9278_c);
}
public void processPacket(NetHandler var1) {
var1.func_6499_a(this);
}
public int getPacketSize() {
return 9;
}
}

View File

@ -1,25 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet8 extends Packet {
public int healthMP;
public void readPacketData(DataInputStream var1) throws IOException {
this.healthMP = var1.readByte();
}
public void writePacketData(DataOutputStream var1) throws IOException {
var1.writeByte(this.healthMP);
}
public void processPacket(NetHandler var1) {
var1.handleHealth(this);
}
public int getPacketSize() {
return 1;
}
}

View File

@ -1,20 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
public class Packet9 extends Packet {
public void processPacket(NetHandler var1) {
var1.func_9448_a(this);
}
public void readPacketData(DataInputStream var1) {
}
public void writePacketData(DataOutputStream var1) {
}
public int getPacketSize() {
return 0;
}
}

Some files were not shown because too many files have changed in this diff Show More