Compare commits

...

10 Commits

Author SHA1 Message Date
PeytonPlayz595
c3faf49aab Change port and handle non-blocking I/O 2023-12-19 14:28:34 -05:00
PeytonPlayz595
87652bc6b5 Another crash 😭 2023-12-19 12:47:26 -05:00
PeytonPlayz595
f5a560d102 😭 2023-12-19 12:39:30 -05:00
PeytonPlayz595
d1542af8b9 Cleanup some code 2023-12-19 11:10:46 -05:00
PeytonPlayz595
587c3e329f Gay crash 2023-12-18 18:22:40 -05:00
PeytonPlayz595
154a55e961 oops 2023-12-18 17:25:59 -05:00
PeytonPlayz595
ad73cda941 Unused socket code 2023-12-18 14:10:12 -05:00
PeytonPlayz595
8eb92b2c47 WebSockets 2023-12-18 13:50:13 -05:00
PeytonPlayz595
8a34075f2c Fix errors 2023-12-18 10:43:23 -05:00
PeytonPlayz595
3c3a039fa2 Upload server src 2023-12-18 10:40:47 -05:00
63 changed files with 6145 additions and 0 deletions

BIN
minecraft-server.jar Normal file

Binary file not shown.

3
src/META-INF/MANIFEST.MF Normal file
View File

@ -0,0 +1,3 @@
Manifest-Version: 1.0
Created-By: 1.6.0_17 (Sun Microsystems Inc.)

View File

@ -0,0 +1,56 @@
package com.mojang.minecraft;
import com.mojang.minecraft.level.tile.a;
import java.util.ArrayList;
import java.util.List;
public final class AvailableBlockType {
public static List blocks;
static {
(blocks = new ArrayList()).add(a.e);
blocks.add(a.h);
blocks.add(a.W);
blocks.add(a.g);
blocks.add(a.i);
blocks.add(a.u);
blocks.add(a.v);
blocks.add(a.x);
blocks.add(a.V);
blocks.add(a.Z);
blocks.add(a.j);
blocks.add(a.O);
blocks.add(a.P);
blocks.add(a.Q);
blocks.add(a.R);
blocks.add(a.p);
blocks.add(a.q);
blocks.add(a.w);
blocks.add(a.y);
blocks.add(a.z);
blocks.add(a.A);
blocks.add(a.B);
blocks.add(a.C);
blocks.add(a.D);
blocks.add(a.E);
blocks.add(a.F);
blocks.add(a.G);
blocks.add(a.H);
blocks.add(a.I);
blocks.add(a.J);
blocks.add(a.K);
blocks.add(a.L);
blocks.add(a.M);
blocks.add(a.N);
blocks.add(a.t);
blocks.add(a.s);
blocks.add(a.r);
blocks.add(a.T);
blocks.add(a.S);
blocks.add(a.Y);
blocks.add(a.X);
blocks.add(a.aa);
}
}

View File

@ -0,0 +1,467 @@
package com.mojang.minecraft;
import com.mojang.minecraft.level.BlockMap;
import com.mojang.minecraft.level.Level;
import com.mojang.minecraft.level.liquid.LiquidType;
import com.mojang.minecraft.level.tile.Tile$SoundType;
import com.mojang.minecraft.level.tile.a;
import com.mojang.minecraft.model.Vector3D;
import com.mojang.minecraft.net.UNKNOWN0;
import com.mojang.minecraft.phys.AABB;
import com.mojang.util.MathHelper;
import java.io.Serializable;
import java.util.ArrayList;
public abstract class Entity implements Serializable {
public static final long serialVersionUID = 0L;
protected Level level;
public float xo;
public float yo;
public float zo;
public float x;
public float y;
public float z;
public float xd;
public float yd;
public float zd;
public float yRot;
public float xRot;
public float yRotO;
public float xRotO;
public AABB bb;
public boolean onGround = false;
public boolean horizontalCollision = false;
public boolean collision = false;
public boolean slide = true;
public boolean removed = false;
public float heightOffset = 0.0F;
public float bbWidth = 0.6F;
public float bbHeight = 1.8F;
public float walkDistO = 0.0F;
public float walkDist = 0.0F;
protected boolean makeStepSound = true;
protected float fallDistance = 0.0F;
private int nextStep = 1;
public BlockMap blockMap;
public float xOld;
public float yOld;
public float zOld;
public int textureId = 0;
public float ySlideOffset = 0.0F;
public float footSize = 0.0F;
public boolean noPhysics = false;
public float pushthrough = 0.0F;
public boolean hovered = false;
public Entity(Level var1) {
this.level = var1;
this.setPos(0.0F, 0.0F, 0.0F);
}
protected void resetPos() {
if(this.level != null) {
float var1 = (float)this.level.xSpawn + 0.5F;
float var2 = (float)this.level.ySpawn;
for(float var3 = (float)this.level.zSpawn + 0.5F; var2 > 0.0F; ++var2) {
this.setPos(var1, var2, var3);
if(this.level.getCubes(this.bb).size() == 0) {
break;
}
}
this.xd = this.yd = this.zd = 0.0F;
this.yRot = this.level.rotSpawn;
this.xRot = 0.0F;
}
}
public void remove() {
this.removed = true;
}
protected void setSize(float var1, float var2) {
this.bbWidth = var1;
this.bbHeight = var2;
}
protected void setPos(UNKNOWN0 var1) {
this.setPos(this.x, this.y, this.z);
this.setRot(this.yRot, this.xRot);
}
protected void setRot(float var1, float var2) {
this.yRot = var1;
this.xRot = var2;
}
protected void setPos(float var1, float var2, float var3) {
this.x = var1;
this.y = var2;
this.z = var3;
float var4 = this.bbWidth / 2.0F;
float var5 = this.bbHeight / 2.0F;
this.bb = new AABB(var1 - var4, var2 - var5, var3 - var4, var1 + var4, var2 + var5, var3 + var4);
}
public void turn(float var1, float var2) {
float var3 = this.xRot;
float var4 = this.yRot;
this.yRot = (float)((double)this.yRot + (double)var1 * 0.15D);
this.xRot = (float)((double)this.xRot - (double)var2 * 0.15D);
if(this.xRot < -90.0F) {
this.xRot = -90.0F;
}
if(this.xRot > 90.0F) {
this.xRot = 90.0F;
}
this.xRotO += this.xRot - var3;
this.yRotO += this.yRot - var4;
}
public void interpolateTurn(float var1, float var2) {
this.yRot = (float)((double)this.yRot + (double)var1 * 0.15D);
this.xRot = (float)((double)this.xRot - (double)var2 * 0.15D);
if(this.xRot < -90.0F) {
this.xRot = -90.0F;
}
if(this.xRot > 90.0F) {
this.xRot = 90.0F;
}
}
public void tick() {
this.walkDistO = this.walkDist;
this.xo = this.x;
this.yo = this.y;
this.zo = this.z;
this.xRotO = this.xRot;
this.yRotO = this.yRot;
}
public boolean isFree(float var1, float var2, float var3, float var4) {
AABB var5 = this.bb.grow(var4, var4, var4).cloneMove(var1, var2, var3);
return this.level.getCubes(var5).size() > 0?false:!this.level.containsAnyLiquid(var5);
}
public boolean isFree(float var1, float var2, float var3) {
AABB var4 = this.bb.cloneMove(var1, var2, var3);
return this.level.getCubes(var4).size() > 0?false:!this.level.containsAnyLiquid(var4);
}
public void move(float var1, float var2, float var3) {
if(this.noPhysics) {
this.bb.move(var1, var2, var3);
this.x = (this.bb.x0 + this.bb.x1) / 2.0F;
this.y = this.bb.y0 + this.heightOffset - this.ySlideOffset;
this.z = (this.bb.z0 + this.bb.z1) / 2.0F;
} else {
float var4 = this.x;
float var5 = this.z;
float var6 = var1;
float var7 = var2;
float var8 = var3;
AABB var9 = this.bb.copy();
ArrayList var10 = this.level.getCubes(this.bb.expand(var1, var2, var3));
for(int var11 = 0; var11 < var10.size(); ++var11) {
var2 = ((AABB)var10.get(var11)).clipYCollide(this.bb, var2);
}
this.bb.move(0.0F, var2, 0.0F);
if(!this.slide && var7 != var2) {
var3 = 0.0F;
var2 = 0.0F;
var1 = 0.0F;
}
boolean var16 = this.onGround || var7 != var2 && var7 < 0.0F;
int var12;
for(var12 = 0; var12 < var10.size(); ++var12) {
var1 = ((AABB)var10.get(var12)).clipXCollide(this.bb, var1);
}
this.bb.move(var1, 0.0F, 0.0F);
if(!this.slide && var6 != var1) {
var3 = 0.0F;
var2 = 0.0F;
var1 = 0.0F;
}
for(var12 = 0; var12 < var10.size(); ++var12) {
var3 = ((AABB)var10.get(var12)).clipZCollide(this.bb, var3);
}
this.bb.move(0.0F, 0.0F, var3);
if(!this.slide && var8 != var3) {
var3 = 0.0F;
var2 = 0.0F;
var1 = 0.0F;
}
float var17;
float var18;
if(this.footSize > 0.0F && var16 && this.ySlideOffset < 0.05F && (var6 != var1 || var8 != var3)) {
var18 = var1;
var17 = var2;
float var13 = var3;
var1 = var6;
var2 = this.footSize;
var3 = var8;
AABB var14 = this.bb.copy();
this.bb = var9.copy();
var10 = this.level.getCubes(this.bb.expand(var6, var2, var8));
int var15;
for(var15 = 0; var15 < var10.size(); ++var15) {
var2 = ((AABB)var10.get(var15)).clipYCollide(this.bb, var2);
}
this.bb.move(0.0F, var2, 0.0F);
if(!this.slide && var7 != var2) {
var3 = 0.0F;
var2 = 0.0F;
var1 = 0.0F;
}
for(var15 = 0; var15 < var10.size(); ++var15) {
var1 = ((AABB)var10.get(var15)).clipXCollide(this.bb, var1);
}
this.bb.move(var1, 0.0F, 0.0F);
if(!this.slide && var6 != var1) {
var3 = 0.0F;
var2 = 0.0F;
var1 = 0.0F;
}
for(var15 = 0; var15 < var10.size(); ++var15) {
var3 = ((AABB)var10.get(var15)).clipZCollide(this.bb, var3);
}
this.bb.move(0.0F, 0.0F, var3);
if(!this.slide && var8 != var3) {
var3 = 0.0F;
var2 = 0.0F;
var1 = 0.0F;
}
if(var18 * var18 + var13 * var13 >= var1 * var1 + var3 * var3) {
var1 = var18;
var2 = var17;
var3 = var13;
this.bb = var14.copy();
} else {
this.ySlideOffset = (float)((double)this.ySlideOffset + 0.5D);
}
}
this.horizontalCollision = var6 != var1 || var8 != var3;
this.onGround = var7 != var2 && var7 < 0.0F;
this.collision = this.horizontalCollision || var7 != var2;
if(this.onGround) {
if(this.fallDistance > 0.0F) {
this.causeFallDamage(this.fallDistance);
this.fallDistance = 0.0F;
}
} else if(var2 < 0.0F) {
this.fallDistance -= var2;
}
if(var6 != var1) {
this.xd = 0.0F;
}
if(var7 != var2) {
this.yd = 0.0F;
}
if(var8 != var3) {
this.zd = 0.0F;
}
this.x = (this.bb.x0 + this.bb.x1) / 2.0F;
this.y = this.bb.y0 + this.heightOffset - this.ySlideOffset;
this.z = (this.bb.z0 + this.bb.z1) / 2.0F;
var18 = this.x - var4;
var17 = this.z - var5;
this.walkDist = (float)((double)this.walkDist + (double)MathHelper.sqrt(var18 * var18 + var17 * var17) * 0.6D);
if(this.makeStepSound) {
int var19 = this.level.getTile((int)this.x, (int)(this.y - 0.2F - this.heightOffset), (int)this.z);
if(this.walkDist > (float)this.nextStep && var19 > 0) {
++this.nextStep;
Tile$SoundType var20;
if((var20 = a.b[var19].ac) != Tile$SoundType.none) {
this.playSound("step." + var20.name, var20.getVolume() * 0.75F, var20.getPitch());
}
}
}
this.ySlideOffset *= 0.4F;
}
}
protected void causeFallDamage(float var1) {}
public boolean isInWater() {
return this.level.containsLiquid(this.bb.grow(0.0F, -0.4F, 0.0F), LiquidType.WATER);
}
public boolean isUnderWater() {
int var1;
return (var1 = this.level.getTile((int)this.x, (int)(this.y + 0.12F), (int)this.z)) != 0?a.b[var1].d().equals(LiquidType.WATER):false;
}
public boolean isInLava() {
return this.level.containsLiquid(this.bb.grow(0.0F, -0.4F, 0.0F), LiquidType.LAVA);
}
public void moveRelative(float var1, float var2, float var3) {
float var4;
if((var4 = MathHelper.sqrt(var1 * var1 + var2 * var2)) >= 0.01F) {
if(var4 < 1.0F) {
var4 = 1.0F;
}
var4 = var3 / var4;
var1 *= var4;
var2 *= var4;
var3 = MathHelper.sin(this.yRot * 3.1415927F / 180.0F);
var4 = MathHelper.cos(this.yRot * 3.1415927F / 180.0F);
this.xd += var1 * var4 - var2 * var3;
this.zd += var2 * var4 + var1 * var3;
}
}
public boolean isLit() {
int var1 = (int)this.x;
int var2 = (int)this.y;
int var3 = (int)this.z;
return this.level.isLit(var1, var2, var3);
}
public float getBrightness(float var1) {
int var4 = (int)this.x;
int var2 = (int)(this.y + this.heightOffset / 2.0F - 0.5F);
int var3 = (int)this.z;
return this.level.getBrightness(var4, var2, var3);
}
public void render(com.mojang.minecraft.render.UNKNOWN0 var1, float var2) {}
public void setLevel(Level var1) {
this.level = var1;
}
public void playSound(String var1, float var2, float var3) {
this.level.playSound(var1, this, var2, var3);
}
public void moveTo(float var1, float var2, float var3, float var4, float var5) {
this.xo = this.x = var1;
this.yo = this.y = var2;
this.zo = this.z = var3;
this.yRot = var4;
this.xRot = var5;
this.setPos(var1, var2, var3);
}
public float distanceTo(Entity var1) {
float var2 = this.x - var1.x;
float var3 = this.y - var1.y;
float var4 = this.z - var1.z;
return MathHelper.sqrt(var2 * var2 + var3 * var3 + var4 * var4);
}
public float distanceTo(float var1, float var2, float var3) {
var1 = this.x - var1;
var2 = this.y - var2;
float var4 = this.z - var3;
return MathHelper.sqrt(var1 * var1 + var2 * var2 + var4 * var4);
}
public float distanceToSqr(Entity var1) {
float var2 = this.x - var1.x;
float var3 = this.y - var1.y;
float var4 = this.z - var1.z;
return var2 * var2 + var3 * var3 + var4 * var4;
}
public void playerTouch(Entity var1) {}
public void push(Entity var1) {
float var2 = var1.x - this.x;
float var3 = var1.z - this.z;
float var4;
if((var4 = var2 * var2 + var3 * var3) >= 0.01F) {
var4 = MathHelper.sqrt(var4);
var2 /= var4;
var3 /= var4;
var2 /= var4;
var3 /= var4;
var2 *= 0.05F;
var3 *= 0.05F;
var2 *= 1.0F - this.pushthrough;
var3 *= 1.0F - this.pushthrough;
this.push(-var2, 0.0F, -var3);
var1.push(var2, 0.0F, var3);
}
}
protected void push(float var1, float var2, float var3) {
this.xd += var1;
this.yd += var2;
this.zd += var3;
}
public void hurt(Entity var1, int var2) {}
public boolean intersects(float var1, float var2, float var3, float var4, float var5, float var6) {
return this.bb.intersects(var1, var2, var3, var4, var5, var6);
}
public boolean isPickable() {
return false;
}
public boolean isPushable() {
return false;
}
public boolean isShootable() {
return false;
}
public void awardKillScore(Entity var1, int var2) {}
public boolean shouldRender(Vector3D var1) {
float var2 = this.x - var1.x;
float var3 = this.y - var1.y;
float var4 = this.z - var1.z;
var4 = var2 * var2 + var3 * var3 + var4 * var4;
return this.shouldRenderAtSqrDistance(var4);
}
public boolean shouldRenderAtSqrDistance(float var1) {
float var2 = this.bb.getSize() * 64.0F;
return var1 < var2 * var2;
}
public int getTexture() {
return this.textureId;
}
public boolean isCreativeModeAllowed() {
return false;
}
public void renderHover(com.mojang.minecraft.render.UNKNOWN0 var1, float var2) {}
}

View File

@ -0,0 +1,5 @@
package com.mojang.minecraft.UNKNOWN0;
public interface UNKNOWN0 {
}

View File

@ -0,0 +1,10 @@
package com.mojang.minecraft;
import com.mojang.minecraft.model.Vector3D;
public final class Vector3DCreator {
public Vector3DCreator(int var1, int var2, int var3, int var4, Vector3D var5) {
new Vector3D(var5.x, var5.y, var5.z);
}
}

View File

@ -0,0 +1,86 @@
package com.mojang.minecraft.level;
import com.mojang.minecraft.Entity;
import com.mojang.minecraft.level.BlockMap;
import com.mojang.minecraft.level.UNKNOWN1;
import java.io.Serializable;
class BlockMap$Slot implements Serializable {
public static final long serialVersionUID = 0L;
private int xSlot;
private int ySlot;
private int zSlot;
// $FF: synthetic field
final BlockMap this$0;
private BlockMap$Slot(BlockMap var1) {
this.this$0 = var1;
}
public BlockMap$Slot init(float var1, float var2, float var3) {
this.xSlot = (int)(var1 / 16.0F);
this.ySlot = (int)(var2 / 16.0F);
this.zSlot = (int)(var3 / 16.0F);
if(this.xSlot < 0) {
this.xSlot = 0;
}
if(this.ySlot < 0) {
this.ySlot = 0;
}
if(this.zSlot < 0) {
this.zSlot = 0;
}
if(this.xSlot >= BlockMap.access$000(this.this$0)) {
this.xSlot = BlockMap.access$000(this.this$0) - 1;
}
if(this.ySlot >= BlockMap.access$100(this.this$0)) {
this.ySlot = BlockMap.access$100(this.this$0) - 1;
}
if(this.zSlot >= BlockMap.access$200(this.this$0)) {
this.zSlot = BlockMap.access$200(this.this$0) - 1;
}
return this;
}
public void add(Entity var1) {
if(this.xSlot >= 0 && this.ySlot >= 0 && this.zSlot >= 0) {
this.this$0.entityGrid[(this.zSlot * BlockMap.access$100(this.this$0) + this.ySlot) * BlockMap.access$000(this.this$0) + this.xSlot].add(var1);
}
}
public void remove(Entity var1) {
if(this.xSlot >= 0 && this.ySlot >= 0 && this.zSlot >= 0) {
this.this$0.entityGrid[(this.zSlot * BlockMap.access$100(this.this$0) + this.ySlot) * BlockMap.access$000(this.this$0) + this.xSlot].remove(var1);
}
}
// $FF: synthetic method
BlockMap$Slot(BlockMap var1, UNKNOWN1 var2) {
this(var1);
}
// $FF: synthetic method
static int access$400(BlockMap$Slot var0) {
return var0.xSlot;
}
// $FF: synthetic method
static int access$500(BlockMap$Slot var0) {
return var0.ySlot;
}
// $FF: synthetic method
static int access$600(BlockMap$Slot var0) {
return var0.zSlot;
}
}

View File

