From 32fd4477156ffaeb80e9443cb8498c17558e7513 Mon Sep 17 00:00:00 2001 From: EvilSeph Date: Tue, 10 May 2011 14:44:45 -0400 Subject: [PATCH] Cleaned up left over debug messages. --- .../net/minecraft/server/BlockPortal.java | 141 +++++++++++++ .../net/minecraft/server/PlayerInstance.java | 2 +- .../net/minecraft/server/StatisticList.java | 186 ++++++++++++++++++ 3 files changed, 328 insertions(+), 1 deletion(-) create mode 100644 src/main/java/net/minecraft/server/BlockPortal.java create mode 100644 src/main/java/net/minecraft/server/StatisticList.java diff --git a/src/main/java/net/minecraft/server/BlockPortal.java b/src/main/java/net/minecraft/server/BlockPortal.java new file mode 100644 index 0000000000..90bdb8e7fa --- /dev/null +++ b/src/main/java/net/minecraft/server/BlockPortal.java @@ -0,0 +1,141 @@ +package net.minecraft.server; + +import java.util.Random; + +public class BlockPortal extends BlockBreakable { + + public BlockPortal(int i, int j) { + super(i, j, Material.PORTAL, false); + } + + public AxisAlignedBB d(World world, int i, int j, int k) { + return null; + } + + public void a(IBlockAccess iblockaccess, int i, int j, int k) { + float f; + float f1; + + if (iblockaccess.getTypeId(i - 1, j, k) != this.id && iblockaccess.getTypeId(i + 1, j, k) != this.id) { + f = 0.125F; + f1 = 0.5F; + this.a(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1); + } else { + f = 0.5F; + f1 = 0.125F; + this.a(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1); + } + } + + public boolean a() { + return false; + } + + public boolean a_(World world, int i, int j, int k) { + byte b0 = 0; + byte b1 = 0; + + if (world.getTypeId(i - 1, j, k) == Block.OBSIDIAN.id || world.getTypeId(i + 1, j, k) == Block.OBSIDIAN.id) { + b0 = 1; + } + + if (world.getTypeId(i, j, k - 1) == Block.OBSIDIAN.id || world.getTypeId(i, j, k + 1) == Block.OBSIDIAN.id) { + b1 = 1; + } + + //System.out.println(b0 + ", " + b1); // CraftBukkit + if (b0 == b1) { + return false; + } else { + if (world.getTypeId(i - b0, j, k - b1) == 0) { + i -= b0; + k -= b1; + } + + int l; + int i1; + + for (l = -1; l <= 2; ++l) { + for (i1 = -1; i1 <= 3; ++i1) { + boolean flag = l == -1 || l == 2 || i1 == -1 || i1 == 3; + + if (l != -1 && l != 2 || i1 != -1 && i1 != 3) { + int j1 = world.getTypeId(i + b0 * l, j + i1, k + b1 * l); + + if (flag) { + if (j1 != Block.OBSIDIAN.id) { + return false; + } + } else if (j1 != 0 && j1 != Block.FIRE.id) { + return false; + } + } + } + } + + world.j = true; + + for (l = 0; l < 2; ++l) { + for (i1 = 0; i1 < 3; ++i1) { + world.setTypeId(i + b0 * l, j + i1, k + b1 * l, Block.PORTAL.id); + } + } + + world.j = false; + return true; + } + } + + public void doPhysics(World world, int i, int j, int k, int l) { + byte b0 = 0; + byte b1 = 1; + + if (world.getTypeId(i - 1, j, k) == this.id || world.getTypeId(i + 1, j, k) == this.id) { + b0 = 1; + b1 = 0; + } + + int i1; + + for (i1 = j; world.getTypeId(i, i1 - 1, k) == this.id; --i1) { + ; + } + + if (world.getTypeId(i, i1 - 1, k) != Block.OBSIDIAN.id) { + world.setTypeId(i, j, k, 0); + } else { + int j1; + + for (j1 = 1; j1 < 4 && world.getTypeId(i, i1 + j1, k) == this.id; ++j1) { + ; + } + + if (j1 == 3 && world.getTypeId(i, i1 + j1, k) == Block.OBSIDIAN.id) { + boolean flag = world.getTypeId(i - 1, j, k) == this.id || world.getTypeId(i + 1, j, k) == this.id; + boolean flag1 = world.getTypeId(i, j, k - 1) == this.id || world.getTypeId(i, j, k + 1) == this.id; + + if (flag && flag1) { + world.setTypeId(i, j, k, 0); + } else if ((world.getTypeId(i + b0, j, k + b1) != Block.OBSIDIAN.id || world.getTypeId(i - b0, j, k - b1) != this.id) && (world.getTypeId(i - b0, j, k - b1) != Block.OBSIDIAN.id || world.getTypeId(i + b0, j, k + b1) != this.id)) { + world.setTypeId(i, j, k, 0); + } + } else { + world.setTypeId(i, j, k, 0); + } + } + } + + public boolean a(IBlockAccess iblockaccess, int i, int j, int k, int l) { + return true; + } + + public int a(Random random) { + return 0; + } + + public void a(World world, int i, int j, int k, Entity entity) { + if (!world.isStatic) { + entity.ad(); + } + } +} diff --git a/src/main/java/net/minecraft/server/PlayerInstance.java b/src/main/java/net/minecraft/server/PlayerInstance.java index eb0edeba3a..60802ff948 100644 --- a/src/main/java/net/minecraft/server/PlayerInstance.java +++ b/src/main/java/net/minecraft/server/PlayerInstance.java @@ -175,7 +175,7 @@ class PlayerInstance { l = this.chunkZ * 16 + (this.dirtyCount >> 8 & 15); // CraftBukkit start if (Block.isTileEntity[this.playerManager.world.getTypeId(j, k, l)]) { - System.out.println("Sending!"); + //System.out.println("Sending!"); // CraftBukkit this.sendTileEntity(this.playerManager.world.getTileEntity(j, k, l)); } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/StatisticList.java b/src/main/java/net/minecraft/server/StatisticList.java new file mode 100644 index 0000000000..837a3acde8 --- /dev/null +++ b/src/main/java/net/minecraft/server/StatisticList.java @@ -0,0 +1,186 @@ +package net.minecraft.server; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +public class StatisticList { + + protected static Map a = new HashMap(); + public static List b = new ArrayList(); + public static List c = new ArrayList(); + public static List d = new ArrayList(); + public static List e = new ArrayList(); + public static Statistic f = (new CounterStatistic(1000, StatisticCollector.a("stat.startGame"))).e().d(); + public static Statistic g = (new CounterStatistic(1001, StatisticCollector.a("stat.createWorld"))).e().d(); + public static Statistic h = (new CounterStatistic(1002, StatisticCollector.a("stat.loadWorld"))).e().d(); + public static Statistic i = (new CounterStatistic(1003, StatisticCollector.a("stat.joinMultiplayer"))).e().d(); + public static Statistic j = (new CounterStatistic(1004, StatisticCollector.a("stat.leaveGame"))).e().d(); + public static Statistic k = (new CounterStatistic(1100, StatisticCollector.a("stat.playOneMinute"), Statistic.j)).e().d(); + public static Statistic l = (new CounterStatistic(2000, StatisticCollector.a("stat.walkOneCm"), Statistic.k)).e().d(); + public static Statistic m = (new CounterStatistic(2001, StatisticCollector.a("stat.swimOneCm"), Statistic.k)).e().d(); + public static Statistic n = (new CounterStatistic(2002, StatisticCollector.a("stat.fallOneCm"), Statistic.k)).e().d(); + public static Statistic o = (new CounterStatistic(2003, StatisticCollector.a("stat.climbOneCm"), Statistic.k)).e().d(); + public static Statistic p = (new CounterStatistic(2004, StatisticCollector.a("stat.flyOneCm"), Statistic.k)).e().d(); + public static Statistic q = (new CounterStatistic(2005, StatisticCollector.a("stat.diveOneCm"), Statistic.k)).e().d(); + public static Statistic r = (new CounterStatistic(2006, StatisticCollector.a("stat.minecartOneCm"), Statistic.k)).e().d(); + public static Statistic s = (new CounterStatistic(2007, StatisticCollector.a("stat.boatOneCm"), Statistic.k)).e().d(); + public static Statistic t = (new CounterStatistic(2008, StatisticCollector.a("stat.pigOneCm"), Statistic.k)).e().d(); + public static Statistic u = (new CounterStatistic(2010, StatisticCollector.a("stat.jump"))).e().d(); + public static Statistic v = (new CounterStatistic(2011, StatisticCollector.a("stat.drop"))).e().d(); + public static Statistic w = (new CounterStatistic(2020, StatisticCollector.a("stat.damageDealt"))).d(); + public static Statistic x = (new CounterStatistic(2021, StatisticCollector.a("stat.damageTaken"))).d(); + public static Statistic y = (new CounterStatistic(2022, StatisticCollector.a("stat.deaths"))).d(); + public static Statistic z = (new CounterStatistic(2023, StatisticCollector.a("stat.mobKills"))).d(); + public static Statistic A = (new CounterStatistic(2024, StatisticCollector.a("stat.playerKills"))).d(); + public static Statistic B = (new CounterStatistic(2025, StatisticCollector.a("stat.fishCaught"))).d(); + public static Statistic[] C = a("stat.mineBlock", 16777216); + public static Statistic[] D; + public static Statistic[] E; + public static Statistic[] F; + private static boolean G; + private static boolean H; + + public StatisticList() {} + + public static void a() {} + + public static void b() { + E = a(E, "stat.useItem", 16908288, 0, Block.byId.length); + F = b(F, "stat.breakItem", 16973824, 0, Block.byId.length); + G = true; + d(); + //System.out.println(E); // CraftBukkit + } + + public static void c() { + E = a(E, "stat.useItem", 16908288, Block.byId.length, 32000); + F = b(F, "stat.breakItem", 16973824, Block.byId.length, 32000); + H = true; + d(); + //System.out.println(E); // CraftBukkit + } + + public static void d() { + if (G && H) { + HashSet hashset = new HashSet(); + Iterator iterator = CraftingManager.a().b().iterator(); + + while (iterator.hasNext()) { + CraftingRecipe craftingrecipe = (CraftingRecipe) iterator.next(); + + hashset.add(Integer.valueOf(craftingrecipe.b().id)); + } + + iterator = FurnaceRecipes.a().b().values().iterator(); + + while (iterator.hasNext()) { + ItemStack itemstack = (ItemStack) iterator.next(); + + hashset.add(Integer.valueOf(itemstack.id)); + } + + D = new Statistic[32000]; + iterator = hashset.iterator(); + + while (iterator.hasNext()) { + Integer integer = (Integer) iterator.next(); + + if (Item.byId[integer.intValue()] != null) { + String s = StatisticCollector.a("stat.craftItem", new Object[] { Item.byId[integer.intValue()].i()}); + + D[integer.intValue()] = (new CraftingStatistic(16842752 + integer.intValue(), s, integer.intValue())).d(); + } + } + + a(D); + } + } + + private static Statistic[] a(String s, int i) { + Statistic[] astatistic = new Statistic[256]; + + for (int j = 0; j < 256; ++j) { + if (Block.byId[j] != null && Block.byId[j].g()) { + String s1 = StatisticCollector.a(s, new Object[] { Block.byId[j].e()}); + + astatistic[j] = (new CraftingStatistic(i + j, s1, j)).d(); + e.add((CraftingStatistic) astatistic[j]); + } + } + + a(astatistic); + return astatistic; + } + + private static Statistic[] a(Statistic[] astatistic, String s, int i, int j, int k) { + if (astatistic == null) { + astatistic = new Statistic[32000]; + } + + for (int l = j; l < k; ++l) { + if (Item.byId[l] != null) { + String s1 = StatisticCollector.a(s, new Object[] { Item.byId[l].i()}); + + astatistic[l] = (new CraftingStatistic(i + l, s1, l)).d(); + if (l >= Block.byId.length) { + d.add((CraftingStatistic) astatistic[l]); + } + } + } + + a(astatistic); + return astatistic; + } + + private static Statistic[] b(Statistic[] astatistic, String s, int i, int j, int k) { + if (astatistic == null) { + astatistic = new Statistic[32000]; + } + + for (int l = j; l < k; ++l) { + if (Item.byId[l] != null && Item.byId[l].e()) { + String s1 = StatisticCollector.a(s, new Object[] { Item.byId[l].i()}); + + astatistic[l] = (new CraftingStatistic(i + l, s1, l)).d(); + } + } + + a(astatistic); + return astatistic; + } + + private static void a(Statistic[] astatistic) { + a(astatistic, Block.STATIONARY_WATER.id, Block.WATER.id); + a(astatistic, Block.STATIONARY_LAVA.id, Block.STATIONARY_LAVA.id); + a(astatistic, Block.JACK_O_LANTERN.id, Block.PUMPKIN.id); + a(astatistic, Block.BURNING_FURNACE.id, Block.FURNACE.id); + a(astatistic, Block.GLOWING_REDSTONE_ORE.id, Block.REDSTONE_ORE.id); + a(astatistic, Block.DIODE_ON.id, Block.DIODE_OFF.id); + a(astatistic, Block.REDSTONE_TORCH_ON.id, Block.REDSTONE_TORCH_OFF.id); + a(astatistic, Block.RED_MUSHROOM.id, Block.BROWN_MUSHROOM.id); + a(astatistic, Block.DOUBLE_STEP.id, Block.STEP.id); + a(astatistic, Block.GRASS.id, Block.DIRT.id); + a(astatistic, Block.SOIL.id, Block.DIRT.id); + } + + private static void a(Statistic[] astatistic, int i, int j) { + if (astatistic[i] != null && astatistic[j] == null) { + astatistic[j] = astatistic[i]; + } else { + b.remove(astatistic[i]); + e.remove(astatistic[i]); + c.remove(astatistic[i]); + astatistic[i] = astatistic[j]; + } + } + + static { + AchievementList.a(); + G = false; + H = false; + } +}