testserver/Spigot-Server-Patches/0003-mc-dev-imports.patch

3396 lines
125 KiB
Diff
Raw Normal View History

2016-02-29 23:09:49 +00:00
From 541eaa4579cd06028863b58078500cdcb86fab6d Mon Sep 17 00:00:00 2001
2015-01-29 21:25:50 +00:00
From: Zach Brown <zach.brown@destroystokyo.com>
2016-02-29 23:09:49 +00:00
Date: Mon, 29 Feb 2016 21:09:10 -0600
Subject: [PATCH] mc-dev imports
diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java
new file mode 100644
2016-02-29 23:09:49 +00:00
index 0000000..be4b871
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BiomeBase.java
2016-02-29 23:09:49 +00:00
@@ -0,0 +1,463 @@
+package net.minecraft.server;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+import java.util.Set;
2015-07-27 22:26:21 +00:00
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+public abstract class BiomeBase {
+
2016-02-29 23:09:49 +00:00
+ private static final Logger y = LogManager.getLogger();
+ protected static final IBlockData a = Blocks.STONE.getBlockData();
+ protected static final IBlockData b = Blocks.AIR.getBlockData();
+ protected static final IBlockData c = Blocks.BEDROCK.getBlockData();
+ protected static final IBlockData d = Blocks.GRAVEL.getBlockData();
+ protected static final IBlockData e = Blocks.RED_SANDSTONE.getBlockData();
+ protected static final IBlockData f = Blocks.SANDSTONE.getBlockData();
+ protected static final IBlockData g = Blocks.ICE.getBlockData();
+ protected static final IBlockData h = Blocks.WATER.getBlockData();
+ public static final Set<BiomeBase> i = Sets.newHashSet();
+ public static final RegistryBlockID<BiomeBase> j = new RegistryBlockID();
+ protected static final NoiseGenerator3 k = new NoiseGenerator3(new Random(1234L), 1);
+ protected static final NoiseGenerator3 l = new NoiseGenerator3(new Random(2345L), 1);
+ protected static final WorldGenTallPlant m = new WorldGenTallPlant();
+ protected static final WorldGenTrees n = new WorldGenTrees(false);
+ protected static final WorldGenBigTree o = new WorldGenBigTree(false);
+ protected static final WorldGenSwampTree p = new WorldGenSwampTree();
+ public static final RegistryMaterials<MinecraftKey, BiomeBase> REGISTRY_ID = new RegistryMaterials();
+ private final String z;
+ private final float A;
+ private final float B;
+ private final float C;
+ private final float D;
+ private final int E;
+ private final boolean F;
+ private final boolean G;
+ private final String H;
+ public IBlockData r;
+ public IBlockData s;
+ public BiomeDecorator t;
+ protected List<BiomeBase.BiomeMeta> u;
+ protected List<BiomeBase.BiomeMeta> v;
+ protected List<BiomeBase.BiomeMeta> w;
+ protected List<BiomeBase.BiomeMeta> x;
+
+ public static int a(BiomeBase biomebase) {
+ return BiomeBase.REGISTRY_ID.a((Object) biomebase);
+ }
+
+ public static BiomeBase a(int i) {
+ return (BiomeBase) BiomeBase.REGISTRY_ID.getId(i);
+ }
+
+ public static BiomeBase b(BiomeBase biomebase) {
+ return (BiomeBase) BiomeBase.j.fromId(a(biomebase));
+ }
+
+ protected BiomeBase(BiomeBase.a biomebase_a) {
+ this.r = Blocks.GRASS.getBlockData();
+ this.s = Blocks.DIRT.getBlockData();
+ this.u = Lists.newArrayList();
+ this.v = Lists.newArrayList();
+ this.w = Lists.newArrayList();
+ this.x = Lists.newArrayList();
+ this.z = biomebase_a.a;
+ this.A = biomebase_a.b;
+ this.B = biomebase_a.c;
+ this.C = biomebase_a.d;
+ this.D = biomebase_a.e;
+ this.E = biomebase_a.f;
+ this.F = biomebase_a.g;
+ this.G = biomebase_a.h;
+ this.H = biomebase_a.i;
+ this.t = this.a();
+ this.v.add(new BiomeBase.BiomeMeta(EntitySheep.class, 12, 4, 4));
+ this.v.add(new BiomeBase.BiomeMeta(EntityPig.class, 10, 4, 4));
+ this.v.add(new BiomeBase.BiomeMeta(EntityChicken.class, 10, 4, 4));
+ this.v.add(new BiomeBase.BiomeMeta(EntityCow.class, 8, 4, 4));
+ this.u.add(new BiomeBase.BiomeMeta(EntitySpider.class, 100, 4, 4));
+ this.u.add(new BiomeBase.BiomeMeta(EntityZombie.class, 100, 4, 4));
+ this.u.add(new BiomeBase.BiomeMeta(EntitySkeleton.class, 100, 4, 4));
+ this.u.add(new BiomeBase.BiomeMeta(EntityCreeper.class, 100, 4, 4));
+ this.u.add(new BiomeBase.BiomeMeta(EntitySlime.class, 100, 4, 4));
+ this.u.add(new BiomeBase.BiomeMeta(EntityEnderman.class, 10, 1, 4));
+ this.u.add(new BiomeBase.BiomeMeta(EntityWitch.class, 5, 1, 1));
+ this.w.add(new BiomeBase.BiomeMeta(EntitySquid.class, 10, 4, 4));
+ this.x.add(new BiomeBase.BiomeMeta(EntityBat.class, 10, 8, 8));
+ }
+
+ protected BiomeDecorator a() {
+ return new BiomeDecorator();
+ }
+
2016-02-29 23:09:49 +00:00
+ public boolean b() {
+ return this.H != null;
+ }
+
+ public WorldGenTreeAbstract a(Random random) {
2016-02-29 23:09:49 +00:00
+ return (WorldGenTreeAbstract) (random.nextInt(10) == 0 ? BiomeBase.o : BiomeBase.n);
+ }
+
+ public WorldGenerator b(Random random) {
+ return new WorldGenGrass(BlockLongGrass.EnumTallGrassType.GRASS);
+ }
+
+ public BlockFlowers.EnumFlowerVarient a(Random random, BlockPosition blockposition) {
+ return random.nextInt(3) > 0 ? BlockFlowers.EnumFlowerVarient.DANDELION : BlockFlowers.EnumFlowerVarient.POPPY;
+ }
+
2016-02-29 23:09:49 +00:00
+ public List<BiomeBase.BiomeMeta> getMobs(EnumCreatureType enumcreaturetype) {
+ switch (BiomeBase.SyntheticClass_1.a[enumcreaturetype.ordinal()]) {
+ case 1:
2016-02-29 23:09:49 +00:00
+ return this.u;
+
+ case 2:
2016-02-29 23:09:49 +00:00
+ return this.v;
+
+ case 3:
2016-02-29 23:09:49 +00:00
+ return this.w;
+
+ case 4:
2016-02-29 23:09:49 +00:00
+ return this.x;
+
+ default:
+ return Collections.emptyList();
+ }
+ }
+
2016-02-29 23:09:49 +00:00
+ public boolean c() {
+ return this.p();
+ }
+
2016-02-29 23:09:49 +00:00
+ public boolean d() {
+ return this.p() ? false : this.G;
+ }
+
2016-02-29 23:09:49 +00:00
+ public boolean e() {
+ return this.getHumidity() > 0.85F;
+ }
+
2016-02-29 23:09:49 +00:00
+ public float f() {
+ return 0.1F;
+ }
+
+ public final float a(BlockPosition blockposition) {
+ if (blockposition.getY() > 64) {
2016-02-29 23:09:49 +00:00
+ float f = (float) (BiomeBase.k.a((double) ((float) blockposition.getX() / 8.0F), (double) ((float) blockposition.getZ() / 8.0F)) * 4.0D);
+
2016-02-29 23:09:49 +00:00
+ return this.getTemperature() - (f + (float) blockposition.getY() - 64.0F) * 0.05F / 30.0F;
+ } else {
2016-02-29 23:09:49 +00:00
+ return this.getTemperature();
+ }
+ }
+
+ public void a(World world, Random random, BlockPosition blockposition) {
2016-02-29 23:09:49 +00:00
+ this.t.a(world, random, this, blockposition);
+ }
+
+ public void a(World world, Random random, ChunkSnapshot chunksnapshot, int i, int j, double d0) {
+ this.b(world, random, chunksnapshot, i, j, d0);
+ }
+
+ public final void b(World world, Random random, ChunkSnapshot chunksnapshot, int i, int j, double d0) {
2016-02-29 23:09:49 +00:00
+ int k = world.K();
+ IBlockData iblockdata = this.r;
+ IBlockData iblockdata1 = this.s;
+ int l = -1;
+ int i1 = (int) (d0 / 3.0D + 3.0D + random.nextDouble() * 0.25D);
+ int j1 = i & 15;
+ int k1 = j & 15;
+ BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
+
+ for (int l1 = 255; l1 >= 0; --l1) {
+ if (l1 <= random.nextInt(5)) {
2016-02-29 23:09:49 +00:00
+ chunksnapshot.a(k1, l1, j1, BiomeBase.c);
+ } else {
+ IBlockData iblockdata2 = chunksnapshot.a(k1, l1, j1);
+
2016-02-29 23:09:49 +00:00
+ if (iblockdata2.getMaterial() == Material.AIR) {
+ l = -1;
+ } else if (iblockdata2.getBlock() == Blocks.STONE) {
+ if (l == -1) {
+ if (i1 <= 0) {
2016-02-29 23:09:49 +00:00
+ iblockdata = BiomeBase.b;
+ iblockdata1 = BiomeBase.a;
+ } else if (l1 >= k - 4 && l1 <= k + 1) {
2016-02-29 23:09:49 +00:00
+ iblockdata = this.r;
+ iblockdata1 = this.s;
+ }
+
2016-02-29 23:09:49 +00:00
+ if (l1 < k && (iblockdata == null || iblockdata.getMaterial() == Material.AIR)) {
+ if (this.a((BlockPosition) blockposition_mutableblockposition.c(i, l1, j)) < 0.15F) {
2016-02-29 23:09:49 +00:00
+ iblockdata = BiomeBase.g;
+ } else {
2016-02-29 23:09:49 +00:00
+ iblockdata = BiomeBase.h;
+ }
+ }
+
+ l = i1;
+ if (l1 >= k - 1) {
+ chunksnapshot.a(k1, l1, j1, iblockdata);
+ } else if (l1 < k - 7 - i1) {
2016-02-29 23:09:49 +00:00
+ iblockdata = BiomeBase.b;
+ iblockdata1 = BiomeBase.a;
+ chunksnapshot.a(k1, l1, j1, BiomeBase.d);
+ } else {
+ chunksnapshot.a(k1, l1, j1, iblockdata1);
+ }
+ } else if (l > 0) {
+ --l;
+ chunksnapshot.a(k1, l1, j1, iblockdata1);
+ if (l == 0 && iblockdata1.getBlock() == Blocks.SAND) {
+ l = random.nextInt(4) + Math.max(0, l1 - 63);
2016-02-29 23:09:49 +00:00
+ iblockdata1 = iblockdata1.get(BlockSand.VARIANT) == BlockSand.EnumSandVariant.RED_SAND ? BiomeBase.e : BiomeBase.f;
+ }
+ }
+ }
+ }
+ }
+
+ }
+
2016-02-29 23:09:49 +00:00
+ public Class<? extends BiomeBase> g() {
+ return this.getClass();
+ }
+
2016-02-29 23:09:49 +00:00
+ public BiomeBase.EnumTemperature h() {
+ return (double) this.getTemperature() < 0.2D ? BiomeBase.EnumTemperature.COLD : ((double) this.getTemperature() < 1.0D ? BiomeBase.EnumTemperature.MEDIUM : BiomeBase.EnumTemperature.WARM);
+ }
+
+ public static BiomeBase getBiome(int i) {
+ return getBiome(i, (BiomeBase) null);
+ }
+
+ public static BiomeBase getBiome(int i, BiomeBase biomebase) {
2016-02-29 23:09:49 +00:00
+ BiomeBase biomebase1 = a(i);
+
2016-02-29 23:09:49 +00:00
+ return biomebase1 == null ? biomebase : biomebase1;
+ }
+
2016-02-29 23:09:49 +00:00
+ public boolean i() {
+ return false;
+ }
+
+ public final float j() {
+ return this.A;
+ }
+
+ public final float getHumidity() {
+ return this.D;
+ }
+
+ public final String l() {
+ return this.z;
+ }
+
+ public final float m() {
+ return this.B;
+ }
+
+ public final float getTemperature() {
+ return this.C;
+ }
+
+ public final boolean p() {
+ return this.F;
+ }
+
+ public static void q() {
+ a(0, "ocean", new BiomeOcean((new BiomeBase.a("Ocean")).c(-1.0F).d(0.1F)));
+ a(1, "plains", new BiomePlains(false, (new BiomeBase.a("Plains")).c(0.125F).d(0.05F).a(0.8F).b(0.4F)));
+ a(2, "desert", new BiomeDesert((new BiomeBase.a("Desert")).c(0.125F).d(0.05F).a(2.0F).b(0.0F).a()));
+ a(3, "extreme_hills", new BiomeBigHills(BiomeBigHills.Type.NORMAL, (new BiomeBase.a("Extreme Hills")).c(1.0F).d(0.5F).a(0.2F).b(0.3F)));
+ a(4, "forest", new BiomeForest(BiomeForest.Type.NORMAL, (new BiomeBase.a("Forest")).a(0.7F).b(0.8F)));
+ a(5, "taiga", new BiomeTaiga(BiomeTaiga.Type.NORMAL, (new BiomeBase.a("Taiga")).c(0.2F).d(0.2F).a(0.25F).b(0.8F)));
+ a(6, "swampland", new BiomeSwamp((new BiomeBase.a("Swampland")).c(-0.2F).d(0.1F).a(0.8F).b(0.9F).a(14745518)));
+ a(7, "river", new BiomeRiver((new BiomeBase.a("River")).c(-0.5F).d(0.0F)));
+ a(8, "hell", new BiomeHell((new BiomeBase.a("Hell")).a(2.0F).b(0.0F).a()));
+ a(9, "sky", new BiomeTheEnd((new BiomeBase.a("The End")).a()));
+ a(10, "frozen_ocean", new BiomeOcean((new BiomeBase.a("FrozenOcean")).c(-1.0F).d(0.1F).a(0.0F).b(0.5F).b()));
+ a(11, "frozen_river", new BiomeRiver((new BiomeBase.a("FrozenRiver")).c(-0.5F).d(0.0F).a(0.0F).b(0.5F).b()));
+ a(12, "ice_flats", new BiomeIcePlains(false, (new BiomeBase.a("Ice Plains")).c(0.125F).d(0.05F).a(0.0F).b(0.5F).b()));
+ a(13, "ice_mountains", new BiomeIcePlains(false, (new BiomeBase.a("Ice Mountains")).c(0.45F).d(0.3F).a(0.0F).b(0.5F).b()));
+ a(14, "mushroom_island", new BiomeMushrooms((new BiomeBase.a("MushroomIsland")).c(0.2F).d(0.3F).a(0.9F).b(1.0F)));
+ a(15, "mushroom_island_shore", new BiomeMushrooms((new BiomeBase.a("MushroomIslandShore")).c(0.0F).d(0.025F).a(0.9F).b(1.0F)));
+ a(16, "beaches", new BiomeBeach((new BiomeBase.a("Beach")).c(0.0F).d(0.025F).a(0.8F).b(0.4F)));
+ a(17, "desert_hills", new BiomeDesert((new BiomeBase.a("DesertHills")).c(0.45F).d(0.3F).a(2.0F).b(0.0F).a()));
+ a(18, "forest_hills", new BiomeForest(BiomeForest.Type.NORMAL, (new BiomeBase.a("ForestHills")).c(0.45F).d(0.3F).a(0.7F).b(0.8F)));
+ a(19, "taiga_hills", new BiomeTaiga(BiomeTaiga.Type.NORMAL, (new BiomeBase.a("TaigaHills")).a(0.25F).b(0.8F).c(0.45F).d(0.3F)));
+ a(20, "smaller_extreme_hills", new BiomeBigHills(BiomeBigHills.Type.EXTRA_TREES, (new BiomeBase.a("Extreme Hills Edge")).c(0.8F).d(0.3F).a(0.2F).b(0.3F)));
+ a(21, "jungle", new BiomeJungle(false, (new BiomeBase.a("Jungle")).a(0.95F).b(0.9F)));
+ a(22, "jungle_hills", new BiomeJungle(false, (new BiomeBase.a("JungleHills")).c(0.45F).d(0.3F).a(0.95F).b(0.9F)));
+ a(23, "jungle_edge", new BiomeJungle(true, (new BiomeBase.a("JungleEdge")).a(0.95F).b(0.8F)));
+ a(24, "deep_ocean", new BiomeOcean((new BiomeBase.a("Deep Ocean")).c(-1.8F).d(0.1F)));
+ a(25, "stone_beach", new BiomeStoneBeach((new BiomeBase.a("Stone Beach")).c(0.1F).d(0.8F).a(0.2F).b(0.3F)));
+ a(26, "cold_beach", new BiomeBeach((new BiomeBase.a("Cold Beach")).c(0.0F).d(0.025F).a(0.05F).b(0.3F).b()));
+ a(27, "birch_forest", new BiomeForest(BiomeForest.Type.BIRCH, (new BiomeBase.a("Birch Forest")).a(0.6F).b(0.6F)));
+ a(28, "birch_forest_hills", new BiomeForest(BiomeForest.Type.BIRCH, (new BiomeBase.a("Birch Forest Hills")).c(0.45F).d(0.3F).a(0.6F).b(0.6F)));
+ a(29, "roofed_forest", new BiomeForest(BiomeForest.Type.ROOFED, (new BiomeBase.a("Roofed Forest")).a(0.7F).b(0.8F)));
+ a(30, "taiga_cold", new BiomeTaiga(BiomeTaiga.Type.NORMAL, (new BiomeBase.a("Cold Taiga")).c(0.2F).d(0.2F).a(-0.5F).b(0.4F).b()));
+ a(31, "taiga_cold_hills", new BiomeTaiga(BiomeTaiga.Type.NORMAL, (new BiomeBase.a("Cold Taiga Hills")).c(0.45F).d(0.3F).a(-0.5F).b(0.4F).b()));
+ a(32, "redwood_taiga", new BiomeTaiga(BiomeTaiga.Type.MEGA, (new BiomeBase.a("Mega Taiga")).a(0.3F).b(0.8F).c(0.2F).d(0.2F)));
+ a(33, "redwood_taiga_hills", new BiomeTaiga(BiomeTaiga.Type.MEGA, (new BiomeBase.a("Mega Taiga Hills")).c(0.45F).d(0.3F).a(0.3F).b(0.8F)));
+ a(34, "extreme_hills_with_trees", new BiomeBigHills(BiomeBigHills.Type.EXTRA_TREES, (new BiomeBase.a("Extreme Hills+")).c(1.0F).d(0.5F).a(0.2F).b(0.3F)));
+ a(35, "savanna", new BiomeSavanna((new BiomeBase.a("Savanna")).c(0.125F).d(0.05F).a(1.2F).b(0.0F).a()));
+ a(36, "savanna_rock", new BiomeSavanna((new BiomeBase.a("Savanna Plateau")).c(1.5F).d(0.025F).a(1.0F).b(0.0F).a()));
+ a(37, "mesa", new BiomeMesa(false, false, (new BiomeBase.a("Mesa")).a(2.0F).b(0.0F).a()));
+ a(38, "mesa_rock", new BiomeMesa(false, true, (new BiomeBase.a("Mesa Plateau F")).c(1.5F).d(0.025F).a(2.0F).b(0.0F).a()));
+ a(39, "mesa_clear_rock", new BiomeMesa(false, false, (new BiomeBase.a("Mesa Plateau")).c(1.5F).d(0.025F).a(2.0F).b(0.0F).a()));
+ a(127, "void", new BiomeVoid((new BiomeBase.a("The Void")).a()));
+ a(129, "mutated_plains", new BiomePlains(true, (new BiomeBase.a("Sunflower Plains")).a("plains").c(0.125F).d(0.05F).a(0.8F).b(0.4F)));
+ a(130, "mutated_desert", new BiomeDesert((new BiomeBase.a("Desert M")).a("desert").c(0.225F).d(0.25F).a(2.0F).b(0.0F).a()));
+ a(131, "mutated_extreme_hills", new BiomeBigHills(BiomeBigHills.Type.MUTATED, (new BiomeBase.a("Extreme Hills M")).a("extreme_hills").c(1.0F).d(0.5F).a(0.2F).b(0.3F)));
+ a(132, "mutated_forest", new BiomeForest(BiomeForest.Type.FLOWER, (new BiomeBase.a("Flower Forest")).a("forest").d(0.4F).a(0.7F).b(0.8F)));
+ a(133, "mutated_taiga", new BiomeTaiga(BiomeTaiga.Type.NORMAL, (new BiomeBase.a("Taiga M")).a("taiga").c(0.3F).d(0.4F).a(0.25F).b(0.8F)));
+ a(134, "mutated_swampland", new BiomeSwamp((new BiomeBase.a("Swampland M")).a("swampland").c(-0.1F).d(0.3F).a(0.8F).b(0.9F).a(14745518)));
+ a(140, "mutated_ice_flats", new BiomeIcePlains(true, (new BiomeBase.a("Ice Plains Spikes")).a("ice_flats").c(0.425F).d(0.45000002F).a(0.0F).b(0.5F).b()));
+ a(149, "mutated_jungle", new BiomeJungle(false, (new BiomeBase.a("Jungle M")).a("jungle").c(0.2F).d(0.4F).a(0.95F).b(0.9F)));
+ a(151, "mutated_jungle_edge", new BiomeJungle(true, (new BiomeBase.a("JungleEdge M")).a("jungle_edge").c(0.2F).d(0.4F).a(0.95F).b(0.8F)));
+ a(155, "mutated_birch_forest", new BiomeForestMutated((new BiomeBase.a("Birch Forest M")).a("birch_forest").c(0.2F).d(0.4F).a(0.6F).b(0.6F)));
+ a(156, "mutated_birch_forest_hills", new BiomeForestMutated((new BiomeBase.a("Birch Forest Hills M")).a("birch_forest").c(0.55F).d(0.5F).a(0.6F).b(0.6F)));
+ a(157, "mutated_roofed_forest", new BiomeForest(BiomeForest.Type.ROOFED, (new BiomeBase.a("Roofed Forest M")).a("roofed_forest").c(0.2F).d(0.4F).a(0.7F).b(0.8F)));
+ a(158, "mutated_taiga_cold", new BiomeTaiga(BiomeTaiga.Type.NORMAL, (new BiomeBase.a("Cold Taiga M")).a("taiga_cold").c(0.3F).d(0.4F).a(-0.5F).b(0.4F).b()));
+ a(160, "mutated_redwood_taiga", new BiomeTaiga(BiomeTaiga.Type.MEGA_SPRUCE, (new BiomeBase.a("Mega Spruce Taiga")).a("redwood_taiga").c(0.2F).d(0.2F).a(0.25F).b(0.8F)));
+ a(161, "mutated_redwood_taiga_hills", new BiomeTaiga(BiomeTaiga.Type.MEGA_SPRUCE, (new BiomeBase.a("Redwood Taiga Hills M")).a("redwood_taiga_hills").c(0.2F).d(0.2F).a(0.25F).b(0.8F)));
+ a(162, "mutated_extreme_hills_with_trees", new BiomeBigHills(BiomeBigHills.Type.MUTATED, (new BiomeBase.a("Extreme Hills+ M")).a("extreme_hills_with_trees").c(1.0F).d(0.5F).a(0.2F).b(0.3F)));
+ a(163, "mutated_savanna", new BiomeSavannaMutated((new BiomeBase.a("Savanna M")).a("savanna").c(0.3625F).d(1.225F).a(1.1F).b(0.0F).a()));
+ a(164, "mutated_savanna_rock", new BiomeSavannaMutated((new BiomeBase.a("Savanna Plateau M")).a("savanna_rock").c(1.05F).d(1.2125001F).a(1.0F).b(0.0F).a()));
+ a(165, "mutated_mesa", new BiomeMesa(true, false, (new BiomeBase.a("Mesa (Bryce)")).a("mesa").a(2.0F).b(0.0F).a()));
+ a(166, "mutated_mesa_rock", new BiomeMesa(false, true, (new BiomeBase.a("Mesa Plateau F M")).a("mesa_rock").c(0.45F).d(0.3F).a(2.0F).b(0.0F).a()));
+ a(167, "mutated_mesa_clear_rock", new BiomeMesa(false, false, (new BiomeBase.a("Mesa Plateau M")).a("mesa_clear_rock").c(0.45F).d(0.3F).a(2.0F).b(0.0F).a()));
+ Collections.addAll(BiomeBase.i, new BiomeBase[] { Biomes.a, Biomes.c, Biomes.d, Biomes.e, Biomes.f, Biomes.g, Biomes.h, Biomes.i, Biomes.m, Biomes.n, Biomes.o, Biomes.p, Biomes.q, Biomes.r, Biomes.s, Biomes.t, Biomes.u, Biomes.w, Biomes.x, Biomes.y, Biomes.z, Biomes.A, Biomes.B, Biomes.C, Biomes.D, Biomes.E, Biomes.F, Biomes.G, Biomes.H, Biomes.I, Biomes.J, Biomes.K, Biomes.L, Biomes.M, Biomes.N, Biomes.O});
+ }
+
+ private static void a(int i, String s, BiomeBase biomebase) {
+ BiomeBase.REGISTRY_ID.a(i, new MinecraftKey(s), biomebase);
+ if (biomebase.b()) {
+ BiomeBase.j.a(biomebase, a((BiomeBase) BiomeBase.REGISTRY_ID.get(new MinecraftKey(biomebase.H))));
+ }
+
+ }
+
+ static class SyntheticClass_1 {
+
2016-02-29 23:09:49 +00:00
+ static final int[] a = new int[EnumCreatureType.values().length];
+
+ static {
+ try {
2016-02-29 23:09:49 +00:00
+ BiomeBase.SyntheticClass_1.a[EnumCreatureType.MONSTER.ordinal()] = 1;
+ } catch (NoSuchFieldError nosuchfielderror) {
+ ;
+ }
+
+ try {
2016-02-29 23:09:49 +00:00
+ BiomeBase.SyntheticClass_1.a[EnumCreatureType.CREATURE.ordinal()] = 2;
+ } catch (NoSuchFieldError nosuchfielderror1) {
+ ;
+ }
+
+ try {
2016-02-29 23:09:49 +00:00
+ BiomeBase.SyntheticClass_1.a[EnumCreatureType.WATER_CREATURE.ordinal()] = 3;
+ } catch (NoSuchFieldError nosuchfielderror2) {
+ ;
+ }
+
+ try {
2016-02-29 23:09:49 +00:00
+ BiomeBase.SyntheticClass_1.a[EnumCreatureType.AMBIENT.ordinal()] = 4;
+ } catch (NoSuchFieldError nosuchfielderror3) {
+ ;
+ }
+
+ }
+ }
+
2016-02-29 23:09:49 +00:00
+ public static class a {
+
+ private final String a;
+ private float b = 0.1F;
+ private float c = 0.2F;
+ private float d = 0.5F;
+ private float e = 0.5F;
+ private int f = 16777215;
+ private boolean g;
+ private boolean h = true;
+ private String i;
+
+ public a(String s) {
+ this.a = s;
+ }
+
+ protected BiomeBase.a a(float f) {
+ if (f > 0.1F && f < 0.2F) {
+ throw new IllegalArgumentException("Please avoid temperatures in the range 0.1 - 0.2 because of snow");
+ } else {
+ this.d = f;
+ return this;
+ }
+ }
+
+ protected BiomeBase.a b(float f) {
+ this.e = f;
+ return this;
+ }
+
+ protected BiomeBase.a c(float f) {
+ this.b = f;
+ return this;
+ }
+
+ protected BiomeBase.a d(float f) {
+ this.c = f;
+ return this;
+ }
+
+ protected BiomeBase.a a() {
+ this.h = false;
+ return this;
+ }
+
+ protected BiomeBase.a b() {
+ this.g = true;
+ return this;
+ }
+
+ protected BiomeBase.a a(int i) {
+ this.f = i;
+ return this;
+ }
+
+ protected BiomeBase.a a(String s) {
+ this.i = s;
+ return this;
+ }
+ }
+
+ public static class BiomeMeta extends WeightedRandom.WeightedRandomChoice {
+
+ public Class<? extends EntityInsentient> b;
+ public int c;
+ public int d;
+
+ public BiomeMeta(Class<? extends EntityInsentient> oclass, int i, int j, int k) {
+ super(i);
+ this.b = oclass;
+ this.c = j;
+ this.d = k;
+ }
+
+ public String toString() {
+ return this.b.getSimpleName() + "*(" + this.c + "-" + this.d + "):" + this.a;
+ }
+ }
+
+ public static enum EnumTemperature {
+
+ OCEAN, COLD, MEDIUM, WARM;
+
+ private EnumTemperature() {}
+ }
+}
diff --git a/src/main/java/net/minecraft/server/BiomeMesa.java b/src/main/java/net/minecraft/server/BiomeMesa.java
new file mode 100644
2016-02-29 23:09:49 +00:00
index 0000000..3ce22aa
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BiomeMesa.java
2016-02-29 23:09:49 +00:00
@@ -0,0 +1,252 @@
+package net.minecraft.server;
+
+import java.util.Arrays;
+import java.util.Random;
+
+public class BiomeMesa extends BiomeBase {
+
2016-02-29 23:09:49 +00:00
+ protected static final IBlockData y = Blocks.DIRT.getBlockData().set(BlockDirt.VARIANT, BlockDirt.EnumDirtVariant.COARSE_DIRT);
+ protected static final IBlockData z = Blocks.GRASS.getBlockData();
+ protected static final IBlockData A = Blocks.HARDENED_CLAY.getBlockData();
+ protected static final IBlockData B = Blocks.STAINED_HARDENED_CLAY.getBlockData();
+ protected static final IBlockData C = BiomeMesa.B.set(BlockCloth.COLOR, EnumColor.ORANGE);
+ protected static final IBlockData D = Blocks.SAND.getBlockData().set(BlockSand.VARIANT, BlockSand.EnumSandVariant.RED_SAND);
+ private IBlockData[] E;
+ private long F;
+ private NoiseGenerator3 G;
+ private NoiseGenerator3 H;
+ private NoiseGenerator3 I;
+ private boolean J;
+ private boolean K;
+
+ public BiomeMesa(boolean flag, boolean flag1, BiomeBase.a biomebase_a) {
+ super(biomebase_a);
+ this.J = flag;
+ this.K = flag1;
+ this.v.clear();
+ this.r = BiomeMesa.D;
+ this.s = BiomeMesa.B;
+ this.t.z = -999;
+ this.t.C = 20;
+ this.t.E = 3;
+ this.t.F = 5;
+ this.t.A = 0;
+ this.v.clear();
+ if (flag1) {
2016-02-29 23:09:49 +00:00
+ this.t.z = 5;
+ }
+
+ }
+
+ public WorldGenTreeAbstract a(Random random) {
2016-02-29 23:09:49 +00:00
+ return BiomeMesa.n;
+ }
+
+ public void a(World world, Random random, BlockPosition blockposition) {
+ super.a(world, random, blockposition);
+ }
+
+ public void a(World world, Random random, ChunkSnapshot chunksnapshot, int i, int j, double d0) {
2016-02-29 23:09:49 +00:00
+ if (this.E == null || this.F != world.getSeed()) {
+ this.a(world.getSeed());
+ }
+
2016-02-29 23:09:49 +00:00
+ if (this.G == null || this.H == null || this.F != world.getSeed()) {
+ Random random1 = new Random(this.F);
+
2016-02-29 23:09:49 +00:00
+ this.G = new NoiseGenerator3(random1, 4);
+ this.H = new NoiseGenerator3(random1, 1);
+ }
+
2016-02-29 23:09:49 +00:00
+ this.F = world.getSeed();
+ double d1 = 0.0D;
+ int k;
+ int l;
+
2016-02-29 23:09:49 +00:00
+ if (this.J) {
+ k = (i & -16) + (j & 15);
+ l = (j & -16) + (i & 15);
2016-02-29 23:09:49 +00:00
+ double d2 = Math.min(Math.abs(d0), this.G.a((double) k * 0.25D, (double) l * 0.25D));
+
+ if (d2 > 0.0D) {
+ double d3 = 0.001953125D;
2016-02-29 23:09:49 +00:00
+ double d4 = Math.abs(this.H.a((double) k * d3, (double) l * d3));
+
+ d1 = d2 * d2 * 2.5D;
+ double d5 = Math.ceil(d4 * 50.0D) + 14.0D;
+
+ if (d1 > d5) {
+ d1 = d5;
+ }
+
+ d1 += 64.0D;
+ }
+ }
+
+ k = i & 15;
+ l = j & 15;
2016-02-29 23:09:49 +00:00
+ int i1 = world.K();
+ IBlockData iblockdata = BiomeMesa.B;
+ IBlockData iblockdata1 = this.s;
+ int j1 = (int) (d0 / 3.0D + 3.0D + random.nextDouble() * 0.25D);
+ boolean flag = Math.cos(d0 / 3.0D * 3.141592653589793D) > 0.0D;
+ int k1 = -1;
+ boolean flag1 = false;
+
+ for (int l1 = 255; l1 >= 0; --l1) {
2016-02-29 23:09:49 +00:00
+ if (chunksnapshot.a(l, l1, k).getMaterial() == Material.AIR && l1 < (int) d1) {
+ chunksnapshot.a(l, l1, k, BiomeMesa.a);
+ }
+
+ if (l1 <= random.nextInt(5)) {
2016-02-29 23:09:49 +00:00
+ chunksnapshot.a(l, l1, k, BiomeMesa.c);
+ } else {
+ IBlockData iblockdata2 = chunksnapshot.a(l, l1, k);
+
2016-02-29 23:09:49 +00:00
+ if (iblockdata2.getMaterial() == Material.AIR) {
+ k1 = -1;
+ } else if (iblockdata2.getBlock() == Blocks.STONE) {
+ if (k1 == -1) {
+ flag1 = false;
+ if (j1 <= 0) {
2016-02-29 23:09:49 +00:00
+ iblockdata = BiomeMesa.b;
+ iblockdata1 = BiomeMesa.a;
+ } else if (l1 >= i1 - 4 && l1 <= i1 + 1) {
2016-02-29 23:09:49 +00:00
+ iblockdata = BiomeMesa.B;
+ iblockdata1 = this.s;
+ }
+
2016-02-29 23:09:49 +00:00
+ if (l1 < i1 && (iblockdata == null || iblockdata.getMaterial() == Material.AIR)) {
+ iblockdata = BiomeMesa.h;
+ }
+
+ k1 = j1 + Math.max(0, l1 - i1);
+ if (l1 >= i1 - 1) {
2016-02-29 23:09:49 +00:00
+ if (this.K && l1 > 86 + j1 * 2) {
+ if (flag) {
2016-02-29 23:09:49 +00:00
+ chunksnapshot.a(l, l1, k, BiomeMesa.y);
+ } else {
2016-02-29 23:09:49 +00:00
+ chunksnapshot.a(l, l1, k, BiomeMesa.z);
+ }
+ } else if (l1 > i1 + 3 + j1) {
2016-02-29 23:09:49 +00:00
+ IBlockData iblockdata3;
+
+ if (l1 >= 64 && l1 <= 127) {
+ if (flag) {
2016-02-29 23:09:49 +00:00
+ iblockdata3 = BiomeMesa.A;
+ } else {
+ iblockdata3 = this.a(i, l1, j);
+ }
+ } else {
2016-02-29 23:09:49 +00:00
+ iblockdata3 = BiomeMesa.C;
+ }
+
+ chunksnapshot.a(l, l1, k, iblockdata3);
+ } else {
2016-02-29 23:09:49 +00:00
+ chunksnapshot.a(l, l1, k, this.r);
+ flag1 = true;
+ }
+ } else {
+ chunksnapshot.a(l, l1, k, iblockdata1);
+ if (iblockdata1.getBlock() == Blocks.STAINED_HARDENED_CLAY) {
2016-02-29 23:09:49 +00:00
+ chunksnapshot.a(l, l1, k, BiomeMesa.C);
+ }
+ }
+ } else if (k1 > 0) {
+ --k1;
+ if (flag1) {
2016-02-29 23:09:49 +00:00
+ chunksnapshot.a(l, l1, k, BiomeMesa.C);
+ } else {
2016-02-29 23:09:49 +00:00
+ chunksnapshot.a(l, l1, k, this.a(i, l1, j));
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+ private void a(long i) {
2016-02-29 23:09:49 +00:00
+ this.E = new IBlockData[64];
+ Arrays.fill(this.E, BiomeMesa.A);
+ Random random = new Random(i);
+
2016-02-29 23:09:49 +00:00
+ this.I = new NoiseGenerator3(random, 1);
+
+ int j;
+
+ for (j = 0; j < 64; ++j) {
+ j += random.nextInt(5) + 1;
+ if (j < 64) {
2016-02-29 23:09:49 +00:00
+ this.E[j] = BiomeMesa.C;
+ }
+ }
+
+ j = random.nextInt(4) + 2;
+
+ int k;
+ int l;
+ int i1;
+ int j1;
+
+ for (k = 0; k < j; ++k) {
+ l = random.nextInt(3) + 1;
+ i1 = random.nextInt(64);
+
+ for (j1 = 0; i1 + j1 < 64 && j1 < l; ++j1) {
2016-02-29 23:09:49 +00:00
+ this.E[i1 + j1] = BiomeMesa.B.set(BlockCloth.COLOR, EnumColor.YELLOW);
+ }
+ }
+
+ k = random.nextInt(4) + 2;
+
+ int k1;
+
+ for (l = 0; l < k; ++l) {
+ i1 = random.nextInt(3) + 2;
+ j1 = random.nextInt(64);
+
+ for (k1 = 0; j1 + k1 < 64 && k1 < i1; ++k1) {
2016-02-29 23:09:49 +00:00
+ this.E[j1 + k1] = BiomeMesa.B.set(BlockCloth.COLOR, EnumColor.BROWN);
+ }
+ }
+
+ l = random.nextInt(4) + 2;
+
+ for (i1 = 0; i1 < l; ++i1) {
+ j1 = random.nextInt(3) + 1;
+ k1 = random.nextInt(64);
+
+ for (int l1 = 0; k1 + l1 < 64 && l1 < j1; ++l1) {
2016-02-29 23:09:49 +00:00
+ this.E[k1 + l1] = BiomeMesa.B.set(BlockCloth.COLOR, EnumColor.RED);
+ }
+ }
+
+ i1 = random.nextInt(3) + 3;
+ j1 = 0;
+
+ for (k1 = 0; k1 < i1; ++k1) {
+ byte b0 = 1;
+
+ j1 += random.nextInt(16) + 4;
+
+ for (int i2 = 0; j1 + i2 < 64 && i2 < b0; ++i2) {
2016-02-29 23:09:49 +00:00
+ this.E[j1 + i2] = BiomeMesa.B.set(BlockCloth.COLOR, EnumColor.WHITE);
+ if (j1 + i2 > 1 && random.nextBoolean()) {
2016-02-29 23:09:49 +00:00
+ this.E[j1 + i2 - 1] = BiomeMesa.B.set(BlockCloth.COLOR, EnumColor.SILVER);
+ }
+
+ if (j1 + i2 < 63 && random.nextBoolean()) {
2016-02-29 23:09:49 +00:00
+ this.E[j1 + i2 + 1] = BiomeMesa.B.set(BlockCloth.COLOR, EnumColor.SILVER);
+ }
+ }
+ }
+
+ }
+
+ private IBlockData a(int i, int j, int k) {
2016-02-29 23:09:49 +00:00
+ int l = (int) Math.round(this.I.a((double) i / 512.0D, (double) i / 512.0D) * 2.0D);
+
2016-02-29 23:09:49 +00:00
+ return this.E[(j + l + 64) % 64];
+ }
+}
diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java
new file mode 100644
2016-02-29 23:09:49 +00:00
index 0000000..7d27317
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BlockChest.java
2016-02-29 23:09:49 +00:00
@@ -0,0 +1,452 @@
+package net.minecraft.server;
+
+import java.util.Iterator;
+
2016-02-29 23:09:49 +00:00
+public class BlockChest extends BlockTileEntity {
+
2016-02-29 23:09:49 +00:00
+ public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
+ protected static final AxisAlignedBB b = new AxisAlignedBB(0.0625D, 0.0D, 0.0D, 0.9375D, 0.875D, 0.9375D);
+ protected static final AxisAlignedBB c = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.875D, 1.0D);
+ protected static final AxisAlignedBB d = new AxisAlignedBB(0.0D, 0.0D, 0.0625D, 0.9375D, 0.875D, 0.9375D);
+ protected static final AxisAlignedBB e = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 1.0D, 0.875D, 0.9375D);
+ protected static final AxisAlignedBB f = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.875D, 0.9375D);
+ public final Type g;
+
2016-02-29 23:09:49 +00:00
+ protected BlockChest(Type blockchest_type) {
+ super(Material.WOOD);
2016-02-29 23:09:49 +00:00
+ this.w(this.blockStateList.getBlockData().set(BlockChest.FACING, EnumDirection.NORTH));
+ this.g = blockchest_type;
+ this.a(blockchest_type == Type.TRAP ? CreativeModeTab.d : CreativeModeTab.c);
+ }
+
2016-02-29 23:09:49 +00:00
+ public boolean b(IBlockData iblockdata) {
+ return false;
+ }
+
2016-02-29 23:09:49 +00:00
+ public boolean c(IBlockData iblockdata) {
+ return false;
+ }
+
2016-02-29 23:09:49 +00:00
+ public EnumRenderType a(IBlockData iblockdata) {
+ return EnumRenderType.ENTITYBLOCK_ANIMATED;
+ }
+
2016-02-29 23:09:49 +00:00
+ public AxisAlignedBB a(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition) {
+ return iblockaccess.getType(blockposition.north()).getBlock() == this ? BlockChest.b : (iblockaccess.getType(blockposition.south()).getBlock() == this ? BlockChest.c : (iblockaccess.getType(blockposition.west()).getBlock() == this ? BlockChest.d : (iblockaccess.getType(blockposition.east()).getBlock() == this ? BlockChest.e : BlockChest.f)));
+ }
+
+ public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) {
+ this.e(world, blockposition, iblockdata);
+ Iterator iterator = EnumDirection.EnumDirectionLimit.HORIZONTAL.iterator();
+
+ while (iterator.hasNext()) {
+ EnumDirection enumdirection = (EnumDirection) iterator.next();
+ BlockPosition blockposition1 = blockposition.shift(enumdirection);
+ IBlockData iblockdata1 = world.getType(blockposition1);
+
+ if (iblockdata1.getBlock() == this) {
+ this.e(world, blockposition1, iblockdata1);
+ }
+ }
+
+ }
+
+ public IBlockData getPlacedState(World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2, int i, EntityLiving entityliving) {
+ return this.getBlockData().set(BlockChest.FACING, entityliving.getDirection());
+ }
+
+ public void postPlace(World world, BlockPosition blockposition, IBlockData iblockdata, EntityLiving entityliving, ItemStack itemstack) {
+ EnumDirection enumdirection = EnumDirection.fromType2(MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3).opposite();
+
+ iblockdata = iblockdata.set(BlockChest.FACING, enumdirection);
+ BlockPosition blockposition1 = blockposition.north();
+ BlockPosition blockposition2 = blockposition.south();
+ BlockPosition blockposition3 = blockposition.west();
+ BlockPosition blockposition4 = blockposition.east();
+ boolean flag = this == world.getType(blockposition1).getBlock();
+ boolean flag1 = this == world.getType(blockposition2).getBlock();
+ boolean flag2 = this == world.getType(blockposition3).getBlock();
+ boolean flag3 = this == world.getType(blockposition4).getBlock();
+
+ if (!flag && !flag1 && !flag2 && !flag3) {
+ world.setTypeAndData(blockposition, iblockdata, 3);
+ } else if (enumdirection.k() == EnumDirection.EnumAxis.X && (flag || flag1)) {
+ if (flag) {
+ world.setTypeAndData(blockposition1, iblockdata, 3);
+ } else {
+ world.setTypeAndData(blockposition2, iblockdata, 3);
+ }
+
+ world.setTypeAndData(blockposition, iblockdata, 3);
+ } else if (enumdirection.k() == EnumDirection.EnumAxis.Z && (flag2 || flag3)) {
+ if (flag2) {
+ world.setTypeAndData(blockposition3, iblockdata, 3);
+ } else {
+ world.setTypeAndData(blockposition4, iblockdata, 3);
+ }
+
+ world.setTypeAndData(blockposition, iblockdata, 3);
+ }
+
+ if (itemstack.hasName()) {
+ TileEntity tileentity = world.getTileEntity(blockposition);
+
+ if (tileentity instanceof TileEntityChest) {
+ ((TileEntityChest) tileentity).a(itemstack.getName());
+ }
+ }
+
+ }
+
+ public IBlockData e(World world, BlockPosition blockposition, IBlockData iblockdata) {
+ if (world.isClientSide) {
+ return iblockdata;
+ } else {
+ IBlockData iblockdata1 = world.getType(blockposition.north());
+ IBlockData iblockdata2 = world.getType(blockposition.south());
+ IBlockData iblockdata3 = world.getType(blockposition.west());
+ IBlockData iblockdata4 = world.getType(blockposition.east());
+ EnumDirection enumdirection = (EnumDirection) iblockdata.get(BlockChest.FACING);
+
2016-02-29 23:09:49 +00:00
+ if (iblockdata1.getBlock() != this && iblockdata2.getBlock() != this) {
+ boolean flag = iblockdata1.b();
+ boolean flag1 = iblockdata2.b();
+
2016-02-29 23:09:49 +00:00
+ if (iblockdata3.getBlock() == this || iblockdata4.getBlock() == this) {
+ BlockPosition blockposition1 = iblockdata3.getBlock() == this ? blockposition.west() : blockposition.east();
+ IBlockData iblockdata5 = world.getType(blockposition1.north());
+ IBlockData iblockdata6 = world.getType(blockposition1.south());
+
+ enumdirection = EnumDirection.SOUTH;
+ EnumDirection enumdirection1;
+
2016-02-29 23:09:49 +00:00
+ if (iblockdata3.getBlock() == this) {
+ enumdirection1 = (EnumDirection) iblockdata3.get(BlockChest.FACING);
+ } else {
+ enumdirection1 = (EnumDirection) iblockdata4.get(BlockChest.FACING);
+ }
+
+ if (enumdirection1 == EnumDirection.NORTH) {
+ enumdirection = EnumDirection.NORTH;
+ }
+
2016-02-29 23:09:49 +00:00
+ if ((flag || iblockdata5.b()) && !flag1 && !iblockdata6.b()) {
+ enumdirection = EnumDirection.SOUTH;
+ }
+
2016-02-29 23:09:49 +00:00
+ if ((flag1 || iblockdata6.b()) && !flag && !iblockdata5.b()) {
+ enumdirection = EnumDirection.NORTH;
+ }
+ }
+ } else {
2016-02-29 23:09:49 +00:00
+ BlockPosition blockposition2 = iblockdata1.getBlock() == this ? blockposition.north() : blockposition.south();
+ IBlockData iblockdata7 = world.getType(blockposition2.west());
+ IBlockData iblockdata8 = world.getType(blockposition2.east());
+
+ enumdirection = EnumDirection.EAST;
+ EnumDirection enumdirection2;
+
2016-02-29 23:09:49 +00:00
+ if (iblockdata1.getBlock() == this) {
+ enumdirection2 = (EnumDirection) iblockdata1.get(BlockChest.FACING);
+ } else {
+ enumdirection2 = (EnumDirection) iblockdata2.get(BlockChest.FACING);
+ }
+
+ if (enumdirection2 == EnumDirection.WEST) {
+ enumdirection = EnumDirection.WEST;
+ }
+
2016-02-29 23:09:49 +00:00
+ if ((iblockdata3.b() || iblockdata7.b()) && !iblockdata4.b() && !iblockdata8.b()) {
+ enumdirection = EnumDirection.EAST;
+ }
+
2016-02-29 23:09:49 +00:00
+ if ((iblockdata4.b() || iblockdata8.b()) && !iblockdata3.b() && !iblockdata7.b()) {
+ enumdirection = EnumDirection.WEST;
+ }
+ }
+
+ iblockdata = iblockdata.set(BlockChest.FACING, enumdirection);
+ world.setTypeAndData(blockposition, iblockdata, 3);
+ return iblockdata;
+ }
+ }
+
+ public IBlockData f(World world, BlockPosition blockposition, IBlockData iblockdata) {
+ EnumDirection enumdirection = null;
+ Iterator iterator = EnumDirection.EnumDirectionLimit.HORIZONTAL.iterator();
+
+ while (iterator.hasNext()) {
+ EnumDirection enumdirection1 = (EnumDirection) iterator.next();
+ IBlockData iblockdata1 = world.getType(blockposition.shift(enumdirection1));
+
+ if (iblockdata1.getBlock() == this) {
+ return iblockdata;
+ }
+
2016-02-29 23:09:49 +00:00
+ if (iblockdata1.b()) {
+ if (enumdirection != null) {
+ enumdirection = null;
+ break;
+ }
+
+ enumdirection = enumdirection1;
+ }
+ }
+
+ if (enumdirection != null) {
+ return iblockdata.set(BlockChest.FACING, enumdirection.opposite());
+ } else {
+ EnumDirection enumdirection2 = (EnumDirection) iblockdata.get(BlockChest.FACING);
+
2016-02-29 23:09:49 +00:00
+ if (world.getType(blockposition.shift(enumdirection2)).b()) {
+ enumdirection2 = enumdirection2.opposite();
+ }
+
2016-02-29 23:09:49 +00:00
+ if (world.getType(blockposition.shift(enumdirection2)).b()) {
+ enumdirection2 = enumdirection2.e();
+ }
+
2016-02-29 23:09:49 +00:00
+ if (world.getType(blockposition.shift(enumdirection2)).b()) {
+ enumdirection2 = enumdirection2.opposite();
+ }
+
+ return iblockdata.set(BlockChest.FACING, enumdirection2);
+ }
+ }
+
+ public boolean canPlace(World world, BlockPosition blockposition) {
+ int i = 0;
+ BlockPosition blockposition1 = blockposition.west();
+ BlockPosition blockposition2 = blockposition.east();
+ BlockPosition blockposition3 = blockposition.north();
+ BlockPosition blockposition4 = blockposition.south();
+
+ if (world.getType(blockposition1).getBlock() == this) {
2016-02-29 23:09:49 +00:00
+ if (this.d(world, blockposition1)) {
+ return false;
+ }
+
+ ++i;
+ }
+
+ if (world.getType(blockposition2).getBlock() == this) {
2016-02-29 23:09:49 +00:00
+ if (this.d(world, blockposition2)) {
+ return false;
+ }
+
+ ++i;
+ }
+
+ if (world.getType(blockposition3).getBlock() == this) {
2016-02-29 23:09:49 +00:00
+ if (this.d(world, blockposition3)) {
+ return false;
+ }
+
+ ++i;
+ }
+
+ if (world.getType(blockposition4).getBlock() == this) {
2016-02-29 23:09:49 +00:00
+ if (this.d(world, blockposition4)) {
+ return false;
+ }
+
+ ++i;
+ }
+
+ return i <= 1;
+ }
+
2016-02-29 23:09:49 +00:00
+ private boolean d(World world, BlockPosition blockposition) {
+ if (world.getType(blockposition).getBlock() != this) {
+ return false;
+ } else {
+ Iterator iterator = EnumDirection.EnumDirectionLimit.HORIZONTAL.iterator();
+
+ EnumDirection enumdirection;
+
+ do {
+ if (!iterator.hasNext()) {
+ return false;
+ }
+
+ enumdirection = (EnumDirection) iterator.next();
+ } while (world.getType(blockposition.shift(enumdirection)).getBlock() != this);
+
+ return true;
+ }
+ }
+
+ public void doPhysics(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) {
+ super.doPhysics(world, blockposition, iblockdata, block);
+ TileEntity tileentity = world.getTileEntity(blockposition);
+
+ if (tileentity instanceof TileEntityChest) {
2016-02-29 23:09:49 +00:00
+ tileentity.invalidateBlockCache();
+ }
+
+ }
+
+ public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) {
+ TileEntity tileentity = world.getTileEntity(blockposition);
+
+ if (tileentity instanceof IInventory) {
+ InventoryUtils.dropInventory(world, blockposition, (IInventory) tileentity);
+ world.updateAdjacentComparators(blockposition, this);
+ }
+
+ super.remove(world, blockposition, iblockdata);
+ }
+
2016-02-29 23:09:49 +00:00
+ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack, EnumDirection enumdirection, float f, float f1, float f2) {
+ if (world.isClientSide) {
+ return true;
+ } else {
2016-02-29 23:09:49 +00:00
+ ITileInventory itileinventory = this.c(world, blockposition);
+
+ if (itileinventory != null) {
+ entityhuman.openContainer(itileinventory);
2016-02-29 23:09:49 +00:00
+ if (this.g == Type.BASIC) {
+ entityhuman.b(StatisticList.ac);
+ } else if (this.g == Type.TRAP) {
+ entityhuman.b(StatisticList.W);
+ }
+ }
+
+ return true;
+ }
+ }
+
2016-02-29 23:09:49 +00:00
+ public ITileInventory c(World world, BlockPosition blockposition) {
+ TileEntity tileentity = world.getTileEntity(blockposition);
+
+ if (!(tileentity instanceof TileEntityChest)) {
+ return null;
+ } else {
+ Object object = (TileEntityChest) tileentity;
+
2016-02-29 23:09:49 +00:00
+ if (this.e(world, blockposition)) {
+ return null;
+ } else {
+ Iterator iterator = EnumDirection.EnumDirectionLimit.HORIZONTAL.iterator();
+
+ while (iterator.hasNext()) {
+ EnumDirection enumdirection = (EnumDirection) iterator.next();
+ BlockPosition blockposition1 = blockposition.shift(enumdirection);
+ Block block = world.getType(blockposition1).getBlock();
+
+ if (block == this) {
2016-02-29 23:09:49 +00:00
+ if (this.e(world, blockposition1)) {
+ return null;
+ }
+
+ TileEntity tileentity1 = world.getTileEntity(blockposition1);
+
+ if (tileentity1 instanceof TileEntityChest) {
+ if (enumdirection != EnumDirection.WEST && enumdirection != EnumDirection.NORTH) {
+ object = new InventoryLargeChest("container.chestDouble", (ITileInventory) object, (TileEntityChest) tileentity1);
+ } else {
+ object = new InventoryLargeChest("container.chestDouble", (TileEntityChest) tileentity1, (ITileInventory) object);
+ }
+ }
+ }
+ }
+
+ return (ITileInventory) object;
+ }
+ }
+ }
+
+ public TileEntity a(World world, int i) {
+ return new TileEntityChest();
+ }
+
2016-02-29 23:09:49 +00:00
+ public boolean isPowerSource(IBlockData iblockdata) {
+ return this.g == Type.TRAP;
+ }
+
2016-02-29 23:09:49 +00:00
+ public int b(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition, EnumDirection enumdirection) {
+ if (!iblockdata.m()) {
+ return 0;
+ } else {
+ int i = 0;
+ TileEntity tileentity = iblockaccess.getTileEntity(blockposition);
+
+ if (tileentity instanceof TileEntityChest) {
+ i = ((TileEntityChest) tileentity).l;
+ }
+
+ return MathHelper.clamp(i, 0, 15);
+ }
+ }
+
2016-02-29 23:09:49 +00:00
+ public int c(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition, EnumDirection enumdirection) {
+ return enumdirection == EnumDirection.UP ? iblockdata.a(iblockaccess, blockposition, enumdirection) : 0;
+ }
+
2016-02-29 23:09:49 +00:00
+ private boolean e(World world, BlockPosition blockposition) {
+ return this.i(world, blockposition) || this.j(world, blockposition);
+ }
+
2016-02-29 23:09:49 +00:00
+ private boolean i(World world, BlockPosition blockposition) {
+ return world.getType(blockposition.up()).l();
+ }
+
2016-02-29 23:09:49 +00:00
+ private boolean j(World world, BlockPosition blockposition) {
+ Iterator iterator = world.a(EntityOcelot.class, new AxisAlignedBB((double) blockposition.getX(), (double) (blockposition.getY() + 1), (double) blockposition.getZ(), (double) (blockposition.getX() + 1), (double) (blockposition.getY() + 2), (double) (blockposition.getZ() + 1))).iterator();
+
+ EntityOcelot entityocelot;
+
+ do {
+ if (!iterator.hasNext()) {
+ return false;
+ }
+
+ Entity entity = (Entity) iterator.next();
+
+ entityocelot = (EntityOcelot) entity;
+ } while (!entityocelot.isSitting());
+
+ return true;
+ }
+
2016-02-29 23:09:49 +00:00
+ public boolean isComplexRedstone(IBlockData iblockdata) {
+ return true;
+ }
+
2016-02-29 23:09:49 +00:00
+ public int d(IBlockData iblockdata, World world, BlockPosition blockposition) {
+ return Container.b((IInventory) this.c(world, blockposition));
+ }
+
+ public IBlockData fromLegacyData(int i) {
+ EnumDirection enumdirection = EnumDirection.fromType1(i);
+
+ if (enumdirection.k() == EnumDirection.EnumAxis.Y) {
+ enumdirection = EnumDirection.NORTH;
+ }
+
+ return this.getBlockData().set(BlockChest.FACING, enumdirection);
+ }
+
+ public int toLegacyData(IBlockData iblockdata) {
+ return ((EnumDirection) iblockdata.get(BlockChest.FACING)).a();
+ }
+
2016-02-29 23:09:49 +00:00
+ public IBlockData a(IBlockData iblockdata, EnumBlockRotation enumblockrotation) {
+ return iblockdata.set(BlockChest.FACING, enumblockrotation.a((EnumDirection) iblockdata.get(BlockChest.FACING)));
+ }
+
+ public IBlockData a(IBlockData iblockdata, EnumBlockMirror enumblockmirror) {
+ return iblockdata.a(enumblockmirror.a((EnumDirection) iblockdata.get(BlockChest.FACING)));
+ }
+
+ protected BlockStateList getStateList() {
+ return new BlockStateList(this, new IBlockState[] { BlockChest.FACING});
+ }
2016-02-29 23:09:49 +00:00
+
+ public static enum Type {
+
+ BASIC, TRAP;
+
+ private Type() {}
+ }
+}
2015-04-17 09:51:46 +00:00
diff --git a/src/main/java/net/minecraft/server/BlockFalling.java b/src/main/java/net/minecraft/server/BlockFalling.java
new file mode 100644
2016-02-29 23:09:49 +00:00
index 0000000..6654240
2015-04-17 09:51:46 +00:00
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BlockFalling.java
@@ -0,0 +1,75 @@
+package net.minecraft.server;
+
+import java.util.Random;
+
+public class BlockFalling extends Block {
+
+ public static boolean instaFall;
+
+ public BlockFalling() {
+ super(Material.SAND);
+ this.a(CreativeModeTab.b);
+ }
+
+ public BlockFalling(Material material) {
+ super(material);
+ }
+
+ public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) {
+ world.a(blockposition, (Block) this, this.a(world));
+ }
+
+ public void doPhysics(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) {
+ world.a(blockposition, (Block) this, this.a(world));
+ }
+
+ public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
+ if (!world.isClientSide) {
2016-02-29 23:09:49 +00:00
+ this.b(world, blockposition);
2015-04-17 09:51:46 +00:00
+ }
+
+ }
+
2016-02-29 23:09:49 +00:00
+ private void b(World world, BlockPosition blockposition) {
+ if (i(world.getType(blockposition.down())) && blockposition.getY() >= 0) {
2015-04-17 09:51:46 +00:00
+ byte b0 = 32;
+
+ if (!BlockFalling.instaFall && world.areChunksLoadedBetween(blockposition.a(-b0, -b0, -b0), blockposition.a(b0, b0, b0))) {
+ if (!world.isClientSide) {
+ EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, world.getType(blockposition));
+
+ this.a(entityfallingblock);
+ world.addEntity(entityfallingblock);
+ }
+ } else {
+ world.setAir(blockposition);
+
+ BlockPosition blockposition1;
+
2016-02-29 23:09:49 +00:00
+ for (blockposition1 = blockposition.down(); i(world.getType(blockposition1)) && blockposition1.getY() > 0; blockposition1 = blockposition1.down()) {
2015-04-17 09:51:46 +00:00
+ ;
+ }
+
+ if (blockposition1.getY() > 0) {
+ world.setTypeUpdate(blockposition1.up(), this.getBlockData());
+ }
+ }
+
+ }
+ }
+
+ protected void a(EntityFallingBlock entityfallingblock) {}
+
+ public int a(World world) {
+ return 2;
+ }
+
2016-02-29 23:09:49 +00:00
+ public static boolean i(IBlockData iblockdata) {
+ Block block = iblockdata.getBlock();
+ Material material = iblockdata.getMaterial();
2015-04-17 09:51:46 +00:00
+
+ return block == Blocks.FIRE || material == Material.AIR || material == Material.WATER || material == Material.LAVA;
+ }
+
+ public void a_(World world, BlockPosition blockposition) {}
+}
diff --git a/src/main/java/net/minecraft/server/BlockFluids.java b/src/main/java/net/minecraft/server/BlockFluids.java
new file mode 100644
2016-02-29 23:09:49 +00:00
index 0000000..675cdc0
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BlockFluids.java
2016-02-29 23:09:49 +00:00
@@ -0,0 +1,224 @@
+package net.minecraft.server;
+
+import java.util.Iterator;
+import java.util.Random;
+
+public abstract class BlockFluids extends Block {
+
+ public static final BlockStateInteger LEVEL = BlockStateInteger.of("level", 0, 15);
+
+ protected BlockFluids(Material material) {
+ super(material);
2016-02-29 23:09:49 +00:00
+ this.w(this.blockStateList.getBlockData().set(BlockFluids.LEVEL, Integer.valueOf(0)));
+ this.a(true);
+ }
+
2016-02-29 23:09:49 +00:00
+ public AxisAlignedBB a(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition) {
+ return BlockFluids.j;
+ }
+
+ public AxisAlignedBB a(IBlockData iblockdata, World world, BlockPosition blockposition) {
+ return BlockFluids.k;
+ }
+
+ public boolean b(IBlockAccess iblockaccess, BlockPosition blockposition) {
+ return this.material != Material.LAVA;
+ }
+
2016-02-29 23:09:49 +00:00
+ public static float e(int i) {
+ if (i >= 8) {
+ i = 0;
+ }
+
+ return (float) (i + 1) / 9.0F;
+ }
+
2016-02-29 23:09:49 +00:00
+ protected int c(IBlockAccess iblockaccess, BlockPosition blockposition) {
+ return iblockaccess.getType(blockposition).getMaterial() == this.material ? ((Integer) iblockaccess.getType(blockposition).get(BlockFluids.LEVEL)).intValue() : -1;
+ }
+
2016-02-29 23:09:49 +00:00
+ protected int d(IBlockAccess iblockaccess, BlockPosition blockposition) {
+ int i = this.c(iblockaccess, blockposition);
+
+ return i >= 8 ? 0 : i;
+ }
+
2016-02-29 23:09:49 +00:00
+ public boolean c(IBlockData iblockdata) {
+ return false;
+ }
+
2016-02-29 23:09:49 +00:00
+ public boolean b(IBlockData iblockdata) {
+ return false;
+ }
+
+ public boolean a(IBlockData iblockdata, boolean flag) {
+ return flag && ((Integer) iblockdata.get(BlockFluids.LEVEL)).intValue() == 0;
+ }
+
2016-02-29 23:09:49 +00:00
+ public boolean a(IBlockAccess iblockaccess, BlockPosition blockposition, EnumDirection enumdirection) {
+ Material material = iblockaccess.getType(blockposition).getMaterial();
+
2016-02-29 23:09:49 +00:00
+ return material == this.material ? false : (enumdirection == EnumDirection.UP ? true : (material == Material.ICE ? false : super.a(iblockaccess, blockposition, enumdirection)));
+ }
+
2016-02-29 23:09:49 +00:00
+ public EnumRenderType a(IBlockData iblockdata) {
+ return EnumRenderType.LIQUID;
+ }
+
+ public Item getDropType(IBlockData iblockdata, Random random, int i) {
+ return null;
+ }
+
+ public int a(Random random) {
+ return 0;
+ }
+
2016-02-29 23:09:49 +00:00
+ protected Vec3D f(IBlockAccess iblockaccess, BlockPosition blockposition) {
+ double d0 = 0.0D;
+ double d1 = 0.0D;
+ double d2 = 0.0D;
+ int i = this.d(iblockaccess, blockposition);
+ BlockPosition.PooledBlockPosition blockposition_pooledblockposition = BlockPosition.PooledBlockPosition.s();
+ Iterator iterator = EnumDirection.EnumDirectionLimit.HORIZONTAL.iterator();
+
+ while (iterator.hasNext()) {
2016-02-29 23:09:49 +00:00
+ EnumDirection enumdirection = (EnumDirection) iterator.next();
+
+ blockposition_pooledblockposition.h(blockposition).c(enumdirection);
+ int j = this.d(iblockaccess, blockposition_pooledblockposition);
+ int k;
+
+ if (j < 0) {
2016-02-29 23:09:49 +00:00
+ if (!iblockaccess.getType(blockposition_pooledblockposition).getMaterial().isSolid()) {
+ j = this.d(iblockaccess, blockposition_pooledblockposition.down());
+ if (j >= 0) {
+ k = j - (i - 8);
2016-02-29 23:09:49 +00:00
+ d0 += (double) (enumdirection.getAdjacentX() * k);
+ d1 += (double) (enumdirection.getAdjacentY() * k);
+ d2 += (double) (enumdirection.getAdjacentZ() * k);
+ }
+ }
+ } else if (j >= 0) {
+ k = j - i;
2016-02-29 23:09:49 +00:00
+ d0 += (double) (enumdirection.getAdjacentX() * k);
+ d1 += (double) (enumdirection.getAdjacentY() * k);
+ d2 += (double) (enumdirection.getAdjacentZ() * k);
+ }
+ }
+
2016-02-29 23:09:49 +00:00
+ Vec3D vec3d = new Vec3D(d0, d1, d2);
+
+ if (((Integer) iblockaccess.getType(blockposition).get(BlockFluids.LEVEL)).intValue() >= 8) {
2016-02-29 23:09:49 +00:00
+ Iterator iterator1 = EnumDirection.EnumDirectionLimit.HORIZONTAL.iterator();
+
2016-02-29 23:09:49 +00:00
+ while (iterator1.hasNext()) {
+ EnumDirection enumdirection1 = (EnumDirection) iterator1.next();
+
+ blockposition_pooledblockposition.h(blockposition).c(enumdirection1);
+ if (this.a(iblockaccess, (BlockPosition) blockposition_pooledblockposition, enumdirection1) || this.a(iblockaccess, blockposition_pooledblockposition.up(), enumdirection1)) {
+ vec3d = vec3d.a().add(0.0D, -6.0D, 0.0D);
+ break;
+ }
+ }
+ }
+
2016-02-29 23:09:49 +00:00
+ blockposition_pooledblockposition.t();
+ return vec3d.a();
+ }
+
+ public Vec3D a(World world, BlockPosition blockposition, Entity entity, Vec3D vec3d) {
2016-02-29 23:09:49 +00:00
+ return vec3d.e(this.f(world, blockposition));
+ }
+
+ public int a(World world) {
2016-02-29 23:09:49 +00:00
+ return this.material == Material.WATER ? 5 : (this.material == Material.LAVA ? (world.worldProvider.m() ? 10 : 30) : 0);
+ }
+
+ public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) {
+ this.e(world, blockposition, iblockdata);
+ }
+
+ public void doPhysics(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) {
+ this.e(world, blockposition, iblockdata);
+ }
+
+ public boolean e(World world, BlockPosition blockposition, IBlockData iblockdata) {
+ if (this.material == Material.LAVA) {
+ boolean flag = false;
+ EnumDirection[] aenumdirection = EnumDirection.values();
+ int i = aenumdirection.length;
+
+ for (int j = 0; j < i; ++j) {
+ EnumDirection enumdirection = aenumdirection[j];
+
2016-02-29 23:09:49 +00:00
+ if (enumdirection != EnumDirection.DOWN && world.getType(blockposition.shift(enumdirection)).getMaterial() == Material.WATER) {
+ flag = true;
+ break;
+ }
+ }
+
+ if (flag) {
+ Integer integer = (Integer) iblockdata.get(BlockFluids.LEVEL);
+
+ if (integer.intValue() == 0) {
+ world.setTypeUpdate(blockposition, Blocks.OBSIDIAN.getBlockData());
+ this.fizz(world, blockposition);
+ return true;
+ }
+
+ if (integer.intValue() <= 4) {
+ world.setTypeUpdate(blockposition, Blocks.COBBLESTONE.getBlockData());
+ this.fizz(world, blockposition);
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ protected void fizz(World world, BlockPosition blockposition) {
+ double d0 = (double) blockposition.getX();
+ double d1 = (double) blockposition.getY();
+ double d2 = (double) blockposition.getZ();
+
2016-02-29 23:09:49 +00:00
+ world.a((EntityHuman) null, blockposition, SoundEffects.db, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
+
+ for (int i = 0; i < 8; ++i) {
+ world.addParticle(EnumParticle.SMOKE_LARGE, d0 + Math.random(), d1 + 1.2D, d2 + Math.random(), 0.0D, 0.0D, 0.0D, new int[0]);
+ }
+
+ }
+
+ public IBlockData fromLegacyData(int i) {
+ return this.getBlockData().set(BlockFluids.LEVEL, Integer.valueOf(i));
+ }
+
+ public int toLegacyData(IBlockData iblockdata) {
+ return ((Integer) iblockdata.get(BlockFluids.LEVEL)).intValue();
+ }
+
+ protected BlockStateList getStateList() {
+ return new BlockStateList(this, new IBlockState[] { BlockFluids.LEVEL});
+ }
+
+ public static BlockFlowing a(Material material) {
+ if (material == Material.WATER) {
+ return Blocks.FLOWING_WATER;
+ } else if (material == Material.LAVA) {
+ return Blocks.FLOWING_LAVA;
+ } else {
+ throw new IllegalArgumentException("Invalid material");
+ }
+ }
+
+ public static BlockStationary b(Material material) {
+ if (material == Material.WATER) {
+ return Blocks.WATER;
+ } else if (material == Material.LAVA) {
+ return Blocks.LAVA;
+ } else {
+ throw new IllegalArgumentException("Invalid material");
+ }
+ }
+}
2016-02-29 23:09:49 +00:00
diff --git a/src/main/java/net/minecraft/server/ChunkProviderFlat.java b/src/main/java/net/minecraft/server/ChunkProviderFlat.java
2016-01-29 09:26:31 +00:00
new file mode 100644
2016-02-29 23:09:49 +00:00
index 0000000..17e0b8e
2016-01-29 09:26:31 +00:00
--- /dev/null
2016-02-29 23:09:49 +00:00
+++ b/src/main/java/net/minecraft/server/ChunkProviderFlat.java
@@ -0,0 +1,214 @@
2016-01-29 09:26:31 +00:00
+package net.minecraft.server;
+
2016-02-29 23:09:49 +00:00
+import com.google.common.collect.Lists;
2016-01-29 09:26:31 +00:00
+import java.util.Iterator;
2016-02-29 23:09:49 +00:00
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
2016-01-29 09:26:31 +00:00
+
2016-02-29 23:09:49 +00:00
+public class ChunkProviderFlat implements ChunkGenerator {
2016-01-29 09:26:31 +00:00
+
2016-02-29 23:09:49 +00:00
+ private final World a;
+ private final Random b;
+ private final IBlockData[] c = new IBlockData[256];
+ private final WorldGenFlatInfo d;
+ private final List<StructureGenerator> e = Lists.newArrayList();
+ private final boolean f;
+ private final boolean g;
+ private WorldGenLakes h;
+ private WorldGenLakes i;
2016-01-29 09:26:31 +00:00
+
2016-02-29 23:09:49 +00:00
+ public ChunkProviderFlat(World world, long i, boolean flag, String s) {
+ this.a = world;
+ this.b = new Random(i);
+ this.d = WorldGenFlatInfo.a(s);
+ if (flag) {
+ Map map = this.d.b();
2016-01-29 09:26:31 +00:00
+
2016-02-29 23:09:49 +00:00
+ if (map.containsKey("village")) {
+ Map map1 = (Map) map.get("village");
2016-01-29 09:26:31 +00:00
+
2016-02-29 23:09:49 +00:00
+ if (!map1.containsKey("size")) {
+ map1.put("size", "1");
+ }
2016-01-29 09:26:31 +00:00
+
2016-02-29 23:09:49 +00:00
+ this.e.add(new WorldGenVillage(map1));
+ }
2016-01-29 09:26:31 +00:00
+
2016-02-29 23:09:49 +00:00
+ if (map.containsKey("biome_1")) {
+ this.e.add(new WorldGenLargeFeature((Map) map.get("biome_1")));
+ }
2016-01-29 09:26:31 +00:00
+
2016-02-29 23:09:49 +00:00
+ if (map.containsKey("mineshaft")) {
+ this.e.add(new WorldGenMineshaft((Map) map.get("mineshaft")));
+ }
2016-01-29 09:26:31 +00:00
+
2016-02-29 23:09:49 +00:00
+ if (map.containsKey("stronghold")) {
+ this.e.add(new WorldGenStronghold((Map) map.get("stronghold")));
+ }
2016-01-29 09:26:31 +00:00
+
2016-02-29 23:09:49 +00:00
+ if (map.containsKey("oceanmonument")) {
+ this.e.add(new WorldGenMonument((Map) map.get("oceanmonument")));
+ }
+ }
2016-01-29 09:26:31 +00:00
+
2016-02-29 23:09:49 +00:00
+ if (this.d.b().containsKey("lake")) {
+ this.h = new WorldGenLakes(Blocks.WATER);
+ }
2016-01-29 09:26:31 +00:00
+
2016-02-29 23:09:49 +00:00
+ if (this.d.b().containsKey("lava_lake")) {
+ this.i = new WorldGenLakes(Blocks.LAVA);
+ }
2016-01-29 09:26:31 +00:00
+
2016-02-29 23:09:49 +00:00
+ this.g = this.d.b().containsKey("dungeon");
+ int j = 0;
+ int k = 0;
+ boolean flag1 = true;
+ Iterator iterator = this.d.c().iterator();
2016-01-29 09:26:31 +00:00
+
2016-02-29 23:09:49 +00:00
+ while (iterator.hasNext()) {
+ WorldGenFlatLayerInfo worldgenflatlayerinfo = (WorldGenFlatLayerInfo) iterator.next();
2016-01-29 09:26:31 +00:00
+
2016-02-29 23:09:49 +00:00
+ for (int l = worldgenflatlayerinfo.d(); l < worldgenflatlayerinfo.d() + worldgenflatlayerinfo.b(); ++l) {
+ IBlockData iblockdata = worldgenflatlayerinfo.c();
2016-01-29 09:26:31 +00:00
+
2016-02-29 23:09:49 +00:00
+ if (iblockdata.getBlock() != Blocks.AIR) {
+ flag1 = false;
+ this.c[l] = iblockdata;
+ }
+ }
+
+ if (worldgenflatlayerinfo.c().getBlock() == Blocks.AIR) {
+ k += worldgenflatlayerinfo.b();
+ } else {
+ j += worldgenflatlayerinfo.b() + k;
+ k = 0;
+ }
+ }
+
+ world.b(j);
2016-02-29 23:09:49 +00:00
+ this.f = flag1 && this.d.a() != BiomeBase.a(Biomes.P) ? false : this.d.b().containsKey("decoration");
+ }
+
+ public Chunk getOrCreateChunk(int i, int j) {
+ ChunkSnapshot chunksnapshot = new ChunkSnapshot();
+
+ int k;
+
+ for (int l = 0; l < this.c.length; ++l) {
+ IBlockData iblockdata = this.c[l];
+
+ if (iblockdata != null) {
+ for (int i1 = 0; i1 < 16; ++i1) {
+ for (k = 0; k < 16; ++k) {
+ chunksnapshot.a(i1, l, k, iblockdata);
+ }
+ }
+ }
+ }
+
+ Iterator iterator = this.e.iterator();
+
+ while (iterator.hasNext()) {
+ WorldGenBase worldgenbase = (WorldGenBase) iterator.next();
+
2016-02-29 23:09:49 +00:00
+ worldgenbase.a(this.a, i, j, chunksnapshot);
+ }
+
+ Chunk chunk = new Chunk(this.a, chunksnapshot, i, j);
+ BiomeBase[] abiomebase = this.a.getWorldChunkManager().getBiomeBlock((BiomeBase[]) null, i * 16, j * 16, 16, 16);
+ byte[] abyte = chunk.getBiomeIndex();
+
+ for (k = 0; k < abyte.length; ++k) {
2016-02-29 23:09:49 +00:00
+ abyte[k] = (byte) BiomeBase.a(abiomebase[k]);
+ }
+
+ chunk.initLighting();
+ return chunk;
+ }
+
2016-02-29 23:09:49 +00:00
+ public void recreateStructures(int i, int j) {
+ int k = i * 16;
+ int l = j * 16;
+ BlockPosition blockposition = new BlockPosition(k, 0, l);
+ BiomeBase biomebase = this.a.getBiome(new BlockPosition(k + 16, 0, l + 16));
+ boolean flag = false;
+
+ this.b.setSeed(this.a.getSeed());
+ long i1 = this.b.nextLong() / 2L * 2L + 1L;
+ long j1 = this.b.nextLong() / 2L * 2L + 1L;
+
+ this.b.setSeed((long) i * i1 + (long) j * j1 ^ this.a.getSeed());
+ ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
+ Iterator iterator = this.e.iterator();
+
+ while (iterator.hasNext()) {
+ StructureGenerator structuregenerator = (StructureGenerator) iterator.next();
+ boolean flag1 = structuregenerator.a(this.a, this.b, chunkcoordintpair);
+
+ if (structuregenerator instanceof WorldGenVillage) {
+ flag |= flag1;
+ }
+ }
+
+ if (this.h != null && !flag && this.b.nextInt(4) == 0) {
+ this.h.generate(this.a, this.b, blockposition.a(this.b.nextInt(16) + 8, this.b.nextInt(256), this.b.nextInt(16) + 8));
+ }
+
+ if (this.i != null && !flag && this.b.nextInt(8) == 0) {
+ BlockPosition blockposition1 = blockposition.a(this.b.nextInt(16) + 8, this.b.nextInt(this.b.nextInt(248) + 8), this.b.nextInt(16) + 8);
+
2016-02-29 23:09:49 +00:00
+ if (blockposition1.getY() < this.a.K() || this.b.nextInt(10) == 0) {
+ this.i.generate(this.a, this.b, blockposition1);
+ }
+ }
+
+ if (this.g) {
+ for (int k1 = 0; k1 < 8; ++k1) {
+ (new WorldGenDungeons()).generate(this.a, this.b, blockposition.a(this.b.nextInt(16) + 8, this.b.nextInt(256), this.b.nextInt(16) + 8));
+ }
+ }
+
+ if (this.f) {
+ biomebase.a(this.a, this.b, blockposition);
+ }
+
+ }
+
2016-02-29 23:09:49 +00:00
+ public boolean a(Chunk chunk, int i, int j) {
+ return false;
+ }
+
+ public List<BiomeBase.BiomeMeta> getMobsFor(EnumCreatureType enumcreaturetype, BlockPosition blockposition) {
+ BiomeBase biomebase = this.a.getBiome(blockposition);
+
+ return biomebase.getMobs(enumcreaturetype);
+ }
+
+ public BlockPosition findNearestMapFeature(World world, String s, BlockPosition blockposition) {
+ if ("Stronghold".equals(s)) {
+ Iterator iterator = this.e.iterator();
+
+ while (iterator.hasNext()) {
+ StructureGenerator structuregenerator = (StructureGenerator) iterator.next();
+
+ if (structuregenerator instanceof WorldGenStronghold) {
+ return structuregenerator.getNearestGeneratedFeature(world, blockposition);
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public void recreateStructures(Chunk chunk, int i, int j) {
+ Iterator iterator = this.e.iterator();
+
+ while (iterator.hasNext()) {
+ StructureGenerator structuregenerator = (StructureGenerator) iterator.next();
+
2016-02-29 23:09:49 +00:00
+ structuregenerator.a(this.a, i, j, (ChunkSnapshot) null);
+ }
+
+ }
+}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderGenerate.java b/src/main/java/net/minecraft/server/ChunkProviderGenerate.java
new file mode 100644
2016-02-29 23:09:49 +00:00
index 0000000..88d0374
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ChunkProviderGenerate.java
2016-02-29 23:09:49 +00:00
@@ -0,0 +1,449 @@
+package net.minecraft.server;
+
+import java.util.List;
+import java.util.Random;
+
2016-02-29 23:09:49 +00:00
+public class ChunkProviderGenerate implements ChunkGenerator {
+
2016-02-29 23:09:49 +00:00
+ protected static final IBlockData a = Blocks.STONE.getBlockData();
+ private final Random i;
+ private final NoiseGeneratorOctaves j;
+ private final NoiseGeneratorOctaves k;
+ private final NoiseGeneratorOctaves l;
+ private final NoiseGenerator3 m;
+ public NoiseGeneratorOctaves b;
+ public NoiseGeneratorOctaves c;
2016-02-29 23:09:49 +00:00
+ public NoiseGeneratorOctaves d;
+ private final World n;
+ private final boolean o;
+ private final WorldType p;
+ private final double[] q;
+ private final float[] r;
+ private CustomWorldSettingsFinal s;
+ private IBlockData t;
+ private double[] u;
+ private final WorldGenBase v;
+ private final WorldGenStronghold w;
+ private final WorldGenVillage x;
+ private final WorldGenMineshaft y;
+ private final WorldGenLargeFeature z;
+ private final WorldGenBase A;
+ private final WorldGenMonument B;
+ private BiomeBase[] C;
+ double[] e;
+ double[] f;
+ double[] g;
2016-02-29 23:09:49 +00:00
+ double[] h;
+
+ public ChunkProviderGenerate(World world, long i, boolean flag, String s) {
2016-02-29 23:09:49 +00:00
+ this.t = Blocks.WATER.getBlockData();
+ this.u = new double[256];
+ this.v = new WorldGenCaves();
+ this.w = new WorldGenStronghold();
+ this.x = new WorldGenVillage();
+ this.y = new WorldGenMineshaft();
+ this.z = new WorldGenLargeFeature();
+ this.A = new WorldGenCanyon();
+ this.B = new WorldGenMonument();
+ this.n = world;
+ this.o = flag;
+ this.p = world.getWorldData().getType();
+ this.i = new Random(i);
+ this.j = new NoiseGeneratorOctaves(this.i, 16);
+ this.k = new NoiseGeneratorOctaves(this.i, 16);
+ this.l = new NoiseGeneratorOctaves(this.i, 8);
+ this.m = new NoiseGenerator3(this.i, 4);
+ this.b = new NoiseGeneratorOctaves(this.i, 10);
+ this.c = new NoiseGeneratorOctaves(this.i, 16);
+ this.d = new NoiseGeneratorOctaves(this.i, 8);
+ this.q = new double[825];
+ this.r = new float[25];
+
+ for (int j = -2; j <= 2; ++j) {
+ for (int k = -2; k <= 2; ++k) {
+ float f = 10.0F / MathHelper.c((float) (j * j + k * k) + 0.2F);
+
2016-02-29 23:09:49 +00:00
+ this.r[j + 2 + (k + 2) * 5] = f;
+ }
+ }
+
+ if (s != null) {
2016-02-29 23:09:49 +00:00
+ this.s = CustomWorldSettingsFinal.CustomWorldSettings.a(s).b();
+ this.t = this.s.E ? Blocks.LAVA.getBlockData() : Blocks.WATER.getBlockData();
+ world.b(this.s.q);
+ }
+
+ }
+
+ public void a(int i, int j, ChunkSnapshot chunksnapshot) {
2016-02-29 23:09:49 +00:00
+ this.C = this.n.getWorldChunkManager().getBiomes(this.C, i * 4 - 2, j * 4 - 2, 10, 10);
+ this.a(i * 4, 0, j * 4);
+
+ for (int k = 0; k < 4; ++k) {
+ int l = k * 5;
+ int i1 = (k + 1) * 5;
+
+ for (int j1 = 0; j1 < 4; ++j1) {
+ int k1 = (l + j1) * 33;
+ int l1 = (l + j1 + 1) * 33;
+ int i2 = (i1 + j1) * 33;
+ int j2 = (i1 + j1 + 1) * 33;
+
+ for (int k2 = 0; k2 < 32; ++k2) {
+ double d0 = 0.125D;
2016-02-29 23:09:49 +00:00
+ double d1 = this.q[k1 + k2];
+ double d2 = this.q[l1 + k2];
+ double d3 = this.q[i2 + k2];
+ double d4 = this.q[j2 + k2];
+ double d5 = (this.q[k1 + k2 + 1] - d1) * d0;
+ double d6 = (this.q[l1 + k2 + 1] - d2) * d0;
+ double d7 = (this.q[i2 + k2 + 1] - d3) * d0;
+ double d8 = (this.q[j2 + k2 + 1] - d4) * d0;
+
+ for (int l2 = 0; l2 < 8; ++l2) {
+ double d9 = 0.25D;
+ double d10 = d1;
+ double d11 = d2;
+ double d12 = (d3 - d1) * d9;
+ double d13 = (d4 - d2) * d9;
+
+ for (int i3 = 0; i3 < 4; ++i3) {
+ double d14 = 0.25D;
+ double d15 = (d11 - d10) * d14;
+ double d16 = d10 - d15;
+
+ for (int j3 = 0; j3 < 4; ++j3) {
+ if ((d16 += d15) > 0.0D) {
2016-02-29 23:09:49 +00:00
+ chunksnapshot.a(k * 4 + i3, k2 * 8 + l2, j1 * 4 + j3, ChunkProviderGenerate.a);
+ } else if (k2 * 8 + l2 < this.s.q) {
+ chunksnapshot.a(k * 4 + i3, k2 * 8 + l2, j1 * 4 + j3, this.t);
+ }
+ }
+
+ d10 += d12;
+ d11 += d13;
+ }
+
+ d1 += d5;
+ d2 += d6;
+ d3 += d7;
+ d4 += d8;
+ }
+ }
+ }
+ }
+
+ }
+
+ public void a(int i, int j, ChunkSnapshot chunksnapshot, BiomeBase[] abiomebase) {
+ double d0 = 0.03125D;
+
2016-02-29 23:09:49 +00:00
+ this.u = this.m.a(this.u, (double) (i * 16), (double) (j * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);
+
+ for (int k = 0; k < 16; ++k) {
+ for (int l = 0; l < 16; ++l) {
+ BiomeBase biomebase = abiomebase[l + k * 16];
+
2016-02-29 23:09:49 +00:00
+ biomebase.a(this.n, this.i, chunksnapshot, i * 16 + k, j * 16 + l, this.u[l + k * 16]);
+ }
+ }
+
+ }
+
+ public Chunk getOrCreateChunk(int i, int j) {
2016-02-29 23:09:49 +00:00
+ this.i.setSeed((long) i * 341873128712L + (long) j * 132897987541L);
+ ChunkSnapshot chunksnapshot = new ChunkSnapshot();
+
+ this.a(i, j, chunksnapshot);
2016-02-29 23:09:49 +00:00
+ this.C = this.n.getWorldChunkManager().getBiomeBlock(this.C, i * 16, j * 16, 16, 16);
+ this.a(i, j, chunksnapshot, this.C);
+ if (this.s.r) {
+ this.v.a(this.n, i, j, chunksnapshot);
+ }
+
2016-02-29 23:09:49 +00:00
+ if (this.s.z) {
+ this.A.a(this.n, i, j, chunksnapshot);
+ }
+
2016-02-29 23:09:49 +00:00
+ if (this.o) {
+ if (this.s.w) {
+ this.y.a(this.n, i, j, chunksnapshot);
+ }
+
2016-02-29 23:09:49 +00:00
+ if (this.s.v) {
+ this.x.a(this.n, i, j, chunksnapshot);
+ }
+
2016-02-29 23:09:49 +00:00
+ if (this.s.u) {
+ this.w.a(this.n, i, j, chunksnapshot);
+ }
+
2016-02-29 23:09:49 +00:00
+ if (this.s.x) {
+ this.z.a(this.n, i, j, chunksnapshot);
+ }
+
2016-02-29 23:09:49 +00:00
+ if (this.s.y) {
+ this.B.a(this.n, i, j, chunksnapshot);
+ }
+ }
+
2016-02-29 23:09:49 +00:00
+ Chunk chunk = new Chunk(this.n, chunksnapshot, i, j);
+ byte[] abyte = chunk.getBiomeIndex();
+
+ for (int k = 0; k < abyte.length; ++k) {
2016-02-29 23:09:49 +00:00
+ abyte[k] = (byte) BiomeBase.a(this.C[k]);
+ }
+
+ chunk.initLighting();
+ return chunk;
+ }
+
+ private void a(int i, int j, int k) {
2016-02-29 23:09:49 +00:00
+ this.h = this.c.a(this.h, i, k, 5, 5, (double) this.s.e, (double) this.s.f, (double) this.s.g);
+ float f = this.s.a;
+ float f1 = this.s.b;
+
2016-02-29 23:09:49 +00:00
+ this.e = this.l.a(this.e, i, j, k, 5, 33, 5, (double) (f / this.s.h), (double) (f1 / this.s.i), (double) (f / this.s.j));
+ this.f = this.j.a(this.f, i, j, k, 5, 33, 5, (double) f, (double) f1, (double) f);
2016-02-29 23:09:49 +00:00
+ this.g = this.k.a(this.g, i, j, k, 5, 33, 5, (double) f, (double) f1, (double) f);
+ boolean flag = false;
+ boolean flag1 = false;
+ int l = 0;
+ int i1 = 0;
+
+ for (int j1 = 0; j1 < 5; ++j1) {
+ for (int k1 = 0; k1 < 5; ++k1) {
+ float f2 = 0.0F;
+ float f3 = 0.0F;
+ float f4 = 0.0F;
+ byte b0 = 2;
2016-02-29 23:09:49 +00:00
+ BiomeBase biomebase = this.C[j1 + 2 + (k1 + 2) * 10];
+
+ for (int l1 = -b0; l1 <= b0; ++l1) {
+ for (int i2 = -b0; i2 <= b0; ++i2) {
2016-02-29 23:09:49 +00:00
+ BiomeBase biomebase1 = this.C[j1 + l1 + 2 + (k1 + i2 + 2) * 10];
+ float f5 = this.s.n + biomebase1.j() * this.s.m;
+ float f6 = this.s.p + biomebase1.m() * this.s.o;
+
2016-02-29 23:09:49 +00:00
+ if (this.p == WorldType.AMPLIFIED && f5 > 0.0F) {
+ f5 = 1.0F + f5 * 2.0F;
+ f6 = 1.0F + f6 * 4.0F;
+ }
+
2016-02-29 23:09:49 +00:00
+ float f7 = this.r[l1 + 2 + (i2 + 2) * 5] / (f5 + 2.0F);
+
2016-02-29 23:09:49 +00:00
+ if (biomebase1.j() > biomebase.j()) {
+ f7 /= 2.0F;
+ }
+
+ f2 += f6 * f7;
+ f3 += f5 * f7;
+ f4 += f7;
+ }
+ }
+
+ f2 /= f4;
+ f3 /= f4;
+ f2 = f2 * 0.9F + 0.1F;
+ f3 = (f3 * 4.0F - 1.0F) / 8.0F;
2016-02-29 23:09:49 +00:00
+ double d0 = this.h[i1] / 8000.0D;
+
+ if (d0 < 0.0D) {
+ d0 = -d0 * 0.3D;
+ }
+
+ d0 = d0 * 3.0D - 2.0D;
+ if (d0 < 0.0D) {
+ d0 /= 2.0D;
+ if (d0 < -1.0D) {
+ d0 = -1.0D;
+ }
+
+ d0 /= 1.4D;
+ d0 /= 2.0D;
+ } else {
+ if (d0 > 1.0D) {
+ d0 = 1.0D;
+ }
+
+ d0 /= 8.0D;
+ }
+
+ ++i1;
+ double d1 = (double) f3;
+ double d2 = (double) f2;
+
+ d1 += d0 * 0.2D;
2016-02-29 23:09:49 +00:00
+ d1 = d1 * (double) this.s.k / 8.0D;
+ double d3 = (double) this.s.k + d1 * 4.0D;
+
+ for (int j2 = 0; j2 < 33; ++j2) {
2016-02-29 23:09:49 +00:00
+ double d4 = ((double) j2 - d3) * (double) this.s.l * 128.0D / 256.0D / d2;
+
+ if (d4 < 0.0D) {
+ d4 *= 4.0D;
+ }
+
2016-02-29 23:09:49 +00:00
+ double d5 = this.f[l] / (double) this.s.d;
+ double d6 = this.g[l] / (double) this.s.c;
+ double d7 = (this.e[l] / 10.0D + 1.0D) / 2.0D;
+ double d8 = MathHelper.b(d5, d6, d7) - d4;
+
+ if (j2 > 29) {
+ double d9 = (double) ((float) (j2 - 29) / 3.0F);
+
+ d8 = d8 * (1.0D - d9) + -10.0D * d9;
+ }
+
2016-02-29 23:09:49 +00:00
+ this.q[l] = d8;
+ ++l;
+ }
+ }
+ }
+
+ }
+
2016-02-29 23:09:49 +00:00
+ public void recreateStructures(int i, int j) {
+ BlockFalling.instaFall = true;
+ int k = i * 16;
+ int l = j * 16;
+ BlockPosition blockposition = new BlockPosition(k, 0, l);
2016-02-29 23:09:49 +00:00
+ BiomeBase biomebase = this.n.getBiome(blockposition.a(16, 0, 16));
+
2016-02-29 23:09:49 +00:00
+ this.i.setSeed(this.n.getSeed());
+ long i1 = this.i.nextLong() / 2L * 2L + 1L;
+ long j1 = this.i.nextLong() / 2L * 2L + 1L;
+
2016-02-29 23:09:49 +00:00
+ this.i.setSeed((long) i * i1 + (long) j * j1 ^ this.n.getSeed());
+ boolean flag = false;
+ ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
+
2016-02-29 23:09:49 +00:00
+ if (this.o) {
+ if (this.s.w) {
+ this.y.a(this.n, this.i, chunkcoordintpair);
+ }
+
2016-02-29 23:09:49 +00:00
+ if (this.s.v) {
+ flag = this.x.a(this.n, this.i, chunkcoordintpair);
+ }
+
2016-02-29 23:09:49 +00:00
+ if (this.s.u) {
+ this.w.a(this.n, this.i, chunkcoordintpair);
+ }
+
2016-02-29 23:09:49 +00:00
+ if (this.s.x) {
+ this.z.a(this.n, this.i, chunkcoordintpair);
+ }
+
2016-02-29 23:09:49 +00:00
+ if (this.s.y) {
+ this.B.a(this.n, this.i, chunkcoordintpair);
+ }
+ }
+
+ int k1;
+ int l1;
+ int i2;
+
2016-02-29 23:09:49 +00:00
+ if (biomebase != Biomes.d && biomebase != Biomes.s && this.s.A && !flag && this.i.nextInt(this.s.B) == 0) {
+ k1 = this.i.nextInt(16) + 8;
+ l1 = this.i.nextInt(256);
+ i2 = this.i.nextInt(16) + 8;
+ (new WorldGenLakes(Blocks.WATER)).generate(this.n, this.i, blockposition.a(k1, l1, i2));
+ }
+
2016-02-29 23:09:49 +00:00
+ if (!flag && this.i.nextInt(this.s.D / 10) == 0 && this.s.C) {
+ k1 = this.i.nextInt(16) + 8;
+ l1 = this.i.nextInt(this.i.nextInt(248) + 8);
+ i2 = this.i.nextInt(16) + 8;
+ if (l1 < this.n.K() || this.i.nextInt(this.s.D / 8) == 0) {
+ (new WorldGenLakes(Blocks.LAVA)).generate(this.n, this.i, blockposition.a(k1, l1, i2));
+ }
+ }
+
2016-02-29 23:09:49 +00:00
+ if (this.s.s) {
+ for (k1 = 0; k1 < this.s.t; ++k1) {
+ l1 = this.i.nextInt(16) + 8;
+ i2 = this.i.nextInt(256);
+ int j2 = this.i.nextInt(16) + 8;
+
2016-02-29 23:09:49 +00:00
+ (new WorldGenDungeons()).generate(this.n, this.i, blockposition.a(l1, i2, j2));
+ }
+ }
+
2016-02-29 23:09:49 +00:00
+ biomebase.a(this.n, this.i, new BlockPosition(k, 0, l));
+ SpawnerCreature.a(this.n, biomebase, k + 8, l + 8, 16, 16, this.i);
+ blockposition = blockposition.a(8, 0, 8);
+
+ for (k1 = 0; k1 < 16; ++k1) {
+ for (l1 = 0; l1 < 16; ++l1) {
2016-02-29 23:09:49 +00:00
+ BlockPosition blockposition1 = this.n.p(blockposition.a(k1, 0, l1));
+ BlockPosition blockposition2 = blockposition1.down();
+
2016-02-29 23:09:49 +00:00
+ if (this.n.u(blockposition2)) {
+ this.n.setTypeAndData(blockposition2, Blocks.ICE.getBlockData(), 2);
+ }
+
2016-02-29 23:09:49 +00:00
+ if (this.n.f(blockposition1, true)) {
+ this.n.setTypeAndData(blockposition1, Blocks.SNOW_LAYER.getBlockData(), 2);
+ }
+ }
+ }
+
+ BlockFalling.instaFall = false;
+ }
+
2016-02-29 23:09:49 +00:00
+ public boolean a(Chunk chunk, int i, int j) {
+ boolean flag = false;
+
2016-02-29 23:09:49 +00:00
+ if (this.s.y && this.o && chunk.x() < 3600L) {
+ flag |= this.B.a(this.n, this.i, new ChunkCoordIntPair(i, j));
+ }
+
+ return flag;
+ }
+
+ public List<BiomeBase.BiomeMeta> getMobsFor(EnumCreatureType enumcreaturetype, BlockPosition blockposition) {
2016-02-29 23:09:49 +00:00
+ BiomeBase biomebase = this.n.getBiome(blockposition);
+
2016-02-29 23:09:49 +00:00
+ if (this.o) {
+ if (enumcreaturetype == EnumCreatureType.MONSTER && this.z.a(blockposition)) {
+ return this.z.b();
+ }
+
2016-02-29 23:09:49 +00:00
+ if (enumcreaturetype == EnumCreatureType.MONSTER && this.s.y && this.B.b(this.n, blockposition)) {
+ return this.B.b();
+ }
+ }
+
+ return biomebase.getMobs(enumcreaturetype);
+ }
+
+ public BlockPosition findNearestMapFeature(World world, String s, BlockPosition blockposition) {
2016-02-29 23:09:49 +00:00
+ return "Stronghold".equals(s) && this.w != null ? this.w.getNearestGeneratedFeature(world, blockposition) : null;
+ }
+
+ public void recreateStructures(Chunk chunk, int i, int j) {
2016-02-29 23:09:49 +00:00
+ if (this.o) {
+ if (this.s.w) {
+ this.y.a(this.n, i, j, (ChunkSnapshot) null);
+ }
+
2016-02-29 23:09:49 +00:00
+ if (this.s.v) {
+ this.x.a(this.n, i, j, (ChunkSnapshot) null);
+ }
+
2016-02-29 23:09:49 +00:00
+ if (this.s.u) {
+ this.w.a(this.n, i, j, (ChunkSnapshot) null);
+ }
+
2016-02-29 23:09:49 +00:00
+ if (this.s.x) {
+ this.z.a(this.n, i, j, (ChunkSnapshot) null);
+ }
+
2016-02-29 23:09:49 +00:00
+ if (this.s.y) {
+ this.B.a(this.n, i, j, (ChunkSnapshot) null);
+ }
+ }
+
+ }
+}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderHell.java b/src/main/java/net/minecraft/server/ChunkProviderHell.java
new file mode 100644
2016-02-29 23:09:49 +00:00
index 0000000..0150efd
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ChunkProviderHell.java
2016-02-29 23:09:49 +00:00
@@ -0,0 +1,369 @@
+package net.minecraft.server;
+
+import java.util.List;
+import java.util.Random;
+
2016-02-29 23:09:49 +00:00
+public class ChunkProviderHell implements ChunkGenerator {
+
+ protected static final IBlockData a = Blocks.AIR.getBlockData();
+ protected static final IBlockData b = Blocks.NETHERRACK.getBlockData();
+ protected static final IBlockData c = Blocks.BEDROCK.getBlockData();
+ protected static final IBlockData d = Blocks.LAVA.getBlockData();
+ protected static final IBlockData e = Blocks.GRAVEL.getBlockData();
+ protected static final IBlockData f = Blocks.SOUL_SAND.getBlockData();
+ private final World n;
+ private final boolean o;
+ private final Random p;
+ private double[] q = new double[256];
+ private double[] r = new double[256];
+ private double[] s = new double[256];
+ private double[] t;
+ private final NoiseGeneratorOctaves u;
+ private final NoiseGeneratorOctaves v;
+ private final NoiseGeneratorOctaves w;
+ private final NoiseGeneratorOctaves x;
+ private final NoiseGeneratorOctaves y;
+ public final NoiseGeneratorOctaves g;
+ public final NoiseGeneratorOctaves h;
+ private final WorldGenFire z = new WorldGenFire();
+ private final WorldGenLightStone1 A = new WorldGenLightStone1();
+ private final WorldGenLightStone2 B = new WorldGenLightStone2();
+ private final WorldGenerator C;
+ private final WorldGenHellLava D;
+ private final WorldGenHellLava E;
+ private final WorldGenMushrooms F;
+ private final WorldGenMushrooms G;
+ private final WorldGenNether H;
+ private final WorldGenBase I;
+ double[] i;
+ double[] j;
+ double[] k;
+ double[] l;
+ double[] m;
+
+ public ChunkProviderHell(World world, boolean flag, long i) {
2016-02-29 23:09:49 +00:00
+ this.C = new WorldGenMinable(Blocks.QUARTZ_ORE.getBlockData(), 14, BlockPredicate.a(Blocks.NETHERRACK));
+ this.D = new WorldGenHellLava(Blocks.FLOWING_LAVA, true);
+ this.E = new WorldGenHellLava(Blocks.FLOWING_LAVA, false);
+ this.F = new WorldGenMushrooms(Blocks.BROWN_MUSHROOM);
+ this.G = new WorldGenMushrooms(Blocks.RED_MUSHROOM);
+ this.H = new WorldGenNether();
+ this.I = new WorldGenCavesHell();
+ this.n = world;
+ this.o = flag;
+ this.p = new Random(i);
+ this.u = new NoiseGeneratorOctaves(this.p, 16);
+ this.v = new NoiseGeneratorOctaves(this.p, 16);
+ this.w = new NoiseGeneratorOctaves(this.p, 8);
+ this.x = new NoiseGeneratorOctaves(this.p, 4);
+ this.y = new NoiseGeneratorOctaves(this.p, 4);
+ this.g = new NoiseGeneratorOctaves(this.p, 10);
+ this.h = new NoiseGeneratorOctaves(this.p, 16);
+ world.b(63);
+ }
+
+ public void a(int i, int j, ChunkSnapshot chunksnapshot) {
+ byte b0 = 4;
2016-02-29 23:09:49 +00:00
+ int k = this.n.K() / 2 + 1;
+ int l = b0 + 1;
+ byte b1 = 17;
+ int i1 = b0 + 1;
+
2016-02-29 23:09:49 +00:00
+ this.t = this.a(this.t, i * b0, 0, j * b0, l, b1, i1);
+
+ for (int j1 = 0; j1 < b0; ++j1) {
+ for (int k1 = 0; k1 < b0; ++k1) {
+ for (int l1 = 0; l1 < 16; ++l1) {
+ double d0 = 0.125D;
2016-02-29 23:09:49 +00:00
+ double d1 = this.t[((j1 + 0) * i1 + k1 + 0) * b1 + l1 + 0];
+ double d2 = this.t[((j1 + 0) * i1 + k1 + 1) * b1 + l1 + 0];
+ double d3 = this.t[((j1 + 1) * i1 + k1 + 0) * b1 + l1 + 0];
+ double d4 = this.t[((j1 + 1) * i1 + k1 + 1) * b1 + l1 + 0];
+ double d5 = (this.t[((j1 + 0) * i1 + k1 + 0) * b1 + l1 + 1] - d1) * d0;
+ double d6 = (this.t[((j1 + 0) * i1 + k1 + 1) * b1 + l1 + 1] - d2) * d0;
+ double d7 = (this.t[((j1 + 1) * i1 + k1 + 0) * b1 + l1 + 1] - d3) * d0;
+ double d8 = (this.t[((j1 + 1) * i1 + k1 + 1) * b1 + l1 + 1] - d4) * d0;
+
+ for (int i2 = 0; i2 < 8; ++i2) {
+ double d9 = 0.25D;
+ double d10 = d1;
+ double d11 = d2;
+ double d12 = (d3 - d1) * d9;
+ double d13 = (d4 - d2) * d9;
+
+ for (int j2 = 0; j2 < 4; ++j2) {
+ double d14 = 0.25D;
+ double d15 = d10;
+ double d16 = (d11 - d10) * d14;
+
+ for (int k2 = 0; k2 < 4; ++k2) {
+ IBlockData iblockdata = null;
+
+ if (l1 * 8 + i2 < k) {
2016-02-29 23:09:49 +00:00
+ iblockdata = ChunkProviderHell.d;
+ }
+
+ if (d15 > 0.0D) {
2016-02-29 23:09:49 +00:00
+ iblockdata = ChunkProviderHell.b;
+ }
+
+ int l2 = j2 + j1 * 4;
+ int i3 = i2 + l1 * 8;
+ int j3 = k2 + k1 * 4;
+
+ chunksnapshot.a(l2, i3, j3, iblockdata);
+ d15 += d16;
+ }
+
+ d10 += d12;
+ d11 += d13;
+ }
+
+ d1 += d5;
+ d2 += d6;
+ d3 += d7;
+ d4 += d8;
+ }
+ }
+ }
+ }
+
+ }
+
+ public void b(int i, int j, ChunkSnapshot chunksnapshot) {
2016-02-29 23:09:49 +00:00
+ int k = this.n.K() + 1;
+ double d0 = 0.03125D;
+
2016-02-29 23:09:49 +00:00
+ this.q = this.x.a(this.q, i * 16, j * 16, 0, 16, 16, 1, d0, d0, 1.0D);
+ this.r = this.x.a(this.r, i * 16, 109, j * 16, 16, 1, 16, d0, 1.0D, d0);
+ this.s = this.y.a(this.s, i * 16, j * 16, 0, 16, 16, 1, d0 * 2.0D, d0 * 2.0D, d0 * 2.0D);
+
+ for (int l = 0; l < 16; ++l) {
+ for (int i1 = 0; i1 < 16; ++i1) {
2016-02-29 23:09:49 +00:00
+ boolean flag = this.q[l + i1 * 16] + this.p.nextDouble() * 0.2D > 0.0D;
+ boolean flag1 = this.r[l + i1 * 16] + this.p.nextDouble() * 0.2D > 0.0D;
+ int j1 = (int) (this.s[l + i1 * 16] / 3.0D + 3.0D + this.p.nextDouble() * 0.25D);
+ int k1 = -1;
2016-02-29 23:09:49 +00:00
+ IBlockData iblockdata = ChunkProviderHell.b;
+ IBlockData iblockdata1 = ChunkProviderHell.b;
+
+ for (int l1 = 127; l1 >= 0; --l1) {
2016-02-29 23:09:49 +00:00
+ if (l1 < 127 - this.p.nextInt(5) && l1 > this.p.nextInt(5)) {
+ IBlockData iblockdata2 = chunksnapshot.a(i1, l1, l);
+
2016-02-29 23:09:49 +00:00
+ if (iblockdata2.getBlock() != null && iblockdata2.getMaterial() != Material.AIR) {
+ if (iblockdata2.getBlock() == Blocks.NETHERRACK) {
+ if (k1 == -1) {
+ if (j1 <= 0) {
2016-02-29 23:09:49 +00:00
+ iblockdata = ChunkProviderHell.a;
+ iblockdata1 = ChunkProviderHell.b;
+ } else if (l1 >= k - 4 && l1 <= k + 1) {
2016-02-29 23:09:49 +00:00
+ iblockdata = ChunkProviderHell.b;
+ iblockdata1 = ChunkProviderHell.b;
+ if (flag1) {
2016-02-29 23:09:49 +00:00
+ iblockdata = ChunkProviderHell.e;
+ iblockdata1 = ChunkProviderHell.b;
+ }
+
+ if (flag) {
2016-02-29 23:09:49 +00:00
+ iblockdata = ChunkProviderHell.f;
+ iblockdata1 = ChunkProviderHell.f;
+ }
+ }
+
2016-02-29 23:09:49 +00:00
+ if (l1 < k && (iblockdata == null || iblockdata.getMaterial() == Material.AIR)) {
+ iblockdata = ChunkProviderHell.d;
+ }
+
+ k1 = j1;
+ if (l1 >= k - 1) {
+ chunksnapshot.a(i1, l1, l, iblockdata);
+ } else {
+ chunksnapshot.a(i1, l1, l, iblockdata1);
+ }
+ } else if (k1 > 0) {
+ --k1;
+ chunksnapshot.a(i1, l1, l, iblockdata1);
+ }
+ }
+ } else {
+ k1 = -1;
+ }
+ } else {
2016-02-29 23:09:49 +00:00
+ chunksnapshot.a(i1, l1, l, ChunkProviderHell.c);
+ }
+ }
+ }
+ }
+
+ }
+
+ public Chunk getOrCreateChunk(int i, int j) {
2016-02-29 23:09:49 +00:00
+ this.p.setSeed((long) i * 341873128712L + (long) j * 132897987541L);
+ ChunkSnapshot chunksnapshot = new ChunkSnapshot();
+
+ this.a(i, j, chunksnapshot);
+ this.b(i, j, chunksnapshot);
2016-02-29 23:09:49 +00:00
+ this.I.a(this.n, i, j, chunksnapshot);
+ if (this.o) {
+ this.H.a(this.n, i, j, chunksnapshot);
+ }
+
2016-02-29 23:09:49 +00:00
+ Chunk chunk = new Chunk(this.n, chunksnapshot, i, j);
+ BiomeBase[] abiomebase = this.n.getWorldChunkManager().getBiomeBlock((BiomeBase[]) null, i * 16, j * 16, 16, 16);
+ byte[] abyte = chunk.getBiomeIndex();
+
+ for (int k = 0; k < abyte.length; ++k) {
2016-02-29 23:09:49 +00:00
+ abyte[k] = (byte) BiomeBase.a(abiomebase[k]);
+ }
+
2016-02-29 23:09:49 +00:00
+ chunk.m();
+ return chunk;
+ }
+
+ private double[] a(double[] adouble, int i, int j, int k, int l, int i1, int j1) {
+ if (adouble == null) {
+ adouble = new double[l * i1 * j1];
+ }
+
+ double d0 = 684.412D;
+ double d1 = 2053.236D;
+
2016-02-29 23:09:49 +00:00
+ this.l = this.g.a(this.l, i, j, k, l, 1, j1, 1.0D, 0.0D, 1.0D);
+ this.m = this.h.a(this.m, i, j, k, l, 1, j1, 100.0D, 0.0D, 100.0D);
+ this.i = this.w.a(this.i, i, j, k, l, i1, j1, d0 / 80.0D, d1 / 60.0D, d0 / 80.0D);
+ this.j = this.u.a(this.j, i, j, k, l, i1, j1, d0, d1, d0);
+ this.k = this.v.a(this.k, i, j, k, l, i1, j1, d0, d1, d0);
+ int k1 = 0;
+ double[] adouble1 = new double[i1];
+
+ int l1;
+
+ for (l1 = 0; l1 < i1; ++l1) {
+ adouble1[l1] = Math.cos((double) l1 * 3.141592653589793D * 6.0D / (double) i1) * 2.0D;
+ double d2 = (double) l1;
+
+ if (l1 > i1 / 2) {
+ d2 = (double) (i1 - 1 - l1);
+ }
+
+ if (d2 < 4.0D) {
+ d2 = 4.0D - d2;
+ adouble1[l1] -= d2 * d2 * d2 * 10.0D;
+ }
+ }
+
+ for (l1 = 0; l1 < l; ++l1) {
+ for (int i2 = 0; i2 < j1; ++i2) {
+ double d3 = 0.0D;
+
+ for (int j2 = 0; j2 < i1; ++j2) {
+ double d4 = 0.0D;
+ double d5 = adouble1[j2];
2016-02-29 23:09:49 +00:00
+ double d6 = this.j[k1] / 512.0D;
+ double d7 = this.k[k1] / 512.0D;
+ double d8 = (this.i[k1] / 10.0D + 1.0D) / 2.0D;
+
+ if (d8 < 0.0D) {
+ d4 = d6;
+ } else if (d8 > 1.0D) {
+ d4 = d7;
+ } else {
+ d4 = d6 + (d7 - d6) * d8;
+ }
+
+ d4 -= d5;
+ double d9;
+
+ if (j2 > i1 - 4) {
+ d9 = (double) ((float) (j2 - (i1 - 4)) / 3.0F);
+ d4 = d4 * (1.0D - d9) + -10.0D * d9;
+ }
+
+ if ((double) j2 < d3) {
+ d9 = (d3 - (double) j2) / 4.0D;
+ d9 = MathHelper.a(d9, 0.0D, 1.0D);
+ d4 = d4 * (1.0D - d9) + -10.0D * d9;
+ }
+
+ adouble[k1] = d4;
+ ++k1;
+ }
+ }
+ }
+
+ return adouble;
+ }
+
2016-02-29 23:09:49 +00:00
+ public void recreateStructures(int i, int j) {
+ BlockFalling.instaFall = true;
+ BlockPosition blockposition = new BlockPosition(i * 16, 0, j * 16);
+ ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
+
2016-02-29 23:09:49 +00:00
+ this.H.a(this.n, this.p, chunkcoordintpair);
+
+ int k;
+
+ for (k = 0; k < 8; ++k) {
2016-02-29 23:09:49 +00:00
+ this.E.generate(this.n, this.p, blockposition.a(this.p.nextInt(16) + 8, this.p.nextInt(120) + 4, this.p.nextInt(16) + 8));
+ }
+
2016-02-29 23:09:49 +00:00
+ for (k = 0; k < this.p.nextInt(this.p.nextInt(10) + 1) + 1; ++k) {
+ this.z.generate(this.n, this.p, blockposition.a(this.p.nextInt(16) + 8, this.p.nextInt(120) + 4, this.p.nextInt(16) + 8));
+ }
+
2016-02-29 23:09:49 +00:00
+ for (k = 0; k < this.p.nextInt(this.p.nextInt(10) + 1); ++k) {
+ this.A.generate(this.n, this.p, blockposition.a(this.p.nextInt(16) + 8, this.p.nextInt(120) + 4, this.p.nextInt(16) + 8));
+ }
+
+ for (k = 0; k < 10; ++k) {
2016-02-29 23:09:49 +00:00
+ this.B.generate(this.n, this.p, blockposition.a(this.p.nextInt(16) + 8, this.p.nextInt(128), this.p.nextInt(16) + 8));
+ }
+
2016-02-29 23:09:49 +00:00
+ if (this.p.nextBoolean()) {
+ this.F.generate(this.n, this.p, blockposition.a(this.p.nextInt(16) + 8, this.p.nextInt(128), this.p.nextInt(16) + 8));
+ }
+
2016-02-29 23:09:49 +00:00
+ if (this.p.nextBoolean()) {
+ this.G.generate(this.n, this.p, blockposition.a(this.p.nextInt(16) + 8, this.p.nextInt(128), this.p.nextInt(16) + 8));
+ }
+
+ for (k = 0; k < 16; ++k) {
2016-02-29 23:09:49 +00:00
+ this.C.generate(this.n, this.p, blockposition.a(this.p.nextInt(16), this.p.nextInt(108) + 10, this.p.nextInt(16)));
+ }
+
+ for (k = 0; k < 16; ++k) {
2016-02-29 23:09:49 +00:00
+ this.D.generate(this.n, this.p, blockposition.a(this.p.nextInt(16), this.p.nextInt(108) + 10, this.p.nextInt(16)));
+ }
+
+ BlockFalling.instaFall = false;
+ }
+
2016-02-29 23:09:49 +00:00
+ public boolean a(Chunk chunk, int i, int j) {
+ return false;
+ }
+
+ public List<BiomeBase.BiomeMeta> getMobsFor(EnumCreatureType enumcreaturetype, BlockPosition blockposition) {
+ if (enumcreaturetype == EnumCreatureType.MONSTER) {
2016-02-29 23:09:49 +00:00
+ if (this.H.b(blockposition)) {
+ return this.H.b();
+ }
+
2016-02-29 23:09:49 +00:00
+ if (this.H.b(this.n, blockposition) && this.n.getType(blockposition.down()).getBlock() == Blocks.NETHER_BRICK) {
+ return this.H.b();
+ }
+ }
+
2016-02-29 23:09:49 +00:00
+ BiomeBase biomebase = this.n.getBiome(blockposition);
+
+ return biomebase.getMobs(enumcreaturetype);
+ }
+
+ public BlockPosition findNearestMapFeature(World world, String s, BlockPosition blockposition) {
+ return null;
+ }
+
+ public void recreateStructures(Chunk chunk, int i, int j) {
2016-02-29 23:09:49 +00:00
+ this.H.a(this.n, i, j, (ChunkSnapshot) null);
+ }
+}
2016-02-29 23:09:49 +00:00
diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java
new file mode 100644
2016-02-29 23:09:49 +00:00
index 0000000..b94444d
--- /dev/null
2016-02-29 23:09:49 +00:00
+++ b/src/main/java/net/minecraft/server/EntitySquid.java
@@ -0,0 +1,182 @@
+package net.minecraft.server;
+
2016-02-29 23:09:49 +00:00
+public class EntitySquid extends EntityWaterAnimal {
+
2016-02-29 23:09:49 +00:00
+ public float a;
+ public float b;
+ public float c;
+ public float bt;
+ public float bu;
+ public float bv;
+ public float bw;
+ public float bx;
+ private float by;
+ private float bz;
+ private float bA;
+ private float bB;
+ private float bC;
+ private float bD;
+
+ public EntitySquid(World world) {
+ super(world);
2016-02-29 23:09:49 +00:00
+ this.setSize(0.8F, 0.8F);
+ this.random.setSeed((long) (1 + this.getId()));
+ this.bz = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
+ }
+
2016-02-29 23:09:49 +00:00
+ protected void r() {
+ this.goalSelector.a(0, new PathfinderGoalSquid(this));
+ }
+
2016-02-29 23:09:49 +00:00
+ protected void initAttributes() {
+ super.initAttributes();
+ this.getAttributeInstance(GenericAttributes.maxHealth).setValue(10.0D);
+ }
+
2016-02-29 23:09:49 +00:00
+ public float getHeadHeight() {
+ return this.length * 0.5F;
+ }
+
2016-02-29 23:09:49 +00:00
+ protected SoundEffect G() {
+ return SoundEffects.fW;
+ }
+
2016-02-29 23:09:49 +00:00
+ protected SoundEffect bR() {
+ return SoundEffects.fY;
+ }
+
2016-02-29 23:09:49 +00:00
+ protected SoundEffect bS() {
+ return SoundEffects.fX;
+ }
+
2016-02-29 23:09:49 +00:00
+ protected float cd() {
+ return 0.4F;
+ }
+
2016-02-29 23:09:49 +00:00
+ protected boolean playStepSound() {
+ return false;
+ }
+
2016-02-29 23:09:49 +00:00
+ protected MinecraftKey J() {
+ return LootTables.af;
+ }
+
2016-02-29 23:09:49 +00:00
+ public boolean isInWater() {
+ return super.isInWater();
+ }
+
2016-02-29 23:09:49 +00:00
+ public void n() {
+ super.n();
+ this.b = this.a;
+ this.bt = this.c;
+ this.bv = this.bu;
+ this.bx = this.bw;
+ this.bu += this.bz;
+ if ((double) this.bu > 6.283185307179586D) {
+ if (this.world.isClientSide) {
+ this.bu = 6.2831855F;
+ } else {
2016-02-29 23:09:49 +00:00
+ this.bu = (float) ((double) this.bu - 6.283185307179586D);
+ if (this.random.nextInt(10) == 0) {
+ this.bz = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
+ }
+
2016-02-29 23:09:49 +00:00
+ this.world.broadcastEntityEffect(this, (byte) 19);
+ }
+ }
+
2016-02-29 23:09:49 +00:00
+ if (this.inWater) {
+ float f;
+
2016-02-29 23:09:49 +00:00
+ if (this.bu < 3.1415927F) {
+ f = this.bu / 3.1415927F;
+ this.bw = MathHelper.sin(f * f * 3.1415927F) * 3.1415927F * 0.25F;
+ if ((double) f > 0.75D) {
+ this.by = 1.0F;
+ this.bA = 1.0F;
+ } else {
+ this.bA *= 0.8F;
+ }
+ } else {
+ this.bw = 0.0F;
+ this.by *= 0.9F;
+ this.bA *= 0.99F;
+ }
+
2016-02-29 23:09:49 +00:00
+ if (!this.world.isClientSide) {
+ this.motX = (double) (this.bB * this.by);
+ this.motY = (double) (this.bC * this.by);
+ this.motZ = (double) (this.bD * this.by);
+ }
+
2016-02-29 23:09:49 +00:00
+ f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
+ this.aM += (-((float) MathHelper.b(this.motX, this.motZ)) * 57.295776F - this.aM) * 0.1F;
+ this.yaw = this.aM;
+ this.c = (float) ((double) this.c + 3.141592653589793D * (double) this.bA * 1.5D);
+ this.a += (-((float) MathHelper.b((double) f, this.motY)) * 57.295776F - this.a) * 0.1F;
+ } else {
2016-02-29 23:09:49 +00:00
+ this.bw = MathHelper.e(MathHelper.sin(this.bu)) * 3.1415927F * 0.25F;
+ if (!this.world.isClientSide) {
+ this.motX = 0.0D;
+ this.motZ = 0.0D;
+ if (this.hasEffect(MobEffects.LEVITATION)) {
+ this.motY += 0.05D * (double) (this.getEffect(MobEffects.LEVITATION).getAmplifier() + 1) - this.motY;
+ } else {
+ this.motY -= 0.08D;
+ }
+
2016-02-29 23:09:49 +00:00
+ this.motY *= 0.9800000190734863D;
+ }
+
2016-02-29 23:09:49 +00:00
+ this.a = (float) ((double) this.a + (double) (-90.0F - this.a) * 0.02D);
+ }
+
+ }
+
2016-02-29 23:09:49 +00:00
+ public void g(float f, float f1) {
+ this.move(this.motX, this.motY, this.motZ);
+ }
+
2016-02-29 23:09:49 +00:00
+ public boolean cF() {
+ return this.locY > 45.0D && this.locY < (double) this.world.K() && super.cF();
+ }
+
2016-02-29 23:09:49 +00:00
+ public void b(float f, float f1, float f2) {
+ this.bB = f;
+ this.bC = f1;
+ this.bD = f2;
+ }
+
2016-02-29 23:09:49 +00:00
+ public boolean o() {
+ return this.bB != 0.0F || this.bC != 0.0F || this.bD != 0.0F;
+ }
+
+ static class PathfinderGoalSquid extends PathfinderGoal {
+
+ private EntitySquid a;
+
+ public PathfinderGoalSquid(EntitySquid entitysquid) {
+ this.a = entitysquid;
+ }
+
2016-02-29 23:09:49 +00:00
+ public boolean a() {
+ return true;
+ }
+
+ public void e() {
+ int i = this.a.bK();
+
2016-02-29 23:09:49 +00:00
+ if (i > 100) {
+ this.a.b(0.0F, 0.0F, 0.0F);
+ } else if (this.a.getRandom().nextInt(50) == 0 || !this.a.inWater || !this.a.o()) {
+ float f = this.a.getRandom().nextFloat() * 6.2831855F;
+ float f1 = MathHelper.cos(f) * 0.2F;
+ float f2 = -0.1F + this.a.getRandom().nextFloat() * 0.2F;
+ float f3 = MathHelper.sin(f) * 0.2F;
+
+ this.a.b(f1, f2, f3);
+ }
+
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
new file mode 100644
2016-02-29 23:09:49 +00:00
index 0000000..300573a
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
2016-02-29 23:09:49 +00:00
@@ -0,0 +1,98 @@
+package net.minecraft.server;
+
+public class ItemBlock extends Item {
+
+ protected final Block a;
+
+ public ItemBlock(Block block) {
+ this.a = block;
+ }
+
+ public ItemBlock b(String s) {
+ super.c(s);
+ return this;
+ }
+
2016-02-29 23:09:49 +00:00
+ public EnumInteractionResult a(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) {
+ IBlockData iblockdata = world.getType(blockposition);
+ Block block = iblockdata.getBlock();
+
2016-02-29 23:09:49 +00:00
+ if (!block.a((IBlockAccess) world, blockposition)) {
+ blockposition = blockposition.shift(enumdirection);
+ }
+
2016-02-29 23:09:49 +00:00
+ if (itemstack.count != 0 && entityhuman.a(blockposition, enumdirection, itemstack) && world.a(this.a, blockposition, false, enumdirection, (Entity) null, itemstack)) {
+ int i = this.filterData(itemstack.getData());
+ IBlockData iblockdata1 = this.a.getPlacedState(world, blockposition, enumdirection, f, f1, f2, i, entityhuman);
+
2016-02-29 23:09:49 +00:00
+ if (world.setTypeAndData(blockposition, iblockdata1, 11)) {
+ iblockdata1 = world.getType(blockposition);
+ if (iblockdata1.getBlock() == this.a) {
2015-05-25 20:59:30 +00:00
+ a(world, entityhuman, blockposition, itemstack);
+ this.a.postPlace(world, blockposition, iblockdata1, entityhuman, itemstack);
+ }
+
2016-02-29 23:09:49 +00:00
+ SoundEffectType soundeffecttype = this.a.w();
+
+ world.a(entityhuman, blockposition, soundeffecttype.e(), SoundCategory.BLOCKS, (soundeffecttype.a() + 1.0F) / 2.0F, soundeffecttype.b() * 0.8F);
+ --itemstack.count;
+ }
+
2016-02-29 23:09:49 +00:00
+ return EnumInteractionResult.SUCCESS;
+ } else {
2016-02-29 23:09:49 +00:00
+ return EnumInteractionResult.FAIL;
+ }
+ }
+
2015-05-25 20:59:30 +00:00
+ public static boolean a(World world, EntityHuman entityhuman, BlockPosition blockposition, ItemStack itemstack) {
2016-02-29 23:09:49 +00:00
+ MinecraftServer minecraftserver = world.getMinecraftServer();
+
2015-05-25 20:59:30 +00:00
+ if (minecraftserver == null) {
+ return false;
+ } else {
+ if (itemstack.hasTag() && itemstack.getTag().hasKeyOfType("BlockEntityTag", 10)) {
+ TileEntity tileentity = world.getTileEntity(blockposition);
+
2015-05-25 20:59:30 +00:00
+ if (tileentity != null) {
2016-02-29 23:09:49 +00:00
+ if (!world.isClientSide && tileentity.isFilteredNBT() && (entityhuman == null || !minecraftserver.getPlayerList().isOp(entityhuman.getProfile()))) {
2015-05-25 20:59:30 +00:00
+ return false;
+ }
+
2015-05-25 20:59:30 +00:00
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+ NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttagcompound.clone();
+
2016-02-29 23:09:49 +00:00
+ tileentity.save(nbttagcompound);
2015-05-25 20:59:30 +00:00
+ NBTTagCompound nbttagcompound2 = (NBTTagCompound) itemstack.getTag().get("BlockEntityTag");
+
+ nbttagcompound.a(nbttagcompound2);
+ nbttagcompound.setInt("x", blockposition.getX());
+ nbttagcompound.setInt("y", blockposition.getY());
+ nbttagcompound.setInt("z", blockposition.getZ());
+ if (!nbttagcompound.equals(nbttagcompound1)) {
+ tileentity.a(nbttagcompound);
+ tileentity.update();
+ return true;
+ }
+ }
+ }
+
2015-05-25 20:59:30 +00:00
+ return false;
+ }
+ }
+
2016-02-29 23:09:49 +00:00
+ public String f_(ItemStack itemstack) {
+ return this.a.a();
+ }
+
+ public String getName() {
+ return this.a.a();
+ }
+
+ public Block d() {
+ return this.a;
+ }
+
+ public Item c(String s) {
+ return this.b(s);
+ }
+}
2016-02-14 01:25:23 +00:00
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
new file mode 100644
2016-02-29 23:09:49 +00:00
index 0000000..2f4265a
2016-02-14 01:25:23 +00:00
--- /dev/null
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
2016-02-29 23:09:49 +00:00
@@ -0,0 +1,275 @@
2016-02-14 01:25:23 +00:00
+package net.minecraft.server;
+
+public abstract class NavigationAbstract {
+
2016-02-29 23:09:49 +00:00
+ private static int f = 20;
+ protected EntityInsentient a;
+ protected World b;
+ protected PathEntity c;
+ protected double d;
+ private final AttributeInstance g;
+ private int h;
+ private int i;
+ private Vec3D j;
+ private Vec3D k;
+ private long l;
+ private long m;
+ private double n;
+ private float o;
+ private boolean p;
+ private long q;
+ protected PathfinderAbstract e;
+ private BlockPosition r;
+ private final Pathfinder s;
2016-02-14 01:25:23 +00:00
+
+ public NavigationAbstract(EntityInsentient entityinsentient, World world) {
2016-02-29 23:09:49 +00:00
+ this.j = Vec3D.a;
+ this.k = Vec3D.a;
+ this.l = 0L;
+ this.m = 0L;
+ this.o = 0.5F;
+ this.a = entityinsentient;
+ this.b = world;
+ this.g = entityinsentient.getAttributeInstance(GenericAttributes.FOLLOW_RANGE);
+ this.s = this.a();
+ this.b.C().a(this);
2016-02-14 01:25:23 +00:00
+ }
+
+ protected abstract Pathfinder a();
+
+ public void a(double d0) {
2016-02-29 23:09:49 +00:00
+ this.d = d0;
+ }
+
+ public float h() {
+ return (float) this.g.getValue();
+ }
+
+ public boolean i() {
+ return this.p;
2016-02-14 01:25:23 +00:00
+ }
+
2016-02-29 23:09:49 +00:00
+ public void j() {
+ if (this.b.getTime() - this.q > (long) NavigationAbstract.f) {
+ if (this.r != null) {
+ this.c = null;
+ this.c = this.a(this.r);
+ this.q = this.b.getTime();
+ this.p = false;
+ }
+ } else {
+ this.p = true;
+ }
+
2016-02-14 01:25:23 +00:00
+ }
+
+ public final PathEntity a(double d0, double d1, double d2) {
+ return this.a(new BlockPosition(MathHelper.floor(d0), (int) d1, MathHelper.floor(d2)));
+ }
+
+ public PathEntity a(BlockPosition blockposition) {
+ if (!this.b()) {
+ return null;
2016-02-29 23:09:49 +00:00
+ } else if (this.c != null && !this.c.b() && blockposition.equals(this.r)) {
+ return this.c;
2016-02-14 01:25:23 +00:00
+ } else {
2016-02-29 23:09:49 +00:00
+ this.r = blockposition;
+ float f = this.h();
2016-02-14 01:25:23 +00:00
+
2016-02-29 23:09:49 +00:00
+ this.b.methodProfiler.a("pathfind");
+ BlockPosition blockposition1 = new BlockPosition(this.a);
2016-02-14 01:25:23 +00:00
+ int i = (int) (f + 8.0F);
2016-02-29 23:09:49 +00:00
+ ChunkCache chunkcache = new ChunkCache(this.b, blockposition1.a(-i, -i, -i), blockposition1.a(i, i, i), 0);
+ PathEntity pathentity = this.s.a(chunkcache, this.a, this.r, f);
2016-02-14 01:25:23 +00:00
+
2016-02-29 23:09:49 +00:00
+ this.b.methodProfiler.b();
2016-02-14 01:25:23 +00:00
+ return pathentity;
+ }
+ }
+
+ public PathEntity a(Entity entity) {
+ if (!this.b()) {
+ return null;
+ } else {
2016-02-29 23:09:49 +00:00
+ BlockPosition blockposition = new BlockPosition(entity);
+
+ if (this.c != null && !this.c.b() && blockposition.equals(this.r)) {
+ return this.c;
+ } else {
+ this.r = blockposition;
+ float f = this.h();
2016-02-14 01:25:23 +00:00
+
2016-02-29 23:09:49 +00:00
+ this.b.methodProfiler.a("pathfind");
+ BlockPosition blockposition1 = (new BlockPosition(this.a)).up();
+ int i = (int) (f + 16.0F);
+ ChunkCache chunkcache = new ChunkCache(this.b, blockposition1.a(-i, -i, -i), blockposition1.a(i, i, i), 0);
+ PathEntity pathentity = this.s.a(chunkcache, this.a, entity, f);
2016-02-14 01:25:23 +00:00
+
2016-02-29 23:09:49 +00:00
+ this.b.methodProfiler.b();
+ return pathentity;
+ }
2016-02-14 01:25:23 +00:00
+ }
+ }
+
2016-02-29 23:09:49 +00:00
+ public boolean a(double d0, double d1, double d2, double d3) {
+ PathEntity pathentity = this.a((double) MathHelper.floor(d0), (double) ((int) d1), (double) MathHelper.floor(d2));
+
+ return this.a(pathentity, d3);
+ }
+
2016-02-14 01:25:23 +00:00
+ public boolean a(Entity entity, double d0) {
+ PathEntity pathentity = this.a(entity);
+
+ return pathentity != null ? this.a(pathentity, d0) : false;
+ }
+
+ public boolean a(PathEntity pathentity, double d0) {
+ if (pathentity == null) {
2016-02-29 23:09:49 +00:00
+ this.c = null;
2016-02-14 01:25:23 +00:00
+ return false;
+ } else {
2016-02-29 23:09:49 +00:00
+ if (!pathentity.a(this.c)) {
+ this.c = pathentity;
2016-02-14 01:25:23 +00:00
+ }
+
+ this.d();
2016-02-29 23:09:49 +00:00
+ if (this.c.d() == 0) {
2016-02-14 01:25:23 +00:00
+ return false;
+ } else {
2016-02-29 23:09:49 +00:00
+ this.d = d0;
2016-02-14 01:25:23 +00:00
+ Vec3D vec3d = this.c();
+
2016-02-29 23:09:49 +00:00
+ this.i = this.h;
+ this.j = vec3d;
2016-02-14 01:25:23 +00:00
+ return true;
+ }
+ }
+ }
+
2016-02-29 23:09:49 +00:00
+ public PathEntity k() {
+ return this.c;
2016-02-14 01:25:23 +00:00
+ }
+
2016-02-29 23:09:49 +00:00
+ public void l() {
+ ++this.h;
+ if (this.p) {
+ this.j();
+ }
+
+ if (!this.n()) {
2016-02-14 01:25:23 +00:00
+ Vec3D vec3d;
+
+ if (this.b()) {
2016-02-29 23:09:49 +00:00
+ this.m();
+ } else if (this.c != null && this.c.e() < this.c.d()) {
2016-02-14 01:25:23 +00:00
+ vec3d = this.c();
2016-02-29 23:09:49 +00:00
+ Vec3D vec3d1 = this.c.a(this.a, this.c.e());
2016-02-14 01:25:23 +00:00
+
2016-02-29 23:09:49 +00:00
+ if (vec3d.y > vec3d1.y && !this.a.onGround && MathHelper.floor(vec3d.x) == MathHelper.floor(vec3d1.x) && MathHelper.floor(vec3d.z) == MathHelper.floor(vec3d1.z)) {
+ this.c.c(this.c.e() + 1);
2016-02-14 01:25:23 +00:00
+ }
+ }
+
2016-02-29 23:09:49 +00:00
+ if (!this.n()) {
+ vec3d = this.c.a((Entity) this.a);
2016-02-14 01:25:23 +00:00
+ if (vec3d != null) {
2016-02-29 23:09:49 +00:00
+ BlockPosition blockposition = (new BlockPosition(vec3d)).down();
+ AxisAlignedBB axisalignedbb = this.b.getType(blockposition).c(this.b, blockposition);
2016-02-14 01:25:23 +00:00
+
2016-02-29 23:09:49 +00:00
+ vec3d = vec3d.a(0.0D, 1.0D - axisalignedbb.e, 0.0D);
+ this.a.getControllerMove().a(vec3d.x, vec3d.y, vec3d.z, this.d);
2016-02-14 01:25:23 +00:00
+ }
+ }
+ }
+ }
+
2016-02-29 23:09:49 +00:00
+ protected void m() {
2016-02-14 01:25:23 +00:00
+ Vec3D vec3d = this.c();
2016-02-29 23:09:49 +00:00
+ int i = this.c.d();
2016-02-14 01:25:23 +00:00
+
2016-02-29 23:09:49 +00:00
+ for (int j = this.c.e(); j < this.c.d(); ++j) {
+ if ((double) this.c.a(j).b != Math.floor(vec3d.y)) {
2016-02-14 01:25:23 +00:00
+ i = j;
+ break;
+ }
+ }
+
2016-02-29 23:09:49 +00:00
+ this.o = this.a.width > 0.75F ? this.a.width / 2.0F : 0.75F - this.a.width / 2.0F;
+ Vec3D vec3d1 = this.c.f();
2016-02-14 01:25:23 +00:00
+
2016-02-29 23:09:49 +00:00
+ if (MathHelper.e((float) (this.a.locX - (vec3d1.x + 0.5D))) < this.o && MathHelper.e((float) (this.a.locZ - (vec3d1.z + 0.5D))) < this.o) {
+ this.c.c(this.c.e() + 1);
2016-02-14 01:25:23 +00:00
+ }
+
2016-02-29 23:09:49 +00:00
+ int k = MathHelper.f(this.a.width);
+ int l = (int) this.a.length + 1;
2016-02-14 01:25:23 +00:00
+ int i1 = k;
+
2016-02-29 23:09:49 +00:00
+ for (int j1 = i - 1; j1 >= this.c.e(); --j1) {
+ if (this.a(vec3d, this.c.a(this.a, j1), k, l, i1)) {
+ this.c.c(j1);
2016-02-14 01:25:23 +00:00
+ break;
+ }
+ }
+
+ this.a(vec3d);
+ }
+
+ protected void a(Vec3D vec3d) {
2016-02-29 23:09:49 +00:00
+ if (this.h - this.i > 100) {
+ if (vec3d.distanceSquared(this.j) < 2.25D) {
+ this.o();
2016-02-14 01:25:23 +00:00
+ }
+
2016-02-29 23:09:49 +00:00
+ this.i = this.h;
+ this.j = vec3d;
2016-02-14 01:25:23 +00:00
+ }
+
2016-02-29 23:09:49 +00:00
+ if (this.c != null && !this.c.b()) {
+ Vec3D vec3d1 = this.c.f();
2016-02-17 01:55:21 +00:00
+
2016-02-29 23:09:49 +00:00
+ if (!vec3d1.equals(this.k)) {
+ this.k = vec3d1;
+ double d0 = vec3d.f(this.k);
2016-02-17 01:55:21 +00:00
+
2016-02-29 23:09:49 +00:00
+ this.n = this.a.ck() > 0.0F ? d0 / (double) this.a.ck() * 1000.0D : 0.0D;
+ } else {
+ this.l += System.currentTimeMillis() - this.m;
+ }
2016-02-17 01:55:21 +00:00
+
2016-02-29 23:09:49 +00:00
+ if (this.n > 0.0D && (double) this.l > this.n * 3.0D) {
+ this.k = Vec3D.a;
+ this.l = 0L;
+ this.n = 0.0D;
+ this.o();
+ }
2016-02-17 01:55:21 +00:00
+
2016-02-29 23:09:49 +00:00
+ this.m = System.currentTimeMillis();
2016-02-17 01:55:21 +00:00
+ }
+
+ }
+
2016-02-29 23:09:49 +00:00
+ public boolean n() {
+ return this.c == null || this.c.b();
2016-02-17 01:55:21 +00:00
+ }
+
2016-02-29 23:09:49 +00:00
+ public void o() {
+ this.c = null;
2016-02-17 01:55:21 +00:00
+ }
+
2016-02-29 23:09:49 +00:00
+ protected abstract Vec3D c();
2016-02-17 01:55:21 +00:00
+
2016-02-29 23:09:49 +00:00
+ protected abstract boolean b();
2016-02-17 01:55:21 +00:00
+
2016-02-29 23:09:49 +00:00
+ protected boolean p() {
+ return this.a.isInWater() || this.a.an();
+ }
2016-02-17 01:55:21 +00:00
+
2016-02-29 23:09:49 +00:00
+ protected void d() {}
2016-02-17 01:55:21 +00:00
+
2016-02-29 23:09:49 +00:00
+ protected abstract boolean a(Vec3D vec3d, Vec3D vec3d1, int i, int j, int k);
2016-02-17 01:55:21 +00:00
+
2016-02-29 23:09:49 +00:00
+ public boolean b(BlockPosition blockposition) {
+ return this.b.getType(blockposition.down()).b();
2016-02-17 01:55:21 +00:00
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java
new file mode 100644
2016-02-29 23:09:49 +00:00
index 0000000..1a20dbf
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java
@@ -0,0 +1,23 @@
+package net.minecraft.server;
+
+public class PathfinderGoalFloat extends PathfinderGoal {
+
+ private EntityInsentient a;
+
+ public PathfinderGoalFloat(EntityInsentient entityinsentient) {
+ this.a = entityinsentient;
+ this.a(4);
2016-02-29 23:09:49 +00:00
+ ((Navigation) entityinsentient.getNavigation()).c(true);
+ }
+
+ public boolean a() {
2016-02-29 23:09:49 +00:00
+ return this.a.isInWater() || this.a.an();
+ }
+
+ public void e() {
2016-02-29 23:09:49 +00:00
+ if (this.a.getRandom().nextFloat() < 0.8F) {
+ this.a.getControllerJump().a();
+ }
+
+ }
+}
diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
new file mode 100644
2016-02-29 23:09:49 +00:00
index 0000000..e454622
--- /dev/null
+++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
2014-11-28 01:17:45 +00:00
@@ -0,0 +1,87 @@
+package net.minecraft.server;
+
2016-02-29 23:09:49 +00:00
+public class TileEntityEnderChest extends TileEntity implements ITickable {
+
+ public float a;
2014-11-28 01:17:45 +00:00
+ public float f;
+ public int g;
+ private int h;
+
+ public TileEntityEnderChest() {}
+
2014-11-28 01:17:45 +00:00
+ public void c() {
+ if (++this.h % 20 * 4 == 0) {
+ this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
+ }
+
2014-11-28 01:17:45 +00:00
+ this.f = this.a;
+ int i = this.position.getX();
+ int j = this.position.getY();
+ int k = this.position.getZ();
+ float f = 0.1F;
+ double d0;
+
2014-11-28 01:17:45 +00:00
+ if (this.g > 0 && this.a == 0.0F) {
+ double d1 = (double) i + 0.5D;
+
2014-11-28 01:17:45 +00:00
+ d0 = (double) k + 0.5D;
2016-02-29 23:09:49 +00:00
+ this.world.a((EntityHuman) null, d1, (double) j + 0.5D, d0, SoundEffects.aL, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ }
+
2014-11-28 01:17:45 +00:00
+ if (this.g == 0 && this.a > 0.0F || this.g > 0 && this.a < 1.0F) {
+ float f1 = this.a;
+
2014-11-28 01:17:45 +00:00
+ if (this.g > 0) {
+ this.a += f;
+ } else {
+ this.a -= f;
+ }
+
+ if (this.a > 1.0F) {
+ this.a = 1.0F;
+ }
+
+ float f2 = 0.5F;
+
+ if (this.a < f2 && f1 >= f2) {
2014-11-28 01:17:45 +00:00
+ d0 = (double) i + 0.5D;
+ double d2 = (double) k + 0.5D;
+
2016-02-29 23:09:49 +00:00
+ this.world.a((EntityHuman) null, d0, (double) j + 0.5D, d2, SoundEffects.aK, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ }
+
+ if (this.a < 0.0F) {
+ this.a = 0.0F;
+ }
+ }
2014-11-28 01:17:45 +00:00
+
+ }
+
+ public boolean c(int i, int j) {
+ if (i == 1) {
2014-11-28 01:17:45 +00:00
+ this.g = j;
+ return true;
+ } else {
+ return super.c(i, j);
+ }
+ }
+
2014-11-28 01:17:45 +00:00
+ public void y() {
2016-02-29 23:09:49 +00:00
+ this.invalidateBlockCache();
2014-11-28 01:17:45 +00:00
+ super.y();
+ }
+
2014-11-28 01:17:45 +00:00
+ public void b() {
+ ++this.g;
+ this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
+ }
+
2014-11-28 01:17:45 +00:00
+ public void d() {
+ --this.g;
+ this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
+ }
+
+ public boolean a(EntityHuman entityhuman) {
2014-11-28 01:17:45 +00:00
+ return this.world.getTileEntity(this.position) != this ? false : entityhuman.e((double) this.position.getX() + 0.5D, (double) this.position.getY() + 0.5D, (double) this.position.getZ() + 0.5D) <= 64.0D;
+ }
+}
2016-02-29 23:09:49 +00:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/PacketPlayOutPlayerListHeaderFooter.java b/src/main/java/org/bukkit/craftbukkit/entity/PacketPlayOutPlayerListHeaderFooter.java
new file mode 100644
index 0000000..842db1d
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/entity/PacketPlayOutPlayerListHeaderFooter.java
@@ -0,0 +1,34 @@
+package org.bukkit.craftbukkit.entity;
+
+import net.minecraft.server.IChatBaseComponent;
+import net.minecraft.server.Packet;
+import net.minecraft.server.PacketDataSerializer;
+import net.minecraft.server.PacketListenerPlayOut;
+
+import java.io.IOException;
+
+public class PacketPlayOutPlayerListHeaderFooter implements Packet<PacketListenerPlayOut> {
+
+ private IChatBaseComponent a;
+ private IChatBaseComponent b;
+
+ public PacketPlayOutPlayerListHeaderFooter() {}
+
+ public PacketPlayOutPlayerListHeaderFooter(IChatBaseComponent ichatbasecomponent) {
+ this.a = ichatbasecomponent;
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException {
+ this.a = packetdataserializer.f();
+ this.b = packetdataserializer.f();
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException {
+ packetdataserializer.a(this.a);
+ packetdataserializer.a(this.b);
+ }
+
+ public void a(PacketListenerPlayOut packetlistenerplayout) {
+ packetlistenerplayout.a(this);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/PacketPlayOutTitle.java b/src/main/java/org/bukkit/craftbukkit/entity/PacketPlayOutTitle.java
new file mode 100644
2016-02-29 23:09:49 +00:00
index 0000000..2286c9e
--- /dev/null
2016-02-29 23:09:49 +00:00
+++ b/src/main/java/org/bukkit/craftbukkit/entity/PacketPlayOutTitle.java
@@ -0,0 +1,99 @@
+package net.minecraft.server;
+
2016-02-29 23:09:49 +00:00
+import java.io.IOException;
+
2016-02-29 23:09:49 +00:00
+public class PacketPlayOutTitle implements Packet<PacketListenerPlayOut> {
+
2016-02-29 23:09:49 +00:00
+ private PacketPlayOutTitle.EnumTitleAction a;
+ private IChatBaseComponent b;
+ private int c;
+ private int d;
+ private int e;
+
+ public PacketPlayOutTitle() {}
+
+ public PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction packetplayouttitle_enumtitleaction, IChatBaseComponent ichatbasecomponent) {
+ this(packetplayouttitle_enumtitleaction, ichatbasecomponent, -1, -1, -1);
+ }
+
+ public PacketPlayOutTitle(int i, int j, int k) {
+ this(PacketPlayOutTitle.EnumTitleAction.TIMES, (IChatBaseComponent) null, i, j, k);
+ }
+
+ public PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction packetplayouttitle_enumtitleaction, IChatBaseComponent ichatbasecomponent, int i, int j, int k) {
+ this.a = packetplayouttitle_enumtitleaction;
+ this.b = ichatbasecomponent;
+ this.c = i;
+ this.d = j;
+ this.e = k;
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException {
+ this.a = (PacketPlayOutTitle.EnumTitleAction) packetdataserializer.a(PacketPlayOutTitle.EnumTitleAction.class);
+ if (this.a == PacketPlayOutTitle.EnumTitleAction.TITLE || this.a == PacketPlayOutTitle.EnumTitleAction.SUBTITLE) {
+ this.b = packetdataserializer.f();
+ }
+
+ if (this.a == PacketPlayOutTitle.EnumTitleAction.TIMES) {
+ this.c = packetdataserializer.readInt();
+ this.d = packetdataserializer.readInt();
+ this.e = packetdataserializer.readInt();
+ }
+
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException {
+ packetdataserializer.a((Enum) this.a);
+ if (this.a == PacketPlayOutTitle.EnumTitleAction.TITLE || this.a == PacketPlayOutTitle.EnumTitleAction.SUBTITLE) {
+ packetdataserializer.a(this.b);
+ }
+
+ if (this.a == PacketPlayOutTitle.EnumTitleAction.TIMES) {
+ packetdataserializer.writeInt(this.c);
+ packetdataserializer.writeInt(this.d);
+ packetdataserializer.writeInt(this.e);
+ }
+
+ }
+
+ public void a(PacketListenerPlayOut packetlistenerplayout) {
+ packetlistenerplayout.a(this);
+ }
+
+ public static enum EnumTitleAction {
+
+ TITLE, SUBTITLE, TIMES, CLEAR, RESET;
+
+ private EnumTitleAction() {}
+
+ public static PacketPlayOutTitle.EnumTitleAction a(String s) {
+ PacketPlayOutTitle.EnumTitleAction[] apacketplayouttitle_enumtitleaction = values();
+ int i = apacketplayouttitle_enumtitleaction.length;
+
+ for (int j = 0; j < i; ++j) {
+ PacketPlayOutTitle.EnumTitleAction packetplayouttitle_enumtitleaction = apacketplayouttitle_enumtitleaction[j];
+
+ if (packetplayouttitle_enumtitleaction.name().equalsIgnoreCase(s)) {
+ return packetplayouttitle_enumtitleaction;
+ }
+ }
2016-02-29 23:09:49 +00:00
+
+ return PacketPlayOutTitle.EnumTitleAction.TITLE;
+ }
2014-11-28 01:17:45 +00:00
+
2016-02-29 23:09:49 +00:00
+ public static String[] a() {
+ String[] astring = new String[values().length];
+ int i = 0;
+ PacketPlayOutTitle.EnumTitleAction[] apacketplayouttitle_enumtitleaction = values();
+ int j = apacketplayouttitle_enumtitleaction.length;
+
+ for (int k = 0; k < j; ++k) {
+ PacketPlayOutTitle.EnumTitleAction packetplayouttitle_enumtitleaction = apacketplayouttitle_enumtitleaction[k];
+
+ astring[i++] = packetplayouttitle_enumtitleaction.name().toLowerCase();
+ }
+
+ return astring;
+ }
+ }
+}
2015-01-07 04:13:40 +00:00
--
2016-02-29 23:09:49 +00:00
2.7.2