@ -0,0 +1,279 @@
package com.mojang.minecraft.level;
import com.mojang.minecraft.Entity;
import com.mojang.minecraft.level.BlockMap$Slot;
import com.mojang.minecraft.level.UNKNOWN1;
import com.mojang.minecraft.model.Vector3D;
import com.mojang.minecraft.phys.AABB;
import com.mojang.minecraft.render.Frustrum;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class BlockMap implements Serializable {
public static final long serialVersionUID = 0L;
private int width;
private int depth;
private int height;
private BlockMap$Slot slot = new BlockMap$Slot(this, (UNKNOWN1)null);
private BlockMap$Slot slot2 = new BlockMap$Slot(this, (UNKNOWN1)null);
public List[] entityGrid;
public List all = new ArrayList();
private List tmp = new ArrayList();
public BlockMap(int var1, int var2, int var3) {
this.width = var1 / 16;
this.depth = var2 / 16;
this.height = var3 / 16;
if(this.width == 0) {
this.width = 1;
}
if(this.depth == 0) {
this.depth = 1;
}
if(this.height == 0) {
this.height = 1;
}
this.entityGrid = new ArrayList[this.width * this.depth * this.height];
for(var1 = 0; var1 < this.width; ++var1) {
for(var2 = 0; var2 < this.depth; ++var2) {
for(var3 = 0; var3 < this.height; ++var3) {
this.entityGrid[(var3 * this.depth + var2) * this.width + var1] = new ArrayList();
}
}
}
}
public void insert(Entity var1) {
this.all.add(var1);
this.slot.init(var1.x, var1.y, var1.z).add(var1);
var1.xOld = var1.x;
var1.yOld = var1.y;
var1.zOld = var1.z;
var1.blockMap = this;
}
public void remove(Entity var1) {
this.slot.init(var1.xOld, var1.yOld, var1.zOld).remove(var1);
this.all.remove(var1);
}
public void moved(Entity var1) {
BlockMap$Slot var2 = this.slot.init(var1.xOld, var1.yOld, var1.zOld);
BlockMap$Slot var3 = this.slot2.init(var1.x, var1.y, var1.z);
if(!var2.equals(var3)) {
var2.remove(var1);
var3.add(var1);
var1.xOld = var1.x;
var1.yOld = var1.y;
var1.zOld = var1.z;
}
}
public List getEntities(Entity var1, float var2, float var3, float var4, float var5, float var6, float var7) {
this.tmp.clear();
return this.getEntities(var1, var2, var3, var4, var5, var6, var7, this.tmp);
}
public List getEntities(Entity var1, float var2, float var3, float var4, float var5, float var6, float var7, List var8) {
BlockMap$Slot var9 = this.slot.init(var2, var3, var4);
BlockMap$Slot var10 = this.slot2.init(var5, var6, var7);
for(int var11 = BlockMap$Slot.access$400(var9) - 1; var11 <= BlockMap$Slot.access$400(var10) + 1; ++var11) {
for(int var12 = BlockMap$Slot.access$500(var9) - 1; var12 <= BlockMap$Slot.access$500(var10) + 1; ++var12) {
for(int var13 = BlockMap$Slot.access$600(var9) - 1; var13 <= BlockMap$Slot.access$600(var10) + 1; ++var13) {
if(var11 >= 0 && var12 >= 0 && var13 >= 0 && var11 < this.width && var12 < this.depth && var13 < this.height) {
List var14 = this.entityGrid[(var13 * this.depth + var12) * this.width + var11];
for(int var15 = 0; var15 < var14.size(); ++var15) {
Entity var16;
if((var16 = (Entity)var14.get(var15)) != var1 && var16.intersects(var2, var3, var4, var5, var6, var7)) {
var8.add(var16);
}
}
}
}
}
}
return var8;
}
public void removeAllNonCreativeModeEntities() {
for(int var1 = 0; var1 < this.width; ++var1) {
for(int var2 = 0; var2 < this.depth; ++var2) {
for(int var3 = 0; var3 < this.height; ++var3) {
List var4 = this.entityGrid[(var3 * this.depth + var2) * this.width + var1];
for(int var5 = 0; var5 < var4.size(); ++var5) {
if(!((Entity)var4.get(var5)).isCreativeModeAllowed()) {
var4.remove(var5--);
}
}
}
}
}
}
public void clear() {
for(int var1 = 0; var1 < this.width; ++var1) {
for(int var2 = 0; var2 < this.depth; ++var2) {
for(int var3 = 0; var3 < this.height; ++var3) {
this.entityGrid[(var3 * this.depth + var2) * this.width + var1].clear();
}
}
}
}
public List getEntities(Entity var1, AABB var2) {
this.tmp.clear();
return this.getEntities(var1, var2.x0, var2.y0, var2.z0, var2.x1, var2.y1, var2.z1, this.tmp);
}
public List getEntities(Entity var1, AABB var2, List var3) {
return this.getEntities(var1, var2.x0, var2.y0, var2.z0, var2.x1, var2.y1, var2.z1, var3);
}
public void tickAll() {
for(int var1 = 0; var1 < this.all.size(); ++var1) {
Entity var2;
(var2 = (Entity)this.all.get(var1)).tick();
if(var2.removed) {
this.all.remove(var1--);
this.slot.init(var2.xOld, var2.yOld, var2.zOld).remove(var2);
} else {
int var3 = (int)(var2.xOld / 16.0F);
int var4 = (int)(var2.yOld / 16.0F);
int var5 = (int)(var2.zOld / 16.0F);
int var6 = (int)(var2.x / 16.0F);
int var7 = (int)(var2.y / 16.0F);
int var8 = (int)(var2.z / 16.0F);
if(var3 != var6 || var4 != var7 || var5 != var8) {
this.moved(var2);
}
}
}
}
public void render(Vector3D var1, Frustrum var2, com.mojang.minecraft.render.UNKNOWN0 var3, float var4) {
for(int var5 = 0; var5 < this.width; ++var5) {
float var6 = (float)((var5 << 4) - 2);
float var7 = (float)((var5 + 1 << 4) + 2);
for(int var8 = 0; var8 < this.depth; ++var8) {
float var9 = (float)((var8 << 4) - 2);
float var10 = (float)((var8 + 1 << 4) + 2);
for(int var11 = 0; var11 < this.height; ++var11) {
List var12;
if((var12 = this.entityGrid[(var11 * this.depth + var8) * this.width + var5]).size() != 0) {
float var13 = (float)((var11 << 4) - 2);
float var14 = (float)((var11 + 1 << 4) + 2);
if(var2.isBoxInFrustrum(var6, var9, var13, var7, var10, var14)) {
float var16 = var14;
float var17 = var10;
float var15 = var7;
var14 = var13;
var13 = var9;
float var18 = var6;
Frustrum var19 = var2;
int var20 = 0;
boolean var10000;
while(true) {
if(var20 >= 6) {
var10000 = true;
break;
}
if(var19.frustrum[var20][0] * var18 + var19.frustrum[var20][1] * var13 + var19.frustrum[var20][2] * var14 + var19.frustrum[var20][3] <= 0.0F) {
var10000 = false;
break;
}
if(var19.frustrum[var20][0] * var15 + var19.frustrum[var20][1] * var13 + var19.frustrum[var20][2] * var14 + var19.frustrum[var20][3] <= 0.0F) {
var10000 = false;
break;
}
if(var19.frustrum[var20][0] * var18 + var19.frustrum[var20][1] * var17 + var19.frustrum[var20][2] * var14 + var19.frustrum[var20][3] <= 0.0F) {
var10000 = false;
break;
}
if(var19.frustrum[var20][0] * var15 + var19.frustrum[var20][1] * var17 + var19.frustrum[var20][2] * var14 + var19.frustrum[var20][3] <= 0.0F) {
var10000 = false;
break;
}
if(var19.frustrum[var20][0] * var18 + var19.frustrum[var20][1] * var13 + var19.frustrum[var20][2] * var16 + var19.frustrum[var20][3] <= 0.0F) {
var10000 = false;
break;
}
if(var19.frustrum[var20][0] * var15 + var19.frustrum[var20][1] * var13 + var19.frustrum[var20][2] * var16 + var19.frustrum[var20][3] <= 0.0F) {
var10000 = false;
break;
}
if(var19.frustrum[var20][0] * var18 + var19.frustrum[var20][1] * var17 + var19.frustrum[var20][2] * var16 + var19.frustrum[var20][3] <= 0.0F) {
var10000 = false;
break;
}
if(var19.frustrum[var20][0] * var15 + var19.frustrum[var20][1] * var17 + var19.frustrum[var20][2] * var16 + var19.frustrum[var20][3] <= 0.0F) {
var10000 = false;
break;
}
++var20;
}
boolean var21 = var10000;
for(int var23 = 0; var23 < var12.size(); ++var23) {
Entity var22;
if((var22 = (Entity)var12.get(var23)).shouldRender(var1)) {
if(!var21) {
AABB var24 = var22.bb;
if(!var2.isBoxInFrustrum(var24.x0, var24.y0, var24.z0, var24.x1, var24.y1, var24.z1)) {
continue;
}
}
var22.render(var3, var4);
}
}
}
}
}
}
}
}
// $FF: synthetic method
static int access$000(BlockMap var0) {
return var0.width;
}
// $FF: synthetic method
static int access$100(BlockMap var0) {
return var0.depth;
}
// $FF: synthetic method
static int access$200(BlockMap var0) {
return var0.height;
}
}

View File

@ -0,0 +1,981 @@
package com.mojang.minecraft.level;
import com.mojang.minecraft.Entity;
import com.mojang.minecraft.Vector3DCreator;
import com.mojang.minecraft.level.BlockMap;
import com.mojang.minecraft.level.NextTickListEntry;
import com.mojang.minecraft.level.UNKNOWN0;
import com.mojang.minecraft.level.liquid.LiquidType;
import com.mojang.minecraft.level.tile.a;
import com.mojang.minecraft.model.Vector3D;
import com.mojang.minecraft.phys.AABB;
import com.mojang.minecraft.server.MinecraftServer;
import com.mojang.util.MathHelper;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
public class Level implements Serializable {
public static final long serialVersionUID = 0L;
public int width;
public int height;
public int depth;
public byte[] blocks;
public String name;
public String creator;
public long createTime;
public int xSpawn;
public int ySpawn;
public int zSpawn;
public float rotSpawn;
private transient ArrayList listeners = new ArrayList();
private transient int[] blockers;
transient Random random = new Random();
private transient int randomID;
private transient ArrayList tickList;
public BlockMap blockMap;
private boolean networkMode;
public transient UNKNOWN0 rendererContext;
public boolean creativeMode;
public int waterLevel;
public int skyColor;
public int fogColor;
public int cloudColor;
int unprocessed;
private int tickCount;
public Entity player;
public transient com.mojang.minecraft.UNKNOWN0.UNKNOWN0 particleEngine;
public transient Object font;
public boolean growTrees;
public Level() {
this.randomID = this.random.nextInt();
this.tickList = new ArrayList();
this.networkMode = false;
this.unprocessed = 0;
this.tickCount = 0;
this.growTrees = false;
}
public void initTransient() {
if(this.blocks == null) {
throw new RuntimeException("The level is corrupt!");
} else {
this.listeners = new ArrayList();
this.blockers = new int[this.width * this.height];
Arrays.fill(this.blockers, this.depth);
this.calcLightDepths(0, 0, this.width, this.height);
this.random = new Random();
this.randomID = this.random.nextInt();
this.tickList = new ArrayList();
if(this.waterLevel == 0) {
this.waterLevel = this.depth / 2;
}
if(this.skyColor == 0) {
this.skyColor = 10079487;
}
if(this.fogColor == 0) {
this.fogColor = 16777215;
}
if(this.cloudColor == 0) {
this.cloudColor = 16777215;
}
if(this.xSpawn == 0 && this.ySpawn == 0 && this.zSpawn == 0) {
this.findSpawn();
}
if(this.blockMap == null) {
this.blockMap = new BlockMap(this.width, this.depth, this.height);
}
}
}
public void setData(int var1, int var2, int var3, byte[] var4) {
this.width = var1;
this.height = var3;
this.depth = var2;
this.blocks = var4;
this.blockers = new int[var1 * var3];
Arrays.fill(this.blockers, this.depth);
this.calcLightDepths(0, 0, var1, var3);
for(var1 = 0; var1 < this.listeners.size(); ++var1) {
this.listeners.get(var1);
}
this.tickList.clear();
this.findSpawn();
this.initTransient();
System.gc();
}
public void findSpawn() {
Random var1 = new Random();
int var2 = 0;
int var3;
int var4;
int var5;
do {
++var2;
var3 = var1.nextInt(this.width / 2) + this.width / 4;
var4 = var1.nextInt(this.height / 2) + this.height / 4;
var5 = this.getHighestTile(var3, var4) + 1;
if(var2 == 10000) {
this.xSpawn = var3;
this.ySpawn = -100;
this.zSpawn = var4;
return;
}
} while((float)var5 <= this.getWaterLevel());
this.xSpawn = var3;
this.ySpawn = var5;
this.zSpawn = var4;
}
public void calcLightDepths(int var1, int var2, int var3, int var4) {
for(int var5 = var1; var5 < var1 + var3; ++var5) {
for(int var6 = var2; var6 < var2 + var4; ++var6) {
int var7 = this.blockers[var5 + var6 * this.width];
int var8;
for(var8 = this.depth - 1; var8 > 0 && !this.isLightBlocker(var5, var8, var6); --var8) {
;
}
this.blockers[var5 + var6 * this.width] = var8;
if(var7 != var8) {
for(var7 = 0; var7 < this.listeners.size(); ++var7) {
this.listeners.get(var7);
}
}
}
}
}
public void addListener$74652038(MinecraftServer var1) {
this.listeners.add(var1);
}
public void finalize() {}
public void removeListener$74652038(MinecraftServer var1) {
this.listeners.remove(var1);
}
public boolean isLightBlocker(int var1, int var2, int var3) {
a var4;
return (var4 = a.b[this.getTile(var1, var2, var3)]) == null?false:var4.b();
}
public ArrayList getCubes(AABB var1) {
ArrayList var2 = new ArrayList();
int var3 = (int)var1.x0;
int var4 = (int)var1.x1 + 1;
int var5 = (int)var1.y0;
int var6 = (int)var1.y1 + 1;
int var7 = (int)var1.z0;
int var8 = (int)var1.z1 + 1;
if(var1.x0 < 0.0F) {
--var3;
}
if(var1.y0 < 0.0F) {
--var5;
}
if(var1.z0 < 0.0F) {
--var7;
}
for(var3 = var3; var3 < var4; ++var3) {
for(int var9 = var5; var9 < var6; ++var9) {
for(int var10 = var7; var10 < var8; ++var10) {
AABB var11;
if(var3 >= 0 && var9 >= 0 && var10 >= 0 && var3 < this.width && var9 < this.depth && var10 < this.height) {
a var12;
if((var12 = a.b[this.getTile(var3, var9, var10)]) != null && (var11 = var12.a(var3, var9, var10)) != null && var1.intersectsInner(var11)) {
var2.add(var11);
}
} else if((var3 < 0 || var9 < 0 || var10 < 0 || var3 >= this.width || var10 >= this.height) && (var11 = a.k.a(var3, var9, var10)) != null && var1.intersectsInner(var11)) {
var2.add(var11);
}
}
}
}
return var2;
}
public void swap(int var1, int var2, int var3, int var4, int var5, int var6) {
if(!this.networkMode) {
int var7 = this.getTile(var1, var2, var3);
int var8 = this.getTile(var4, var5, var6);
this.setTileNoNeighborChange(var1, var2, var3, var8);
this.setTileNoNeighborChange(var4, var5, var6, var7);
this.updateNeighborsAt(var1, var2, var3, var8);
this.updateNeighborsAt(var4, var5, var6, var7);
}
}
public boolean setTileNoNeighborChange(int var1, int var2, int var3, int var4) {
return this.networkMode?false:this.netSetTileNoNeighborChange(var1, var2, var3, var4);
}
public boolean netSetTileNoNeighborChange(int var1, int var2, int var3, int var4) {
if(var1 >= 0 && var2 >= 0 && var3 >= 0 && var1 < this.width && var2 < this.depth && var3 < this.height) {
if(var4 == this.blocks[(var2 * this.height + var3) * this.width + var1]) {
return false;
} else {
if(var4 == 0 && (var1 == 0 || var3 == 0 || var1 == this.width - 1 || var3 == this.height - 1) && (float)var2 >= this.getGroundLevel() && (float)var2 < this.getWaterLevel()) {
var4 = a.l.ab;
}
byte var5 = this.blocks[(var2 * this.height + var3) * this.width + var1];
this.blocks[(var2 * this.height + var3) * this.width + var1] = (byte)var4;
if(var5 != 0) {
a.b[var5].c(this, var1, var2, var3);
}
if(var4 != 0) {
a.b[var4].b(this, var1, var2, var3);
}
this.calcLightDepths(var1, var3, 1, 1);
for(var4 = 0; var4 < this.listeners.size(); ++var4) {
((MinecraftServer)this.listeners.get(var4)).a(var1, var2, var3);
}
return true;
}
} else {
return false;
}
}
public boolean setTile(int var1, int var2, int var3, int var4) {
if(this.networkMode) {
return false;
} else if(this.setTileNoNeighborChange(var1, var2, var3, var4)) {
this.updateNeighborsAt(var1, var2, var3, var4);
return true;
} else {
return false;
}
}
public boolean netSetTile(int var1, int var2, int var3, int var4) {
if(this.netSetTileNoNeighborChange(var1, var2, var3, var4)) {
this.updateNeighborsAt(var1, var2, var3, var4);
return true;
} else {
return false;
}
}
public void updateNeighborsAt(int var1, int var2, int var3, int var4) {
this.a(var1 - 1, var2, var3, var4);
this.a(var1 + 1, var2, var3, var4);
this.a(var1, var2 - 1, var3, var4);
this.a(var1, var2 + 1, var3, var4);
this.a(var1, var2, var3 - 1, var4);
this.a(var1, var2, var3 + 1, var4);
}
public boolean setTileNoUpdate(int var1, int var2, int var3, int var4) {
if(var1 >= 0 && var2 >= 0 && var3 >= 0 && var1 < this.width && var2 < this.depth && var3 < this.height) {
if(var4 == this.blocks[(var2 * this.height + var3) * this.width + var1]) {
return false;
} else {
this.blocks[(var2 * this.height + var3) * this.width + var1] = (byte)var4;
return true;
}
} else {
return false;
}
}
private void a(int var1, int var2, int var3, int var4) {
if(var1 >= 0 && var2 >= 0 && var3 >= 0 && var1 < this.width && var2 < this.depth && var3 < this.height) {
a var5;
if((var5 = a.b[this.blocks[(var2 * this.height + var3) * this.width + var1]]) != null) {
var5.a(this, var1, var2, var3, var4);
}
}
}
public boolean isLit(int var1, int var2, int var3) {
return var1 >= 0 && var2 >= 0 && var3 >= 0 && var1 < this.width && var2 < this.depth && var3 < this.height?var2 >= this.blockers[var1 + var3 * this.width]:true;
}
public int getTile(int var1, int var2, int var3) {
return var1 >= 0 && var2 >= 0 && var3 >= 0 && var1 < this.width && var2 < this.depth && var3 < this.height?this.blocks[(var2 * this.height + var3) * this.width + var1] & 255:0;
}
public boolean isSolidTile(int var1, int var2, int var3) {
a var4;
return (var4 = a.b[this.getTile(var1, var2, var3)]) == null?false:var4.c();
}
public void tickEntities() {
this.blockMap.tickAll();
}
public void tick() {
++this.tickCount;
int var1 = 1;
int var2;
for(var2 = 1; 1 << var1 < this.width; ++var1) {
;
}
while(1 << var2 < this.height) {
++var2;
}
int var3 = this.height - 1;
int var4 = this.width - 1;
int var5 = this.depth - 1;
int var6;
int var7;
if(this.tickCount % 5 == 0) {
var6 = this.tickList.size();
for(var7 = 0; var7 < var6; ++var7) {
NextTickListEntry var8;
if((var8 = (NextTickListEntry)this.tickList.remove(0)).ticks > 0) {
--var8.ticks;
this.tickList.add(var8);
} else {
byte var9;
if(this.a(var8.x, var8.y, var8.z) && (var9 = this.blocks[(var8.y * this.height + var8.z) * this.width + var8.x]) == var8.blocks && var9 > 0) {
a.b[var9].a(this, var8.x, var8.y, var8.z, this.random);
}
}
}
}
this.unprocessed += this.width * this.height * this.depth;
var6 = this.unprocessed / 200;
this.unprocessed -= var6 * 200;
for(var7 = 0; var7 < var6; ++var7) {
this.randomID = this.randomID * 3 + 1013904223;
int var12;
int var13 = (var12 = this.randomID >> 2) & var4;
int var10 = var12 >> var1 & var3;
var12 = var12 >> var1 + var2 & var5;
byte var11 = this.blocks[(var12 * this.height + var10) * this.width + var13];
if(a.c[var11]) {
a.b[var11].a(this, var13, var12, var10, this.random);
}
}
}
public int countInstanceOf(Class var1) {
int var2 = 0;
for(int var3 = 0; var3 < this.blockMap.all.size(); ++var3) {
Entity var4 = (Entity)this.blockMap.all.get(var3);
if(var1.isAssignableFrom(var4.getClass())) {
++var2;
}
}
return var2;
}
private boolean a(int var1, int var2, int var3) {
return var1 >= 0 && var2 >= 0 && var3 >= 0 && var1 < this.width && var2 < this.depth && var3 < this.height;
}
public float getGroundLevel() {
return this.getWaterLevel() - 2.0F;
}
public float getWaterLevel() {
return (float)this.waterLevel;
}
public boolean containsAnyLiquid(AABB var1) {
int var2 = (int)var1.x0;
int var3 = (int)var1.x1 + 1;
int var4 = (int)var1.y0;
int var5 = (int)var1.y1 + 1;
int var6 = (int)var1.z0;
int var7 = (int)var1.z1 + 1;
if(var1.x0 < 0.0F) {
--var2;
}
if(var1.y0 < 0.0F) {
--var4;
}
if(var1.z0 < 0.0F) {
--var6;
}
if(var2 < 0) {
var2 = 0;
}
if(var4 < 0) {
var4 = 0;
}
if(var6 < 0) {
var6 = 0;
}
if(var3 > this.width) {
var3 = this.width;
}
if(var5 > this.depth) {
var5 = this.depth;
}
if(var7 > this.height) {
var7 = this.height;
}
for(int var10 = var2; var10 < var3; ++var10) {
for(var2 = var4; var2 < var5; ++var2) {
for(int var8 = var6; var8 < var7; ++var8) {
a var9;
if((var9 = a.b[this.getTile(var10, var2, var8)]) != null && var9.d() != LiquidType.NOT_LIQUID) {
return true;
}
}
}
}
return false;
}
public boolean containsLiquid(AABB var1, LiquidType var2) {
int var3 = (int)var1.x0;
int var4 = (int)var1.x1 + 1;
int var5 = (int)var1.y0;
int var6 = (int)var1.y1 + 1;
int var7 = (int)var1.z0;
int var8 = (int)var1.z1 + 1;
if(var1.x0 < 0.0F) {
--var3;
}
if(var1.y0 < 0.0F) {
--var5;
}
if(var1.z0 < 0.0F) {
--var7;
}
if(var3 < 0) {
var3 = 0;
}
if(var5 < 0) {
var5 = 0;
}
if(var7 < 0) {
var7 = 0;
}
if(var4 > this.width) {
var4 = this.width;
}
if(var6 > this.depth) {
var6 = this.depth;
}
if(var8 > this.height) {
var8 = this.height;
}
for(int var11 = var3; var11 < var4; ++var11) {
for(var3 = var5; var3 < var6; ++var3) {
for(int var9 = var7; var9 < var8; ++var9) {
a var10;
if((var10 = a.b[this.getTile(var11, var3, var9)]) != null && var10.d() == var2) {
return true;
}
}
}
}
return false;
}
public void addToTickNextTick(int var1, int var2, int var3, int var4) {
if(!this.networkMode) {
NextTickListEntry var5 = new NextTickListEntry(var1, var2, var3, var4);
if(var4 > 0) {
var3 = a.b[var4].e();
var5.ticks = var3;
}
this.tickList.add(var5);
}
}
public boolean isFree(AABB var1) {
return this.blockMap.getEntities((Entity)null, var1).size() == 0;
}
public List findEntities(Entity var1, AABB var2) {
return this.blockMap.getEntities(var1, var2);
}
public boolean isSolid(float var1, float var2, float var3, float var4) {
return this.a(var1 - var4, var2 - var4, var3 - var4)?true:(this.a(var1 - var4, var2 - var4, var3 + var4)?true:(this.a(var1 - var4, var2 + var4, var3 - var4)?true:(this.a(var1 - var4, var2 + var4, var3 + var4)?true:(this.a(var1 + var4, var2 - var4, var3 - var4)?true:(this.a(var1 + var4, var2 - var4, var3 + var4)?true:(this.a(var1 + var4, var2 + var4, var3 - var4)?true:this.a(var1 + var4, var2 + var4, var3 + var4)))))));
}
private boolean a(float var1, float var2, float var3) {
int var4;
return (var4 = this.getTile((int)var1, (int)var2, (int)var3)) > 0 && a.b[var4].c();
}
public int getHighestTile(int var1, int var2) {
int var3;
for(var3 = this.depth; (this.getTile(var1, var3 - 1, var2) == 0 || a.b[this.getTile(var1, var3 - 1, var2)].d() != LiquidType.NOT_LIQUID) && var3 > 0; --var3) {
;
}
return var3;
}
public void setSpawnPos(int var1, int var2, int var3, float var4) {
this.xSpawn = var1;
this.ySpawn = var2;
this.zSpawn = var3;
this.rotSpawn = var4;
}
public float getBrightness(int var1, int var2, int var3) {
return this.isLit(var1, var2, var3)?1.0F:0.6F;
}
public float getCaveness(float var1, float var2, float var3, float var4) {
int var5 = (int)var1;
int var14 = (int)var2;
int var6 = (int)var3;
float var7 = 0.0F;
float var8 = 0.0F;
for(int var9 = var5 - 6; var9 <= var5 + 6; ++var9) {
for(int var10 = var6 - 6; var10 <= var6 + 6; ++var10) {
if(this.a(var9, var14, var10) && !this.isSolidTile(var9, var14, var10)) {
float var11 = (float)var9 + 0.5F - var1;
float var12;
float var13;
for(var13 = (float)(Math.atan2((double)(var12 = (float)var10 + 0.5F - var3), (double)var11) - (double)(var4 * 3.1415927F / 180.0F) + 1.5707963705062866D); var13 < -3.1415927F; var13 += 6.2831855F) {
;
}
while(var13 >= 3.1415927F) {
var13 -= 6.2831855F;
}
if(var13 < 0.0F) {
var13 = -var13;
}
var11 = MathHelper.sqrt(var11 * var11 + 4.0F + var12 * var12);
var11 = 1.0F / var11;
if(var13 > 1.0F) {
var11 = 0.0F;
}
if(var11 < 0.0F) {
var11 = 0.0F;
}
var8 += var11;
if(this.isLit(var9, var14, var10)) {
var7 += var11;
}
}
}
}
if(var8 == 0.0F) {
return 0.0F;
} else {
return var7 / var8;
}
}
public float getCaveness(Entity var1) {
float var2 = MathHelper.cos(-var1.yRot * 0.017453292F + 3.1415927F);
float var3 = MathHelper.sin(-var1.yRot * 0.017453292F + 3.1415927F);
float var4 = MathHelper.cos(-var1.xRot * 0.017453292F);
float var5 = MathHelper.sin(-var1.xRot * 0.017453292F);
float var6 = var1.x;
float var7 = var1.y;
float var21 = var1.z;
float var8 = 1.6F;
float var9 = 0.0F;
float var10 = 0.0F;
for(int var11 = 0; var11 <= 200; ++var11) {
float var12 = ((float)var11 / (float)200 - 0.5F) * 2.0F;
int var13 = 0;
while(var13 <= 200) {
float var14 = ((float)var13 / (float)200 - 0.5F) * var8;
float var16 = var4 * var14 + var5;
var14 = var4 - var5 * var14;
float var17 = var2 * var12 + var3 * var14;
var16 = var16;
var14 = var2 * var14 - var3 * var12;
int var15 = 0;
while(true) {
if(var15 < 10) {
float var18 = var6 + var17 * (float)var15 * 0.8F;
float var19 = var7 + var16 * (float)var15 * 0.8F;
float var20 = var21 + var14 * (float)var15 * 0.8F;
if(!this.a(var18, var19, var20)) {
++var9;
if(this.isLit((int)var18, (int)var19, (int)var20)) {
++var10;
}
++var15;
continue;
}
}
++var13;
break;
}
}
}
if(var9 == 0.0F) {
return 0.0F;
} else {
float var22;
if((var22 = var10 / var9 / 0.1F) > 1.0F) {
var22 = 1.0F;
}
var22 = 1.0F - var22;
return 1.0F - var22 * var22 * var22;
}
}
public byte[] copyBlocks() {
return Arrays.copyOf(this.blocks, this.blocks.length);
}
public LiquidType getLiquid(int var1, int var2, int var3) {
int var4;
return (var4 = this.getTile(var1, var2, var3)) == 0?LiquidType.NOT_LIQUID:a.b[var4].d();
}
public boolean isWater(int var1, int var2, int var3) {
int var4;
return (var4 = this.getTile(var1, var2, var3)) > 0 && a.b[var4].d() == LiquidType.WATER;
}
public void setNetworkMode(boolean var1) {
this.networkMode = var1;
}
public Vector3DCreator clip(Vector3D var1, Vector3D var2) {
if(!Float.isNaN(var1.x) && !Float.isNaN(var1.y) && !Float.isNaN(var1.z)) {
if(!Float.isNaN(var2.x) && !Float.isNaN(var2.y) && !Float.isNaN(var2.z)) {
int var3 = (int)Math.floor((double)var2.x);
int var4 = (int)Math.floor((double)var2.y);
int var5 = (int)Math.floor((double)var2.z);
int var6 = (int)Math.floor((double)var1.x);
int var7 = (int)Math.floor((double)var1.y);
int var8 = (int)Math.floor((double)var1.z);
int var9 = 20;
while(var9-- >= 0) {
if(Float.isNaN(var1.x) || Float.isNaN(var1.y) || Float.isNaN(var1.z)) {
return null;
}
if(var6 == var3 && var7 == var4 && var8 == var5) {
return null;
}
float var10 = 999.0F;
float var11 = 999.0F;
float var12 = 999.0F;
if(var3 > var6) {
var10 = (float)var6 + 1.0F;
}
if(var3 < var6) {
var10 = (float)var6;
}
if(var4 > var7) {
var11 = (float)var7 + 1.0F;
}
if(var4 < var7) {
var11 = (float)var7;
}
if(var5 > var8) {
var12 = (float)var8 + 1.0F;
}
if(var5 < var8) {
var12 = (float)var8;
}
float var13 = 999.0F;
float var14 = 999.0F;
float var15 = 999.0F;
float var16 = var2.x - var1.x;
float var17 = var2.y - var1.y;
float var18 = var2.z - var1.z;
if(var10 != 999.0F) {
var13 = (var10 - var1.x) / var16;
}
if(var11 != 999.0F) {
var14 = (var11 - var1.y) / var17;
}
if(var12 != 999.0F) {
var15 = (var12 - var1.z) / var18;
}
boolean var19 = false;
byte var24;
if(var13 < var14 && var13 < var15) {
if(var3 > var6) {
var24 = 4;
} else {
var24 = 5;
}
var1.x = var10;
var1.y += var17 * var13;
var1.z += var18 * var13;
} else if(var14 < var15) {
if(var4 > var7) {
var24 = 0;
} else {
var24 = 1;
}
var1.x += var16 * var14;
var1.y = var11;
var1.z += var18 * var14;
} else {
if(var5 > var8) {
var24 = 2;
} else {
var24 = 3;
}
var1.x += var16 * var15;
var1.y += var17 * var15;
var1.z = var12;
}
Vector3D var20;
var6 = (int)((var20 = new Vector3D(var1.x, var1.y, var1.z)).x = (float)Math.floor((double)var1.x));
if(var24 == 5) {
--var6;
++var20.x;
}
var7 = (int)(var20.y = (float)Math.floor((double)var1.y));
if(var24 == 1) {
--var7;
++var20.y;
}
var8 = (int)(var20.z = (float)Math.floor((double)var1.z));
if(var24 == 3) {
--var8;
++var20.z;
}
int var22 = this.getTile(var6, var7, var8);
a var21 = a.b[var22];
if(var22 > 0 && var21.d() == LiquidType.NOT_LIQUID) {
Vector3DCreator var23;
if(var21.a()) {
if((var23 = var21.a(var6, var7, var8, var1, var2)) != null) {
return var23;
}
} else if((var23 = var21.a(var6, var7, var8, var1, var2)) != null) {
return var23;
}
}
}
return null;
} else {
return null;
}
} else {
return null;
}
}
public void playSound(String var1, Entity var2, float var3, float var4) {}
public void playSound(String var1, float var2, float var3, float var4, float var5, float var6) {}
public boolean maybeGrowTree(int var1, int var2, int var3) {
int var4 = this.random.nextInt(3) + 4;
boolean var5 = true;
int var6;
int var8;
int var9;
for(var6 = var2; var6 <= var2 + 1 + var4; ++var6) {
byte var7 = 1;
if(var6 == var2) {
var7 = 0;
}
if(var6 >= var2 + 1 + var4 - 2) {
var7 = 2;
}
for(var8 = var1 - var7; var8 <= var1 + var7 && var5; ++var8) {
for(var9 = var3 - var7; var9 <= var3 + var7 && var5; ++var9) {
if(var8 >= 0 && var6 >= 0 && var9 >= 0 && var8 < this.width && var6 < this.depth && var9 < this.height) {
if((this.blocks[(var6 * this.height + var9) * this.width + var8] & 255) != 0) {
var5 = false;
}
} else {
var5 = false;
}
}
}
}
if(!var5) {
return false;
} else if((this.blocks[((var2 - 1) * this.height + var3) * this.width + var1] & 255) == a.f.ab && var2 < this.depth - var4 - 1) {
this.setTile(var1, var2 - 1, var3, a.g.ab);
int var13;
for(var13 = var2 - 3 + var4; var13 <= var2 + var4; ++var13) {
var8 = var13 - (var2 + var4);
var9 = 1 - var8 / 2;
for(int var10 = var1 - var9; var10 <= var1 + var9; ++var10) {
int var12 = var10 - var1;
for(var6 = var3 - var9; var6 <= var3 + var9; ++var6) {
int var11 = var6 - var3;
if((Math.abs(var12) != var9 || Math.abs(var11) != var9 || this.random.nextInt(2) != 0 && var8 != 0) && this.getTile(var10, var13, var6) == 0) {
this.setTile(var10, var13, var6, a.v.ab);
}
}
}
}
for(var13 = 0; var13 < var4; ++var13) {
if(this.getTile(var1, var2 + var13, var3) == 0) {
this.setTile(var1, var2 + var13, var3, a.u.ab);
}
}
return true;
} else {
return false;
}
}
public Entity getPlayer() {
return this.player;
}
public void addEntity(Entity var1) {
this.blockMap.insert(var1);
var1.setLevel(this);
}
public void removeEntity(Entity var1) {
this.blockMap.remove(var1);
}
public void explode(Entity var1, float var2, float var3, float var4, float var5) {
int var6 = (int)(var2 - var5 - 1.0F);
int var7 = (int)(var2 + var5 + 1.0F);
int var8 = (int)(var3 - var5 - 1.0F);
int var9 = (int)(var3 + var5 + 1.0F);
int var10 = (int)(var4 - var5 - 1.0F);
int var11 = (int)(var4 + var5 + 1.0F);
int var13;
float var15;
float var16;
for(int var12 = var6; var12 < var7; ++var12) {
for(var13 = var9 - 1; var13 >= var8; --var13) {
for(int var14 = var10; var14 < var11; ++var14) {
var15 = (float)var12 + 0.5F - var2;
var16 = (float)var13 + 0.5F - var3;
float var17 = (float)var14 + 0.5F - var4;
int var19;
if(var12 >= 0 && var13 >= 0 && var14 >= 0 && var12 < this.width && var13 < this.depth && var14 < this.height && var15 * var15 + var16 * var16 + var17 * var17 < var5 * var5 && (var19 = this.getTile(var12, var13, var14)) > 0 && a.b[var19].g()) {
a.b[var19].a(this, 0.3F);
this.setTile(var12, var13, var14, 0);
}
}
}
}
List var18 = this.blockMap.getEntities(var1, (float)var6, (float)var8, (float)var10, (float)var7, (float)var9, (float)var11);
for(var13 = 0; var13 < var18.size(); ++var13) {
Entity var20;
if((var15 = (var20 = (Entity)var18.get(var13)).distanceTo(var2, var3, var4) / var5) <= 1.0F) {
var16 = 1.0F - var15;
var20.hurt(var1, (int)(var16 * 15.0F + 1.0F));
}
}
}
public Entity findSubclassOf(Class var1) {
for(int var2 = 0; var2 < this.blockMap.all.size(); ++var2) {
Entity var3 = (Entity)this.blockMap.all.get(var2);
if(var1.isAssignableFrom(var3.getClass())) {
return var3;
}
}
return null;
}
public void removeAllNonCreativeModeEntities() {
this.blockMap.removeAllNonCreativeModeEntities();
}
}

