Skip to content

Commit

Permalink
1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
grum committed May 27, 2011
1 parent 2b73db2 commit 00e2118
Show file tree
Hide file tree
Showing 193 changed files with 5,103 additions and 2,882 deletions.
10 changes: 10 additions & 0 deletions net/minecraft/server/BedBlockTextures.java
@@ -0,0 +1,10 @@
package net.minecraft.server;

public class BedBlockTextures {

public static final int[] a = new int[] { 3, 4, 2, 5};
public static final int[] b = new int[] { 2, 3, 0, 1};
public static final int[][] c = new int[][] { { 1, 0, 3, 2, 5, 4}, { 1, 0, 5, 4, 2, 3}, { 1, 0, 2, 3, 4, 5}, { 1, 0, 4, 5, 3, 2}};

public BedBlockTextures() {}
}
2 changes: 1 addition & 1 deletion net/minecraft/server/BiomeBase.java
Expand Up @@ -30,7 +30,7 @@ public BiomeBase() {
this.o = (byte) Block.GRASS.id;
this.p = (byte) Block.DIRT.id;
this.q = 5169201;
this.r = new Class[] { EntitySpider.class, EntityZombie.class, EntitySkeleton.class, EntityCreeper.class};
this.r = new Class[] { EntitySpider.class, EntityZombie.class, EntitySkeleton.class, EntityCreeper.class, EntitySlime.class};
this.s = new Class[] { EntitySheep.class, EntityPig.class, EntityChicken.class, EntityCow.class};
this.t = new Class[] { EntitySquid.class};
}
Expand Down
51 changes: 28 additions & 23 deletions net/minecraft/server/Block.java
Expand Up @@ -46,7 +46,7 @@ public class Block {
public static final Block DISPENSER = (new BlockDispenser(23)).c(3.5F).a(h).a("dispenser");
public static final Block SANDSTONE = (new BlockSandStone(24)).a(h).c(0.8F).a("sandStone");
public static final Block NOTE_BLOCK = (new BlockNote(25)).c(0.8F).a("musicBlock");
public static final Block S = null;
public static final Block BED = (new BlockBed(26)).c(0.2F).a("bed");
public static final Block T = null;
public static final Block U = null;
public static final Block V = null;
Expand Down Expand Up @@ -75,7 +75,7 @@ public class Block {
public static final Block MOB_SPAWNER = (new BlockMobSpawner(52, 65)).c(5.0F).a(i).a("mobSpawner");
public static final Block WOOD_STAIRS = (new BlockStairs(53, WOOD)).a("stairsWood");
public static final Block CHEST = (new BlockChest(54)).c(2.5F).a(e).a("chest");
public static final Block REDSTONE_WIRE = (new BlockRedstoneWire(55, 84)).c(0.0F).a(d).a("redstoneDust");
public static final Block REDSTONE_WIRE = (new BlockRedstoneWire(55, 164)).c(0.0F).a(d).a("redstoneDust");
public static final Block DIAMOND_ORE = (new BlockOre(56, 50)).c(3.0F).b(5.0F).a(h).a("oreDiamond");
public static final Block DIAMOND_BLOCK = (new BlockOreBlock(57, 24)).c(5.0F).b(10.0F).a(i).a("blockDiamond");
public static final Block WORKBENCH = (new BlockWorkbench(58)).c(2.5F).a(e).a("workbench");
Expand Down Expand Up @@ -113,6 +113,8 @@ public class Block {
public static final BlockPortal PORTAL = (BlockPortal) (new BlockPortal(90, 14)).c(-1.0F).a(j).a(0.75F).a("portal");
public static final Block JACK_O_LANTERN = (new BlockPumpkin(91, 102, true)).c(1.0F).a(e).a(1.0F).a("litpumpkin");
public static final Block CAKE_BLOCK = (new BlockCake(92, 121)).c(0.5F).a(k).a("cake");
public static final Block DIODE_OFF = (new BlockDiode(93, false)).c(0.0F).a(e).a("diode");
public static final Block DIODE_ON = (new BlockDiode(94, true)).c(0.0F).a(0.625F).a(e).a("diode");
public int textureId;
public final int id;
protected float strength;
Expand All @@ -124,14 +126,14 @@ public class Block {
public double maxY;
public double maxZ;
public StepSound stepSound;
public float bs;
public float bu;
public final Material material;
public float frictionFactor;
private String name;

protected Block(int i, Material material) {
this.stepSound = d;
this.bs = 1.0F;
this.bu = 1.0F;
this.frictionFactor = 0.6F;
if (byId[i] != null) {
throw new IllegalArgumentException("Slot " + i + " is already occupied by " + byId[i] + " when adding " + this);
Expand All @@ -142,7 +144,7 @@ protected Block(int i, Material material) {
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
o[i] = this.a();
q[i] = this.a() ? 255 : 0;
r[i] = this.f();
r[i] = !material.blocksLight();
p[i] = false;
}
}
Expand Down Expand Up @@ -172,10 +174,6 @@ protected Block b(float f) {
return this;
}

private boolean f() {
return false;
}

protected Block c(float f) {
this.strength = f;
if (this.durability < f * 5.0F) {
Expand All @@ -202,6 +200,10 @@ public boolean a(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return l == 0 && this.minY > 0.0D ? true : (l == 1 && this.maxY < 1.0D ? true : (l == 2 && this.minZ > 0.0D ? true : (l == 3 && this.maxZ < 1.0D ? true : (l == 4 && this.minX > 0.0D ? true : (l == 5 && this.maxX < 1.0D ? true : !iblockaccess.d(i, j, k))))));
}

public int a(int i, int j) {
return this.a(i);
}

public int a(int i) {
return this.textureId;
}
Expand Down Expand Up @@ -232,10 +234,10 @@ public boolean d() {

public void a(World world, int i, int j, int k, Random random) {}

public void a(World world, int i, int j, int k, int l) {}

public void b(World world, int i, int j, int k, int l) {}

public void a(World world, int i, int j, int k, int l) {}

public int b() {
return 10;
}
Expand All @@ -256,23 +258,23 @@ public float a(EntityHuman entityhuman) {
return this.strength < 0.0F ? 0.0F : (!entityhuman.b(this) ? 1.0F / this.strength / 100.0F : entityhuman.a(this) / this.strength / 30.0F);
}

public void a_(World world, int i, int j, int k, int l) {
public void b_(World world, int i, int j, int k, int l) {
this.a(world, i, j, k, l, 1.0F);
}

public void a(World world, int i, int j, int k, int l, float f) {
if (!world.isStatic) {
int i1 = this.a(world.l);
int i1 = this.a(world.k);

for (int j1 = 0; j1 < i1; ++j1) {
if (world.l.nextFloat() <= f) {
int k1 = this.a(l, world.l);
if (world.k.nextFloat() <= f) {
int k1 = this.a(l, world.k);

if (k1 > 0) {
float f1 = 0.7F;
double d0 = (double) (world.l.nextFloat() * f1) + (double) (1.0F - f1) * 0.5D;
double d1 = (double) (world.l.nextFloat() * f1) + (double) (1.0F - f1) * 0.5D;
double d2 = (double) (world.l.nextFloat() * f1) + (double) (1.0F - f1) * 0.5D;
double d0 = (double) (world.k.nextFloat() * f1) + (double) (1.0F - f1) * 0.5D;
double d1 = (double) (world.k.nextFloat() * f1) + (double) (1.0F - f1) * 0.5D;
double d2 = (double) (world.k.nextFloat() * f1) + (double) (1.0F - f1) * 0.5D;
EntityItem entityitem = new EntityItem(world, (double) i + d0, (double) j + d1, (double) k + d2, new ItemStack(k1, 1, this.b(l)));

entityitem.c = 10;
Expand Down Expand Up @@ -397,7 +399,7 @@ private boolean c(Vec3D vec3d) {
return vec3d == null ? false : vec3d.a >= this.minX && vec3d.a <= this.maxX && vec3d.b >= this.minY && vec3d.b <= this.maxY;
}

public void a_(World world, int i, int j, int k) {}
public void c(World world, int i, int j, int k) {}

public boolean a(World world, int i, int j, int k) {
int l = world.getTypeId(i, j, k);
Expand All @@ -411,7 +413,7 @@ public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {

public void b(World world, int i, int j, int k, Entity entity) {}

public void c(World world, int i, int j, int k, int l) {}
public void d(World world, int i, int j, int k, int l) {}

public void b(World world, int i, int j, int k, EntityHuman entityhuman) {}

Expand All @@ -429,12 +431,12 @@ public boolean c() {

public void a(World world, int i, int j, int k, Entity entity) {}

public boolean d(World world, int i, int j, int k, int l) {
public boolean c(World world, int i, int j, int k, int l) {
return false;
}

public void g(World world, int i, int j, int k, int l) {
this.a_(world, i, j, k, l);
public void a_(World world, int i, int j, int k, int l) {
this.b_(world, i, j, k, l);
}

public boolean f(World world, int i, int j, int k) {
Expand All @@ -457,11 +459,14 @@ public void a(World world, int i, int j, int k, int l, int i1) {}
static {
Item.byId[WOOL.id] = (new ItemCloth(WOOL.id - 256)).a("cloth");
Item.byId[LOG.id] = (new ItemLog(LOG.id - 256)).a("log");
Item.byId[STEP.id] = (new ItemStep(STEP.id - 256)).a("stoneSlab");

for (int i = 0; i < 256; ++i) {
if (byId[i] != null && Item.byId[i] == null) {
Item.byId[i] = new ItemBlock(i - 256);
}
}

r[0] = true;
}
}
133 changes: 133 additions & 0 deletions net/minecraft/server/BlockBed.java
@@ -0,0 +1,133 @@
package net.minecraft.server;

import java.util.Random;

public class BlockBed extends Block {

public static final int[][] a = new int[][] { { 0, 1}, { -1, 0}, { 0, -1}, { 1, 0}};

public BlockBed(int i) {
super(i, 134, Material.CLOTH);
this.f();
}

public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {
int l = world.getData(i, j, k);

if (!d(l)) {
int i1 = c(l);

i += a[i1][0];
k += a[i1][1];
if (world.getTypeId(i, j, k) != this.id) {
return true;
}

l = world.getData(i, j, k);
}

if (f(l)) {
entityhuman.a("tile.bed.occupied");
return true;
} else if (entityhuman.a(i, j, k)) {
a(world, i, j, k, true);
return true;
} else {
entityhuman.a("tile.bed.noSleep");
return true;
}
}

public int a(int i, int j) {
if (i == 0) {
return Block.WOOD.textureId;
} else {
int k = c(j);
int l = BedBlockTextures.c[k][i];

return d(j) ? (l == 2 ? this.textureId + 2 + 16 : (l != 5 && l != 4 ? this.textureId + 1 : this.textureId + 1 + 16)) : (l == 3 ? this.textureId - 1 + 16 : (l != 5 && l != 4 ? this.textureId : this.textureId + 16));
}
}

public boolean a() {
return false;
}

public void a(IBlockAccess iblockaccess, int i, int j, int k) {
this.f();
}

public void a(World world, int i, int j, int k, int l) {
int i1 = world.getData(i, j, k);
int j1 = c(i1);

if (d(i1)) {
if (world.getTypeId(i - a[j1][0], j, k - a[j1][1]) != this.id) {
world.e(i, j, k, 0);
}
} else if (world.getTypeId(i + a[j1][0], j, k + a[j1][1]) != this.id) {
world.e(i, j, k, 0);
if (!world.isStatic) {
this.b_(world, i, j, k, i1);
}
}
}

public int a(int i, Random random) {
return d(i) ? 0 : Item.BED.id;
}

private void f() {
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.5625F, 1.0F);
}

public static int c(int i) {
return i & 3;
}

public static boolean d(int i) {
return (i & 8) != 0;
}

public static boolean f(int i) {
return (i & 4) != 0;
}

public static void a(World world, int i, int j, int k, boolean flag) {
int l = world.getData(i, j, k);

if (flag) {
l |= 4;
} else {
l &= -5;
}

world.c(i, j, k, l);
}

public static ChunkCoordinates g(World world, int i, int j, int k, int l) {
int i1 = world.getData(i, j, k);
int j1 = c(i1);

for (int k1 = 0; k1 <= 1; ++k1) {
int l1 = i - a[j1][0] * k1 - 1;
int i2 = k - a[j1][1] * k1 - 1;
int j2 = l1 + 2;
int k2 = i2 + 2;

for (int l2 = l1; l2 <= j2; ++l2) {
for (int i3 = i2; i3 <= k2; ++i3) {
if (world.d(l2, j - 1, i3) && world.isEmpty(l2, j, i3) && world.isEmpty(l2, j + 1, i3)) {
if (l <= 0) {
return new ChunkCoordinates(l2, j, i3);
}

--l;
}
}
}
}

return new ChunkCoordinates(i, j + 1, k);
}
}

0 comments on commit 00e2118

Please sign in to comment.