Add version
This commit is contained in:
parent
83f8c65a1a
commit
f83645e069
51 changed files with 1690 additions and 74 deletions
|
@ -97,7 +97,8 @@ public class Block {
|
|||
public static final Block torchRedstoneActive = (new BlockRedstoneTorch(76, 99, true)).setHardness(0.0F).setLightValue(0.5F).setStepSound(soundWoodFootstep);
|
||||
public static final Block button = (new BlockButton(77, stone.blockIndexInTexture)).setHardness(0.5F).setStepSound(soundStoneFootstep);
|
||||
public static final Block snow = (new BlockSnow(78, 66)).setHardness(0.1F).setStepSound(soundClothFootstep);
|
||||
public static final Block ice = (new BlockIce(79, 67)).setHardness(0.1F).setLightOpacity(3).setStepSound(soundGlassFootstep);
|
||||
public static final Block ice = (new BlockIce(79, 67)).setHardness(0.5F).setLightOpacity(3).setStepSound(soundGlassFootstep);
|
||||
public static final Block blockSnow = (new BlockSnowBlock(80, 66)).setHardness(0.2F).setStepSound(soundClothFootstep);
|
||||
public int blockIndexInTexture;
|
||||
public final int blockID;
|
||||
protected float hardness;
|
||||
|
|
|
@ -61,7 +61,7 @@ public abstract class BlockFluid extends Block {
|
|||
|
||||
public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
Material var6 = var1.getBlockMaterial(var2, var3, var4);
|
||||
return var6 == this.material ? false : (var5 == 1 ? true : super.shouldSideBeRendered(var1, var2, var3, var4, var5));
|
||||
return var6 == this.material ? false : (var6 == Material.ice ? false : (var5 == 1 ? true : super.shouldSideBeRendered(var1, var2, var3, var4, var5)));
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
|
|
|
@ -18,7 +18,11 @@ public class BlockIce extends BlockBreakable {
|
|||
}
|
||||
|
||||
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, Block.waterMoving.blockID);
|
||||
Material var5 = var1.getBlockMaterial(var2, var3 - 1, var4);
|
||||
if(var5.getIsSolid() || var5.getIsLiquid()) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, Block.waterMoving.blockID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
|
|
|
@ -75,10 +75,6 @@ public class BlockSign extends BlockContainer {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
return super.canPlaceBlockAt(var1, var2, var3, var4) && super.canPlaceBlockAt(var1, var2, var3 + 1, var4);
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return this.b;
|
||||
}
|
||||
|
|
|
@ -40,11 +40,11 @@ public class BlockSnow extends Block {
|
|||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return 0;
|
||||
return Item.snowball.shiftedIndex;
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
|
@ -54,4 +54,9 @@ public class BlockSnow extends Block {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
Material var6 = var1.getBlockMaterial(var2, var3, var4);
|
||||
return var6 == this.material ? false : (var5 == 1 ? true : super.shouldSideBeRendered(var1, var2, var3, var4, var5));
|
||||
}
|
||||
}
|
||||
|
|
26
src/main/java/net/minecraft/src/BlockSnowBlock.java
Normal file
26
src/main/java/net/minecraft/src/BlockSnowBlock.java
Normal file
|
@ -0,0 +1,26 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockSnowBlock extends Block {
|
||||
protected BlockSnowBlock(int var1, int var2) {
|
||||
super(var1, var2, Material.snow);
|
||||
this.setTickOnLoad(true);
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return Item.snowball.shiftedIndex;
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return 6;
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(var1.getSavedLightValue(EnumSkyBlock.Block, var2, var3, var4) > 11) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4));
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -126,7 +126,7 @@ public class CanvasIsomPreview extends Canvas implements KeyListener, MouseListe
|
|||
public void start() {
|
||||
(new ThreadRunIsoClient(this)).start();
|
||||
|
||||
for(int var1 = 0; var1 < 1; ++var1) {
|
||||
for(int var1 = 0; var1 < 8; ++var1) {
|
||||
(new Thread(this)).start();
|
||||
}
|
||||
|
||||
|
|
|
@ -470,4 +470,33 @@ public class Chunk {
|
|||
public boolean needsSaving(boolean var1) {
|
||||
return this.neverSave ? false : (this.hasEntities && this.worldObj.worldTime != this.lastSaveTime ? true : this.isModified);
|
||||
}
|
||||
|
||||
public int setChunkData(byte[] var1, int var2, int var3, int var4, int var5, int var6, int var7, int var8) {
|
||||
int var9;
|
||||
int var10;
|
||||
int var11;
|
||||
int var12;
|
||||
for(var9 = var2; var9 < var5; ++var9) {
|
||||
for(var10 = var4; var10 < var7; ++var10) {
|
||||
var11 = var9 << 11 | var10 << 7 | var3;
|
||||
|
||||
for(var12 = var3; var12 < var6; ++var12) {
|
||||
this.blocks[var11++] = var1[var8++];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(var9 = var2; var9 < var5; ++var9) {
|
||||
for(var10 = var4; var10 < var7; ++var10) {
|
||||
var11 = (var9 << 11 | var10 << 7 | var3) >> 1;
|
||||
|
||||
for(var12 = var3; var12 < var6; var12 += 2) {
|
||||
this.data.data[var11++] = var1[var8++];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.generateSkylightMap();
|
||||
return var8;
|
||||
}
|
||||
}
|
||||
|
|
24
src/main/java/net/minecraft/src/ChunkCoordinates.java
Normal file
24
src/main/java/net/minecraft/src/ChunkCoordinates.java
Normal file
|
@ -0,0 +1,24 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
final class ChunkCoordinates {
|
||||
public final int posX;
|
||||
public final int posZ;
|
||||
|
||||
public ChunkCoordinates(int var1, int var2) {
|
||||
this.posX = var1;
|
||||
this.posZ = var2;
|
||||
}
|
||||
|
||||
public boolean equals(Object var1) {
|
||||
if(!(var1 instanceof ChunkCoordinates)) {
|
||||
return false;
|
||||
} else {
|
||||
ChunkCoordinates var2 = (ChunkCoordinates)var1;
|
||||
return this.posX == var2.posX && this.posZ == var2.posZ;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return this.posX << 16 ^ this.posZ;
|
||||
}
|
||||
}
|
72
src/main/java/net/minecraft/src/ChunkProviderClient.java
Normal file
72
src/main/java/net/minecraft/src/ChunkProviderClient.java
Normal file
|
@ -0,0 +1,72 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ChunkProviderClient implements IChunkProvider {
|
||||
private Chunk blankChunk;
|
||||
private Map chunkMapping = new HashMap();
|
||||
private List chunkListing = new ArrayList();
|
||||
private World worldObj;
|
||||
int a = -999999999;
|
||||
int b = -999999999;
|
||||
private Chunk g;
|
||||
|
||||
public ChunkProviderClient(World var1) {
|
||||
this.blankChunk = new Chunk(var1, new byte[-Short.MIN_VALUE], 0, 0);
|
||||
this.blankChunk.isChunkRendered = true;
|
||||
this.blankChunk.neverSave = true;
|
||||
this.worldObj = var1;
|
||||
}
|
||||
|
||||
public boolean chunkExists(int var1, int var2) {
|
||||
if(var1 == this.a && var2 == this.b && this.g != null) {
|
||||
return true;
|
||||
} else {
|
||||
ChunkCoordinates var3 = new ChunkCoordinates(var1, var2);
|
||||
return this.chunkMapping.containsKey(var3);
|
||||
}
|
||||
}
|
||||
|
||||
public Chunk loadChunk(int var1, int var2) {
|
||||
ChunkCoordinates var3 = new ChunkCoordinates(var1, var2);
|
||||
this.g = null;
|
||||
Chunk var4 = new Chunk(this.worldObj, new byte[-Short.MIN_VALUE], var1, var2);
|
||||
this.chunkMapping.put(var3, var4);
|
||||
return var4;
|
||||
}
|
||||
|
||||
public Chunk provideChunk(int var1, int var2) {
|
||||
if(var1 == this.a && var2 == this.b && this.g != null) {
|
||||
return this.g;
|
||||
} else {
|
||||
ChunkCoordinates var3 = new ChunkCoordinates(var1, var2);
|
||||
Chunk var4 = (Chunk)this.chunkMapping.get(var3);
|
||||
if(var4 == null) {
|
||||
return this.blankChunk;
|
||||
} else {
|
||||
this.a = var1;
|
||||
this.b = var2;
|
||||
this.g = var4;
|
||||
return var4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean saveChunks(boolean var1, IProgressUpdate var2) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean unload100OldestChunks() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canSave() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void populate(IChunkProvider var1, int var2, int var3) {
|
||||
}
|
||||
}
|
|
@ -615,7 +615,7 @@ public class ChunkProviderGenerate implements IChunkProvider {
|
|||
if(this.worldObj.snowCovered) {
|
||||
for(var14 = var4 + 8 + 0; var14 < var4 + 8 + 16; ++var14) {
|
||||
for(var15 = var5 + 8 + 0; var15 < var5 + 8 + 16; ++var15) {
|
||||
var16 = this.worldObj.getPrecipitationHeight(var14, var15);
|
||||
var16 = this.worldObj.getTopSolidOrLiquidBlock(var14, var15);
|
||||
if(var16 > 0 && var16 < 128 && this.worldObj.getBlockId(var14, var16, var15) == 0 && this.worldObj.getBlockMaterial(var14, var16 - 1, var15).getIsSolid() && this.worldObj.getBlockMaterial(var14, var16 - 1, var15) != Material.ice) {
|
||||
this.worldObj.setBlockWithNotify(var14, var16, var15, Block.snow.blockID);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ public class CraftingManager {
|
|||
(new RecipesFood()).addRecipes(this);
|
||||
(new RecipesCrafting()).addRecipes(this);
|
||||
(new RecipesArmor()).addRecipes(this);
|
||||
this.addRecipe(new ItemStack(Block.blockSnow, 1), new Object[]{"###", "###", "###", Character.valueOf('#'), Item.snowball});
|
||||
this.addRecipe(new ItemStack(Block.cloth, 1), new Object[]{"###", "###", "###", Character.valueOf('#'), Item.silk});
|
||||
this.addRecipe(new ItemStack(Block.tnt, 1), new Object[]{"X#X", "#X#", "X#X", Character.valueOf('X'), Item.gunpowder, Character.valueOf('#'), Block.sand});
|
||||
this.addRecipe(new ItemStack(Block.stairSingle, 3), new Object[]{"###", Character.valueOf('#'), Block.cobblestone});
|
||||
|
|
|
@ -7,7 +7,7 @@ import org.lwjgl.opengl.GL11;
|
|||
|
||||
public class EffectRenderer {
|
||||
protected World worldObj;
|
||||
private List[] fxLayers = new List[3];
|
||||
private List[] fxLayers = new List[4];
|
||||
private RenderEngine renderEngine;
|
||||
private Random rand = new Random();
|
||||
|
||||
|
@ -18,7 +18,7 @@ public class EffectRenderer {
|
|||
|
||||
this.renderEngine = var2;
|
||||
|
||||
for(int var3 = 0; var3 < 3; ++var3) {
|
||||
for(int var3 = 0; var3 < 4; ++var3) {
|
||||
this.fxLayers[var3] = new ArrayList();
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ public class EffectRenderer {
|
|||
}
|
||||
|
||||
public void updateEffects() {
|
||||
for(int var1 = 0; var1 < 3; ++var1) {
|
||||
for(int var1 = 0; var1 < 4; ++var1) {
|
||||
for(int var2 = 0; var2 < this.fxLayers[var1].size(); ++var2) {
|
||||
EntityFX var3 = (EntityFX)this.fxLayers[var1].get(var2);
|
||||
var3.onUpdate();
|
||||
|
@ -52,7 +52,7 @@ public class EffectRenderer {
|
|||
EntityFX.interpPosY = var1.lastTickPosY + (var1.posY - var1.lastTickPosY) * (double)var2;
|
||||
EntityFX.interpPosZ = var1.lastTickPosZ + (var1.posZ - var1.lastTickPosZ) * (double)var2;
|
||||
|
||||
for(int var8 = 0; var8 < 2; ++var8) {
|
||||
for(int var8 = 0; var8 < 3; ++var8) {
|
||||
if(this.fxLayers[var8].size() != 0) {
|
||||
int var9 = 0;
|
||||
if(var8 == 0) {
|
||||
|
@ -63,6 +63,10 @@ public class EffectRenderer {
|
|||
var9 = this.renderEngine.getTexture("/terrain.png");
|
||||
}
|
||||
|
||||
if(var8 == 2) {
|
||||
var9 = this.renderEngine.getTexture("/gui/items.png");
|
||||
}
|
||||
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, var9);
|
||||
Tessellator var10 = Tessellator.instance;
|
||||
var10.startDrawingQuads();
|
||||
|
@ -79,7 +83,7 @@ public class EffectRenderer {
|
|||
}
|
||||
|
||||
public void renderLitParticles(Entity var1, float var2) {
|
||||
byte var3 = 2;
|
||||
byte var3 = 3;
|
||||
if(this.fxLayers[var3].size() != 0) {
|
||||
Tessellator var4 = Tessellator.instance;
|
||||
|
||||
|
@ -94,7 +98,7 @@ public class EffectRenderer {
|
|||
public void clearEffects(World var1) {
|
||||
this.worldObj = var1;
|
||||
|
||||
for(int var2 = 0; var2 < 3; ++var2) {
|
||||
for(int var2 = 0; var2 < 4; ++var2) {
|
||||
this.fxLayers[var2].clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -345,7 +345,10 @@ public abstract class Entity {
|
|||
if(this.distanceWalkedModified > (float)this.nextStepDistance && var27 > 0) {
|
||||
++this.nextStepDistance;
|
||||
StepSound var28 = Block.blocksList[var27].stepSound;
|
||||
if(!Block.blocksList[var27].material.getIsLiquid()) {
|
||||
if(this.worldObj.getBlockId(var36, var25 + 1, var38) == Block.snow.blockID) {
|
||||
var28 = Block.snow.stepSound;
|
||||
this.worldObj.playSoundAtEntity(this, var28.getStepSound(), var28.getVolume() * 0.15F, var28.getPitch());
|
||||
} else if(!Block.blocksList[var27].material.getIsLiquid()) {
|
||||
this.worldObj.playSoundAtEntity(this, var28.getStepSound(), var28.getVolume() * 0.15F, var28.getPitch());
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ public class EntityList {
|
|||
|
||||
static {
|
||||
addMapping(EntityArrow.class, "Arrow");
|
||||
addMapping(EntitySnowball.class, "Snowball");
|
||||
addMapping(EntityItem.class, "Item");
|
||||
addMapping(EntityPainting.class, "Painting");
|
||||
addMapping(EntityLiving.class, "Mob");
|
||||
|
|
|
@ -49,6 +49,6 @@ public class EntityPickupFX extends EntityFX {
|
|||
}
|
||||
|
||||
public int getFXLayer() {
|
||||
return 2;
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -389,6 +389,10 @@ public class EntityRenderer {
|
|||
this.renderSnow(var1);
|
||||
}
|
||||
|
||||
if(this.mc.isRaining) {
|
||||
this.renderRain(var1);
|
||||
}
|
||||
|
||||
if(this.pointedEntity != null) {
|
||||
}
|
||||
|
||||
|
@ -455,7 +459,11 @@ public class EntityRenderer {
|
|||
|
||||
for(int var15 = var4 - var14; var15 <= var4 + var14; ++var15) {
|
||||
for(int var16 = var6 - var14; var16 <= var6 + var14; ++var16) {
|
||||
int var17 = var3.getPrecipitationHeight(var15, var16);
|
||||
int var17 = var3.getTopSolidOrLiquidBlock(var15, var16);
|
||||
if(var17 < 0) {
|
||||
var17 = 0;
|
||||
}
|
||||
|
||||
int var18 = var5 - var14;
|
||||
int var19 = var5 + var14;
|
||||
if(var18 < var17) {
|
||||
|
@ -470,7 +478,7 @@ public class EntityRenderer {
|
|||
if(var18 != var19) {
|
||||
this.random.setSeed((long)(var15 * var15 * 3121 + var15 * 45238971 + var16 * var16 * 418711 + var16 * 13761));
|
||||
float var21 = (float)this.rendererUpdateCount + var1;
|
||||
float var22 = ((float)(this.rendererUpdateCount & 255) + var1) / 256.0F;
|
||||
float var22 = ((float)(this.rendererUpdateCount & 511) + var1) / 512.0F;
|
||||
float var23 = this.random.nextFloat() + var21 * 0.01F * (float)this.random.nextGaussian();
|
||||
float var24 = this.random.nextFloat() + var21 * (float)this.random.nextGaussian() * 0.001F;
|
||||
double var25 = (double)((float)var15 + 0.5F) - var2.posX;
|
||||
|
@ -498,6 +506,67 @@ public class EntityRenderer {
|
|||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
private void renderRain(float var1) {
|
||||
EntityPlayerSP var2 = this.mc.thePlayer;
|
||||
World var3 = this.mc.theWorld;
|
||||
int var4 = MathHelper.floor_double(var2.posX);
|
||||
int var5 = MathHelper.floor_double(var2.posY);
|
||||
int var6 = MathHelper.floor_double(var2.posZ);
|
||||
Tessellator var7 = Tessellator.instance;
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/rain.png"));
|
||||
double var8 = var2.lastTickPosX + (var2.posX - var2.lastTickPosX) * (double)var1;
|
||||
double var10 = var2.lastTickPosY + (var2.posY - var2.lastTickPosY) * (double)var1;
|
||||
double var12 = var2.lastTickPosZ + (var2.posZ - var2.lastTickPosZ) * (double)var1;
|
||||
byte var14 = 5;
|
||||
if(this.mc.options.fancyGraphics) {
|
||||
var14 = 10;
|
||||
}
|
||||
|
||||
for(int var15 = var4 - var14; var15 <= var4 + var14; ++var15) {
|
||||
for(int var16 = var6 - var14; var16 <= var6 + var14; ++var16) {
|
||||
int var17 = var3.getPrecipitationHeight(var15, var16);
|
||||
int var18 = var5 - var14;
|
||||
int var19 = var5 + var14;
|
||||
if(var18 < var17) {
|
||||
var18 = var17;
|
||||
}
|
||||
|
||||
if(var19 < var17) {
|
||||
var19 = var17;
|
||||
}
|
||||
|
||||
float var20 = 2.0F;
|
||||
if(var18 != var19) {
|
||||
float var21 = ((float)(this.rendererUpdateCount + var15 * var15 * 3121 + var15 * 45238971 + var16 * var16 * 418711 + var16 * 13761 & 31) + var1) / 32.0F;
|
||||
double var22 = (double)((float)var15 + 0.5F) - var2.posX;
|
||||
double var24 = (double)((float)var16 + 0.5F) - var2.posZ;
|
||||
float var26 = MathHelper.sqrt_double(var22 * var22 + var24 * var24) / (float)var14;
|
||||
var7.startDrawingQuads();
|
||||
float var27 = var3.getBrightness(var15, 128, var16);
|
||||
GL11.glColor4f(var27, var27, var27, (1.0F - var26 * var26) * 0.7F);
|
||||
var7.setTranslationD(-var8 * 1.0D, -var10 * 1.0D, -var12 * 1.0D);
|
||||
var7.addVertexWithUV((double)(var15 + 0), (double)var18, (double)(var16 + 0), (double)(0.0F * var20), (double)((float)var18 * var20 / 8.0F + var21 * var20));
|
||||
var7.addVertexWithUV((double)(var15 + 1), (double)var18, (double)(var16 + 1), (double)(1.0F * var20), (double)((float)var18 * var20 / 8.0F + var21 * var20));
|
||||
var7.addVertexWithUV((double)(var15 + 1), (double)var19, (double)(var16 + 1), (double)(1.0F * var20), (double)((float)var19 * var20 / 8.0F + var21 * var20));
|
||||
var7.addVertexWithUV((double)(var15 + 0), (double)var19, (double)(var16 + 0), (double)(0.0F * var20), (double)((float)var19 * var20 / 8.0F + var21 * var20));
|
||||
var7.addVertexWithUV((double)(var15 + 0), (double)var18, (double)(var16 + 1), (double)(0.0F * var20), (double)((float)var18 * var20 / 8.0F + var21 * var20));
|
||||
var7.addVertexWithUV((double)(var15 + 1), (double)var18, (double)(var16 + 0), (double)(1.0F * var20), (double)((float)var18 * var20 / 8.0F + var21 * var20));
|
||||
var7.addVertexWithUV((double)(var15 + 1), (double)var19, (double)(var16 + 0), (double)(1.0F * var20), (double)((float)var19 * var20 / 8.0F + var21 * var20));
|
||||
var7.addVertexWithUV((double)(var15 + 0), (double)var19, (double)(var16 + 1), (double)(0.0F * var20), (double)((float)var19 * var20 / 8.0F + var21 * var20));
|
||||
var7.setTranslationD(0.0D, 0.0D, 0.0D);
|
||||
var7.draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
public void setupOverlayRendering() {
|
||||
ScaledResolution var1 = new ScaledResolution(this.mc.displayWidth, this.mc.displayHeight);
|
||||
int var2 = var1.getScaledWidth();
|
||||
|
|
32
src/main/java/net/minecraft/src/EntitySlimeFX.java
Normal file
32
src/main/java/net/minecraft/src/EntitySlimeFX.java
Normal file
|
@ -0,0 +1,32 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class EntitySlimeFX extends EntityFX {
|
||||
public EntitySlimeFX(World var1, double var2, double var4, double var6) {
|
||||
super(var1, var2, var4, var6, 0.0D, 0.0D, 0.0D);
|
||||
this.particleTextureIndex = Item.snowball.getIconIndex((ItemStack)null);
|
||||
this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
|
||||
this.particleGravity = Block.blockSnow.blockParticleGravity;
|
||||
this.particleScale /= 2.0F;
|
||||
}
|
||||
|
||||
public int getFXLayer() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
public void renderParticle(Tessellator var1, float var2, float var3, float var4, float var5, float var6, float var7) {
|
||||
float var8 = ((float)(this.particleTextureIndex % 16) + this.particleTextureJitterX / 4.0F) / 16.0F;
|
||||
float var9 = var8 + 0.999F / 64.0F;
|
||||
float var10 = ((float)(this.particleTextureIndex / 16) + this.particleTextureJitterY / 4.0F) / 16.0F;
|
||||
float var11 = var10 + 0.999F / 64.0F;
|
||||
float var12 = 0.1F * this.particleScale;
|
||||
float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)var2 - interpPosX);
|
||||
float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)var2 - interpPosY);
|
||||
float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)var2 - interpPosZ);
|
||||
float var16 = this.getBrightness(var2);
|
||||
var1.setColorOpaque_F(var16 * this.particleRed, var16 * this.particleGreen, var16 * this.particleBlue);
|
||||
var1.addVertexWithUV((double)(var13 - var3 * var12 - var6 * var12), (double)(var14 - var4 * var12), (double)(var15 - var5 * var12 - var7 * var12), (double)var8, (double)var11);
|
||||
var1.addVertexWithUV((double)(var13 - var3 * var12 + var6 * var12), (double)(var14 + var4 * var12), (double)(var15 - var5 * var12 + var7 * var12), (double)var8, (double)var10);
|
||||
var1.addVertexWithUV((double)(var13 + var3 * var12 + var6 * var12), (double)(var14 + var4 * var12), (double)(var15 + var5 * var12 + var7 * var12), (double)var9, (double)var10);
|
||||
var1.addVertexWithUV((double)(var13 + var3 * var12 - var6 * var12), (double)(var14 - var4 * var12), (double)(var15 + var5 * var12 - var7 * var12), (double)var9, (double)var11);
|
||||
}
|
||||
}
|
198
src/main/java/net/minecraft/src/EntitySnowball.java
Normal file
198
src/main/java/net/minecraft/src/EntitySnowball.java
Normal file
|
@ -0,0 +1,198 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EntitySnowball extends Entity {
|
||||
private int xTile = -1;
|
||||
private int yTile = -1;
|
||||
private int zTile = -1;
|
||||
private int inTile = 0;
|
||||
private boolean inGround = false;
|
||||
public int throwableShake = 0;
|
||||
private EntityLiving thrower;
|
||||
private int ticksInGround;
|
||||
private int ticksInAir = 0;
|
||||
|
||||
public EntitySnowball(World var1) {
|
||||
super(var1);
|
||||
this.setSize(0.5F, 0.5F);
|
||||
}
|
||||
|
||||
public EntitySnowball(World var1, EntityLiving var2) {
|
||||
super(var1);
|
||||
this.thrower = var2;
|
||||
this.setSize(0.25F, 0.25F);
|
||||
this.setLocationAndAngles(var2.posX, var2.posY, var2.posZ, var2.rotationYaw, var2.rotationPitch);
|
||||
this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);
|
||||
this.posY -= (double)0.1F;
|
||||
this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
this.yOffset = 0.0F;
|
||||
float var3 = 0.4F;
|
||||
this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * var3);
|
||||
this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * var3);
|
||||
this.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI) * var3);
|
||||
this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, 1.5F, 1.0F);
|
||||
}
|
||||
|
||||
public void setThrowableHeading(double var1, double var3, double var5, float var7, float var8) {
|
||||
float var9 = MathHelper.sqrt_double(var1 * var1 + var3 * var3 + var5 * var5);
|
||||
var1 /= (double)var9;
|
||||
var3 /= (double)var9;
|
||||
var5 /= (double)var9;
|
||||
var1 += this.rand.nextGaussian() * (double)0.0075F * (double)var8;
|
||||
var3 += this.rand.nextGaussian() * (double)0.0075F * (double)var8;
|
||||
var5 += this.rand.nextGaussian() * (double)0.0075F * (double)var8;
|
||||
var1 *= (double)var7;
|
||||
var3 *= (double)var7;
|
||||
var5 *= (double)var7;
|
||||
this.motionX = var1;
|
||||
this.motionY = var3;
|
||||
this.motionZ = var5;
|
||||
float var10 = MathHelper.sqrt_double(var1 * var1 + var5 * var5);
|
||||
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(var1, var5) * 180.0D / (double)((float)Math.PI));
|
||||
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(var3, (double)var10) * 180.0D / (double)((float)Math.PI));
|
||||
this.ticksInGround = 0;
|
||||
}
|
||||
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
if(this.throwableShake > 0) {
|
||||
--this.throwableShake;
|
||||
}
|
||||
|
||||
if(this.inGround) {
|
||||
int var1 = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile);
|
||||
if(var1 == this.inTile) {
|
||||
++this.ticksInGround;
|
||||
if(this.ticksInGround == 1200) {
|
||||
this.setEntityDead();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.inGround = false;
|
||||
this.motionX *= (double)(this.rand.nextFloat() * 0.2F);
|
||||
this.motionY *= (double)(this.rand.nextFloat() * 0.2F);
|
||||
this.motionZ *= (double)(this.rand.nextFloat() * 0.2F);
|
||||
this.ticksInGround = 0;
|
||||
this.ticksInAir = 0;
|
||||
} else {
|
||||
++this.ticksInAir;
|
||||
}
|
||||
|
||||
Vec3D var15 = Vec3D.createVector(this.posX, this.posY, this.posZ);
|
||||
Vec3D var2 = Vec3D.createVector(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||
MovingObjectPosition var3 = this.worldObj.rayTraceBlocks(var15, var2);
|
||||
var15 = Vec3D.createVector(this.posX, this.posY, this.posZ);
|
||||
var2 = Vec3D.createVector(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||
if(var3 != null) {
|
||||
var2 = Vec3D.createVector(var3.hitVec.xCoord, var3.hitVec.yCoord, var3.hitVec.zCoord);
|
||||
}
|
||||
|
||||
Entity var4 = null;
|
||||
List var5 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
|
||||
double var6 = 0.0D;
|
||||
|
||||
int var8;
|
||||
float var10;
|
||||
for(var8 = 0; var8 < var5.size(); ++var8) {
|
||||
Entity var9 = (Entity)var5.get(var8);
|
||||
if(var9.canBeCollidedWith() && (var9 != this.thrower || this.ticksInAir >= 5)) {
|
||||
var10 = 0.3F;
|
||||
AxisAlignedBB var11 = var9.boundingBox.expand((double)var10, (double)var10, (double)var10);
|
||||
MovingObjectPosition var12 = var11.calculateIntercept(var15, var2);
|
||||
if(var12 != null) {
|
||||
double var13 = var15.distanceTo(var12.hitVec);
|
||||
if(var13 < var6 || var6 == 0.0D) {
|
||||
var4 = var9;
|
||||
var6 = var13;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(var4 != null) {
|
||||
var3 = new MovingObjectPosition(var4);
|
||||
}
|
||||
|
||||
if(var3 != null) {
|
||||
if(var3.entityHit != null && var3.entityHit.attackEntityFrom(this.thrower, 0)) {
|
||||
}
|
||||
|
||||
for(var8 = 0; var8 < 8; ++var8) {
|
||||
this.worldObj.spawnParticle("snowballpoof", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
this.setEntityDead();
|
||||
}
|
||||
|
||||
this.posX += this.motionX;
|
||||
this.posY += this.motionY;
|
||||
this.posZ += this.motionZ;
|
||||
float var16 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / (double)((float)Math.PI));
|
||||
|
||||
for(this.rotationPitch = (float)(Math.atan2(this.motionY, (double)var16) * 180.0D / (double)((float)Math.PI)); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) {
|
||||
}
|
||||
|
||||
while(this.rotationPitch - this.prevRotationPitch >= 180.0F) {
|
||||
this.prevRotationPitch += 360.0F;
|
||||
}
|
||||
|
||||
while(this.rotationYaw - this.prevRotationYaw < -180.0F) {
|
||||
this.prevRotationYaw -= 360.0F;
|
||||
}
|
||||
|
||||
while(this.rotationYaw - this.prevRotationYaw >= 180.0F) {
|
||||
this.prevRotationYaw += 360.0F;
|
||||
}
|
||||
|
||||
this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
|
||||
this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
|
||||
float var17 = 0.99F;
|
||||
var10 = 0.03F;
|
||||
if(this.handleWaterMovement()) {
|
||||
for(int var18 = 0; var18 < 4; ++var18) {
|
||||
float var19 = 0.25F;
|
||||
this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)var19, this.posY - this.motionY * (double)var19, this.posZ - this.motionZ * (double)var19, this.motionX, this.motionY, this.motionZ);
|
||||
}
|
||||
|
||||
var17 = 0.8F;
|
||||
}
|
||||
|
||||
this.motionX *= (double)var17;
|
||||
this.motionY *= (double)var17;
|
||||
this.motionZ *= (double)var17;
|
||||
this.motionY -= (double)var10;
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
}
|
||||
|
||||
public void writeEntityToNBT(NBTTagCompound var1) {
|
||||
var1.setShort("xTile", (short)this.xTile);
|
||||
var1.setShort("yTile", (short)this.yTile);
|
||||
var1.setShort("zTile", (short)this.zTile);
|
||||
var1.setByte("inTile", (byte)this.inTile);
|
||||
var1.setByte("shake", (byte)this.throwableShake);
|
||||
var1.setByte("inGround", (byte)(this.inGround ? 1 : 0));
|
||||
}
|
||||
|
||||
public void readEntityFromNBT(NBTTagCompound var1) {
|
||||
this.xTile = var1.getShort("xTile");
|
||||
this.yTile = var1.getShort("yTile");
|
||||
this.zTile = var1.getShort("zTile");
|
||||
this.inTile = var1.getByte("inTile") & 255;
|
||||
this.throwableShake = var1.getByte("shake") & 255;
|
||||
this.inGround = var1.getByte("inGround") == 1;
|
||||
}
|
||||
|
||||
public void onCollideWithPlayer(EntityPlayer var1) {
|
||||
if(this.inGround && this.thrower == var1 && this.throwableShake <= 0 && var1.inventory.addItemStackToInventory(new ItemStack(Item.arrow.shiftedIndex, 1))) {
|
||||
this.worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
var1.onItemPickup(this);
|
||||
this.setEntityDead();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
36
src/main/java/net/minecraft/src/GuiConnectFailed.java
Normal file
36
src/main/java/net/minecraft/src/GuiConnectFailed.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class GuiConnectFailed extends GuiScreen {
|
||||
private String message;
|
||||
private String description;
|
||||
|
||||
public GuiConnectFailed(String var1, String var2) {
|
||||
this.message = var1;
|
||||
this.description = var2;
|
||||
}
|
||||
|
||||
public void updateScreen() {
|
||||
}
|
||||
|
||||
protected void keyTyped(char var1, int var2) {
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
this.controlList.clear();
|
||||
this.controlList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, "Back to title screen"));
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton var1) {
|
||||
if(var1.id == 0) {
|
||||
this.mc.displayGuiScreen(new GuiMainMenu());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void drawScreen(int var1, int var2, float var3) {
|
||||
this.drawDefaultBackground();
|
||||
this.drawCenteredString(this.fontRenderer, this.message, this.width / 2, this.height / 2 - 50, 16777215);
|
||||
this.drawCenteredString(this.fontRenderer, this.description, this.width / 2, this.height / 2 - 10, 16777215);
|
||||
super.drawScreen(var1, var2, var3);
|
||||
}
|
||||
}
|
52
src/main/java/net/minecraft/src/GuiConnecting.java
Normal file
52
src/main/java/net/minecraft/src/GuiConnecting.java
Normal file
|
@ -0,0 +1,52 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class GuiConnecting extends GuiScreen {
|
||||
private NetClientHandler clientHandler;
|
||||
|
||||
public GuiConnecting(Minecraft var1, String var2, int var3) {
|
||||
(new ThreadConnectToServer(this, var1, var2, var3)).start();
|
||||
}
|
||||
|
||||
public void updateScreen() {
|
||||
if(this.clientHandler != null) {
|
||||
this.clientHandler.processReadPackets();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void keyTyped(char var1, int var2) {
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
this.controlList.clear();
|
||||
this.controlList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, "Cancel"));
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton var1) {
|
||||
if(var1.id == 0) {
|
||||
this.mc.displayGuiScreen(new GuiMainMenu());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void drawScreen(int var1, int var2, float var3) {
|
||||
this.drawDefaultBackground();
|
||||
if(this.clientHandler == null) {
|
||||
this.drawCenteredString(this.fontRenderer, "Connecting to the server...", this.width / 2, this.height / 2 - 50, 16777215);
|
||||
this.drawCenteredString(this.fontRenderer, "", this.width / 2, this.height / 2 - 10, 16777215);
|
||||
} else {
|
||||
this.drawCenteredString(this.fontRenderer, "Logging in...", this.width / 2, this.height / 2 - 50, 16777215);
|
||||
this.drawCenteredString(this.fontRenderer, this.clientHandler.loginProgress, this.width / 2, this.height / 2 - 10, 16777215);
|
||||
}
|
||||
|
||||
super.drawScreen(var1, var2, var3);
|
||||
}
|
||||
|
||||
static NetClientHandler setNetClientHandler(GuiConnecting var0, NetClientHandler var1) {
|
||||
return var0.clientHandler = var1;
|
||||
}
|
||||
|
||||
static NetClientHandler getNetClientHandler(GuiConnecting var0) {
|
||||
return var0.clientHandler;
|
||||
}
|
||||
}
|
32
src/main/java/net/minecraft/src/GuiDownloadTerrain.java
Normal file
32
src/main/java/net/minecraft/src/GuiDownloadTerrain.java
Normal file
|
@ -0,0 +1,32 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class GuiDownloadTerrain extends GuiScreen {
|
||||
private NetClientHandler netHandler;
|
||||
|
||||
public GuiDownloadTerrain(NetClientHandler var1) {
|
||||
this.netHandler = var1;
|
||||
}
|
||||
|
||||
protected void keyTyped(char var1, int var2) {
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
this.controlList.clear();
|
||||
}
|
||||
|
||||
public void updateScreen() {
|
||||
if(this.netHandler != null) {
|
||||
this.netHandler.processReadPackets();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton var1) {
|
||||
}
|
||||
|
||||
public void drawScreen(int var1, int var2, float var3) {
|
||||
this.drawBackground(0);
|
||||
this.drawCenteredString(this.fontRenderer, "Receiving level", this.width / 2, this.height / 2 - 50, 16777215);
|
||||
super.drawScreen(var1, var2, var3);
|
||||
}
|
||||
}
|
|
@ -134,7 +134,7 @@ public class GuiIngame extends Gui {
|
|||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
if(this.mc.options.d) {
|
||||
var8.drawStringWithShadow("Minecraft Alpha v1.0.4 (" + this.mc.debug + ")", 2, 2, 16777215);
|
||||
var8.drawStringWithShadow("Minecraft Alpha v1.0.5 (" + this.mc.debug + ")", 2, 2, 16777215);
|
||||
var8.drawStringWithShadow(this.mc.debugInfoRenders(), 2, 12, 16777215);
|
||||
var8.drawStringWithShadow(this.mc.getEntityDebug(), 2, 22, 16777215);
|
||||
var8.drawStringWithShadow(this.mc.debugInfoEntities(), 2, 32, 16777215);
|
||||
|
@ -147,7 +147,7 @@ public class GuiIngame extends Gui {
|
|||
var21 = "Allocated memory: " + var26 * 100L / var22 + "% (" + var26 / 1024L / 1024L + "MB)";
|
||||
this.drawString(var8, var21, var6 - var8.getStringWidth(var21) - 2, 12, 14737632);
|
||||
} else {
|
||||
var8.drawStringWithShadow("Minecraft Alpha v1.0.4", 2, 2, 16777215);
|
||||
var8.drawStringWithShadow("Minecraft Alpha v1.0.5", 2, 2, 16777215);
|
||||
}
|
||||
|
||||
byte var23 = 10;
|
||||
|
|
|
@ -105,30 +105,34 @@ public class GuiScreen extends Gui {
|
|||
}
|
||||
|
||||
public void drawDefaultBackground() {
|
||||
this.drawBackground(0);
|
||||
this.drawWorldBackground(0);
|
||||
}
|
||||
|
||||
public void drawBackground(int var1) {
|
||||
public void drawWorldBackground(int var1) {
|
||||
if(this.mc.theWorld != null) {
|
||||
this.drawGradientRect(0, 0, this.width, this.height, 1610941696, -1607454656);
|
||||
} else {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_FOG);
|
||||
Tessellator var2 = Tessellator.instance;
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/dirt.png"));
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
float var3 = 32.0F;
|
||||
var2.startDrawingQuads();
|
||||
var2.setColorOpaque_I(4210752);
|
||||
var2.addVertexWithUV(0.0D, (double)this.height, 0.0D, 0.0D, (double)((float)this.height / var3 + (float)var1));
|
||||
var2.addVertexWithUV((double)this.width, (double)this.height, 0.0D, (double)((float)this.width / var3), (double)((float)this.height / var3 + (float)var1));
|
||||
var2.addVertexWithUV((double)this.width, 0.0D, 0.0D, (double)((float)this.width / var3), (double)(0 + var1));
|
||||
var2.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, (double)(0 + var1));
|
||||
var2.draw();
|
||||
this.drawBackground(var1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void drawBackground(int var1) {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_FOG);
|
||||
Tessellator var2 = Tessellator.instance;
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/dirt.png"));
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
float var3 = 32.0F;
|
||||
var2.startDrawingQuads();
|
||||
var2.setColorOpaque_I(4210752);
|
||||
var2.addVertexWithUV(0.0D, (double)this.height, 0.0D, 0.0D, (double)((float)this.height / var3 + (float)var1));
|
||||
var2.addVertexWithUV((double)this.width, (double)this.height, 0.0D, (double)((float)this.width / var3), (double)((float)this.height / var3 + (float)var1));
|
||||
var2.addVertexWithUV((double)this.width, 0.0D, 0.0D, (double)((float)this.width / var3), (double)(0 + var1));
|
||||
var2.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, (double)(0 + var1));
|
||||
var2.draw();
|
||||
}
|
||||
|
||||
public boolean doesGuiPauseGame() {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -81,6 +81,7 @@ public class Item {
|
|||
public static Item saddle = (new ItemSaddle(73)).setIconIndex(104);
|
||||
public static Item doorSteel = (new ItemDoor(74, Material.iron)).setIconIndex(44);
|
||||
public static Item redstone = (new ItemRedstone(75)).setIconIndex(56);
|
||||
public static Item snowball = (new ItemSnowball(76)).setIconIndex(14);
|
||||
public final int shiftedIndex;
|
||||
protected int maxStackSize = 64;
|
||||
protected int maxDamage = 32;
|
||||
|
|
|
@ -10,28 +10,32 @@ public class ItemBlock extends Item {
|
|||
}
|
||||
|
||||
public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7) {
|
||||
if(var7 == 0) {
|
||||
--var5;
|
||||
}
|
||||
if(var3.getBlockId(var4, var5, var6) == Block.snow.blockID) {
|
||||
var7 = 0;
|
||||
} else {
|
||||
if(var7 == 0) {
|
||||
--var5;
|
||||
}
|
||||
|
||||
if(var7 == 1) {
|
||||
++var5;
|
||||
}
|
||||
if(var7 == 1) {
|
||||
++var5;
|
||||
}
|
||||
|
||||
if(var7 == 2) {
|
||||
--var6;
|
||||
}
|
||||
if(var7 == 2) {
|
||||
--var6;
|
||||
}
|
||||
|
||||
if(var7 == 3) {
|
||||
++var6;
|
||||
}
|
||||
if(var7 == 3) {
|
||||
++var6;
|
||||
}
|
||||
|
||||
if(var7 == 4) {
|
||||
--var4;
|
||||
}
|
||||
if(var7 == 4) {
|
||||
--var4;
|
||||
}
|
||||
|
||||
if(var7 == 5) {
|
||||
++var4;
|
||||
if(var7 == 5) {
|
||||
++var4;
|
||||
}
|
||||
}
|
||||
|
||||
if(var1.stackSize == 0) {
|
||||
|
|
14
src/main/java/net/minecraft/src/ItemSnowball.java
Normal file
14
src/main/java/net/minecraft/src/ItemSnowball.java
Normal file
|
@ -0,0 +1,14 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class ItemSnowball extends Item {
|
||||
public ItemSnowball(int var1) {
|
||||
super(var1);
|
||||
}
|
||||
|
||||
public ItemStack onItemRightClick(ItemStack var1, World var2, EntityPlayer var3) {
|
||||
--var1.stackSize;
|
||||
var2.playSoundAtEntity(var3, "random.bow", 1.0F, 0.6F / (rand.nextFloat() * 0.4F + 0.8F));
|
||||
var2.spawnEntityInWorld(new EntitySnowball(var2, var3));
|
||||
return var1;
|
||||
}
|
||||
}
|
50
src/main/java/net/minecraft/src/MCHashEntry.java
Normal file
50
src/main/java/net/minecraft/src/MCHashEntry.java
Normal file
|
@ -0,0 +1,50 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
class MCHashEntry {
|
||||
final int hashEntry;
|
||||
Object valueEntry;
|
||||
MCHashEntry nextEntry;
|
||||
final int slotHash;
|
||||
|
||||
MCHashEntry(int var1, int var2, Object var3, MCHashEntry var4) {
|
||||
this.valueEntry = var3;
|
||||
this.nextEntry = var4;
|
||||
this.hashEntry = var2;
|
||||
this.slotHash = var1;
|
||||
}
|
||||
|
||||
public final int getHash() {
|
||||
return this.hashEntry;
|
||||
}
|
||||
|
||||
public final Object getValue() {
|
||||
return this.valueEntry;
|
||||
}
|
||||
|
||||
public final boolean equals(Object var1) {
|
||||
if(!(var1 instanceof MCHashEntry)) {
|
||||
return false;
|
||||
} else {
|
||||
MCHashEntry var2 = (MCHashEntry)var1;
|
||||
Integer var3 = Integer.valueOf(this.getHash());
|
||||
Integer var4 = Integer.valueOf(var2.getHash());
|
||||
if(var3 == var4 || var3 != null && var3.equals(var4)) {
|
||||
Object var5 = this.getValue();
|
||||
Object var6 = var2.getValue();
|
||||
if(var5 == var6 || var5 != null && var5.equals(var6)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public final int hashCode() {
|
||||
return MCHashTable.getHash(this.hashEntry);
|
||||
}
|
||||
|
||||
public final String toString() {
|
||||
return this.getHash() + "=" + this.getValue();
|
||||
}
|
||||
}
|
103
src/main/java/net/minecraft/src/MCHashTable.java
Normal file
103
src/main/java/net/minecraft/src/MCHashTable.java
Normal file
|
@ -0,0 +1,103 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class MCHashTable {
|
||||
private transient MCHashEntry[] slots = new MCHashEntry[16];
|
||||
private transient int count;
|
||||
private int threshold = 12;
|
||||
private final float growFactor = 12.0F / 16.0F;
|
||||
private transient volatile int versionStamp;
|
||||
|
||||
private static int computeHash(int var0) {
|
||||
var0 ^= var0 >>> 20 ^ var0 >>> 12;
|
||||
return var0 ^ var0 >>> 7 ^ var0 >>> 4;
|
||||
}
|
||||
|
||||
private static int getSlotIndex(int var0, int var1) {
|
||||
return var0 & var1 - 1;
|
||||
}
|
||||
|
||||
public Object lookup(int var1) {
|
||||
int var2 = computeHash(var1);
|
||||
|
||||
for(MCHashEntry var3 = this.slots[getSlotIndex(var2, this.slots.length)]; var3 != null; var3 = var3.nextEntry) {
|
||||
if(var3.hashEntry == var1) {
|
||||
return var3.valueEntry;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addKey(int var1, Object var2) {
|
||||
int var3 = computeHash(var1);
|
||||
int var4 = getSlotIndex(var3, this.slots.length);
|
||||
|
||||
for(MCHashEntry var5 = this.slots[var4]; var5 != null; var5 = var5.nextEntry) {
|
||||
if(var5.hashEntry == var1) {
|
||||
var5.valueEntry = var2;
|
||||
}
|
||||
}
|
||||
|
||||
++this.versionStamp;
|
||||
this.insert(var3, var1, var2, var4);
|
||||
}
|
||||
|
||||
private void grow(int var1) {
|
||||
MCHashEntry[] var2 = this.slots;
|
||||
int var3 = var2.length;
|
||||
if(var3 == 1073741824) {
|
||||
this.threshold = Integer.MAX_VALUE;
|
||||
} else {
|
||||
MCHashEntry[] var4 = new MCHashEntry[var1];
|
||||
this.copyTo(var4);
|
||||
this.slots = var4;
|
||||
this.threshold = (int)((float)var1 * this.growFactor);
|
||||
}
|
||||
}
|
||||
|
||||
private void copyTo(MCHashEntry[] var1) {
|
||||
MCHashEntry[] var2 = this.slots;
|
||||
int var3 = var1.length;
|
||||
|
||||
for(int var4 = 0; var4 < var2.length; ++var4) {
|
||||
MCHashEntry var5 = var2[var4];
|
||||
if(var5 != null) {
|
||||
var2[var4] = null;
|
||||
|
||||
MCHashEntry var6;
|
||||
do {
|
||||
var6 = var5.nextEntry;
|
||||
int var7 = getSlotIndex(var5.slotHash, var3);
|
||||
var5.nextEntry = var1[var7];
|
||||
var1[var7] = var5;
|
||||
var5 = var6;
|
||||
} while(var6 != null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void clearMap() {
|
||||
++this.versionStamp;
|
||||
MCHashEntry[] var1 = this.slots;
|
||||
|
||||
for(int var2 = 0; var2 < var1.length; ++var2) {
|
||||
var1[var2] = null;
|
||||
}
|
||||
|
||||
this.count = 0;
|
||||
}
|
||||
|
||||
private void insert(int var1, int var2, Object var3, int var4) {
|
||||
MCHashEntry var5 = this.slots[var4];
|
||||
this.slots[var4] = new MCHashEntry(var1, var2, var3, var5);
|
||||
if(this.count++ >= this.threshold) {
|
||||
this.grow(2 * this.slots.length);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static int getHash(int var0) {
|
||||
return computeHash(var0);
|
||||
}
|
||||
}
|
|
@ -54,6 +54,8 @@ public abstract class Minecraft implements Runnable {
|
|||
public File mcDataDir;
|
||||
public static long[] frameTimes = new long[512];
|
||||
public static int numRecordedFrameTimes = 0;
|
||||
private String serverName;
|
||||
private int serverPort;
|
||||
private TextureWaterFX textureWaterFX = new TextureWaterFX();
|
||||
private TextureLavaFX textureLavaFX = new TextureLavaFX();
|
||||
private static File minecraftDir = null;
|
||||
|
@ -80,6 +82,8 @@ public abstract class Minecraft implements Runnable {
|
|||
public abstract void displayUnexpectedThrowable(UnexpectedThrowable var1);
|
||||
|
||||
public void setServer(String var1, int var2) {
|
||||
this.serverName = var1;
|
||||
this.serverPort = var2;
|
||||
}
|
||||
|
||||
public void startGame() throws LWJGLException {
|
||||
|
@ -107,7 +111,7 @@ public abstract class Minecraft implements Runnable {
|
|||
Display.setDisplayMode(new DisplayMode(this.displayWidth, this.displayHeight));
|
||||
}
|
||||
|
||||
Display.setTitle("Minecraft Minecraft Alpha v1.0.4");
|
||||
Display.setTitle("Minecraft Minecraft Alpha v1.0.5");
|
||||
|
||||
try {
|
||||
Display.create();
|
||||
|
@ -160,7 +164,6 @@ public abstract class Minecraft implements Runnable {
|
|||
this.renderEngine.registerTextureFX(new TextureFlamesFX(1));
|
||||
this.renderGlobal = new RenderGlobal(this, this.renderEngine);
|
||||
GL11.glViewport(0, 0, this.displayWidth, this.displayHeight);
|
||||
this.displayGuiScreen(new GuiMainMenu());
|
||||
this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine);
|
||||
|
||||
try {
|
||||
|
@ -172,6 +175,12 @@ public abstract class Minecraft implements Runnable {
|
|||
this.checkGLError("Post startup");
|
||||
this.ingameGUI = new GuiIngame(this);
|
||||
this.playerController.initController();
|
||||
if(this.serverName != null) {
|
||||
this.displayGuiScreen(new GuiConnecting(this, this.serverName, this.serverPort));
|
||||
} else {
|
||||
this.displayGuiScreen(new GuiMainMenu());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void loadScreen() throws LWJGLException {
|
||||
|
@ -429,6 +438,7 @@ public abstract class Minecraft implements Runnable {
|
|||
}
|
||||
} catch (MinecraftError var11) {
|
||||
} catch (Throwable var12) {
|
||||
this.theWorld = null;
|
||||
var12.printStackTrace();
|
||||
this.displayUnexpectedThrowable(new UnexpectedThrowable("Unexpected error", var12));
|
||||
} finally {
|
||||
|
@ -727,7 +737,7 @@ public abstract class Minecraft implements Runnable {
|
|||
}
|
||||
|
||||
if(this.currentScreen == null || this.currentScreen.allowUserInput) {
|
||||
label226:
|
||||
label221:
|
||||
while(true) {
|
||||
while(true) {
|
||||
while(true) {
|
||||
|
@ -755,7 +765,7 @@ public abstract class Minecraft implements Runnable {
|
|||
}
|
||||
|
||||
this.sendClickBlockToController(0, this.currentScreen == null && Mouse.isButtonDown(0) && this.inGameHasFocus);
|
||||
break label226;
|
||||
break label221;
|
||||
}
|
||||
|
||||
this.thePlayer.handleKeyPress(Keyboard.getEventKey(), Keyboard.getEventKeyState());
|
||||
|
@ -781,7 +791,6 @@ public abstract class Minecraft implements Runnable {
|
|||
|
||||
if(Keyboard.getEventKey() == Keyboard.KEY_F5) {
|
||||
this.options.thirdPersonView = !this.options.thirdPersonView;
|
||||
this.isRaining = !this.isRaining;
|
||||
}
|
||||
|
||||
if(Keyboard.getEventKey() == this.options.keyBindInventory.keyCode) {
|
||||
|
@ -883,7 +892,7 @@ public abstract class Minecraft implements Runnable {
|
|||
}
|
||||
|
||||
public boolean isMultiplayerWorld() {
|
||||
return false;
|
||||
return this.theWorld != null && this.theWorld.multiplayerWorld;
|
||||
}
|
||||
|
||||
public void startWorld(String var1) {
|
||||
|
@ -920,7 +929,10 @@ public abstract class Minecraft implements Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
this.preloadWorld(var2);
|
||||
if(!var1.multiplayerWorld) {
|
||||
this.preloadWorld(var2);
|
||||
}
|
||||
|
||||
if(this.thePlayer == null) {
|
||||
this.thePlayer = new EntityPlayerSP(this, var1, this.session);
|
||||
this.thePlayer.preparePlayerToSpawn();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Canvas;
|
||||
import java.awt.Component;
|
||||
import net.minecraft.client.MinecraftApplet;
|
||||
|
@ -14,6 +15,7 @@ public class MinecraftAppletImpl extends Minecraft {
|
|||
|
||||
public void displayUnexpectedThrowable(UnexpectedThrowable var1) {
|
||||
this.mainFrame.removeAll();
|
||||
this.mainFrame.setLayout(new BorderLayout());
|
||||
this.mainFrame.add(new PanelCrashReport(var1), "Center");
|
||||
this.mainFrame.validate();
|
||||
}
|
||||
|
|
64
src/main/java/net/minecraft/src/NetClientHandler.java
Normal file
64
src/main/java/net/minecraft/src/NetClientHandler.java
Normal file
|
@ -0,0 +1,64 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.Socket;
|
||||
|
||||
public class NetClientHandler extends NetHandler {
|
||||
private boolean disconnected = false;
|
||||
private NetworkManager netManager;
|
||||
public String loginProgress;
|
||||
private Minecraft mc;
|
||||
private WorldClient worldClient;
|
||||
|
||||
public NetClientHandler(Minecraft var1, String var2, int var3) throws IOException {
|
||||
this.mc = var1;
|
||||
Socket var4 = new Socket(InetAddress.getByName(var2), var3);
|
||||
this.netManager = new NetworkManager(var4, "Client", this);
|
||||
}
|
||||
|
||||
public void processReadPackets() {
|
||||
if(!this.disconnected) {
|
||||
this.netManager.processReadPackets();
|
||||
}
|
||||
}
|
||||
|
||||
public void handleLogin(Packet0Handshake var1) {
|
||||
this.mc.playerController = new PlayerControllerMP(this.mc);
|
||||
this.worldClient = new WorldClient(this);
|
||||
this.worldClient.multiplayerWorld = true;
|
||||
this.mc.changeWorld1(this.worldClient);
|
||||
this.mc.displayGuiScreen(new GuiDownloadTerrain(this));
|
||||
}
|
||||
|
||||
public void handleFlying(Packet1PlayerLookMove var1) {
|
||||
System.out.println("SPAWN!");
|
||||
this.mc.thePlayer.setLocationAndAngles(var1.xPosition, var1.yPosition, var1.zPosition, var1.yaw, var1.pitch);
|
||||
this.mc.displayGuiScreen((GuiScreen)null);
|
||||
}
|
||||
|
||||
public void handleMapChunk(Packet10MapChunk var1) {
|
||||
this.worldClient.setChunkData(var1.xPosition, var1.yPosition, var1.zPosition, var1.xSize, var1.ySize, var1.zSize, var1.chunkData);
|
||||
}
|
||||
|
||||
public void handleKickDisconnect(Packet255KickDisconnect var1) {
|
||||
this.netManager.networkShutdown("Got kicked");
|
||||
this.disconnected = true;
|
||||
this.mc.changeWorld1((World)null);
|
||||
this.mc.displayGuiScreen(new GuiConnectFailed("Disconnected by server", var1.reason));
|
||||
}
|
||||
|
||||
public void handleErrorMessage(String var1) {
|
||||
if(!this.disconnected) {
|
||||
this.disconnected = true;
|
||||
this.mc.changeWorld1((World)null);
|
||||
this.mc.displayGuiScreen(new GuiConnectFailed("Connection lost", var1));
|
||||
}
|
||||
}
|
||||
|
||||
public void addToSendQueue(Packet var1) {
|
||||
if(!this.disconnected) {
|
||||
this.netManager.addToSendQueue(var1);
|
||||
}
|
||||
}
|
||||
}
|
24
src/main/java/net/minecraft/src/NetHandler.java
Normal file
24
src/main/java/net/minecraft/src/NetHandler.java
Normal file
|
@ -0,0 +1,24 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class NetHandler {
|
||||
public void handleMapChunk(Packet10MapChunk var1) {
|
||||
}
|
||||
|
||||
public void registerPacket(Packet var1) {
|
||||
}
|
||||
|
||||
public void handleErrorMessage(String var1) {
|
||||
}
|
||||
|
||||
public void handleKickDisconnect(Packet255KickDisconnect var1) {
|
||||
this.registerPacket(var1);
|
||||
}
|
||||
|
||||
public void handleLogin(Packet0Handshake var1) {
|
||||
this.registerPacket(var1);
|
||||
}
|
||||
|
||||
public void handleFlying(Packet1PlayerLookMove var1) {
|
||||
this.registerPacket(var1);
|
||||
}
|
||||
}
|
142
src/main/java/net/minecraft/src/NetworkManager.java
Normal file
142
src/main/java/net/minecraft/src/NetworkManager.java
Normal file
|
@ -0,0 +1,142 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class NetworkManager {
|
||||
private Socket networkSocket;
|
||||
private DataInputStream socketInputStream;
|
||||
private DataOutputStream socketOutputStream;
|
||||
private boolean isRunning = true;
|
||||
private List readPackets = Collections.synchronizedList(new LinkedList());
|
||||
private List dataPackets = Collections.synchronizedList(new LinkedList());
|
||||
private List chunkDataPackets = Collections.synchronizedList(new LinkedList());
|
||||
private NetHandler netHandler;
|
||||
private boolean isServerTerminating = false;
|
||||
private Thread writeThread;
|
||||
private Thread readThread;
|
||||
private boolean isTerminating = false;
|
||||
private String terminationReason = "";
|
||||
private int chunkDataSendCounter = 0;
|
||||
|
||||
public NetworkManager(Socket var1, String var2, NetHandler var3) throws IOException {
|
||||
this.networkSocket = var1;
|
||||
this.netHandler = var3;
|
||||
var1.setTrafficClass(24);
|
||||
this.socketInputStream = new DataInputStream(var1.getInputStream());
|
||||
this.socketOutputStream = new DataOutputStream(var1.getOutputStream());
|
||||
this.readThread = new NetworkReaderThread(this, var2 + " read thread");
|
||||
this.writeThread = new NetworkWriterThread(this, var2 + " write thread");
|
||||
this.readThread.start();
|
||||
this.writeThread.start();
|
||||
}
|
||||
|
||||
public void addToSendQueue(Packet var1) {
|
||||
if(this.isServerTerminating) {
|
||||
throw new IllegalStateException("Tried to send data on a connection marked for quitting");
|
||||
} else {
|
||||
this.dataPackets.add(var1);
|
||||
}
|
||||
}
|
||||
|
||||
private void sendPacket() {
|
||||
try {
|
||||
boolean var1 = true;
|
||||
if(!this.dataPackets.isEmpty()) {
|
||||
var1 = false;
|
||||
Packet.writePacket((Packet)this.dataPackets.remove(0), this.socketOutputStream);
|
||||
}
|
||||
|
||||
if((var1 || this.chunkDataSendCounter-- <= 0) && !this.chunkDataPackets.isEmpty()) {
|
||||
var1 = false;
|
||||
Packet.writePacket((Packet)this.chunkDataPackets.remove(0), this.socketOutputStream);
|
||||
this.chunkDataSendCounter = 50;
|
||||
}
|
||||
|
||||
if(var1) {
|
||||
Thread.sleep(10L);
|
||||
}
|
||||
} catch (InterruptedException var2) {
|
||||
} catch (Exception var3) {
|
||||
this.onNetworkError(var3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void readPacket() {
|
||||
try {
|
||||
Packet var1 = Packet.readPacket(this.socketInputStream);
|
||||
if(var1 != null) {
|
||||
this.readPackets.add(var1);
|
||||
} else {
|
||||
this.networkShutdown("End of stream");
|
||||
}
|
||||
} catch (Exception var2) {
|
||||
this.onNetworkError(var2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void onNetworkError(Exception var1) {
|
||||
this.networkShutdown("Internal exception: " + var1.toString());
|
||||
}
|
||||
|
||||
public void networkShutdown(String var1) {
|
||||
if(this.isRunning) {
|
||||
this.isTerminating = true;
|
||||
this.terminationReason = var1;
|
||||
this.isRunning = false;
|
||||
|
||||
try {
|
||||
this.socketInputStream.close();
|
||||
} catch (Throwable var5) {
|
||||
}
|
||||
|
||||
try {
|
||||
this.socketOutputStream.close();
|
||||
} catch (Throwable var4) {
|
||||
}
|
||||
|
||||
try {
|
||||
this.networkSocket.close();
|
||||
} catch (Throwable var3) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void processReadPackets() {
|
||||
int var1 = 100;
|
||||
|
||||
while(!this.readPackets.isEmpty() && var1-- >= 0) {
|
||||
Packet var2 = (Packet)this.readPackets.remove(0);
|
||||
var2.processPacket(this.netHandler);
|
||||
}
|
||||
|
||||
if(this.isTerminating && this.readPackets.isEmpty()) {
|
||||
this.netHandler.handleErrorMessage(this.terminationReason);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static boolean isRunning(NetworkManager var0) {
|
||||
return var0.isRunning;
|
||||
}
|
||||
|
||||
static boolean isServerTerminating(NetworkManager var0) {
|
||||
return var0.isServerTerminating;
|
||||
}
|
||||
|
||||
static void readNetworkPacket(NetworkManager var0) {
|
||||
var0.readPacket();
|
||||
}
|
||||
|
||||
static void sendNetworkPacket(NetworkManager var0) {
|
||||
var0.sendPacket();
|
||||
}
|
||||
}
|
17
src/main/java/net/minecraft/src/NetworkReaderThread.java
Normal file
17
src/main/java/net/minecraft/src/NetworkReaderThread.java
Normal file
|
@ -0,0 +1,17 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
class NetworkReaderThread extends Thread {
|
||||
final NetworkManager netManager;
|
||||
|
||||
NetworkReaderThread(NetworkManager var1, String var2) {
|
||||
super(var2);
|
||||
this.netManager = var1;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
while(NetworkManager.isRunning(this.netManager) && !NetworkManager.isServerTerminating(this.netManager)) {
|
||||
NetworkManager.readNetworkPacket(this.netManager);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
17
src/main/java/net/minecraft/src/NetworkWriterThread.java
Normal file
17
src/main/java/net/minecraft/src/NetworkWriterThread.java
Normal file
|
@ -0,0 +1,17 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
class NetworkWriterThread extends Thread {
|
||||
final NetworkManager netManager;
|
||||
|
||||
NetworkWriterThread(NetworkManager var1, String var2) {
|
||||
super(var2);
|
||||
this.netManager = var1;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
while(NetworkManager.isRunning(this.netManager)) {
|
||||
NetworkManager.sendNetworkPacket(this.netManager);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
50
src/main/java/net/minecraft/src/Packet.java
Normal file
50
src/main/java/net/minecraft/src/Packet.java
Normal file
|
@ -0,0 +1,50 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public abstract class Packet {
|
||||
public static Packet getNewPacket(int var0) {
|
||||
switch(var0) {
|
||||
case 0:
|
||||
return new Packet0Handshake();
|
||||
case 1:
|
||||
return new Packet1PlayerLookMove();
|
||||
case 10:
|
||||
return new Packet10MapChunk();
|
||||
case 255:
|
||||
return new Packet255KickDisconnect();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Packet readPacket(DataInputStream var0) throws IOException {
|
||||
int var1 = var0.read();
|
||||
if(var1 == -1) {
|
||||
return null;
|
||||
} else {
|
||||
Packet var2 = getNewPacket(var1);
|
||||
if(var2 == null) {
|
||||
throw new IOException("Bad packet id " + var1);
|
||||
} else {
|
||||
var2.readPacketData(var0);
|
||||
return var2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void writePacket(Packet var0, DataOutputStream var1) throws IOException {
|
||||
var1.write(var0.getPacketId());
|
||||
var0.writePacket(var1);
|
||||
}
|
||||
|
||||
public abstract void readPacketData(DataInputStream var1) throws IOException;
|
||||
|
||||
public abstract void writePacket(DataOutputStream var1) throws IOException;
|
||||
|
||||
public abstract int getPacketId() throws IOException;
|
||||
|
||||
public abstract void processPacket(NetHandler var1);
|
||||
}
|
40
src/main/java/net/minecraft/src/Packet0Handshake.java
Normal file
40
src/main/java/net/minecraft/src/Packet0Handshake.java
Normal file
|
@ -0,0 +1,40 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet0Handshake extends Packet {
|
||||
public int protocol;
|
||||
public String username;
|
||||
public String password;
|
||||
|
||||
public Packet0Handshake() {
|
||||
}
|
||||
|
||||
public Packet0Handshake(String var1, String var2, int var3) {
|
||||
this.username = var1;
|
||||
this.password = var2;
|
||||
this.protocol = var3;
|
||||
}
|
||||
|
||||
public int getPacketId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.protocol = var1.readInt();
|
||||
this.username = var1.readUTF();
|
||||
this.password = var1.readUTF();
|
||||
}
|
||||
|
||||
public void writePacket(DataOutputStream var1) throws IOException {
|
||||
var1.writeInt(this.protocol);
|
||||
var1.writeUTF(this.username);
|
||||
var1.writeUTF(this.password);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleLogin(this);
|
||||
}
|
||||
}
|
67
src/main/java/net/minecraft/src/Packet10MapChunk.java
Normal file
67
src/main/java/net/minecraft/src/Packet10MapChunk.java
Normal file
|
@ -0,0 +1,67 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.zip.DataFormatException;
|
||||
import java.util.zip.Deflater;
|
||||
import java.util.zip.Inflater;
|
||||
|
||||
public class Packet10MapChunk extends Packet {
|
||||
public int xPosition;
|
||||
public int yPosition;
|
||||
public int zPosition;
|
||||
public int xSize;
|
||||
public int ySize;
|
||||
public int zSize;
|
||||
public byte[] chunkData;
|
||||
public int tempLength;
|
||||
|
||||
public int getPacketId() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.xPosition = var1.readInt();
|
||||
this.yPosition = var1.readShort();
|
||||
this.zPosition = var1.readInt();
|
||||
this.xSize = var1.read() + 1;
|
||||
this.ySize = var1.read() + 1;
|
||||
this.zSize = var1.read() + 1;
|
||||
int var2 = var1.readInt();
|
||||
byte[] var3 = new byte[var2];
|
||||
var1.readFully(var3);
|
||||
this.chunkData = new byte[this.xSize * this.ySize * this.zSize * 3 / 2];
|
||||
Inflater var4 = new Inflater();
|
||||
var4.setInput(var3);
|
||||
|
||||
try {
|
||||
var4.inflate(this.chunkData);
|
||||
} catch (DataFormatException var6) {
|
||||
throw new IOException("Bad compressed data format");
|
||||
}
|
||||
|
||||
var4.end();
|
||||
}
|
||||
|
||||
public void writePacket(DataOutputStream var1) throws IOException {
|
||||
Deflater var2 = new Deflater();
|
||||
var2.setInput(this.chunkData);
|
||||
var2.finish();
|
||||
this.chunkData = new byte[this.xSize * this.ySize * this.zSize * 2];
|
||||
this.tempLength = var2.deflate(this.chunkData);
|
||||
var2.end();
|
||||
var1.writeInt(this.xPosition);
|
||||
var1.writeShort(this.yPosition);
|
||||
var1.writeInt(this.zPosition);
|
||||
var1.write(this.xSize - 1);
|
||||
var1.write(this.ySize - 1);
|
||||
var1.write(this.zSize - 1);
|
||||
var1.writeInt(this.tempLength);
|
||||
var1.write(this.chunkData, 0, this.tempLength);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleMapChunk(this);
|
||||
}
|
||||
}
|
38
src/main/java/net/minecraft/src/Packet1PlayerLookMove.java
Normal file
38
src/main/java/net/minecraft/src/Packet1PlayerLookMove.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet1PlayerLookMove extends Packet {
|
||||
public double xPosition;
|
||||
public double yPosition;
|
||||
public double zPosition;
|
||||
public float yaw;
|
||||
public float pitch;
|
||||
|
||||
public int getPacketId() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
System.out.println("HANDLING A SPAWN PACKET!");
|
||||
var1.handleFlying(this);
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.xPosition = var1.readDouble();
|
||||
this.yPosition = var1.readDouble();
|
||||
this.zPosition = var1.readDouble();
|
||||
this.yaw = var1.readFloat();
|
||||
this.pitch = var1.readFloat();
|
||||
}
|
||||
|
||||
public void writePacket(DataOutputStream var1) throws IOException {
|
||||
var1.writeDouble(this.xPosition);
|
||||
var1.writeDouble(this.yPosition);
|
||||
var1.writeDouble(this.zPosition);
|
||||
var1.writeFloat(this.yaw);
|
||||
var1.writeFloat(this.pitch);
|
||||
}
|
||||
}
|
32
src/main/java/net/minecraft/src/Packet255KickDisconnect.java
Normal file
32
src/main/java/net/minecraft/src/Packet255KickDisconnect.java
Normal file
|
@ -0,0 +1,32 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet255KickDisconnect extends Packet {
|
||||
public String reason;
|
||||
|
||||
public Packet255KickDisconnect() {
|
||||
}
|
||||
|
||||
public Packet255KickDisconnect(String var1) {
|
||||
this.reason = var1;
|
||||
}
|
||||
|
||||
public int getPacketId() {
|
||||
return 255;
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream var1) throws IOException {
|
||||
this.reason = var1.readUTF();
|
||||
}
|
||||
|
||||
public void writePacket(DataOutputStream var1) throws IOException {
|
||||
var1.writeUTF(this.reason);
|
||||
}
|
||||
|
||||
public void processPacket(NetHandler var1) {
|
||||
var1.handleKickDisconnect(this);
|
||||
}
|
||||
}
|
|
@ -25,7 +25,7 @@ public class PanelCrashReport extends Panel {
|
|||
try {
|
||||
var5 = var5 + "Generated " + (new SimpleDateFormat()).format(new Date()) + "\n";
|
||||
var5 = var5 + "\n";
|
||||
var5 = var5 + "Minecraft: Minecraft Alpha v1.0.4\n";
|
||||
var5 = var5 + "Minecraft: Minecraft Alpha v1.0.5\n";
|
||||
var5 = var5 + "OS: " + System.getProperty("os.name") + " (" + System.getProperty("os.arch") + ") version " + System.getProperty("os.version") + "\n";
|
||||
var5 = var5 + "Java: " + System.getProperty("java.version") + ", " + System.getProperty("java.vendor") + "\n";
|
||||
var5 = var5 + "VM: " + System.getProperty("java.vm.name") + " (" + System.getProperty("java.vm.info") + "), " + System.getProperty("java.vm.vendor") + "\n";
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Pathfinder {
|
||||
private IBlockAccess worldMap;
|
||||
private Path path = new Path();
|
||||
private Map pointMap = new HashMap();
|
||||
private MCHashTable pointMap = new MCHashTable();
|
||||
private PathPoint[] pathOptions = new PathPoint[32];
|
||||
|
||||
public Pathfinder(IBlockAccess var1) {
|
||||
|
@ -23,7 +20,7 @@ public class Pathfinder {
|
|||
|
||||
private PathEntity createEntityPathTo(Entity var1, double var2, double var4, double var6, float var8) {
|
||||
this.path.clearPath();
|
||||
this.pointMap.clear();
|
||||
this.pointMap.clearMap();
|
||||
PathPoint var9 = this.openPoint(MathHelper.floor_double(var1.boundingBox.minX), MathHelper.floor_double(var1.boundingBox.minY), MathHelper.floor_double(var1.boundingBox.minZ));
|
||||
PathPoint var10 = this.openPoint(MathHelper.floor_double(var2 - (double)(var1.width / 2.0F)), MathHelper.floor_double(var4), MathHelper.floor_double(var6 - (double)(var1.width / 2.0F)));
|
||||
PathPoint var11 = new PathPoint(MathHelper.floor_float(var1.width + 1.0F), MathHelper.floor_float(var1.height + 1.0F), MathHelper.floor_float(var1.width + 1.0F));
|
||||
|
@ -146,10 +143,10 @@ public class Pathfinder {
|
|||
|
||||
private final PathPoint openPoint(int var1, int var2, int var3) {
|
||||
int var4 = var1 | var2 << 10 | var3 << 20;
|
||||
PathPoint var5 = (PathPoint)this.pointMap.get(Integer.valueOf(var4));
|
||||
PathPoint var5 = (PathPoint)this.pointMap.lookup(var4);
|
||||
if(var5 == null) {
|
||||
var5 = new PathPoint(var1, var2, var3);
|
||||
this.pointMap.put(Integer.valueOf(var4), var5);
|
||||
this.pointMap.addKey(var4, var5);
|
||||
}
|
||||
|
||||
return var5;
|
||||
|
|
120
src/main/java/net/minecraft/src/PlayerControllerMP.java
Normal file
120
src/main/java/net/minecraft/src/PlayerControllerMP.java
Normal file
|
@ -0,0 +1,120 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class PlayerControllerMP extends PlayerController {
|
||||
private int currentBlockX = -1;
|
||||
private int currentBlockY = -1;
|
||||
private int currentBlockZ = -1;
|
||||
private float curBlockDamageMP = 0.0F;
|
||||
private float prevBlockDamageMP = 0.0F;
|
||||
private float stepSoundTickCounter = 0.0F;
|
||||
private int blockHitDelay = 0;
|
||||
|
||||
public PlayerControllerMP(Minecraft var1) {
|
||||
super(var1);
|
||||
}
|
||||
|
||||
public void flipPlayer(EntityPlayer var1) {
|
||||
var1.rotationYaw = -180.0F;
|
||||
}
|
||||
|
||||
public void initController() {
|
||||
}
|
||||
|
||||
public boolean sendBlockRemoved(int var1, int var2, int var3) {
|
||||
int var4 = this.mc.theWorld.getBlockId(var1, var2, var3);
|
||||
int var5 = this.mc.theWorld.getBlockMetadata(var1, var2, var3);
|
||||
boolean var6 = super.sendBlockRemoved(var1, var2, var3);
|
||||
ItemStack var7 = this.mc.thePlayer.getCurrentEquippedItem();
|
||||
if(var7 != null) {
|
||||
var7.onDestroyBlock(var4, var1, var2, var3);
|
||||
if(var7.stackSize == 0) {
|
||||
var7.onItemDestroyedByUse(this.mc.thePlayer);
|
||||
this.mc.thePlayer.destroyCurrentEquippedItem();
|
||||
}
|
||||
}
|
||||
|
||||
if(var6 && this.mc.thePlayer.canHarvestBlock(Block.blocksList[var4])) {
|
||||
Block.blocksList[var4].dropBlockAsItem(this.mc.theWorld, var1, var2, var3, var5);
|
||||
}
|
||||
|
||||
return var6;
|
||||
}
|
||||
|
||||
public void clickBlock(int var1, int var2, int var3) {
|
||||
int var4 = this.mc.theWorld.getBlockId(var1, var2, var3);
|
||||
if(var4 > 0 && this.curBlockDamageMP == 0.0F) {
|
||||
Block.blocksList[var4].onBlockClicked(this.mc.theWorld, var1, var2, var3, this.mc.thePlayer);
|
||||
}
|
||||
|
||||
if(var4 > 0 && Block.blocksList[var4].blockStrength(this.mc.thePlayer) >= 1.0F) {
|
||||
this.sendBlockRemoved(var1, var2, var3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void resetBlockRemoving() {
|
||||
this.curBlockDamageMP = 0.0F;
|
||||
this.blockHitDelay = 0;
|
||||
}
|
||||
|
||||
public void sendBlockRemoving(int var1, int var2, int var3, int var4) {
|
||||
if(this.blockHitDelay > 0) {
|
||||
--this.blockHitDelay;
|
||||
} else {
|
||||
super.sendBlockRemoving(var1, var2, var3, var4);
|
||||
if(var1 == this.currentBlockX && var2 == this.currentBlockY && var3 == this.currentBlockZ) {
|
||||
int var5 = this.mc.theWorld.getBlockId(var1, var2, var3);
|
||||
if(var5 == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Block var6 = Block.blocksList[var5];
|
||||
this.curBlockDamageMP += var6.blockStrength(this.mc.thePlayer);
|
||||
if(this.stepSoundTickCounter % 4.0F == 0.0F && var6 != null) {
|
||||
this.mc.sndManager.playSound(var6.stepSound.getStepSound(), (float)var1 + 0.5F, (float)var2 + 0.5F, (float)var3 + 0.5F, (var6.stepSound.getVolume() + 1.0F) / 8.0F, var6.stepSound.getPitch() * 0.5F);
|
||||
}
|
||||
|
||||
++this.stepSoundTickCounter;
|
||||
if(this.curBlockDamageMP >= 1.0F) {
|
||||
this.sendBlockRemoved(var1, var2, var3);
|
||||
this.curBlockDamageMP = 0.0F;
|
||||
this.prevBlockDamageMP = 0.0F;
|
||||
this.stepSoundTickCounter = 0.0F;
|
||||
this.blockHitDelay = 5;
|
||||
}
|
||||
} else {
|
||||
this.curBlockDamageMP = 0.0F;
|
||||
this.prevBlockDamageMP = 0.0F;
|
||||
this.stepSoundTickCounter = 0.0F;
|
||||
this.currentBlockX = var1;
|
||||
this.currentBlockY = var2;
|
||||
this.currentBlockZ = var3;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void setPartialTime(float var1) {
|
||||
if(this.curBlockDamageMP <= 0.0F) {
|
||||
this.mc.ingameGUI.damageGuiPartialTime = 0.0F;
|
||||
this.mc.renderGlobal.damagePartialTime = 0.0F;
|
||||
} else {
|
||||
float var2 = this.prevBlockDamageMP + (this.curBlockDamageMP - this.prevBlockDamageMP) * var1;
|
||||
this.mc.ingameGUI.damageGuiPartialTime = var2;
|
||||
this.mc.renderGlobal.damagePartialTime = var2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public float getBlockReachDistance() {
|
||||
return 4.0F;
|
||||
}
|
||||
|
||||
public void onWorldChange(World var1) {
|
||||
super.onWorldChange(var1);
|
||||
}
|
||||
|
||||
public void onUpdate() {
|
||||
this.prevBlockDamageMP = this.curBlockDamageMP;
|
||||
}
|
||||
}
|
|
@ -1057,6 +1057,8 @@ public class RenderGlobal implements IWorldAccess {
|
|||
this.mc.effectRenderer.addEffect(new EntitySmokeFX(this.theWorld, var2, var4, var6, 2.5F));
|
||||
} else if(var1 == "reddust") {
|
||||
this.mc.effectRenderer.addEffect(new EntityReddustFX(this.theWorld, var2, var4, var6));
|
||||
} else if(var1 == "snowballpoof") {
|
||||
this.mc.effectRenderer.addEffect(new EntitySlimeFX(this.theWorld, var2, var4, var6));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ public class RenderManager {
|
|||
this.entityRenderMap.put(Entity.class, new RenderEntity());
|
||||
this.entityRenderMap.put(EntityPainting.class, new RenderPainting());
|
||||
this.entityRenderMap.put(EntityArrow.class, new RenderArrow());
|
||||
this.entityRenderMap.put(EntitySnowball.class, new RenderSnowball());
|
||||
this.entityRenderMap.put(EntityItem.class, new RenderItem());
|
||||
this.entityRenderMap.put(EntityTNTPrimed.class, new RenderTNTPrimed());
|
||||
this.entityRenderMap.put(EntityFallingSand.class, new RenderFallingSand());
|
||||
|
|
38
src/main/java/net/minecraft/src/RenderSnowball.java
Normal file
38
src/main/java/net/minecraft/src/RenderSnowball.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
public class RenderSnowball extends Render {
|
||||
public void doRenderSnowball(EntitySnowball var1, double var2, double var4, double var6, float var8, float var9) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)var2, (float)var4, (float)var6);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
int var10 = Item.snowball.getIconIndex((ItemStack)null);
|
||||
this.loadTexture("/gui/items.png");
|
||||
Tessellator var11 = Tessellator.instance;
|
||||
float var12 = (float)(var10 % 16 * 16 + 0) / 256.0F;
|
||||
float var13 = (float)(var10 % 16 * 16 + 16) / 256.0F;
|
||||
float var14 = (float)(var10 / 16 * 16 + 0) / 256.0F;
|
||||
float var15 = (float)(var10 / 16 * 16 + 16) / 256.0F;
|
||||
float var16 = 1.0F;
|
||||
float var17 = 0.5F;
|
||||
float var18 = 0.25F;
|
||||
GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
|
||||
var11.startDrawingQuads();
|
||||
var11.setNormal(0.0F, 1.0F, 0.0F);
|
||||
var11.addVertexWithUV((double)(0.0F - var17), (double)(0.0F - var18), 0.0D, (double)var12, (double)var15);
|
||||
var11.addVertexWithUV((double)(var16 - var17), (double)(0.0F - var18), 0.0D, (double)var13, (double)var15);
|
||||
var11.addVertexWithUV((double)(var16 - var17), (double)(1.0F - var18), 0.0D, (double)var13, (double)var14);
|
||||
var11.addVertexWithUV((double)(0.0F - var17), (double)(1.0F - var18), 0.0D, (double)var12, (double)var14);
|
||||
var11.draw();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9) {
|
||||
this.doRenderSnowball((EntitySnowball)var1, var2, var4, var6, var8, var9);
|
||||
}
|
||||
}
|
33
src/main/java/net/minecraft/src/ThreadConnectToServer.java
Normal file
33
src/main/java/net/minecraft/src/ThreadConnectToServer.java
Normal file
|
@ -0,0 +1,33 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.net.ConnectException;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
class ThreadConnectToServer extends Thread {
|
||||
final Minecraft mc;
|
||||
final String ip;
|
||||
final int port;
|
||||
final GuiConnecting connectingGui;
|
||||
|
||||
ThreadConnectToServer(GuiConnecting var1, Minecraft var2, String var3, int var4) {
|
||||
this.connectingGui = var1;
|
||||
this.mc = var2;
|
||||
this.ip = var3;
|
||||
this.port = var4;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
GuiConnecting.setNetClientHandler(this.connectingGui, new NetClientHandler(this.mc, this.ip, this.port));
|
||||
GuiConnecting.getNetClientHandler(this.connectingGui).addToSendQueue(new Packet0Handshake(this.mc.session.username, "Password", 10));
|
||||
} catch (UnknownHostException var2) {
|
||||
this.mc.displayGuiScreen(new GuiConnectFailed("Failed to connect to the server", "Unknown host \'" + this.ip + "\'"));
|
||||
} catch (ConnectException var3) {
|
||||
this.mc.displayGuiScreen(new GuiConnectFailed("Failed to connect to the server", var3.getMessage()));
|
||||
} catch (Exception var4) {
|
||||
var4.printStackTrace();
|
||||
this.mc.displayGuiScreen(new GuiConnectFailed("Failed to connect to the server", var4.toString()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -47,6 +47,7 @@ public class World implements IBlockAccess {
|
|||
private Set positionsToUpdate;
|
||||
private int soundCounter;
|
||||
private List entitiesWithinAABBExcludingEntity;
|
||||
public boolean multiplayerWorld;
|
||||
|
||||
public static NBTTagCompound getLevelData(File var0, String var1) {
|
||||
File var2 = new File(var0, "saves");
|
||||
|
@ -93,6 +94,38 @@ public class World implements IBlockAccess {
|
|||
this(var1, var2, (new Random()).nextLong());
|
||||
}
|
||||
|
||||
public World(String var1) {
|
||||
this.lightingToUpdate = new ArrayList();
|
||||
this.loadedEntityList = new ArrayList();
|
||||
this.unloadedEntityList = new ArrayList();
|
||||
this.scheduledTickTreeSet = new TreeSet();
|
||||
this.scheduledTickSet = new HashSet();
|
||||
this.loadedTileEntityList = new ArrayList();
|
||||
this.worldTime = 0L;
|
||||
this.snowCovered = false;
|
||||
this.skyColor = 8961023L;
|
||||
this.fogColor = 12638463L;
|
||||
this.cloudColor = 16777215L;
|
||||
this.skylightSubtracted = 0;
|
||||
this.updateLCG = (new Random()).nextInt();
|
||||
this.DIST_HASH_MAGIC = 1013904223;
|
||||
this.editingBlocks = false;
|
||||
this.playerEntities = new ArrayList();
|
||||
this.rand = new Random();
|
||||
this.isNewWorld = false;
|
||||
this.worldAccesses = new ArrayList();
|
||||
this.randomSeed = 0L;
|
||||
this.sizeOnDisk = 0L;
|
||||
this.collidingBoundingBoxes = new ArrayList();
|
||||
this.positionsToUpdate = new HashSet();
|
||||
this.soundCounter = this.rand.nextInt(12000);
|
||||
this.entitiesWithinAABBExcludingEntity = new ArrayList();
|
||||
this.multiplayerWorld = false;
|
||||
this.levelName = var1;
|
||||
this.chunkProvider = this.getChunkProvider(this.saveDirectory);
|
||||
this.calculateInitialSkylight();
|
||||
}
|
||||
|
||||
public World(File var1, String var2, long var3) {
|
||||
this.lightingToUpdate = new ArrayList();
|
||||
this.loadedEntityList = new ArrayList();
|
||||
|
@ -119,6 +152,7 @@ public class World implements IBlockAccess {
|
|||
this.positionsToUpdate = new HashSet();
|
||||
this.soundCounter = this.rand.nextInt(12000);
|
||||
this.entitiesWithinAABBExcludingEntity = new ArrayList();
|
||||
this.multiplayerWorld = false;
|
||||
this.levelName = var2;
|
||||
var1.mkdirs();
|
||||
this.saveDirectory = new File(var1, var2);
|
||||
|
@ -946,6 +980,21 @@ public class World implements IBlockAccess {
|
|||
return Vec3D.createVector((double)var4, (double)var5, (double)var6);
|
||||
}
|
||||
|
||||
public int getTopSolidOrLiquidBlock(int var1, int var2) {
|
||||
Chunk var3 = this.getChunkFromBlockCoords(var1, var2);
|
||||
int var4 = 127;
|
||||
var1 &= 15;
|
||||
|
||||
for(var2 &= 15; var4 > 0; --var4) {
|
||||
int var5 = var3.getBlockID(var1, var4, var2);
|
||||
if(var5 != 0 && Block.blocksList[var5].material.getIsSolid()) {
|
||||
return var4 + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int getPrecipitationHeight(int var1, int var2) {
|
||||
return this.getChunkFromBlockCoords(var1, var2).getHeightValue(var1 & 15, var2 & 15);
|
||||
}
|
||||
|
@ -1324,7 +1373,7 @@ public class World implements IBlockAccess {
|
|||
}
|
||||
|
||||
public boolean updatingLighting() {
|
||||
int var1 = 100000;
|
||||
int var1 = 10000;
|
||||
|
||||
while(this.lightingToUpdate.size() > 0) {
|
||||
--var1;
|
||||
|
@ -1446,8 +1495,8 @@ public class World implements IBlockAccess {
|
|||
var6 = this.updateLCG >> 2;
|
||||
var7 = var6 & 15;
|
||||
var8 = var6 >> 8 & 15;
|
||||
var9 = var14.getHeightValue(var7, var8);
|
||||
if(var14.getSavedLightValue(EnumSkyBlock.Block, var7, var9, var8) < 10 && var14.getBlockID(var7, var9, var8) == 0) {
|
||||
var9 = this.getTopSolidOrLiquidBlock(var7 + var3, var8 + var4);
|
||||
if(var9 >= 0 && var9 < 128 && var14.getSavedLightValue(EnumSkyBlock.Block, var7, var9, var8) < 10 && var14.getBlockID(var7, var9, var8) == 0) {
|
||||
var10 = var14.getBlockID(var7, var9 - 1, var8);
|
||||
if(var10 != 0 && var10 != Block.ice.blockID && Block.blocksList[var10].material.getIsSolid()) {
|
||||
this.setBlockWithNotify(var7 + var3, var9, var8 + var4, Block.snow.blockID);
|
||||
|
@ -1612,7 +1661,7 @@ public class World implements IBlockAccess {
|
|||
var9 = null;
|
||||
}
|
||||
|
||||
return (var1 > 0 && var7 == null || var7 == Block.waterMoving || var7 == Block.waterStill || var7 == Block.lavaMoving || var7 == Block.lavaStill || var7 == Block.fire) && (var9 == null || this.checkIfAABBIsClear(var9)) && var8.canPlaceBlockAt(this, var2, var3, var4);
|
||||
return var7 != Block.waterMoving && var7 != Block.waterStill && var7 != Block.lavaMoving && var7 != Block.lavaStill && var7 != Block.fire && var7 != Block.snow ? var1 > 0 && var7 == null && (var9 == null || this.checkIfAABBIsClear(var9)) && var8.canPlaceBlockAt(this, var2, var3, var4) : true;
|
||||
}
|
||||
|
||||
public PathEntity getPathToEntity(Entity var1, Entity var2, float var3) {
|
||||
|
@ -1687,6 +1736,50 @@ public class World implements IBlockAccess {
|
|||
return var11;
|
||||
}
|
||||
|
||||
public void setChunkData(int var1, int var2, int var3, int var4, int var5, int var6, byte[] var7) {
|
||||
int var8 = var1 >> 4;
|
||||
int var9 = var3 >> 4;
|
||||
int var10 = var1 + var4 - 1 >> 4;
|
||||
int var11 = var3 + var6 - 1 >> 4;
|
||||
int var12 = 0;
|
||||
int var13 = var2;
|
||||
int var14 = var2 + var5;
|
||||
if(var2 < 0) {
|
||||
var13 = 0;
|
||||
}
|
||||
|
||||
if(var14 > 128) {
|
||||
var14 = 128;
|
||||
}
|
||||
|
||||
for(int var15 = var8; var15 <= var10; ++var15) {
|
||||
int var16 = var1 - var15 * 16;
|
||||
int var17 = var1 + var4 - var15 * 16;
|
||||
if(var16 < 0) {
|
||||
var16 = 0;
|
||||
}
|
||||
|
||||
if(var17 > 16) {
|
||||
var17 = 16;
|
||||
}
|
||||
|
||||
for(int var18 = var9; var18 <= var11; ++var18) {
|
||||
int var19 = var3 - var18 * 16;
|
||||
int var20 = var3 + var6 - var18 * 16;
|
||||
if(var19 < 0) {
|
||||
var19 = 0;
|
||||
}
|
||||
|
||||
if(var20 > 16) {
|
||||
var20 = 16;
|
||||
}
|
||||
|
||||
var12 = this.getChunkFromChunkCoords(var15, var18).setChunkData(var7, var16, var13, var19, var17, var14, var20, var12);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static {
|
||||
float var0 = 0.05F;
|
||||
|
||||
|
|
66
src/main/java/net/minecraft/src/WorldClient.java
Normal file
66
src/main/java/net/minecraft/src/WorldClient.java
Normal file
|
@ -0,0 +1,66 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class WorldClient extends World {
|
||||
private NetClientHandler sendQueue;
|
||||
private ChunkProviderClient clientChunkProvider;
|
||||
|
||||
public WorldClient(NetClientHandler var1) {
|
||||
super("MpServer");
|
||||
this.sendQueue = var1;
|
||||
this.spawnX = 8;
|
||||
this.spawnY = 64;
|
||||
this.spawnZ = 8;
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
this.sendQueue.processReadPackets();
|
||||
super.tick();
|
||||
}
|
||||
|
||||
protected IChunkProvider getChunkProvider(File var1) {
|
||||
this.clientChunkProvider = new ChunkProviderClient(this);
|
||||
return this.clientChunkProvider;
|
||||
}
|
||||
|
||||
public void setSpawnLocation() {
|
||||
this.spawnX = 8;
|
||||
this.spawnY = 64;
|
||||
this.spawnZ = 8;
|
||||
}
|
||||
|
||||
public Chunk doPreChunk(int var1, int var2) {
|
||||
Chunk var3 = this.getChunkFromChunkCoords(var1, var2);
|
||||
if(var3.isChunkRendered) {
|
||||
var3 = this.clientChunkProvider.loadChunk(var1, var2);
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
|
||||
protected void updateBlocksAndPlayCaveSounds() {
|
||||
}
|
||||
|
||||
public void scheduleBlockUpdate(int var1, int var2, int var3, int var4) {
|
||||
}
|
||||
|
||||
public boolean tickUpdates(boolean var1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setChunkData(int var1, int var2, int var3, int var4, int var5, int var6, byte[] var7) {
|
||||
int var8 = var1 >> 4;
|
||||
int var9 = var3 >> 4;
|
||||
int var10 = var1 + var4 - 1 >> 4;
|
||||
int var11 = var3 + var6 - 1 >> 4;
|
||||
|
||||
for(int var12 = var8; var12 <= var10; ++var12) {
|
||||
for(int var13 = var9; var13 <= var11; ++var13) {
|
||||
this.doPreChunk(var12, var13);
|
||||
}
|
||||
}
|
||||
|
||||
super.setChunkData(var1, var2, var3, var4, var5, var6, var7);
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.5 KiB |
Loading…
Reference in a new issue