View File

@ -0,0 +1,83 @@
package com.mojang.minecraft.level;
import com.mojang.minecraft.level.Level;
import com.mojang.minecraft.level.LevelObjectInputStream;
import com.mojang.minecraft.server.MinecraftServer;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
public final class LevelIO {
private MinecraftServer server;
public LevelIO(MinecraftServer var1) {
this.server = var1;
}
public final Level load(InputStream var1) {
if(this.server != null) {
this.server.a("Loading level");
}
if(this.server != null) {
this.server.b("Reading..");
}
try {
DataInputStream var10;
if((var10 = new DataInputStream(new GZIPInputStream(var1))).readInt() != 656127880) {
return null;
} else {
byte var12;
if((var12 = var10.readByte()) > 2) {
return null;
} else if(var12 <= 1) {
String var14 = var10.readUTF();
String var15 = var10.readUTF();
long var3 = var10.readLong();
short var5 = var10.readShort();
short var6 = var10.readShort();
short var7 = var10.readShort();
byte[] var8 = new byte[var5 * var6 * var7];
var10.readFully(var8);
var10.close();
Level var11;
(var11 = new Level()).setData(var5, var7, var6, var8);
var11.name = var14;
var11.creator = var15;
var11.createTime = var3;
return var11;
} else {
Level var2;
LevelObjectInputStream var13;
(var2 = (Level)(var13 = new LevelObjectInputStream(var10)).readObject()).initTransient();
var13.close();
return var2;
}
}
} catch (Exception var9) {
var9.printStackTrace();
System.err.println("Failed to load level: " + var9.toString());
return null;
}
}
public static void save(Level var0, OutputStream var1) {
try {
DataOutputStream var3;
(var3 = new DataOutputStream(new GZIPOutputStream(var1))).writeInt(656127880);
var3.writeByte(2);
ObjectOutputStream var4;
(var4 = new ObjectOutputStream(var3)).writeObject(var0);
var4.close();
} catch (Exception var2) {
var2.printStackTrace();
}
}
}

View File

@ -0,0 +1,32 @@
package com.mojang.minecraft.level;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectStreamClass;
import java.util.HashSet;
import java.util.Set;
public final class LevelObjectInputStream extends ObjectInputStream {
private Set classes = new HashSet<String>();
public LevelObjectInputStream(InputStream var1) throws IOException {
super(var1);
this.classes.add("com.mojang.minecraft.player.Player$1");
this.classes.add("com.mojang.minecraft.mob.Creeper$1");
this.classes.add("com.mojang.minecraft.mob.Skeleton$1");
}
protected final ObjectStreamClass readClassDescriptor() {
try {
ObjectStreamClass var1 = super.readClassDescriptor();
return this.classes.contains(var1.getName())?ObjectStreamClass.lookup(Class.forName(var1.getName())):var1;
} catch(Exception e) {
e.printStackTrace();
System.err.println("Error reading class descriptor!");
return null;
}
}
}

View File

@ -0,0 +1,19 @@
package com.mojang.minecraft.level;
public final class NextTickListEntry {
public int x;
public int y;
public int z;
public int blocks;
public int ticks;
public NextTickListEntry(int var1, int var2, int var3, int var4) {
this.x = var1;
this.y = var2;
this.z = var3;
this.blocks = var4;
}
}

View File

@ -0,0 +1,5 @@
package com.mojang.minecraft.level;
public interface UNKNOWN0 {
}

View File

@ -0,0 +1,6 @@
package com.mojang.minecraft.level;
// $FF: synthetic class
final class UNKNOWN1 {
}

View File

@ -0,0 +1,516 @@
package com.mojang.minecraft.level.generator;
import com.mojang.minecraft.level.Level;
import com.mojang.minecraft.level.generator.noise.CombinedNoise;
import com.mojang.minecraft.level.generator.noise.OctaveNoise;
import com.mojang.minecraft.level.tile.a;
import com.mojang.minecraft.server.MinecraftServer;
import com.mojang.util.MathHelper;
import java.util.ArrayList;
import java.util.Random;
public final class LevelGenerator {
private MinecraftServer server;
private int width;
private int depth;
private int height;
private Random random = new Random();
private byte[] blocks;
private int waterLevel;
private int[] h = new int[1048576];
public LevelGenerator(MinecraftServer var1) {
this.server = var1;
}
public final Level generate(String var1, int var2, int var3, int var4) {
this.server.a("Generating level");
this.width = 256;
this.depth = 256;
this.height = 64;
this.waterLevel = 32;
this.blocks = new byte[256 << 8 << 6];
this.server.b("Raising..");
LevelGenerator var41 = this;
CombinedNoise var5 = new CombinedNoise(new OctaveNoise(this.random, 8), new OctaveNoise(this.random, 8));
CombinedNoise var6 = new CombinedNoise(new OctaveNoise(this.random, 8), new OctaveNoise(this.random, 8));
OctaveNoise var7 = new OctaveNoise(this.random, 6);
int[] var8 = new int[this.width * this.depth];
float var9 = 1.3F;
int var10;
int var11;
for(var10 = 0; var10 < var41.width; ++var10) {
for(var11 = 0; var11 < var41.depth; ++var11) {
double var12 = var5.compute((double)((float)var10 * var9), (double)((float)var11 * var9)) / 6.0D + (double)-4;
double var14 = var6.compute((double)((float)var10 * var9), (double)((float)var11 * var9)) / 5.0D + 10.0D + (double)-4;
if(var7.compute((double)var10, (double)var11) / 8.0D > 0.0D) {
var14 = var12;
}
double var18;
if((var18 = Math.max(var12, var14) / 2.0D) < 0.0D) {
var18 *= 0.8D;
}
var8[var10 + var11 * var41.width] = (int)var18;
}
}
this.server.b("Eroding..");
int[] var42 = var8;
var41 = this;
var6 = new CombinedNoise(new OctaveNoise(this.random, 8), new OctaveNoise(this.random, 8));
CombinedNoise var47 = new CombinedNoise(new OctaveNoise(this.random, 8), new OctaveNoise(this.random, 8));
int var22;
int var51;
int var52;
for(var51 = 0; var51 < var41.width; ++var51) {
for(var52 = 0; var52 < var41.depth; ++var52) {
double var20 = var6.compute((double)(var51 << 1), (double)(var52 << 1)) / 8.0D;
var11 = var47.compute((double)(var51 << 1), (double)(var52 << 1)) > 0.0D?1:0;
if(var20 > 2.0D) {
var22 = ((var42[var51 + var52 * var41.width] - var11) / 2 << 1) + var11;
var42[var51 + var52 * var41.width] = var22;
}
}
}
this.server.b("Soiling..");
var42 = var8;
var41 = this;
int var44 = this.width;
int var49 = this.depth;
var51 = this.height;
OctaveNoise var54 = new OctaveNoise(this.random, 8);
int var23;
int var25;
int var24;
int var27;
int var26;
for(var23 = 0; var23 < var44; ++var23) {
for(var10 = 0; var10 < var49; ++var10) {
var11 = (int)(var54.compute((double)var23, (double)var10) / 24.0D) - 4;
var24 = (var22 = var42[var23 + var10 * var44] + var41.waterLevel) + var11;
var42[var23 + var10 * var44] = Math.max(var22, var24);
if(var42[var23 + var10 * var44] > var51 - 2) {
var42[var23 + var10 * var44] = var51 - 2;
}
if(var42[var23 + var10 * var44] < 1) {
var42[var23 + var10 * var44] = 1;
}
for(var25 = 0; var25 < var51; ++var25) {
var26 = (var25 * var41.depth + var10) * var41.width + var23;
var27 = 0;
if(var25 <= var22) {
var27 = a.g.ab;
}
if(var25 <= var24) {
var27 = a.e.ab;
}
if(var25 == 0) {
var27 = a.n.ab;
}
var41.blocks[var26] = (byte)var27;
}
}
}
this.server.b("Carving..");
boolean var48 = true;
boolean var43 = false;
var41 = this;
var49 = this.width;
var51 = this.depth;
var52 = this.height;
var23 = var49 * var51 * var52 / 256 / 64 << 1;
for(var10 = 0; var10 < var23; ++var10) {
float var55 = var41.random.nextFloat() * (float)var49;
float var56 = var41.random.nextFloat() * (float)var52;
float var60 = var41.random.nextFloat() * (float)var51;
var25 = (int)((var41.random.nextFloat() + var41.random.nextFloat()) * 200.0F);
float var63 = var41.random.nextFloat() * 3.1415927F * 2.0F;
float var61 = 0.0F;
float var28 = var41.random.nextFloat() * 3.1415927F * 2.0F;
float var29 = 0.0F;
float var30 = var41.random.nextFloat() * var41.random.nextFloat();
for(var3 = 0; var3 < var25; ++var3) {
var55 += MathHelper.sin(var63) * MathHelper.cos(var28);
var60 += MathHelper.cos(var63) * MathHelper.cos(var28);
var56 += MathHelper.sin(var28);
var63 += var61 * 0.2F;
var61 = (var61 *= 0.9F) + (var41.random.nextFloat() - var41.random.nextFloat());
var28 = (var28 + var29 * 0.5F) * 0.5F;
var29 = (var29 *= 0.75F) + (var41.random.nextFloat() - var41.random.nextFloat());
if(var41.random.nextFloat() >= 0.25F) {
float var45 = var55 + (var41.random.nextFloat() * 4.0F - 2.0F) * 0.2F;
float var46 = var56 + (var41.random.nextFloat() * 4.0F - 2.0F) * 0.2F;
float var31 = var60 + (var41.random.nextFloat() * 4.0F - 2.0F) * 0.2F;
float var32 = ((float)var41.height - var46) / (float)var41.height;
var32 = 1.2F + (var32 * 3.5F + 1.0F) * var30;
var32 = MathHelper.sin((float)var3 * 3.1415927F / (float)var25) * var32;
for(int var33 = (int)(var45 - var32); var33 <= (int)(var45 + var32); ++var33) {
for(int var34 = (int)(var46 - var32); var34 <= (int)(var46 + var32); ++var34) {
for(int var35 = (int)(var31 - var32); var35 <= (int)(var31 + var32); ++var35) {
float var36 = (float)var33 - var45;
float var37 = (float)var34 - var46;
float var38 = (float)var35 - var31;
if(var36 * var36 + var37 * var37 * 2.0F + var38 * var38 < var32 * var32 && var33 >= 1 && var34 >= 1 && var35 >= 1 && var33 < var41.width - 1 && var34 < var41.height - 1 && var35 < var41.depth - 1) {
int var65 = (var34 * var41.depth + var35) * var41.width + var33;
if(var41.blocks[var65] == a.e.ab) {
var41.blocks[var65] = 0;
}
}
}
}
}
}
}
}
this.populateOre(a.t.ab, 90, 1, 4);
this.populateOre(a.s.ab, 70, 2, 4);
this.populateOre(a.r.ab, 50, 3, 4);
this.server.b("Watering..");
var41 = this;
var51 = a.m.ab;
for(var52 = 0; var52 < var41.width; ++var52) {
var41.flood(var52, var41.height / 2 - 1, 0, 0, var51);
var41.flood(var52, var41.height / 2 - 1, var41.depth - 1, 0, var51);
}
for(var52 = 0; var52 < var41.depth; ++var52) {
var41.flood(0, var41.height / 2 - 1, var52, 0, var51);
var41.flood(var41.width - 1, var41.height / 2 - 1, var52, 0, var51);
}
var52 = var41.width * var41.depth / 8000;
for(var23 = 0; var23 < var52; ++var23) {
var10 = var41.random.nextInt(var41.width);
var11 = var41.waterLevel - 1 - var41.random.nextInt(2);
var22 = var41.random.nextInt(var41.depth);
if(var41.blocks[(var11 * var41.depth + var22) * var41.width + var10] == 0) {
var41.flood(var10, var11, var22, 0, var51);
}
}
this.server.b("Melting..");
var41 = this;
var44 = this.width * this.depth * this.height / 20000;
for(var49 = 0; var49 < var44; ++var49) {
var51 = var41.random.nextInt(var41.width);
var52 = (int)(var41.random.nextFloat() * var41.random.nextFloat() * (float)(var41.waterLevel - 3));
var23 = var41.random.nextInt(var41.depth);
if(var41.blocks[(var52 * var41.depth + var23) * var41.width + var51] == 0) {
var41.flood(var51, var52, var23, 0, a.o.ab);
}
}
this.server.b("Growing..");
var42 = var8;
var41 = this;
var44 = this.width;
var49 = this.depth;
var51 = this.height;
var54 = new OctaveNoise(this.random, 8);
OctaveNoise var57 = new OctaveNoise(this.random, 8);
int var62;
for(var10 = 0; var10 < var44; ++var10) {
for(var11 = 0; var11 < var49; ++var11) {
boolean var59 = var54.compute((double)var10, (double)var11) > 8.0D;
boolean var58 = var57.compute((double)var10, (double)var11) > 12.0D;
var26 = ((var25 = var42[var10 + var11 * var44]) * var41.depth + var11) * var41.width + var10;
if(((var27 = var41.blocks[((var25 + 1) * var41.depth + var11) * var41.width + var10] & 255) == a.l.ab || var27 == a.m.ab) && var25 <= var51 / 2 - 1 && var58) {
var41.blocks[var26] = (byte)a.q.ab;
}
if(var27 == 0) {
var62 = a.f.ab;
if(var25 <= var51 / 2 - 1 && var59) {
var62 = a.p.ab;
}
var41.blocks[var26] = (byte)var62;
}
}
}
this.server.b("Planting..");
var42 = var8;
var41 = this;
var44 = this.width;
var49 = this.width * this.depth / 3000;
for(var51 = 0; var51 < var49; ++var51) {
var52 = var41.random.nextInt(2);
var23 = var41.random.nextInt(var41.width);
var10 = var41.random.nextInt(var41.depth);
for(var11 = 0; var11 < 10; ++var11) {
var22 = var23;
var24 = var10;
for(var25 = 0; var25 < 5; ++var25) {
var22 += var41.random.nextInt(6) - var41.random.nextInt(6);
var24 += var41.random.nextInt(6) - var41.random.nextInt(6);
if((var52 < 2 || var41.random.nextInt(4) == 0) && var22 >= 0 && var24 >= 0 && var22 < var41.width && var24 < var41.depth) {
var26 = var42[var22 + var24 * var44] + 1;
if((var41.blocks[(var26 * var41.depth + var24) * var41.width + var22] & 255) == 0) {
var62 = (var26 * var41.depth + var24) * var41.width + var22;
if((var41.blocks[((var26 - 1) * var41.depth + var24) * var41.width + var22] & 255) == a.f.ab) {
if(var52 == 0) {
var41.blocks[var62] = (byte)a.O.ab;
} else if(var52 == 1) {
var41.blocks[var62] = (byte)a.P.ab;
}
}
}
}
}
}
}
var42 = var8;
var41 = this;
var44 = this.width;
var51 = this.width * this.depth * this.height / 2000;
for(var52 = 0; var52 < var51; ++var52) {
var23 = var41.random.nextInt(2);
var10 = var41.random.nextInt(var41.width);
var11 = var41.random.nextInt(var41.height);
var22 = var41.random.nextInt(var41.depth);
for(var24 = 0; var24 < 20; ++var24) {
var25 = var10;
var26 = var11;
var27 = var22;
for(var62 = 0; var62 < 5; ++var62) {
var25 += var41.random.nextInt(6) - var41.random.nextInt(6);
var26 += var41.random.nextInt(2) - var41.random.nextInt(2);
var27 += var41.random.nextInt(6) - var41.random.nextInt(6);
if((var23 < 2 || var41.random.nextInt(4) == 0) && var25 >= 0 && var27 >= 0 && var26 >= 1 && var25 < var41.width && var27 < var41.depth && var26 < var42[var25 + var27 * var44] - 1 && (var41.blocks[(var26 * var41.depth + var27) * var41.width + var25] & 255) == 0) {
int var64 = (var26 * var41.depth + var27) * var41.width + var25;
if((var41.blocks[((var26 - 1) * var41.depth + var27) * var41.width + var25] & 255) == a.e.ab) {
if(var23 == 0) {
var41.blocks[var64] = (byte)a.Q.ab;
} else if(var23 == 1) {
var41.blocks[var64] = (byte)a.R.ab;
}
}
}
}
}
}
Level var40;
(var40 = new Level()).waterLevel = this.waterLevel;
var40.setData(256, 64, 256, this.blocks);
var40.createTime = System.currentTimeMillis();
var40.creator = var1;
var40.name = "A Nice World";
int[] var53 = var8;
Level var50 = var40;
var41 = this;
var49 = this.width;
var51 = this.width * this.depth / 4000;
for(var52 = 0; var52 < var51; ++var52) {
var23 = var41.random.nextInt(var41.width);
var10 = var41.random.nextInt(var41.depth);
for(var11 = 0; var11 < 20; ++var11) {
var22 = var23;
var24 = var10;
for(var25 = 0; var25 < 20; ++var25) {
var22 += var41.random.nextInt(6) - var41.random.nextInt(6);
var24 += var41.random.nextInt(6) - var41.random.nextInt(6);
if(var22 >= 0 && var24 >= 0 && var22 < var41.width && var24 < var41.depth) {
var26 = var53[var22 + var24 * var49] + 1;
if(var41.random.nextInt(4) == 0) {
var50.maybeGrowTree(var22, var26, var24);
}
}
}
}
}
return var40;
}
private void populateOre(int var1, int var2, int var3, int var4) {
byte var24 = (byte)var1;
var3 = this.width;
var4 = this.depth;
int var5 = this.height;
int var6 = var3 * var4 * var5 / 256 / 64 * var2 / 100;
for(int var7 = 0; var7 < var6; ++var7) {
float var8 = this.random.nextFloat() * (float)var3;
float var9 = this.random.nextFloat() * (float)var5;
float var10 = this.random.nextFloat() * (float)var4;
int var11 = (int)((this.random.nextFloat() + this.random.nextFloat()) * 75.0F * (float)var2 / 100.0F);
float var12 = this.random.nextFloat() * 3.1415927F * 2.0F;
float var13 = 0.0F;
float var14 = this.random.nextFloat() * 3.1415927F * 2.0F;
float var15 = 0.0F;
for(int var16 = 0; var16 < var11; ++var16) {
var8 += MathHelper.sin(var12) * MathHelper.cos(var14);
var10 += MathHelper.cos(var12) * MathHelper.cos(var14);
var9 += MathHelper.sin(var14);
var12 += var13 * 0.2F;
var13 = (var13 *= 0.9F) + (this.random.nextFloat() - this.random.nextFloat());
var14 = (var14 + var15 * 0.5F) * 0.5F;
var15 = (var15 *= 0.9F) + (this.random.nextFloat() - this.random.nextFloat());
float var17 = MathHelper.sin((float)var16 * 3.1415927F / (float)var11) * (float)var2 / 100.0F + 1.0F;
for(int var18 = (int)(var8 - var17); var18 <= (int)(var8 + var17); ++var18) {
for(int var19 = (int)(var9 - var17); var19 <= (int)(var9 + var17); ++var19) {
for(int var20 = (int)(var10 - var17); var20 <= (int)(var10 + var17); ++var20) {
float var21 = (float)var18 - var8;
float var22 = (float)var19 - var9;
float var23 = (float)var20 - var10;
if(var21 * var21 + var22 * var22 * 2.0F + var23 * var23 < var17 * var17 && var18 >= 1 && var19 >= 1 && var20 >= 1 && var18 < this.width - 1 && var19 < this.height - 1 && var20 < this.depth - 1) {
int var25 = (var19 * this.depth + var20) * this.width + var18;
if(this.blocks[var25] == a.e.ab) {
this.blocks[var25] = var24;
}
}
}
}
}
}
}
}
private long flood(int var1, int var2, int var3, int var4, int var5) {
byte var20 = (byte)var5;
ArrayList var21 = new ArrayList();
byte var6 = 0;
int var7 = 1;
int var8;
for(var8 = 1; 1 << var7 < this.width; ++var7) {
;
}
while(1 << var8 < this.depth) {
++var8;
}
int var9 = this.depth - 1;
int var10 = this.width - 1;
int var22 = var6 + 1;
this.h[0] = ((var2 << var8) + var3 << var7) + var1;
long var11 = 0L;
var1 = this.width * this.depth;
while(var22 > 0) {
--var22;
var2 = this.h[var22];
if(var22 == 0 && var21.size() > 0) {
this.h = (int[])var21.remove(var21.size() - 1);
var22 = this.h.length;
}
var3 = var2 >> var7 & var9;
int var13 = var2 >> var7 + var8;
int var14;
int var15;
for(var15 = var14 = var2 & var10; var14 > 0 && this.blocks[var2 - 1] == 0; --var2) {
--var14;
}
while(var15 < this.width && this.blocks[var2 + var15 - var14] == 0) {
++var15;
}
int var16 = var2 >> var7 & var9;
int var17 = var2 >> var7 + var8;
if(var16 != var3 || var17 != var13) {
System.out.println("Diagonal flood!?");
}
boolean var23 = false;
boolean var24 = false;
boolean var18 = false;
var11 += (long)(var15 - var14);
for(var14 = var14; var14 < var15; ++var14) {
this.blocks[var2] = var20;
boolean var19;
if(var3 > 0) {
if((var19 = this.blocks[var2 - this.width] == 0) && !var23) {
if(var22 == this.h.length) {
var21.add(this.h);
this.h = new int[1048576];
var22 = 0;
}
this.h[var22++] = var2 - this.width;
}
var23 = var19;
}
if(var3 < this.depth - 1) {
if((var19 = this.blocks[var2 + this.width] == 0) && !var24) {
if(var22 == this.h.length) {
var21.add(this.h);
this.h = new int[1048576];
var22 = 0;
}
this.h[var22++] = var2 + this.width;
}
var24 = var19;
}
if(var13 > 0) {
byte var25 = this.blocks[var2 - var1];
if((var20 == a.n.ab || var20 == a.o.ab) && (var25 == a.l.ab || var25 == a.m.ab)) {
this.blocks[var2 - var1] = (byte)a.e.ab;
}
if((var19 = var25 == 0) && !var18) {
if(var22 == this.h.length) {
var21.add(this.h);
this.h = new int[1048576];
var22 = 0;
}
this.h[var22++] = var2 - var1;
}
var18 = var19;
}
++var2;
}
}
return var11;
}
}

View File

@ -0,0 +1,19 @@
package com.mojang.minecraft.level.generator.noise;
import com.mojang.minecraft.level.generator.noise.Noise;
public final class CombinedNoise extends Noise {
private Noise noise1;
private Noise noise2;
public CombinedNoise(Noise var1, Noise var2) {
this.noise1 = var1;
this.noise2 = var2;
}
public final double compute(double var1, double var3) {
return this.noise1.compute(var1 + this.noise2.compute(var1, var3), var3);
}
}

View File

@ -0,0 +1,7 @@
package com.mojang.minecraft.level.generator.noise;
public abstract class Noise {
public abstract double compute(double var1, double var3);
}

View File

@ -0,0 +1,34 @@
package com.mojang.minecraft.level.generator.noise;
import com.mojang.minecraft.level.generator.noise.Noise;
import com.mojang.minecraft.level.generator.noise.PerlinNoise;
import java.util.Random;
public final class OctaveNoise extends Noise {
private PerlinNoise[] perlin;
private int octaves;
public OctaveNoise(Random var1, int var2) {
this.octaves = var2;
this.perlin = new PerlinNoise[var2];
for(int var3 = 0; var3 < var2; ++var3) {
this.perlin[var3] = new PerlinNoise(var1);
}
}
public final double compute(double var1, double var3) {
double var5 = 0.0D;
double var7 = 1.0D;
for(int var9 = 0; var9 < this.octaves; ++var9) {
var5 += this.perlin[var9].compute(var1 / var7, var3 / var7) * var7;
var7 *= 2.0D;
}
return var5;
}
}

View File

@ -0,0 +1,68 @@
package com.mojang.minecraft.level.generator.noise;
import com.mojang.minecraft.level.generator.noise.Noise;
import java.util.Random;
public final class PerlinNoise extends Noise {
private int[] noise;
public PerlinNoise() {
this(new Random());
}
public PerlinNoise(Random var1) {
this.noise = new int[512];
int var2;
for(var2 = 0; var2 < 256; this.noise[var2] = var2++) {
;
}
for(var2 = 0; var2 < 256; ++var2) {
int var3 = var1.nextInt(256 - var2) + var2;
int var4 = this.noise[var2];
this.noise[var2] = this.noise[var3];
this.noise[var3] = var4;
this.noise[var2 + 256] = this.noise[var2];
}
}
private static double a(double var0) {
return var0 * var0 * var0 * (var0 * (var0 * 6.0D - 15.0D) + 10.0D);
}
private static double lerp(double var0, double var2, double var4) {
return var2 + var0 * (var4 - var2);
}
private static double grad(int var0, double var1, double var3, double var5) {
double var7 = (var0 &= 15) < 8?var1:var3;
double var9 = var0 < 4?var3:(var0 != 12 && var0 != 14?var5:var1);
return ((var0 & 1) == 0?var7:-var7) + ((var0 & 2) == 0?var9:-var9);
}
public final double compute(double var1, double var3) {
double var5 = 0.0D;
double var7 = var3;
double var9 = var1;
int var18 = (int)Math.floor(var1) & 255;
int var2 = (int)Math.floor(var3) & 255;
int var19 = (int)Math.floor(0.0D) & 255;
var9 -= Math.floor(var9);
var7 -= Math.floor(var7);
var5 = 0.0D - Math.floor(0.0D);
double var11 = a(var9);
double var13 = a(var7);
double var15 = a(var5);
int var4 = this.noise[var18] + var2;
int var17 = this.noise[var4] + var19;
var4 = this.noise[var4 + 1] + var19;
var18 = this.noise[var18 + 1] + var2;
var2 = this.noise[var18] + var19;
var18 = this.noise[var18 + 1] + var19;
return lerp(var15, lerp(var13, lerp(var11, grad(this.noise[var17], var9, var7, var5), grad(this.noise[var2], var9 - 1.0D, var7, var5)), lerp(var11, grad(this.noise[var4], var9, var7 - 1.0D, var5), grad(this.noise[var18], var9 - 1.0D, var7 - 1.0D, var5))), lerp(var13, lerp(var11, grad(this.noise[var17 + 1], var9, var7, var5 - 1.0D), grad(this.noise[var2 + 1], var9 - 1.0D, var7, var5 - 1.0D)), lerp(var11, grad(this.noise[var4 + 1], var9, var7 - 1.0D, var5 - 1.0D), grad(this.noise[var18 + 1], var9 - 1.0D, var7 - 1.0D, var5 - 1.0D))));
}
}

View File

@ -0,0 +1,16 @@
package com.mojang.minecraft.level.liquid;
public final class LiquidType {
private static LiquidType[] values = new LiquidType[4];
public static final LiquidType NOT_LIQUID = new LiquidType(0);
public static final LiquidType WATER = new LiquidType(1);
public static final LiquidType LAVA = new LiquidType(2);
private LiquidType(int var1) {
values[var1] = this;
}
}

View File

@ -0,0 +1,35 @@
package com.mojang.minecraft.level.tile;
import com.mojang.minecraft.level.tile.a;
public enum Tile$SoundType {
none("none", 0, "-", 0.0F, 0.0F),
grass("grass", 1, "grass", 0.6F, 1.0F),
cloth("cloth", 2, "grass", 0.7F, 1.2F),
gravel("gravel", 3, "gravel", 1.0F, 1.0F),
stone("stone", 4, "stone", 1.0F, 1.0F),
metal("metal", 5, "stone", 1.0F, 2.0F),
wood("wood", 6, "wood", 1.0F, 1.0F);
public final String name;
private final float volume;
private final float pitch;
// $FF: synthetic field
private static final Tile$SoundType[] values = new Tile$SoundType[]{none, grass, cloth, gravel, stone, metal, wood};
private Tile$SoundType(String var1, int var2, String var3, float var4, float var5) {
this.name = var3;
this.volume = var4;
this.pitch = var5;
}
public final float getVolume() {
return this.volume / (a.a.nextFloat() * 0.4F + 1.0F) * 0.5F;
}
public final float getPitch() {
return this.pitch / (a.a.nextFloat() * 0.2F + 0.9F);
}
}

View File

@ -0,0 +1,708 @@
package com.mojang.minecraft.level.tile;
import com.mojang.minecraft.Vector3DCreator;
import com.mojang.minecraft.level.Level;
import com.mojang.minecraft.level.liquid.LiquidType;
import com.mojang.minecraft.level.tile.Tile$SoundType;
import com.mojang.minecraft.level.tile.c;
import com.mojang.minecraft.level.tile.d;
import com.mojang.minecraft.level.tile.e;
import com.mojang.minecraft.level.tile.f;
import com.mojang.minecraft.level.tile.g;
import com.mojang.minecraft.level.tile.h;
import com.mojang.minecraft.level.tile.i;
import com.mojang.minecraft.level.tile.j;
import com.mojang.minecraft.level.tile.k;
import com.mojang.minecraft.level.tile.l;
import com.mojang.minecraft.level.tile.m;
import com.mojang.minecraft.level.tile.n;
import com.mojang.minecraft.level.tile.o;
import com.mojang.minecraft.level.tile.p;
import com.mojang.minecraft.level.tile.q;
import com.mojang.minecraft.level.tile.r;
import com.mojang.minecraft.level.tile.s;
import com.mojang.minecraft.level.tile.t;
import com.mojang.minecraft.model.Vector3D;
import com.mojang.minecraft.phys.AABB;
import java.util.Random;
public class a {
protected static Random a = new Random();
public static final a[] b = new a[256];
public static final boolean[] c = new boolean[256];
private static boolean[] ad = new boolean[256];
private static boolean[] ae = new boolean[256];
public static final boolean[] d = new boolean[256];
private static int[] af = new int[256];
public static final a e;
public static final a f;
public static final a g;
public static final a h;
public static final a i;
public static final a j;
public static final a k;
public static final a l;
public static final a m;
public static final a n;
public static final a o;
public static final a p;
public static final a q;
public static final a r;
public static final a s;
public static final a t;
public static final a u;
public static final a v;
public static final a w;
public static final a x;
public static final a y;
public static final a z;
public static final a A;
public static final a B;
public static final a C;
public static final a D;
public static final a E;
public static final a F;
public static final a G;
public static final a H;
public static final a I;
public static final a J;
public static final a K;
public static final a L;
public static final a M;
public static final a N;
public static final a O;
public static final a P;
public static final a Q;
public static final a R;
public static final a S;
public static final a T;
public static final a U;
public static final a V;
public static final a W;
public static final a X;
public static final a Y;
public static final a Z;
public static final a aa;
public final int ab;
public Tile$SoundType ac;
protected boolean ag;
private float ah;
private float ai;
private float aj;
private float ak;
private float al;
private float am;
protected a(int var1) {
this.ag = true;
b[var1] = this;
this.ab = var1;
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
ad[var1] = this.c();
ae[var1] = this.a();
d[var1] = false;
}
public boolean a() {
return true;
}
protected final void a(boolean var1) {
c[this.ab] = var1;
}
protected final void a(float var1, float var2, float var3, float var4, float var5, float var6) {
this.ah = var1;
this.ai = var2;
this.aj = var3;
this.ak = var4;
this.al = var5;
this.am = var6;
}
protected a(int var1, int var2) {
this(var1);
}
public final void a(int var1) {
af[this.ab] = 16;
}
public AABB a(int var1, int var2, int var3) {
return new AABB((float)var1 + this.ah, (float)var2 + this.ai, (float)var3 + this.aj, (float)var1 + this.ak, (float)var2 + this.al, (float)var3 + this.am);
}
public boolean b() {
return true;
}
public boolean c() {
return true;
}
public void a(Level var1, int var2, int var3, int var4, Random var5) {}
public LiquidType d() {
return LiquidType.NOT_LIQUID;
}
public void a(Level var1, int var2, int var3, int var4, int var5) {}
public void a(Level var1, int var2, int var3, int var4) {}
public int e() {
return 0;
}
public void b(Level var1, int var2, int var3, int var4) {}
public void c(Level var1, int var2, int var3, int var4) {}
public int f() {
return 1;
}
public void a(Level var1, float var2) {
if(!var1.creativeMode) {
int var3 = this.f();
for(int var4 = 0; var4 < var3; ++var4) {
if(a.nextFloat() <= var2) {
a.nextFloat();
a.nextFloat();
a.nextFloat();
}
}
}
}
public final boolean g() {
return this.ag;
}
public final Vector3DCreator a(int var1, int var2, int var3, Vector3D var4, Vector3D var5) {
var4 = var4.add((float)(-var1), (float)(-var2), (float)(-var3));
var5 = var5.add((float)(-var1), (float)(-var2), (float)(-var3));
Vector3D var6 = var4.getXIntersection(var5, this.ah);
Vector3D var7 = var4.getXIntersection(var5, this.ak);
Vector3D var8 = var4.getYIntersection(var5, this.ai);
Vector3D var9 = var4.getYIntersection(var5, this.al);
Vector3D var10 = var4.getZIntersection(var5, this.aj);
var5 = var4.getZIntersection(var5, this.am);
if(!this.a(var6)) {
var6 = null;
}
if(!this.a(var7)) {
var7 = null;
}
if(!this.b(var8)) {
var8 = null;
}
if(!this.b(var9)) {
var9 = null;
}
if(!this.c(var10)) {
var10 = null;
}
if(!this.c(var5)) {
var5 = null;
}
Vector3D var11 = null;
if(var6 != null) {
var11 = var6;
}
if(var7 != null && (var11 == null || var4.distanceSquared(var7) < var4.distanceSquared(var11))) {
var11 = var7;
}
if(var8 != null && (var11 == null || var4.distanceSquared(var8) < var4.distanceSquared(var11))) {
var11 = var8;
}
if(var9 != null && (var11 == null || var4.distanceSquared(var9) < var4.distanceSquared(var11))) {
var11 = var9;
}
if(var10 != null && (var11 == null || var4.distanceSquared(var10) < var4.distanceSquared(var11))) {
var11 = var10;
}
if(var5 != null && (var11 == null || var4.distanceSquared(var5) < var4.distanceSquared(var11))) {
var11 = var5;
}
if(var11 == null) {
return null;
} else {
byte var12 = -1;
if(var11 == var6) {
var12 = 4;
}
if(var11 == var7) {
var12 = 5;
}
if(var11 == var8) {
var12 = 0;
}
if(var11 == var9) {
var12 = 1;
}
if(var11 == var10) {
var12 = 2;
}
if(var11 == var5) {
var12 = 3;
}
return new Vector3DCreator(var1, var2, var3, var12, var11.add((float)var1, (float)var2, (float)var3));
}
}
private boolean a(Vector3D var1) {
return var1 == null?false:var1.y >= this.ai && var1.y <= this.al && var1.z >= this.aj && var1.z <= this.am;
}
private boolean b(Vector3D var1) {
return var1 == null?false:var1.x >= this.ah && var1.x <= this.ak && var1.z >= this.aj && var1.z <= this.am;
}
private boolean c(Vector3D var1) {
return var1 == null?false:var1.x >= this.ah && var1.x <= this.ak && var1.y >= this.ai && var1.y <= this.al;
}
static {
e var10000 = new e(1, 1);
float var0 = 1.0F;
var0 = 1.0F;
var0 = 1.0F;
Tile$SoundType var1 = Tile$SoundType.stone;
e var2 = var10000;
var10000.ac = var1;
boolean var3 = false;
var2.ag = false;
e = var2;
l var22 = new l(2);
var0 = 0.6F;
var0 = 1.0F;
var0 = 0.9F;
var1 = Tile$SoundType.grass;
l var4 = var22;
var22.ac = var1;
f = var4;
c var23 = new c(3, 2);
var0 = 0.5F;
var0 = 1.0F;
var0 = 0.8F;
var1 = Tile$SoundType.grass;
c var5 = var23;
var23.ac = var1;
g = var5;
a var21 = new a(4, 16);
var0 = 1.5F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.stone;
a var6 = var21;
var21.ac = var1;
var3 = false;
var6.ag = false;
h = var6;
var21 = new a(5, 4);
var0 = 1.5F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.wood;
var6 = var21;
var21.ac = var1;
i = var6;
h var20 = new h(6, 15);
var0 = 0.0F;
var0 = 1.0F;
var0 = 0.7F;
var1 = Tile$SoundType.none;
h var7 = var20;
var20.ac = var1;
j = var7;
var21 = new a(7, 17);
var0 = 999.0F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.stone;
var6 = var21;
var21.ac = var1;
var3 = false;
var6.ag = false;
k = var6;
r var18 = new r(8, LiquidType.WATER);
var0 = 100.0F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.none;
r var8 = var18;
var18.ac = var1;
l = var8;
i var19 = new i(9, LiquidType.WATER);
var0 = 100.0F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.none;
i var9 = var19;
var19.ac = var1;
m = var9;
var18 = new r(10, LiquidType.LAVA);
var0 = 100.0F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.none;
var8 = var18;
var18.ac = var1;
n = var8;
var19 = new i(11, LiquidType.LAVA);
var0 = 100.0F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.none;
var9 = var19;
var19.ac = var1;
o = var9;
f var17 = new f(12, 18);
var0 = 0.5F;
var0 = 1.0F;
var0 = 0.8F;
var1 = Tile$SoundType.gravel;
f var10 = var17;
var17.ac = var1;
p = var10;
var17 = new f(13, 19);
var0 = 0.6F;
var0 = 1.0F;
var0 = 0.8F;
var1 = Tile$SoundType.gravel;
var10 = var17;
var17.ac = var1;
q = var10;
n var16 = new n(14, 32);
var0 = 3.0F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.stone;
n var11 = var16;
var16.ac = var1;
var3 = false;
var11.ag = false;
r = var11;
var16 = new n(15, 33);
var0 = 3.0F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.stone;
var11 = var16;
var16.ac = var1;
var3 = false;
var11.ag = false;
s = var11;
var16 = new n(16, 34);
var0 = 3.0F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.stone;
var11 = var16;
var16.ac = var1;
var3 = false;
var11.ag = false;
t = var11;
j var36 = new j(17);
var0 = 2.5F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.wood;
j var12 = var36;
var36.ac = var1;
u = var12;
p var38 = new p(18, 22);
var0 = 0.2F;
var0 = 0.4F;
var0 = 1.0F;
var1 = Tile$SoundType.grass;
p var14 = var38;
var38.ac = var1;
v = var14;
o var37 = new o(19);
var0 = 0.6F;
var0 = 0.9F;
var0 = 1.0F;
var1 = Tile$SoundType.cloth;
o var13 = var37;
var37.ac = var1;
w = var13;
q var39 = new q(20, 49, false);
var0 = 0.3F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.metal;
q var15 = var39;
var39.ac = var1;
x = var15;
var21 = new a(21, 64);
var0 = 0.8F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.cloth;
var6 = var21;
var21.ac = var1;
y = var6;
var21 = new a(22, 65);
var0 = 0.8F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.cloth;
var6 = var21;
var21.ac = var1;
z = var6;
var21 = new a(23, 66);
var0 = 0.8F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.cloth;
var6 = var21;
var21.ac = var1;
A = var6;
var21 = new a(24, 67);
var0 = 0.8F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.cloth;
var6 = var21;
var21.ac = var1;
B = var6;
var21 = new a(25, 68);
var0 = 0.8F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.cloth;
var6 = var21;
var21.ac = var1;
C = var6;
var21 = new a(26, 69);
var0 = 0.8F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.cloth;
var6 = var21;
var21.ac = var1;
D = var6;
var21 = new a(27, 70);
var0 = 0.8F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.cloth;
var6 = var21;
var21.ac = var1;
E = var6;
var21 = new a(28, 71);
var0 = 0.8F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.cloth;
var6 = var21;
var21.ac = var1;
F = var6;
var21 = new a(29, 72);
var0 = 0.8F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.cloth;
var6 = var21;
var21.ac = var1;
G = var6;
var21 = new a(30, 73);
var0 = 0.8F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.cloth;
var6 = var21;
var21.ac = var1;
H = var6;
var21 = new a(31, 74);
var0 = 0.8F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.cloth;
var6 = var21;
var21.ac = var1;
I = var6;
var21 = new a(32, 75);
var0 = 0.8F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.cloth;
var6 = var21;
var21.ac = var1;
J = var6;
var21 = new a(33, 76);
var0 = 0.8F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.cloth;
var6 = var21;
var21.ac = var1;
K = var6;
var21 = new a(34, 77);
var0 = 0.8F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.cloth;
var6 = var21;
var21.ac = var1;
L = var6;
var21 = new a(35, 78);
var0 = 0.8F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.cloth;
var6 = var21;
var21.ac = var1;
M = var6;
var21 = new a(36, 79);
var0 = 0.8F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.cloth;
var6 = var21;
var21.ac = var1;
N = var6;
m var34 = new m(37, 13);
var0 = 0.0F;
var0 = 1.0F;
var0 = 0.7F;
var1 = Tile$SoundType.none;
m var25 = var34;
var34.ac = var1;
O = var25;
var34 = new m(38, 12);
var0 = 0.0F;
var0 = 1.0F;
var0 = 0.7F;
var1 = Tile$SoundType.none;
var25 = var34;
var34.ac = var1;
P = var25;
t var35 = new t(39, 29);
var0 = 0.0F;
var0 = 1.0F;
var0 = 0.7F;
var1 = Tile$SoundType.none;
t var24 = var35;
var35.ac = var1;
Q = var24;
var35 = new t(40, 28);
var0 = 0.0F;
var0 = 1.0F;
var0 = 0.7F;
var1 = Tile$SoundType.none;
var24 = var35;
var35.ac = var1;
R = var24;
d var30 = new d(41, 40);
var0 = 3.0F;
var0 = 1.0F;
var0 = 0.7F;
var1 = Tile$SoundType.metal;
d var27 = var30;
var30.ac = var1;
var3 = false;
var27.ag = false;
S = var27;
var30 = new d(42, 39);
var0 = 5.0F;
var0 = 1.0F;
var0 = 0.7F;
var1 = Tile$SoundType.metal;
var27 = var30;
var30.ac = var1;
var3 = false;
var27.ag = false;
T = var27;
k var31 = new k(43, true);
var0 = 2.0F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.stone;
k var26 = var31;
var31.ac = var1;
var3 = false;
var26.ag = false;
U = var26;
var31 = new k(44, false);
var0 = 2.0F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.stone;
var26 = var31;
var31.ac = var1;
var3 = false;
var26.ag = false;
V = var26;
var21 = new a(45, 7);
var0 = 2.0F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.stone;
var6 = var21;
var21.ac = var1;
var3 = false;
var6.ag = false;
W = var6;
s var32 = new s(46, 8);
var0 = 0.0F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.cloth;
s var28 = var32;
var32.ac = var1;
X = var28;
g var33 = new g(47, 35);
var0 = 1.5F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.wood;
g var29 = var33;
var33.ac = var1;
Y = var29;
var21 = new a(48, 36);
var0 = 1.0F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.stone;
var6 = var21;
var21.ac = var1;
var3 = false;
var6.ag = false;
Z = var6;
var10000 = new e(49, 37);
var0 = 10.0F;
var0 = 1.0F;
var0 = 1.0F;
var1 = Tile$SoundType.stone;
var2 = var10000;
var10000.ac = var1;
var3 = false;
var2.ag = false;
aa = var2;
}
}

View File

@ -0,0 +1,18 @@
package com.mojang.minecraft.level.tile;
import com.mojang.minecraft.level.tile.a;
public class b extends a {
protected b(int var1, int var2, boolean var3) {
super(var1, var2);
}
public final boolean c() {
return false;
}
public final boolean b() {
return false;
}
}

View File

@ -0,0 +1,10 @@
package com.mojang.minecraft.level.tile;
import com.mojang.minecraft.level.tile.a;
public final class c extends a {
protected c(int var1, int var2) {
super(3, 2);
}
}

View File

@ -0,0 +1,10 @@
package com.mojang.minecraft.level.tile;
import com.mojang.minecraft.level.tile.a;
public final class d extends a {
public d(int var1, int var2) {
super(var1);
}
}

View File

@ -0,0 +1,10 @@
package com.mojang.minecraft.level.tile;
import com.mojang.minecraft.level.tile.a;
public final class e extends a {
public e(int var1, int var2) {
super(var1, var2);
}
}

View File

@ -0,0 +1,45 @@
package com.mojang.minecraft.level.tile;
import com.mojang.minecraft.level.Level;
import com.mojang.minecraft.level.liquid.LiquidType;
import com.mojang.minecraft.level.tile.a;
public final class f extends a {
public f(int var1, int var2) {
super(var1, var2);
}
public final void a(Level var1, int var2, int var3, int var4) {
this.d(var1, var2, var3, var4);
}
public final void a(Level var1, int var2, int var3, int var4, int var5) {
this.d(var1, var2, var3, var4);
}
private void d(Level var1, int var2, int var3, int var4) {
int var11 = var2;
int var5 = var3;
int var6 = var4;
while(true) {
int var8 = var5 - 1;
int var10;
LiquidType var12;
if(!((var10 = var1.getTile(var11, var8, var6)) == 0?true:((var12 = b[var10].d()) == LiquidType.WATER?true:var12 == LiquidType.LAVA)) || var5 <= 0) {
if(var5 != var3) {
if((var10 = var1.getTile(var11, var5, var6)) > 0 && b[var10].d() != LiquidType.NOT_LIQUID) {
var1.setTileNoUpdate(var11, var5, var6, 0);
}
var1.swap(var2, var3, var4, var11, var5, var6);
}
return;
}
--var5;
}
}
}

View File

@ -0,0 +1,14 @@
package com.mojang.minecraft.level.tile;
import com.mojang.minecraft.level.tile.a;
public final class g extends a {
public g(int var1, int var2) {
super(47, 35);
}
public final int f() {
return 0;
}
}

View File

@ -0,0 +1,32 @@
package com.mojang.minecraft.level.tile;
import com.mojang.minecraft.level.Level;
import com.mojang.minecraft.level.tile.a;
import com.mojang.minecraft.level.tile.m;
import java.util.Random;
public final class h extends m {
protected h(int var1, int var2) {
super(6, 15);
float var3 = 0.4F;
this.a(0.5F - var3, 0.0F, 0.5F - var3, var3 + 0.5F, var3 * 2.0F, var3 + 0.5F);
}
public final void a(Level var1, int var2, int var3, int var4, Random var5) {
if(var1.growTrees) {
int var6 = var1.getTile(var2, var3 - 1, var4);
if(var1.isLit(var2, var3, var4) && (var6 == g.ab || var6 == f.ab)) {
if(var5.nextInt(5) == 0) {
var1.setTileNoUpdate(var2, var3, var4, 0);
if(!var1.maybeGrowTree(var2, var3, var4)) {
var1.setTileNoUpdate(var2, var3, var4, this.ab);
}
}
} else {
var1.setTile(var2, var3, var4, 0);
}
}
}
}

View File

@ -0,0 +1,56 @@
package com.mojang.minecraft.level.tile;
import com.mojang.minecraft.level.Level;
import com.mojang.minecraft.level.liquid.LiquidType;
import com.mojang.minecraft.level.tile.a;
import com.mojang.minecraft.level.tile.r;
import java.util.Random;
public final class i extends r {
protected i(int var1, LiquidType var2) {
super(var1, var2);
this.af = var1 - 1;
this.ae = var1;
this.a(false);
}
public final void a(Level var1, int var2, int var3, int var4, Random var5) {}
public final void a(Level var1, int var2, int var3, int var4, int var5) {
boolean var6 = false;
if(var1.getTile(var2 - 1, var3, var4) == 0) {
var6 = true;
}
if(var1.getTile(var2 + 1, var3, var4) == 0) {
var6 = true;
}
if(var1.getTile(var2, var3, var4 - 1) == 0) {
var6 = true;
}
if(var1.getTile(var2, var3, var4 + 1) == 0) {
var6 = true;
}
if(var1.getTile(var2, var3 - 1, var4) == 0) {
var6 = true;
}
if(var5 != 0) {
LiquidType var7 = b[var5].d();
if(this.ad == LiquidType.WATER && var7 == LiquidType.LAVA || var7 == LiquidType.WATER && this.ad == LiquidType.LAVA) {
var1.setTile(var2, var3, var4, e.ab);
return;
}
}
if(var6) {
var1.setTileNoUpdate(var2, var3, var4, this.af);
var1.addToTickNextTick(var2, var3, var4, this.af);
}
}
}

View File

@ -0,0 +1,14 @@
package com.mojang.minecraft.level.tile;
import com.mojang.minecraft.level.tile.a;
public final class j extends a {
protected j(int var1) {
super(17);
}
public final int f() {
return a.nextInt(3) + 3;
}
}

View File

@ -0,0 +1,45 @@
package com.mojang.minecraft.level.tile;
import com.mojang.minecraft.level.Level;
import com.mojang.minecraft.level.tile.a;
public final class k extends a {
private boolean ad;
public k(int var1, boolean var2) {
super(var1, 6);
this.ad = var2;
if(!var2) {
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
}
}
public final boolean c() {
return this.ad;
}
public final void a(Level var1, int var2, int var3, int var4, int var5) {
if(this == V) {
;
}
}
public final void b(Level var1, int var2, int var3, int var4) {
if(this != V) {
super.b(var1, var2, var3, var4);
}
if(var1.getTile(var2, var3 - 1, var4) == V.ab) {
var1.setTile(var2, var3, var4, 0);
var1.setTile(var2, var3 - 1, var4, U.ab);
}
}
public final boolean a() {
return this.ad;
}
}

View File

@ -0,0 +1,31 @@
package com.mojang.minecraft.level.tile;
import com.mojang.minecraft.level.Level;
import com.mojang.minecraft.level.tile.a;
import java.util.Random;
public final class l extends a {
protected l(int var1) {
super(2);
this.a(true);
}
public final void a(Level var1, int var2, int var3, int var4, Random var5) {
if(var5.nextInt(4) == 0) {
if(!var1.isLit(var2, var3, var4)) {
var1.setTile(var2, var3, var4, g.ab);
} else {
for(int var9 = 0; var9 < 4; ++var9) {
int var6 = var2 + var5.nextInt(3) - 1;
int var7 = var3 + var5.nextInt(5) - 3;
int var8 = var4 + var5.nextInt(3) - 1;
if(var1.getTile(var6, var7, var8) == g.ab && var1.isLit(var6, var7, var8)) {
var1.setTile(var6, var7, var8, f.ab);
}
}
}
}
}
}

View File

@ -0,0 +1,40 @@
package com.mojang.minecraft.level.tile;
import com.mojang.minecraft.level.Level;
import com.mojang.minecraft.level.tile.a;
import com.mojang.minecraft.phys.AABB;
import java.util.Random;
public class m extends a {
protected m(int var1, int var2) {
super(var1);
this.a(true);
float var3 = 0.2F;
this.a(0.5F - var3, 0.0F, 0.5F - var3, var3 + 0.5F, var3 * 3.0F, var3 + 0.5F);
}
public void a(Level var1, int var2, int var3, int var4, Random var5) {
int var6 = var1.getTile(var2, var3 - 1, var4);
if(!var1.isLit(var2, var3, var4) || var6 != g.ab && var6 != f.ab) {
var1.setTile(var2, var3, var4, 0);
}
}
public final AABB a(int var1, int var2, int var3) {
return null;
}
public final boolean b() {
return false;
}
public final boolean c() {
return false;
}
public final boolean a() {
return false;
}
}

View File

@ -0,0 +1,14 @@
package com.mojang.minecraft.level.tile;
import com.mojang.minecraft.level.tile.a;
public final class n extends a {
public n(int var1, int var2) {
super(var1, var2);
}
public final int f() {
return a.nextInt(3) + 1;
}
}

View File

@ -0,0 +1,35 @@
package com.mojang.minecraft.level.tile;
import com.mojang.minecraft.level.Level;
import com.mojang.minecraft.level.tile.a;
public final class o extends a {
protected o(int var1) {
super(19);
}
public final void b(Level var1, int var2, int var3, int var4) {
for(int var7 = var2 - 2; var7 <= var2 + 2; ++var7) {
for(int var5 = var3 - 2; var5 <= var3 + 2; ++var5) {
for(int var6 = var4 - 2; var6 <= var4 + 2; ++var6) {
if(var1.isWater(var7, var5, var6)) {
var1.setTileNoNeighborChange(var7, var5, var6, 0);
}
}
}
}
}
public final void c(Level var1, int var2, int var3, int var4) {
for(int var7 = var2 - 2; var7 <= var2 + 2; ++var7) {
for(int var5 = var3 - 2; var5 <= var3 + 2; ++var5) {
for(int var6 = var4 - 2; var6 <= var4 + 2; ++var6) {
var1.updateNeighborsAt(var7, var5, var6, var1.getTile(var7, var5, var6));
}
}
}
}
}

View File

@ -0,0 +1,14 @@
package com.mojang.minecraft.level.tile;
import com.mojang.minecraft.level.tile.b;
public final class p extends b {
protected p(int var1, int var2) {
super(18, 22, true);
}
public final int f() {
return a.nextInt(10) == 0?1:0;
}
}

View File

@ -0,0 +1,18 @@
package com.mojang.minecraft.level.tile;
import com.mojang.minecraft.level.tile.a;
public final class q extends a {
protected q(int var1, int var2, boolean var3) {
super(20, 49);
}
public final boolean c() {
return false;
}
public final boolean b() {
return false;
}
}

View File

@ -0,0 +1,140 @@
package com.mojang.minecraft.level.tile;
import com.mojang.minecraft.level.Level;
import com.mojang.minecraft.level.liquid.LiquidType;
import com.mojang.minecraft.level.tile.a;
import com.mojang.minecraft.phys.AABB;
import java.util.Random;
public class r extends a {
protected LiquidType ad;
protected int ae;
protected int af;
protected r(int var1, LiquidType var2) {
super(var1);
this.ad = var2;
d[var1] = true;
this.af = var1;
this.ae = var1 + 1;
float var4 = 0.01F;
float var3 = 0.1F;
this.a(var4 + 0.0F, 0.0F - var3 + var4, var4 + 0.0F, var4 + 1.0F, 1.0F - var3 + var4, var4 + 1.0F);
this.a(true);
if(var2 == LiquidType.LAVA) {
this.a(16);
}
}
public final boolean a() {
return false;
}
public final void a(Level var1, int var2, int var3, int var4) {
var1.addToTickNextTick(var2, var3, var4, this.af);
}
public void a(Level var1, int var2, int var3, int var4, Random var5) {
boolean var7 = false;
var4 = var4;
var3 = var3;
var2 = var2;
var1 = var1;
boolean var8 = false;
boolean var6;
do {
--var3;
if(var1.getTile(var2, var3, var4) != 0 || !this.d(var1, var2, var3, var4)) {
break;
}
if(var6 = var1.setTile(var2, var3, var4, this.af)) {
var8 = true;
}
} while(var6 && this.ad != LiquidType.LAVA);
++var3;
if(this.ad == LiquidType.WATER || !var8) {
var8 = var8 | this.e(var1, var2 - 1, var3, var4) | this.e(var1, var2 + 1, var3, var4) | this.e(var1, var2, var3, var4 - 1) | this.e(var1, var2, var3, var4 + 1);
}
if(!var8) {
var1.setTileNoUpdate(var2, var3, var4, this.ae);
} else {
var1.addToTickNextTick(var2, var3, var4, this.af);
}
}
private boolean d(Level var1, int var2, int var3, int var4) {
if(this.ad == LiquidType.WATER) {
for(int var7 = var2 - 2; var7 <= var2 + 2; ++var7) {
for(int var5 = var3 - 2; var5 <= var3 + 2; ++var5) {
for(int var6 = var4 - 2; var6 <= var4 + 2; ++var6) {
if(var1.getTile(var7, var5, var6) == w.ab) {
return false;
}
}
}
}
}
return true;
}
private boolean e(Level var1, int var2, int var3, int var4) {
if(var1.getTile(var2, var3, var4) == 0) {
if(!this.d(var1, var2, var3, var4)) {
return false;
}
if(var1.setTile(var2, var3, var4, this.af)) {
var1.addToTickNextTick(var2, var3, var4, this.af);
}
}
return false;
}
public final AABB a(int var1, int var2, int var3) {
return null;
}
public final boolean b() {
return true;
}
public final boolean c() {
return false;
}
public final LiquidType d() {
return this.ad;
}
public void a(Level var1, int var2, int var3, int var4, int var5) {
if(var5 != 0) {
LiquidType var6 = b[var5].d();
if(this.ad == LiquidType.WATER && var6 == LiquidType.LAVA || var6 == LiquidType.WATER && this.ad == LiquidType.LAVA) {
var1.setTile(var2, var3, var4, e.ab);
return;
}
}
var1.addToTickNextTick(var2, var3, var4, var5);
}
public final int e() {
return this.ad == LiquidType.LAVA?5:0;
}
public final void a(Level var1, float var2) {}
public final int f() {
return 0;
}
}

View File

@ -0,0 +1,14 @@
package com.mojang.minecraft.level.tile;
import com.mojang.minecraft.level.tile.a;
public final class s extends a {
public s(int var1, int var2) {
super(46, 8);
}
public final int f() {
return 0;
}
}

View File

@ -0,0 +1,23 @@
package com.mojang.minecraft.level.tile;
import com.mojang.minecraft.level.Level;
import com.mojang.minecraft.level.tile.a;
import com.mojang.minecraft.level.tile.m;
import java.util.Random;
public final class t extends m {
protected t(int var1, int var2) {
super(var1, var2);
float var3 = 0.2F;
this.a(0.5F - var3, 0.0F, 0.5F - var3, var3 + 0.5F, var3 * 2.0F, var3 + 0.5F);
}
public final void a(Level var1, int var2, int var3, int var4, Random var5) {
int var6 = var1.getTile(var2, var3 - 1, var4);
if(var1.isLit(var2, var3, var4) || var6 != e.ab && var6 != q.ab && var6 != h.ab) {
var1.setTile(var2, var3, var4, 0);
}
}
}

View File

@ -0,0 +1,60 @@
package com.mojang.minecraft.model;
import com.mojang.util.MathHelper;
public final class Vector3D {
public float x;
public float y;
public float z;
public Vector3D(float var1, float var2, float var3) {
this.x = var1;
this.y = var2;
this.z = var3;
}
public final Vector3D add(float var1, float var2, float var3) {
return new Vector3D(this.x + var1, this.y + var2, this.z + var3);
}
public final float distanceSquared(Vector3D var1) {
float var2 = var1.x - this.x;
float var3 = var1.y - this.y;
float var4 = var1.z - this.z;
return MathHelper.sqrt(var2 * var2 + var3 * var3 + var4 * var4);
}
public final float distance(Vector3D var1) {
float var2 = var1.x - this.x;
float var3 = var1.y - this.y;
float var4 = var1.z - this.z;
return var2 * var2 + var3 * var3 + var4 * var4;
}
public final Vector3D getXIntersection(Vector3D var1, float var2) {
float var3 = var1.x - this.x;
float var4 = var1.y - this.y;
float var5 = var1.z - this.z;
return var3 * var3 < 1.0E-7F?null:((var2 = (var2 - this.x) / var3) >= 0.0F && var2 <= 1.0F?new Vector3D(this.x + var3 * var2, this.y + var4 * var2, this.z + var5 * var2):null);
}
public final Vector3D getYIntersection(Vector3D var1, float var2) {
float var3 = var1.x - this.x;
float var4 = var1.y - this.y;
float var5 = var1.z - this.z;
return var4 * var4 < 1.0E-7F?null:((var2 = (var2 - this.y) / var4) >= 0.0F && var2 <= 1.0F?new Vector3D(this.x + var3 * var2, this.y + var4 * var2, this.z + var5 * var2):null);
}
public final Vector3D getZIntersection(Vector3D var1, float var2) {
float var3 = var1.x - this.x;
float var4 = var1.y - this.y;
float var5;
return (var5 = var1.z - this.z) * var5 < 1.0E-7F?null:((var2 = (var2 - this.z) / var5) >= 0.0F && var2 <= 1.0F?new Vector3D(this.x + var3 * var2, this.y + var4 * var2, this.z + var5 * var2):null);
}
public final String toString() {
return "(" + this.x + ", " + this.y + ", " + this.z + ")";
}
}

View File

@ -0,0 +1,60 @@
package com.mojang.minecraft.net;
public final class PacketType {
public static final PacketType[] packets = new PacketType[256];
public static final PacketType INDENTIFICATION = new PacketType(new Class[]{Byte.TYPE, String.class, String.class, Byte.TYPE});
public static final PacketType PING = new PacketType(new Class[0]);
public static final PacketType LEVEL_INITIALIZE = new PacketType(new Class[0]);
public static final PacketType LEVEL_DATA_CHUNK = new PacketType(new Class[]{Short.TYPE, byte[].class, Byte.TYPE});
public static final PacketType LEVEL_FINALIZE = new PacketType(new Class[]{Short.TYPE, Short.TYPE, Short.TYPE});
public static final PacketType PLAYER_SET_BLOCK = new PacketType(new Class[]{Short.TYPE, Short.TYPE, Short.TYPE, Byte.TYPE, Byte.TYPE});
public static final PacketType BLOCK_CHANGE = new PacketType(new Class[]{Short.TYPE, Short.TYPE, Short.TYPE, Byte.TYPE});
public static final PacketType SPAWN_PLAYER = new PacketType(new Class[]{Byte.TYPE, String.class, Short.TYPE, Short.TYPE, Short.TYPE, Byte.TYPE, Byte.TYPE});
public static final PacketType POSITION_ROTATION = new PacketType(new Class[]{Byte.TYPE, Short.TYPE, Short.TYPE, Short.TYPE, Byte.TYPE, Byte.TYPE});
public static final PacketType POSITION_ROTATION_UPDATE = new PacketType(new Class[]{Byte.TYPE, Byte.TYPE, Byte.TYPE, Byte.TYPE, Byte.TYPE, Byte.TYPE});
public static final PacketType POSITION_UPDATE = new PacketType(new Class[]{Byte.TYPE, Byte.TYPE, Byte.TYPE, Byte.TYPE});
public static final PacketType ROTATION_UPDATE = new PacketType(new Class[]{Byte.TYPE, Byte.TYPE, Byte.TYPE});
public static final PacketType DESPAWN_PLAYER = new PacketType(new Class[]{Byte.TYPE});
public static final PacketType CHAT_MESSAGE = new PacketType(new Class[]{Byte.TYPE, String.class});
public static final PacketType DISCONNECT = new PacketType(new Class[]{String.class});
public static final PacketType UPDATE_PLAYER_TYPE = new PacketType(new Class[]{Byte.TYPE});
public final int length;
private static int nextOpcode = 0;
public final byte opCode;
public Class[] params;
private PacketType(Class ... var1) {
this.opCode = (byte)(nextOpcode++);
packets[this.opCode] = this;
this.params = new Class[var1.length];
int var2 = 0;
for(int var3 = 0; var3 < var1.length; ++var3) {
Class var4 = var1[var3];
this.params[var3] = var4;
if(var4 == Long.TYPE) {
var2 += 8;
} else if(var4 == Integer.TYPE) {
var2 += 4;
} else if(var4 == Short.TYPE) {
var2 += 2;
} else if(var4 == Byte.TYPE) {
++var2;
} else if(var4 == Float.TYPE) {
var2 += 4;
} else if(var4 == Double.TYPE) {
var2 += 8;
} else if(var4 == byte[].class) {
var2 += 1024;
} else if(var4 == String.class) {
var2 += 64;
}
}
this.length = var2;
}
}

View File

@ -0,0 +1,5 @@
package com.mojang.minecraft.net;
public final class UNKNOWN0 {
}

View File

@ -0,0 +1,308 @@
package com.mojang.minecraft.phys;
import com.mojang.minecraft.Vector3DCreator;
import com.mojang.minecraft.model.Vector3D;
import java.io.Serializable;
public class AABB implements Serializable {
public static final long serialVersionUID = 0L;
private float epsilon = 0.0F;
public float x0;
public float y0;
public float z0;
public float x1;
public float y1;
public float z1;
public AABB(float var1, float var2, float var3, float var4, float var5, float var6) {
this.x0 = var1;
this.y0 = var2;
this.z0 = var3;
this.x1 = var4;
this.y1 = var5;
this.z1 = var6;
}
public AABB expand(float var1, float var2, float var3) {
float var4 = this.x0;
float var5 = this.y0;
float var6 = this.z0;
float var7 = this.x1;
float var8 = this.y1;
float var9 = this.z1;
if(var1 < 0.0F) {
var4 += var1;
}
if(var1 > 0.0F) {
var7 += var1;
}
if(var2 < 0.0F) {
var5 += var2;
}
if(var2 > 0.0F) {
var8 += var2;
}
if(var3 < 0.0F) {
var6 += var3;
}
if(var3 > 0.0F) {
var9 += var3;
}
return new AABB(var4, var5, var6, var7, var8, var9);
}
public AABB grow(float var1, float var2, float var3) {
float var4 = this.x0 - var1;
float var5 = this.y0 - var2;
float var6 = this.z0 - var3;
var1 += this.x1;
var2 += this.y1;
float var7 = this.z1 + var3;
return new AABB(var4, var5, var6, var1, var2, var7);
}
public AABB cloneMove(float var1, float var2, float var3) {
return new AABB(this.x0 + var3, this.y0 + var2, this.z0 + var3, this.x1 + var1, this.y1 + var2, this.z1 + var3);
}
public float clipXCollide(AABB var1, float var2) {
if(var1.y1 > this.y0 && var1.y0 < this.y1) {
if(var1.z1 > this.z0 && var1.z0 < this.z1) {
float var3;
if(var2 > 0.0F && var1.x1 <= this.x0 && (var3 = this.x0 - var1.x1 - this.epsilon) < var2) {
var2 = var3;
}
if(var2 < 0.0F && var1.x0 >= this.x1 && (var3 = this.x1 - var1.x0 + this.epsilon) > var2) {
var2 = var3;
}
return var2;
} else {
return var2;
}
} else {
return var2;
}
}
public float clipYCollide(AABB var1, float var2) {
if(var1.x1 > this.x0 && var1.x0 < this.x1) {
if(var1.z1 > this.z0 && var1.z0 < this.z1) {
float var3;
if(var2 > 0.0F && var1.y1 <= this.y0 && (var3 = this.y0 - var1.y1 - this.epsilon) < var2) {
var2 = var3;
}
if(var2 < 0.0F && var1.y0 >= this.y1 && (var3 = this.y1 - var1.y0 + this.epsilon) > var2) {
var2 = var3;
}
return var2;
} else {
return var2;
}
} else {
return var2;
}
}
public float clipZCollide(AABB var1, float var2) {
if(var1.x1 > this.x0 && var1.x0 < this.x1) {
if(var1.y1 > this.y0 && var1.y0 < this.y1) {
float var3;
if(var2 > 0.0F && var1.z1 <= this.z0 && (var3 = this.z0 - var1.z1 - this.epsilon) < var2) {
var2 = var3;
}
if(var2 < 0.0F && var1.z0 >= this.z1 && (var3 = this.z1 - var1.z0 + this.epsilon) > var2) {
var2 = var3;
}
return var2;
} else {
return var2;
}
} else {
return var2;
}
}
public boolean intersects(AABB var1) {
return var1.x1 > this.x0 && var1.x0 < this.x1?(var1.y1 > this.y0 && var1.y0 < this.y1?var1.z1 > this.z0 && var1.z0 < this.z1:false):false;
}
public boolean intersectsInner(AABB var1) {
return var1.x1 >= this.x0 && var1.x0 <= this.x1?(var1.y1 >= this.y0 && var1.y0 <= this.y1?var1.z1 >= this.z0 && var1.z0 <= this.z1:false):false;
}
public void move(float var1, float var2, float var3) {
this.x0 += var1;
this.y0 += var2;
this.z0 += var3;
this.x1 += var1;
this.y1 += var2;
this.z1 += var3;
}
public boolean intersects(float var1, float var2, float var3, float var4, float var5, float var6) {
return var4 > this.x0 && var1 < this.x1?(var5 > this.y0 && var2 < this.y1?var6 > this.z0 && var3 < this.z1:false):false;
}
public boolean contains(Vector3D var1) {
return var1.x > this.x0 && var1.x < this.x1?(var1.y > this.y0 && var1.y < this.y1?var1.z > this.z0 && var1.z < this.z1:false):false;
}
public float getSize() {
float var1 = this.x1 - this.x0;
float var2 = this.y1 - this.y0;
float var3 = this.z1 - this.z0;
return (var1 + var2 + var3) / 3.0F;
}
public AABB shrink(float var1, float var2, float var3) {
float var4 = this.x0;
float var5 = this.y0;
float var6 = this.z0;
float var7 = this.x1;
float var8 = this.y1;
float var9 = this.z1;
if(var1 < 0.0F) {
var4 -= var1;
}
if(var1 > 0.0F) {
var7 -= var1;
}
if(var2 < 0.0F) {
var5 -= var2;
}
if(var2 > 0.0F) {
var8 -= var2;
}
if(var3 < 0.0F) {
var6 -= var3;
}
if(var3 > 0.0F) {
var9 -= var3;
}
return new AABB(var4, var5, var6, var7, var8, var9);
}
public AABB copy() {
return new AABB(this.x0, this.y0, this.z0, this.x1, this.y1, this.z1);
}
public Vector3DCreator clip(Vector3D var1, Vector3D var2) {
Vector3D var3 = var1.getXIntersection(var2, this.x0);
Vector3D var4 = var1.getXIntersection(var2, this.x1);
Vector3D var5 = var1.getYIntersection(var2, this.y0);
Vector3D var6 = var1.getYIntersection(var2, this.y1);
Vector3D var7 = var1.getZIntersection(var2, this.z0);
var2 = var1.getZIntersection(var2, this.z1);
if(!this.a(var3)) {
var3 = null;
}
if(!this.a(var4)) {
var4 = null;
}
if(!this.b(var5)) {
var5 = null;
}
if(!this.b(var6)) {
var6 = null;
}
if(!this.c(var7)) {
var7 = null;
}
if(!this.c(var2)) {
var2 = null;
}
Vector3D var8 = null;
if(var3 != null) {
var8 = var3;
}
if(var4 != null && (var8 == null || var1.distance(var4) < var1.distance(var8))) {
var8 = var4;
}
if(var5 != null && (var8 == null || var1.distance(var5) < var1.distance(var8))) {
var8 = var5;
}
if(var6 != null && (var8 == null || var1.distance(var6) < var1.distance(var8))) {
var8 = var6;
}
if(var7 != null && (var8 == null || var1.distance(var7) < var1.distance(var8))) {
var8 = var7;
}
if(var2 != null && (var8 == null || var1.distance(var2) < var1.distance(var8))) {
var8 = var2;
}
if(var8 == null) {
return null;
} else {
byte var9 = -1;
if(var8 == var3) {
var9 = 4;
}
if(var8 == var4) {
var9 = 5;
}
if(var8 == var5) {
var9 = 0;
}
if(var8 == var6) {
var9 = 1;
}
if(var8 == var7) {
var9 = 2;
}
if(var8 == var2) {
var9 = 3;
}
return new Vector3DCreator(0, 0, 0, var9, var8);
}
}
private boolean a(Vector3D var1) {
return var1 == null?false:var1.y >= this.y0 && var1.y <= this.y1 && var1.z >= this.z0 && var1.z <= this.z1;
}
private boolean b(Vector3D var1) {
return var1 == null?false:var1.x >= this.x0 && var1.x <= this.x1 && var1.z >= this.z0 && var1.z <= this.z1;
}
private boolean c(Vector3D var1) {
return var1 == null?false:var1.x >= this.x0 && var1.x <= this.x1 && var1.y >= this.y0 && var1.y <= this.y1;
}
}

View File

@ -0,0 +1,18 @@
package com.mojang.minecraft.render;
public final class Frustrum {
public float[][] frustrum = new float[16][16];
public final boolean isBoxInFrustrum(float var1, float var2, float var3, float var4, float var5, float var6) {
for(int var7 = 0; var7 < 6; ++var7) {
if(this.frustrum[var7][0] * var1 + this.frustrum[var7][1] * var2 + this.frustrum[var7][2] * var3 + this.frustrum[var7][3] <= 0.0F && this.frustrum[var7][0] * var4 + this.frustrum[var7][1] * var2 + this.frustrum[var7][2] * var3 + this.frustrum[var7][3] <= 0.0F && this.frustrum[var7][0] * var1 + this.frustrum[var7][1] * var5 + this.frustrum[var7][2] * var3 + this.frustrum[var7][3] <= 0.0F && this.frustrum[var7][0] * var4 + this.frustrum[var7][1] * var5 + this.frustrum[var7][2] * var3 + this.frustrum[var7][3] <= 0.0F && this.frustrum[var7][0] * var1 + this.frustrum[var7][1] * var2 + this.frustrum[var7][2] * var6 + this.frustrum[var7][3] <= 0.0F && this.frustrum[var7][0] * var4 + this.frustrum[var7][1] * var2 + this.frustrum[var7][2] * var6 + this.frustrum[var7][3] <= 0.0F && this.frustrum[var7][0] * var1 + this.frustrum[var7][1] * var5 + this.frustrum[var7][2] * var6 + this.frustrum[var7][3] <= 0.0F && this.frustrum[var7][0] * var4 + this.frustrum[var7][1] * var5 + this.frustrum[var7][2] * var6 + this.frustrum[var7][3] <= 0.0F) {
return false;
}
}
return true;
}
}

View File

@ -0,0 +1,5 @@
package com.mojang.minecraft.render;
public interface UNKNOWN0 {
}

View File

@ -0,0 +1,36 @@
package com.mojang.minecraft.server;
import com.mojang.minecraft.server.MinecraftServer;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
final class ConsoleInput extends Thread {
// $FF: synthetic field
private MinecraftServer server;
ConsoleInput(MinecraftServer var1) {
super();
this.server = var1;
}
public final void run() {
try {
BufferedReader var1 = new BufferedReader(new InputStreamReader(System.in));
String var2 = null;
while((var2 = var1.readLine()) != null) {
synchronized(MinecraftServer.a(this.server)) {
MinecraftServer.a(this.server).add(var2);
}
}
MinecraftServer.logger.warning("stdin: end of file! No more direct console input is possible.");
} catch (IOException var5) {
MinecraftServer.logger.warning("stdin: ioexception! No more direct console input is possible.");
var5.printStackTrace();
}
}
}

View File

@ -0,0 +1,67 @@
package com.mojang.minecraft.server;
import com.mojang.minecraft.server.MinecraftServer;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.FileWriter;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.URL;
final class HeartbeatManager extends Thread {
// $FF: synthetic field
private String name;
// $FF: synthetic field
private MinecraftServer server;
HeartbeatManager(MinecraftServer var1, String var2) {
super();
this.server = var1;
this.name = var2;
}
public final void run() {
HttpURLConnection var1 = null;
try {
(var1 = (HttpURLConnection)(new URL("http://www.minecraft.net/heartbeat.jsp")).openConnection()).setRequestMethod("POST");
var1.setDoOutput(true);
var1.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
var1.setRequestProperty("Content-Length", "" + Integer.toString(this.name.getBytes().length));
var1.setRequestProperty("Content-Language", "en-US");
var1.setUseCaches(false);
var1.setDoInput(true);
var1.setDoOutput(true);
var1.connect();
DataOutputStream var2;
(var2 = new DataOutputStream(var1.getOutputStream())).writeBytes(this.name);
var2.flush();
var2.close();
BufferedReader var9;
String var3 = (var9 = new BufferedReader(new InputStreamReader(var1.getInputStream()))).readLine();
if(!MinecraftServer.b(this.server).equals(var3)) {
MinecraftServer.logger.info("To connect directly to this server, surf to: " + var3);
PrintWriter var4;
(var4 = new PrintWriter(new FileWriter("externalurl.txt"))).println(var3);
var4.close();
MinecraftServer.logger.info("(This is also in externalurl.txt)");
MinecraftServer.a(this.server, var3);
}
var9.close();
return;
} catch (Exception var7) {
MinecraftServer.logger.severe("Failed to assemble heartbeat: " + var7);
var7.printStackTrace();
} finally {
if(var1 != null) {
var1.disconnect();
}
}
}
}

View File

@ -0,0 +1,44 @@
package com.mojang.minecraft.server;
import com.mojang.minecraft.server.NetworkManager;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.util.zip.GZIPOutputStream;
final class LevelSaver extends Thread {
// $FF: synthetic field
private byte[] bytes;
// $FF: synthetic field
private NetworkManager networkManager;
LevelSaver(NetworkManager var1, byte[] var2) {
super();
this.networkManager = var1;
this.bytes = var2;
}
public final void run() {
try {
ByteArrayOutputStream var1 = new ByteArrayOutputStream();
Thread.sleep(500L);
ByteArrayOutputStream var2 = var1;
byte[] var3 = this.bytes;
try {
DataOutputStream var6;
(var6 = new DataOutputStream(new GZIPOutputStream(var2))).writeInt(var3.length);
var6.write(var3);
var6.close();
} catch (Exception var4) {
throw new RuntimeException(var4);
}
Thread.sleep(500L);
this.networkManager.a(var1.toByteArray());
} catch (InterruptedException var5) {
;
}
}
}

View File

@ -0,0 +1,23 @@
package com.mojang.minecraft.server;
import com.mojang.minecraft.server.MinecraftServer;
import java.util.logging.Formatter;
import java.util.logging.Level;
import java.util.logging.LogRecord;
final class LogFormatter extends Formatter {
public final String format(LogRecord var1) {
Level var3 = var1.getLevel();
String var2 = " ";
if(var3 == Level.WARNING) {
var2 = " !";
}
if(var3 == Level.SEVERE) {
var2 = "***";
}
return var2 + " " + MinecraftServer.dateFormat.format(Long.valueOf(var1.getMillis())) + " " + var1.getMessage() + "\n";
}
}

View File

@ -0,0 +1,18 @@
package com.mojang.minecraft.server;
import java.io.OutputStream;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import java.util.logging.StreamHandler;
final class LogHandler extends StreamHandler {
LogHandler(OutputStream var1, Formatter var2) {
super(var1, var2);
}
public final synchronized void publish(LogRecord var1) {
super.publish(var1);
this.flush();
}
}

View File

@ -0,0 +1,635 @@
package com.mojang.minecraft.server;
import com.mojang.minecraft.level.LevelIO;
import com.mojang.minecraft.level.generator.LevelGenerator;
import com.mojang.minecraft.net.PacketType;
import com.mojang.net.BindTo;
import com.mojang.net.NetworkHandler;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.net.URLEncoder;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Random;
import java.util.logging.ConsoleHandler;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
public class MinecraftServer implements Runnable {
static Logger logger = Logger.getLogger("MinecraftServer");
static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
private BindTo bindTo;
private Map m = new HashMap();
private List n = new ArrayList();
private List o = new ArrayList();
private Properties properties = new Properties();
public com.mojang.minecraft.level.Level mainLevel;
public String serverName;
public String MOTD;
public boolean adminSlot;
private NetworkManager[] networkManager;
public PlayerManager playerManager1 = new PlayerManager("Admins", new File("admins.txt"));
public PlayerManager playerManager2 = new PlayerManager("Banned", new File("banned.txt"));
private PlayerManager playerManager3 = new PlayerManager("Banned (IP)", new File("banned-ip.txt"));
public PlayerManager playerManager4 = new PlayerManager("Players", new File("players.txt"));
private List v = new ArrayList();
private String salt = "" + (new Random()).nextLong();
private String x = "";
private boolean growTrees;
public MinecraftServer() {
this.growTrees = false;
try {
this.properties.load(new FileReader("server.properties"));
} catch (Exception var4) {
logger.warning("Failed to load server.properties!");
}
try {
this.serverName = this.properties.getProperty("server-name", "Minecraft Server");
this.MOTD = this.properties.getProperty("motd", "Welcome to my Minecraft Server!");
this.growTrees = Boolean.parseBoolean(this.properties.getProperty("grow-trees", "false"));
this.adminSlot = Boolean.parseBoolean(this.properties.getProperty("admin-slot", "false"));
this.properties.setProperty("server-name", this.serverName);
this.properties.setProperty("motd", this.MOTD);
this.properties.setProperty("max-connections", "3");
this.properties.setProperty("grow-trees", "" + this.growTrees);
this.properties.setProperty("admin-slot", "" + this.adminSlot);
} catch (Exception var3) {
var3.printStackTrace();
logger.warning("server.properties is broken! Delete it or fix it!");
System.exit(0);
}
try {
this.properties.store(new FileWriter("server.properties"), "Minecraft server properties");
} catch (Exception var2) {
logger.warning("Failed to save server.properties!");
}
this.networkManager = new NetworkManager[32];
this.bindTo = new BindTo(this);
(new ConsoleInput(this)).start();
}
public final void a(NetworkHandler var1) {
NetworkManager var2;
if((var2 = (NetworkManager)this.m.get(var1)) != null) {
this.playerManager4.removePlayer(var2.playerName);
logger.info(var2 + " disconnected");
this.m.remove(var2.networkHandler);
this.n.remove(var2);
if(var2.playerID >= 0) {
this.networkManager[var2.playerID] = null;
}
this.a(PacketType.DESPAWN_PLAYER, new Object[]{Integer.valueOf(var2.playerID)});
}
}
private void b(NetworkHandler var1) {
this.o.add(new UNKNOWN0(var1, 100));
}
public final void a(NetworkManager var1) {
this.o.add(new UNKNOWN0(var1.networkHandler, 100));
}
public static void b(NetworkManager var0) {
var0.networkHandler.close();
}
public final void a(PacketType var1, Object ... var2) {
for(int var3 = 0; var3 < this.n.size(); ++var3) {
try {
((NetworkManager)this.n.get(var3)).b(var1, var2);
} catch (Exception var5) {
((NetworkManager)this.n.get(var3)).a(var5);
}
}
}
public final void a(NetworkManager var1, PacketType var2, Object ... var3) {
for(int var4 = 0; var4 < this.n.size(); ++var4) {
if(this.n.get(var4) != var1) {
try {
((NetworkManager)this.n.get(var4)).b(var2, var3);
} catch (Exception var6) {
((NetworkManager)this.n.get(var4)).a(var6);
}
}
}
}
public void run() {
logger.info("Now accepting input on 25565");
int var1 = 50000000;
int var2 = 500000000;
try {
long var3 = System.nanoTime();
long var5 = System.nanoTime();
int var7 = 0;
while(true) {
this.d();
for(; System.nanoTime() - var5 > (long)var1; ++var7) {
var5 += (long)var1;
this.c();
if(var7 % 1200 == 0) {
MinecraftServer var8 = this;
try {
new LevelIO(var8);
LevelIO.save(var8.mainLevel, new FileOutputStream("server_level.dat"));
} catch (Exception var11) {
logger.severe("Failed to save the level! " + var11);
}
logger.info("Level saved! Load: " + this.n.size() + "/" + 32);
}
if(var7 % 900 == 0) {
HashMap var9;
(var9 = new HashMap()).put("name", this.serverName);
var9.put("users", Integer.valueOf(this.n.size()));
var9.put("max", Integer.valueOf(32 - (this.adminSlot?1:0)));
var9.put("salt", this.salt);
var9.put("admin-slot", Boolean.valueOf(this.adminSlot));
var9.put("version", Byte.valueOf((byte)7));
String var13 = a((Map)var9);
(new HeartbeatManager(this, var13)).start();
}
}
while(System.nanoTime() - var3 > (long)var2) {
var3 += (long)var2;
this.a(PacketType.PING, new Object[0]);
}
Thread.sleep(5L);
}
} catch (Exception var12) {
logger.log(Level.SEVERE, "Error in main loop, server shutting down!", var12);
var12.printStackTrace();
}
}
private static String a(Map var0) {
try {
String var1 = "";
String var3;
for(Iterator var2 = var0.keySet().iterator(); var2.hasNext(); var1 = var1 + var3 + "=" + URLEncoder.encode(var0.get(var3).toString(), "UTF-8")) {
var3 = (String)var2.next();
if(var1 != "") {
var1 = var1 + "&";
}
}
return var1;
} catch (Exception var4) {
var4.printStackTrace();
throw new RuntimeException("Failed to assemble heartbeat! This is pretty fatal");
}
}
private void c() {
Iterator var1 = this.n.iterator();
while(var1.hasNext()) {
NetworkManager var2 = (NetworkManager)var1.next();
try {
var2.a();
} catch (Exception var8) {
var2.a(var8);
}
}
this.mainLevel.tick();
for(int var9 = 0; var9 < this.o.size(); ++var9) {
UNKNOWN0 var10 = (UNKNOWN0)this.o.get(var9);
this.a(var10.networkHandler);
try {
NetworkHandler var3 = var10.networkHandler;
if(var3.out.position() > 0) {
var3.out.flip();
var3.channel.write(var3.out);
var3.out.compact();
}
if(var10.b-- <= 0) {
try {
var10.networkHandler.close();
} catch (Exception var5) {
;
}
this.o.remove(var9--);
}
} catch (Exception var7) {
try {
var10.networkHandler.close();
} catch (Exception var4) {
;
}
}
}
}
public final void a(String var1) {
logger.info(var1);
}
public final void b(String var1) {
logger.fine(var1);
}
private void d() {
List var1 = this.v;
synchronized(this.v) {
while(this.v.size() > 0) {
this.a((NetworkManager)null, (String)this.v.remove(0));
}
}
BindTo var13 = this.bindTo;
if(!NetworkHandler.gay) {
NetworkHandler var2 = new NetworkHandler(25565);
var13.c.add(var2);
}
for(int var17 = 0; var17 < var13.c.size(); ++var17) {
NetworkHandler var15 = (NetworkHandler)var13.c.get(var17);
try {
NetworkHandler var20 = var15;
var15.channel.read(var15.in);
int var19 = 0;
while(var20.in.position() > 0 && var19++ != 100) {
var20.in.flip();
byte var22 = var20.in.get(0);
PacketType var25;
if((var25 = PacketType.packets[var22]) == null) {
throw new IOException("Bad command: " + var22);
}
if(var20.in.remaining() < var25.length + 1) {
var20.in.compact();
break;
}
var20.in.get();
Object[] var21 = new Object[var25.params.length];
for(int var7 = 0; var7 < var21.length; ++var7) {
var21[var7] = var20.receive(var25.params[var7]);
}
var20.networkManager.a(var25, var21);
if(!var20.connected) {
break;
}
var20.in.compact();
}
if(var20.out.position() > 0) {
var20.out.flip();
var20.channel.write(var20.out);
var20.out.compact();
}
} catch (Exception var9) {
MinecraftServer var10001 = var13.server;
NetworkManager var23;
if((var23 = (NetworkManager)var13.server.m.get(var15)) != null) {
var23.a(var9);
}
}
try {
if(!var15.connected) {
var15.close();
var13.server.a(var15);
var13.c.remove(var17--);
}
} catch (Exception var8) {
var8.printStackTrace();
}
}
}
public final void a(NetworkManager var1, String var2) {
while(var2.startsWith("/")) {
var2 = var2.substring(1);
}
logger.info((var1 == null?"[console]":var1.playerName) + " admins: " + var2);
String[] var3;
if((var3 = var2.split(" "))[0].toLowerCase().equals("ban") && var3.length > 1) {
this.e(var3[1]);
} else if(var3[0].toLowerCase().equals("kick") && var3.length > 1) {
this.d(var3[1]);
} else if(var3[0].toLowerCase().equals("banip") && var3.length > 1) {
this.h(var3[1]);
} else if(var3[0].toLowerCase().equals("unban") && var3.length > 1) {
String var5 = var3[1];
this.playerManager2.removePlayer(var5);
} else if(var3[0].toLowerCase().equals("op") && var3.length > 1) {
this.f(var3[1]);
} else if(var3[0].toLowerCase().equals("deop") && var3.length > 1) {
this.g(var3[1]);
} else if(var3[0].toLowerCase().equals("setspawn")) {
if(var1 != null) {
this.mainLevel.setSpawnPos(var1.xSpawn / 32, var1.ySpawn / 32, var1.zSpawn / 32, (float)(var1.yawSpawn * 320 / 256));
} else {
logger.info("Can\'t set spawn from console!");
}
} else {
if(var3[0].toLowerCase().equals("solid")) {
if(var1 != null) {
var1.i = !var1.i;
if(var1.i) {
var1.b("Now placing unbreakable stone");
return;
}
var1.b("Now placing normal stone");
return;
}
} else {
if(var3[0].toLowerCase().equals("broadcast") && var3.length > 1) {
this.a(PacketType.CHAT_MESSAGE, new Object[]{Integer.valueOf(-1), var2.substring("broadcast ".length()).trim()});
return;
}
if(var3[0].toLowerCase().equals("say") && var3.length > 1) {
this.a(PacketType.CHAT_MESSAGE, new Object[]{Integer.valueOf(-1), var2.substring("say ".length()).trim()});
return;
}
if((var3[0].toLowerCase().equals("teleport") || var3[0].toLowerCase().equals("tp")) && var3.length > 1) {
if(var1 == null) {
logger.info("Can\'t teleport from console!");
return;
}
NetworkManager var4;
if((var4 = this.c(var3[1])) == null) {
var1.b(PacketType.CHAT_MESSAGE, new Object[]{Integer.valueOf(-1), "No such player"});
return;
}
var1.networkHandler.send(PacketType.POSITION_ROTATION, new Object[]{Integer.valueOf(-1), Integer.valueOf(var4.xSpawn), Integer.valueOf(var4.ySpawn), Integer.valueOf(var4.zSpawn), Integer.valueOf(var4.yawSpawn), Integer.valueOf(var4.pitchSpawn)});
} else if(var1 != null) {
var1.b(PacketType.CHAT_MESSAGE, new Object[]{Integer.valueOf(-1), "Unknown command!"});
}
}
}
}
public final void a(int var1, int var2, int var3) {
this.a(PacketType.BLOCK_CHANGE, new Object[]{Integer.valueOf(var1), Integer.valueOf(var2), Integer.valueOf(var3), Integer.valueOf(this.mainLevel.getTile(var1, var2, var3))});
}
public final int a() {
int var1 = 0;
for(int var2 = 0; var2 < 32; ++var2) {
if(this.networkManager[var2] == null) {
++var1;
}
}
return var1;
}
private int e() {
for(int var1 = 0; var1 < 32; ++var1) {
if(this.networkManager[var1] == null) {
return var1;
}
}
return -1;
}
public final List b() {
return this.n;
}
private void d(String var1) {
boolean var2 = false;
Iterator var3 = this.n.iterator();
while(var3.hasNext()) {
NetworkManager var4;
if((var4 = (NetworkManager)var3.next()).playerName.equalsIgnoreCase(var1)) {
var2 = true;
var4.a("You were kicked");
}
}
if(var2) {
this.a(PacketType.CHAT_MESSAGE, new Object[]{Integer.valueOf(-1), var1 + " got kicked from the server!"});
}
}
private void e(String var1) {
this.playerManager2.addPlayer(var1);
boolean var2 = false;
Iterator var3 = this.n.iterator();
while(var3.hasNext()) {
NetworkManager var4;
if((var4 = (NetworkManager)var3.next()).playerName.equalsIgnoreCase(var1)) {
var2 = true;
var4.a("You were banned");
}
}
if(var2) {
this.a(PacketType.CHAT_MESSAGE, new Object[]{Integer.valueOf(-1), var1 + " got banned!"});
}
}
private void f(String var1) {
this.playerManager1.addPlayer(var1);
Iterator var3 = this.n.iterator();
while(var3.hasNext()) {
NetworkManager var2;
if((var2 = (NetworkManager)var3.next()).playerName.equalsIgnoreCase(var1)) {
var2.b("You\'re now op!");
var2.b(PacketType.UPDATE_PLAYER_TYPE, new Object[]{Integer.valueOf(100)});
}
}
}
private void g(String var1) {
this.playerManager1.removePlayer(var1);
Iterator var3 = this.n.iterator();
while(var3.hasNext()) {
NetworkManager var2;
if((var2 = (NetworkManager)var3.next()).playerName.equalsIgnoreCase(var1)) {
var2.i = false;
var2.b("You\'re no longer op!");
var2.b(PacketType.UPDATE_PLAYER_TYPE, new Object[]{Integer.valueOf(0)});
}
}
}
private void h(String var1) {
boolean var2 = false;
String var3 = "";
Iterator var4 = this.n.iterator();
while(var4.hasNext()) {
NetworkManager var5;
NetworkHandler var6;
if(!(var5 = (NetworkManager)var4.next()).playerName.equalsIgnoreCase(var1)) {
var6 = var5.networkHandler;
if(!var5.networkHandler.address.equalsIgnoreCase(var1)) {
var6 = var5.networkHandler;
if(!var5.networkHandler.address.equalsIgnoreCase("/" + var1)) {
continue;
}
}
}
var6 = var5.networkHandler;
this.playerManager3.addPlayer(var5.networkHandler.address);
var5.a("You were banned");
if(var3 == "") {
var3 = var3 + ", ";
}
var3 = var3 + var5.playerName;
var2 = true;
}
if(var2) {
this.a(PacketType.CHAT_MESSAGE, new Object[]{Integer.valueOf(-1), var3 + " got ip banned!"});
}
}
public final NetworkManager c(String var1) {
Iterator var3 = this.n.iterator();
NetworkManager var2;
do {
if(!var3.hasNext()) {
return null;
}
} while(!(var2 = (NetworkManager)var3.next()).playerName.equalsIgnoreCase(var1));
return var2;
}
public static void main(String[] var0) {
try {
MinecraftServer var6;
MinecraftServer var1 = var6 = new MinecraftServer();
logger.info("Setting up");
File var2;
if((var2 = new File("server_level.dat")).exists()) {
try {
var1.mainLevel = (new LevelIO(var1)).load(new FileInputStream(var2));
} catch (Exception var4) {
logger.warning("Failed to load level. Generating a new level");
var4.printStackTrace();
}
} else {
logger.warning("No level file found. Generating a new level");
}
if(var1.mainLevel == null) {
var1.mainLevel = (new LevelGenerator(var1)).generate("--", 256, 256, 64);
}
try {
new LevelIO(var1);
LevelIO.save(var1.mainLevel, new FileOutputStream("server_level.dat"));
} catch (Exception var3) {
;
}
var1.mainLevel.creativeMode = true;
var1.mainLevel.growTrees = var1.growTrees;
var1.mainLevel.addListener$74652038(var1);
(new Thread(var6)).start();
} catch (Exception var5) {
logger.severe("Failed to start the server!");
var5.printStackTrace();
}
}
// $FF: synthetic method
static List a(MinecraftServer var0) {
return var0.v;
}
// $FF: synthetic method
static String b(MinecraftServer var0) {
return var0.x;
}
// $FF: synthetic method
static String a(MinecraftServer var0, String var1) {
return var0.x = var1;
}
static {
LogFormatter var0 = new LogFormatter();
Handler[] var1;
int var2 = (var1 = logger.getParent().getHandlers()).length;
for(int var3 = 0; var3 < var2; ++var3) {
Handler var4 = var1[var3];
logger.getParent().removeHandler(var4);
}
ConsoleHandler var6;
(var6 = new ConsoleHandler()).setFormatter(var0);
logger.addHandler(var6);
try {
LogHandler var7;
(var7 = new LogHandler(new FileOutputStream("server.log"), var0)).setFormatter(var0);
logger.addHandler(var7);
} catch (Exception var5) {
logger.warning("Failed to open file server.log for writing: " + var5);
}
}
}

View File

@ -0,0 +1,381 @@
package com.mojang.minecraft.server;
import com.mojang.minecraft.AvailableBlockType;
import com.mojang.minecraft.level.Level;
import com.mojang.minecraft.level.tile.a;
import com.mojang.minecraft.net.PacketType;
import com.mojang.net.NetworkHandler;
import com.mojang.util.MathHelper;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Logger;
public final class NetworkManager {
private static Logger logger = MinecraftServer.logger;
public final NetworkHandler networkHandler;
private final MinecraftServer server;
private boolean l = false;
private boolean m = false;
public String playerName = "";
public final int playerID;
private ArrayList n = new ArrayList();
private long time;
private List p = new ArrayList();
private int timeTillTalk = 0;
public int xSpawn;
public int ySpawn;
public int zSpawn;
public int pitchSpawn;
public int yawSpawn;
private boolean kicked = false;
private int clicks = 0;
private int t = 0;
private volatile byte[] bytes = null;
public boolean i = false;
public NetworkManager(MinecraftServer var1, NetworkHandler var2, int var3) {
this.server = var1;
this.networkHandler = var2;
this.playerID = var3;
this.time = System.currentTimeMillis();
var2.networkManager = this;
Level var4 = var1.mainLevel;
this.xSpawn = (var4.xSpawn << 5) + 16;
this.ySpawn = (var4.ySpawn << 5) + 16;
this.zSpawn = (var4.zSpawn << 5) + 16;
this.yawSpawn = (int)(var4.rotSpawn * 256.0F / 360.0F);
this.pitchSpawn = 0;
}
public final String toString() {
NetworkHandler var1;
return !this.l?(var1 = this.networkHandler).address:this.playerName + " (" + (var1 = this.networkHandler).address + ")";
}
public final void a(PacketType var1, Object[] var2) {
if(!this.kicked) {
if(var1 != PacketType.INDENTIFICATION) {
if(var1 != PacketType.PING) {
if(this.l && this.m) {
if(var1 == PacketType.PLAYER_SET_BLOCK) {
if(this.p.size() > 1200) {
this.d("Too much lag");
} else {
this.p.add(var2);
}
} else if(var1 == PacketType.CHAT_MESSAGE) {
String var7;
if((var7 = var2[1].toString().trim()).length() > 0) {
this.c(var7);
}
} else {
if(var1 == PacketType.POSITION_ROTATION) {
if(this.p.size() > 1200) {
this.d("Too much lag");
return;
}
this.p.add(var2);
}
}
}
}
} else {
byte var6 = ((Byte)var2[0]).byteValue();
String var3 = ((String)var2[1]).trim();
String var8 = (String)var2[2];
char[] var4 = var3.toCharArray();
for(int var5 = 0; var5 < var4.length; ++var5) {
if(var4[var5] < 32 || var4[var5] > 127) {
this.d("Bad name!");
return;
}
}
if(var3.length() < 2 || var3.length() > 16) {
this.a("Illegal name.");
}
if(var6 != 7) {
this.a("Wrong protocol version.");
} else if(this.server.playerManager2.containsPlayer(var3)) {
this.a("You\'re banned!");
} else if(this.server.adminSlot && !this.server.playerManager1.containsPlayer(var3) && this.server.a() < 1) {
this.networkHandler.send(PacketType.DISCONNECT, new Object[]{"The server is full!"});
logger.info(var3 + " connected, but got kicked because the server was almost full and there are reserved admin slots.");
this.server.a(this);
this.kicked = true;
} else {
NetworkManager var11;
if((var11 = this.server.c(var3)) != null) {
var11.a("You logged in from another computer.");
}
logger.info(this + " logged in as " + var3);
this.l = true;
this.playerName = var3;
this.networkHandler.send(PacketType.INDENTIFICATION, new Object[]{Byte.valueOf((byte)7), this.server.serverName, this.server.MOTD, Integer.valueOf(this.server.playerManager1.containsPlayer(var3)?100:0)});
Level var9 = this.server.mainLevel;
byte[] var10 = var9.copyBlocks();
(new LevelSaver(this, var10)).start();
this.server.playerManager4.addPlayer(var3);
}
}
}
}
private void c(String var1) {
var1 = var1.trim();
this.timeTillTalk += var1.length() + 15 << 2;
if(this.timeTillTalk > 600) {
this.timeTillTalk = 760;
this.b(PacketType.CHAT_MESSAGE, new Object[]{Integer.valueOf(-1), "Too much chatter! Muted for eight seconds."});
logger.info("Muting " + this.playerName + " for chatting too much");
} else {
char[] var2 = var1.toCharArray();
for(int var3 = 0; var3 < var2.length; ++var3) {
if(var2[var3] < 32 || var2[var3] > 127) {
this.d("Bad chat message!");
return;
}
}
if(var1.startsWith("/")) {
if(this.server.playerManager1.containsPlayer(this.playerName)) {
this.server.a(this, var1.substring(1));
} else {
this.b(PacketType.CHAT_MESSAGE, new Object[]{Integer.valueOf(-1), "You\'re not a server admin!"});
}
} else {
logger.info(this.playerName + " says: " + var1);
this.server.a(PacketType.CHAT_MESSAGE, new Object[]{Integer.valueOf(this.playerID), this.playerName + ": " + var1});
}
}
}
public final void a(String var1) {
this.networkHandler.send(PacketType.DISCONNECT, new Object[]{var1});
logger.info("Kicking " + this + ": " + var1);
this.server.a(this);
this.kicked = true;
}
private void d(String var1) {
this.a("Cheat detected: " + var1);
}
public final void b(String var1) {
this.b(PacketType.CHAT_MESSAGE, new Object[]{Integer.valueOf(-1), var1});
}
public final void a(byte[] var1) {
this.bytes = var1;
}
public final void a() {
if(this.clicks >= 2) {
this.clicks -= 2;
}
if(this.timeTillTalk > 0) {
--this.timeTillTalk;
if(this.timeTillTalk == 600) {
this.b(PacketType.CHAT_MESSAGE, new Object[]{Integer.valueOf(-1), "You can now talk again."});
this.timeTillTalk = 300;
}
}
Object[] var2;
boolean var10000;
if(this.p.size() > 0) {
for(boolean var1 = true; this.p.size() > 0 && var1; var1 = var10000) {
byte var3;
byte var4;
short var5;
short var6;
short var13;
byte var10004;
short var10001;
short var10003;
short var10002;
if((var2 = (Object[])this.p.remove(0))[0] instanceof Short) {
var10001 = ((Short)var2[0]).shortValue();
var10002 = ((Short)var2[1]).shortValue();
var10003 = ((Short)var2[2]).shortValue();
var10004 = ((Byte)var2[3]).byteValue();
var3 = ((Byte)var2[4]).byteValue();
var4 = var10004;
var5 = var10003;
var6 = var10002;
var13 = var10001;
++this.clicks;
if(this.clicks == 100) {
this.d("Too much clicking!");
} else {
Level var7 = this.server.mainLevel;
float var8 = (float)var13 - (float)this.xSpawn / 32.0F;
float var9 = (float)var6 - ((float)this.ySpawn / 32.0F - 1.62F);
float var10 = (float)var5 - (float)this.zSpawn / 32.0F;
var8 = var8 * var8 + var9 * var9 + var10 * var10;
var9 = 8.0F;
if(var8 >= var9 * var9) {
System.out.println("Distance: " + MathHelper.sqrt(var8));
this.d("Distance");
} else if(!AvailableBlockType.blocks.contains(a.b[var3])) {
this.d("Tile type");
} else if(var13 >= 0 && var6 >= 0 && var5 >= 0 && var13 < var7.width && var6 < var7.depth && var5 < var7.height) {
if(var4 == 0) {
if(var7.getTile(var13, var6, var5) != a.k.ab || this.server.playerManager1.containsPlayer(this.playerName)) {
var7.setTile(var13, var6, var5, 0);
}
} else {
a var16;
if((var16 = a.b[var7.getTile(var13, var6, var5)]) == null || var16 == a.l || var16 == a.m || var16 == a.n || var16 == a.o) {
if(this.i && var3 == a.e.ab) {
var7.setTile(var13, var6, var5, a.k.ab);
} else {
var7.setTile(var13, var6, var5, var3);
}
a.b[var3].a(var7, var13, var6, var5);
}
}
}
}
var10000 = true;
} else {
((Byte)var2[0]).byteValue();
var10001 = ((Short)var2[1]).shortValue();
var10002 = ((Short)var2[2]).shortValue();
var10003 = ((Short)var2[3]).shortValue();
var10004 = ((Byte)var2[4]).byteValue();
var3 = ((Byte)var2[5]).byteValue();
var4 = var10004;
var5 = var10003;
var6 = var10002;
var13 = var10001;
if(var13 == this.xSpawn && var6 == this.ySpawn && var5 == this.zSpawn && var4 == this.yawSpawn && var3 == this.pitchSpawn) {
var10000 = true;
} else {
boolean var21 = var13 == this.xSpawn && var6 == this.ySpawn && var5 == this.zSpawn;
if(this.t++ % 2 == 0) {
int var22 = var13 - this.xSpawn;
int var23 = var6 - this.ySpawn;
int var24 = var5 - this.zSpawn;
if(var22 >= 128 || var22 < -128 || var23 >= 128 || var23 < -128 || var24 >= 128 || var24 < -128 || this.t % 20 <= 1) {
this.xSpawn = var13;
this.ySpawn = var6;
this.zSpawn = var5;
this.yawSpawn = var4;
this.pitchSpawn = var3;
this.server.a(this, PacketType.POSITION_ROTATION, new Object[]{Integer.valueOf(this.playerID), Short.valueOf(var13), Short.valueOf(var6), Short.valueOf(var5), Byte.valueOf(var4), Byte.valueOf(var3)});
var10000 = false;
continue;
}
if(var13 == this.xSpawn && var6 == this.ySpawn && var5 == this.zSpawn) {
this.yawSpawn = var4;
this.pitchSpawn = var3;
this.server.a(this, PacketType.ROTATION_UPDATE, new Object[]{Integer.valueOf(this.playerID), Byte.valueOf(var4), Byte.valueOf(var3)});
} else if(var4 == this.yawSpawn && var3 == this.pitchSpawn) {
this.xSpawn = var13;
this.ySpawn = var6;
this.zSpawn = var5;
this.server.a(this, PacketType.POSITION_UPDATE, new Object[]{Integer.valueOf(this.playerID), Integer.valueOf(var22), Integer.valueOf(var23), Integer.valueOf(var24)});
} else {
this.xSpawn = var13;
this.ySpawn = var6;
this.zSpawn = var5;
this.yawSpawn = var4;
this.pitchSpawn = var3;
this.server.a(this, PacketType.POSITION_ROTATION_UPDATE, new Object[]{Integer.valueOf(this.playerID), Integer.valueOf(var22), Integer.valueOf(var23), Integer.valueOf(var24), Byte.valueOf(var4), Byte.valueOf(var3)});
}
}
var10000 = var21;
}
}
}
}
if(!this.l && System.currentTimeMillis() - this.time > 5000L) {
this.a("You need to log in!");
} else if(this.bytes != null) {
Level var11 = this.server.mainLevel;
byte[] var15 = new byte[1024];
int var20 = 0;
int var19 = this.bytes.length;
this.networkHandler.send(PacketType.LEVEL_INITIALIZE, new Object[0]);
int var17;
while(var19 > 0) {
var17 = var19;
if(var19 > var15.length) {
var17 = var15.length;
}
System.arraycopy(this.bytes, var20, var15, 0, var17);
this.networkHandler.send(PacketType.LEVEL_DATA_CHUNK, new Object[]{Integer.valueOf(var17), var15, Integer.valueOf((var20 + var17) * 100 / this.bytes.length)});
var19 -= var17;
var20 += var17;
}
this.networkHandler.send(PacketType.LEVEL_FINALIZE, new Object[]{Integer.valueOf(var11.width), Integer.valueOf(var11.depth), Integer.valueOf(var11.height)});
this.networkHandler.send(PacketType.SPAWN_PLAYER, new Object[]{Integer.valueOf(-1), this.playerName, Integer.valueOf(this.xSpawn), Integer.valueOf(this.ySpawn), Integer.valueOf(this.zSpawn), Integer.valueOf(this.yawSpawn), Integer.valueOf(this.pitchSpawn)});
this.server.a(this, PacketType.SPAWN_PLAYER, new Object[]{Integer.valueOf(this.playerID), this.playerName, Integer.valueOf((var11.xSpawn << 5) + 16), Integer.valueOf((var11.ySpawn << 5) + 16), Integer.valueOf((var11.zSpawn << 5) + 16), Integer.valueOf((int)(var11.rotSpawn * 256.0F / 360.0F)), Integer.valueOf(0)});
this.server.a(PacketType.CHAT_MESSAGE, new Object[]{Integer.valueOf(-1), this.playerName + " joined the game"});
Iterator var18 = this.server.b().iterator();
while(var18.hasNext()) {
NetworkManager var12;
if((var12 = (NetworkManager)var18.next()) != null && var12 != this && var12.l) {
this.networkHandler.send(PacketType.SPAWN_PLAYER, new Object[]{Integer.valueOf(var12.playerID), var12.playerName, Integer.valueOf(var12.xSpawn), Integer.valueOf(var12.ySpawn), Integer.valueOf(var12.zSpawn), Integer.valueOf(var12.yawSpawn), Integer.valueOf(var12.pitchSpawn)});
}
}
this.m = true;
var17 = 0;
while(var17 < this.n.size()) {
PacketType var14 = (PacketType)this.n.get(var17++);
var2 = (Object[])((Object[])this.n.get(var17++));
this.b(var14, var2);
}
this.n = null;
this.bytes = null;
}
}
public final void b(PacketType var1, Object ... var2) {
if(!this.m) {
this.n.add(var1);
this.n.add(var2);
} else {
this.networkHandler.send(var1, var2);
}
}
public final void a(Exception var1) {
if(var1 instanceof IOException) {
logger.info(this + " lost connection suddenly. (" + var1 + ")");
} else {
logger.warning(this + ":" + var1);
logger.log(java.util.logging.Level.WARNING, "Exception handling " + this + "!", var1);
var1.printStackTrace();
}
this.server.a(this, PacketType.CHAT_MESSAGE, new Object[]{Integer.valueOf(-1), this.playerName + " left the game"});
MinecraftServer.b(this);
}
}

View File

@ -0,0 +1,84 @@
package com.mojang.minecraft.server;
import com.mojang.minecraft.server.MinecraftServer;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.logging.Logger;
public final class PlayerManager {
private static Logger logger = MinecraftServer.logger;
private String name;
private File file;
private Set players = new HashSet();
public PlayerManager(String var1, File var2) {
this.name = var1;
this.file = var2;
this.load();
}
public final void addPlayer(String var1) {
var1 = var1.toLowerCase();
this.players.add(var1);
this.save();
}
public final void removePlayer(String var1) {
var1 = var1.toLowerCase();
this.players.remove(var1);
this.save();
}
public final boolean containsPlayer(String var1) {
var1 = var1.toLowerCase();
return this.players.contains(var1);
}
private void load() {
try {
BufferedReader var1 = new BufferedReader(new FileReader(this.file));
String var2 = null;
while((var2 = var1.readLine()) != null) {
var2 = var2.toLowerCase();
this.players.add(var2);
}
var1.close();
} catch (IOException var4) {
try {
this.file.createNewFile();
} catch (IOException var3) {
var3.printStackTrace();
}
logger.warning("Failed to load player list \"" + this.name + "\". (" + var4 + ")");
}
}
private void save() {
try {
PrintWriter var1 = new PrintWriter(new FileWriter(this.file));
Iterator var2 = this.players.iterator();
while(var2.hasNext()) {
String var3 = (String)var2.next();
var1.println(var3);
}
var1.close();
} catch (IOException var4) {
logger.warning("Failed to save player list \"" + this.name + "\". (" + var4 + ")");
}
}
}

View File

@ -0,0 +1,15 @@
package com.mojang.minecraft.server;
import com.mojang.net.NetworkHandler;
public final class UNKNOWN0 {
public NetworkHandler networkHandler;
public int b;
public UNKNOWN0(NetworkHandler var1, int var2) {
this.networkHandler = var1;
this.b = 100;
}
}

View File

@ -0,0 +1,15 @@
package com.mojang.net;
import com.mojang.minecraft.server.MinecraftServer;
import java.util.LinkedList;
import java.util.List;
public final class BindTo {
public MinecraftServer server;
public List<NetworkHandler> c = new LinkedList<NetworkHandler>();
public BindTo(MinecraftServer var2) {
this.server = var2;
}
}

View File

@ -0,0 +1,148 @@
package com.mojang.net;
import com.mojang.minecraft.net.PacketType;
import com.mojang.minecraft.server.NetworkManager;
import net.io.DummyLogger;
import net.io.WebSocketChannel;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.eclipse.jetty.util.log.Log;
public final class NetworkHandler {
public volatile boolean connected;
public ByteBuffer in = ByteBuffer.allocate(1048576);
public ByteBuffer out = ByteBuffer.allocate(1048576);
public NetworkManager networkManager;
private boolean h = false;
public String address;
private byte[] stringBytes = new byte[64];
public static boolean gay = false;
public WebSocketChannel channel;
public NetworkHandler(int port) {
gay = true;
try {
Log.setLog(new DummyLogger());
channel = new WebSocketChannel(port);
} catch (Exception e) {
e.printStackTrace();
throw new Error(e.getLocalizedMessage());
}
}
public final void close() {
try {
if(this.out.position() > 0) {
this.out.flip();
this.channel.write(this.out);
this.out.compact();
}
} catch (Exception var2) {
;
}
this.connected = false;
try {
channel.stopServer();
} catch (Exception var1) {
;
}
}
public final void send(PacketType var1, Object ... var2) {
if(this.connected) {
this.out.put(var1.opCode);
for(int var3 = 0; var3 < var2.length; ++var3) {
Class var10001 = var1.params[var3];
Object var4 = var2[var3];
Class var5 = var10001;
NetworkHandler var6 = this;
if(this.connected) {
try {
if(var5 == Long.TYPE) {
var6.out.putLong(((Long)var4).longValue());
} else if(var5 == Integer.TYPE) {
var6.out.putInt(((Number)var4).intValue());
} else if(var5 == Short.TYPE) {
var6.out.putShort(((Number)var4).shortValue());
} else if(var5 == Byte.TYPE) {
var6.out.put(((Number)var4).byteValue());
} else if(var5 == Double.TYPE) {
var6.out.putDouble(((Double)var4).doubleValue());
} else if(var5 == Float.TYPE) {
var6.out.putFloat(((Float)var4).floatValue());
} else {
byte[] var9;
if(var5 != String.class) {
if(var5 == byte[].class) {
if((var9 = (byte[])((byte[])var4)).length < 1024) {
var9 = Arrays.copyOf(var9, 1024);
}
var6.out.put(var9);
}
} else {
var9 = ((String)var4).getBytes("UTF-8");
Arrays.fill(var6.stringBytes, (byte)32);
int var8;
for(var8 = 0; var8 < 64 && var8 < var9.length; ++var8) {
var6.stringBytes[var8] = var9[var8];
}
for(var8 = var9.length; var8 < 64; ++var8) {
var6.stringBytes[var8] = 32;
}
var6.out.put(var6.stringBytes);
}
}
} catch (Exception var7) {
this.networkManager.a(var7);
}
}
}
}
}
public Object receive(Class var1) {
if(!this.connected) {
return null;
} else {
try {
if(var1 == Long.TYPE) {
return Long.valueOf(this.in.getLong());
} else if(var1 == Integer.TYPE) {
return Integer.valueOf(this.in.getInt());
} else if(var1 == Short.TYPE) {
return Short.valueOf(this.in.getShort());
} else if(var1 == Byte.TYPE) {
return Byte.valueOf(this.in.get());
} else if(var1 == Double.TYPE) {
return Double.valueOf(this.in.getDouble());
} else if(var1 == Float.TYPE) {
return Float.valueOf(this.in.getFloat());
} else if(var1 == String.class) {
this.in.get(this.stringBytes);
return (new String(this.stringBytes, "UTF-8")).trim();
} else if(var1 == byte[].class) {
byte[] var3 = new byte[1024];
this.in.get(var3);
return var3;
} else {
return null;
}
} catch (Exception var2) {
this.networkManager.a(var2);
return null;
}
}
}
}

View File

@ -0,0 +1,27 @@
package com.mojang.util;
public final class MathHelper {
private static float[] SIN_TABLE = new float[65536];
public static final float sin(float var0) {
return SIN_TABLE[(int)(var0 * 10430.378F) & '\uffff'];
}
public static final float cos(float var0) {
return SIN_TABLE[(int)(var0 * 10430.378F + 16384.0F) & '\uffff'];
}
public static final float sqrt(float var0) {
return (float)Math.sqrt((double)var0);
}
static {
for(int var0 = 0; var0 < 65536; ++var0) {
SIN_TABLE[var0] = (float)Math.sin((double)var0 * 3.141592653589793D * 2.0D / 65536.0D);
}
}
}

View File

@ -0,0 +1,39 @@
package net.io;
import org.eclipse.jetty.util.log.Logger;
public class DummyLogger implements Logger {
public String getName() {
return "DummyLogger";
}
public void warn(String msg, Object... args) {}
public void warn(Throwable thrown) {}
public void warn(String msg, Throwable thrown) {}
public void info(String msg, Object... args) {}
public void info(Throwable thrown) {}
public void info(String msg, Throwable thrown) {}
public boolean isDebugEnabled() {return false; }
public void setDebugEnabled(boolean enabled) {}
public void debug(String msg, Object... args) {}
public void debug(Throwable thrown) {}
public void debug(String msg, Throwable thrown) {}
public Logger getLogger(String name) {return this; }
public void ignore(Throwable ignored) {}
public void debug(String msg, long value) {}
}

View File

@ -0,0 +1,13 @@
package net.io;
import org.eclipse.jetty.websocket.servlet.WebSocketServlet;
import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory;
public class MyWebSocketServlet extends WebSocketServlet {
private static final long serialVersionUID = 1L;
@Override
public void configure(WebSocketServletFactory factory) {
factory.register(WebSocketChannel.class);
}
}

View File

@ -0,0 +1,126 @@
package net.io;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.annotations.*;
import org.eclipse.jetty.websocket.servlet.WebSocketServlet;
import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.*;
@WebSocket
public class WebSocketChannel {
private static Set<Session> sessions;
private final Queue<ByteBuffer> writeQueue;
private final ByteBuffer readBuffer;
private boolean reading;
private boolean isConnected = false;
public WebSocketChannel(int port) {
writeQueue = new LinkedList<ByteBuffer>();
readBuffer = ByteBuffer.allocate(1024);
reading = false;
sessions = new HashSet<Session>();
writeQueue.clear();
try {
this.startServer(port);
isConnected = true;
} catch (Exception e) {
isConnected = false;
e.printStackTrace();
}
}
@OnWebSocketConnect
private void onConnect(Session session) {
sessions.add(session);
}
@OnWebSocketMessage
private void onMessage(byte[] data, int offset, int length) {
for (byte b : data) {
readBuffer.put(b);
}
if (reading) {
readBuffer.flip();
reading = false;
}
}
@OnWebSocketClose
private void onClose(Session session, int statusCode, String reason) {
sessions.remove(session);
}
@OnWebSocketError
private void onError(Session session, Throwable throwable) {
System.err.println(throwable.getMessage());
}
private void startServer(int port) throws Exception {
org.eclipse.jetty.server.Server server = new org.eclipse.jetty.server.Server(port);
org.eclipse.jetty.servlet.ServletContextHandler context = new org.eclipse.jetty.servlet.ServletContextHandler();
context.setContextPath("");
context.addServlet(MyWebSocketServlet.class, "");
server.setHandler(context);
server.start();
}
public void stopServer() {
for (Session session : sessions) {
session.close();
}
}
public boolean connectionOpen() {
return isConnected;
}
public int read(ByteBuffer buffer) {
if (reading) {
return 0;
}
if (readBuffer.hasRemaining()) {
int bytesToRead = Math.min(buffer.remaining(), readBuffer.remaining());
for (int i = 0; i < bytesToRead; i++) {
buffer.put(readBuffer.get());
}
return bytesToRead;
} else {
readBuffer.clear();
reading = true;
return 0;
}
}
public int write(ByteBuffer buffer) {
if (!isConnected) {
return 0;
}
int bytesToWrite = 0;
for (Session session : sessions) {
if (session.isOpen()) {
int sessionBytesToWrite = Math.min(buffer.remaining(), session.getPolicy().getMaxTextMessageBufferSize());
if (sessionBytesToWrite > 0) {
byte[] data = new byte[sessionBytesToWrite];
buffer.get(data);
session.getRemote().sendBytesByFuture(ByteBuffer.wrap(data));
}
bytesToWrite += sessionBytesToWrite;
}
}
if (buffer.hasRemaining()) {
writeQueue.offer(buffer);
}
return bytesToWrite;
}
}

0
src/null Normal file
View File