Paper/CraftBukkit-Patches/0003-mc-dev-imports.patch

4242 lines
196 KiB
Diff

From a09ff91264b91a13d52cc68e9fe61792ab5a8c2e Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 1 Dec 2013 15:10:48 +1100
Subject: [PATCH] mc-dev imports
Imported files which are only modified by Spigot, not upstream. Files here should be completely unmodified aside from trivial changes such as adding throws statements to ensure proper compilation. You may need to add unrelated files in order to ensure a compilable result in the face of synthetic methods.
diff --git a/src/main/java/net/minecraft/server/AttributeRanged.java b/src/main/java/net/minecraft/server/AttributeRanged.java
new file mode 100644
index 0000000..13602f0
--- /dev/null
+++ b/src/main/java/net/minecraft/server/AttributeRanged.java
@@ -0,0 +1,35 @@
+package net.minecraft.server;
+
+public class AttributeRanged extends AttributeBase {
+
+ private final double a;
+ private final double b;
+ private String c;
+
+ public AttributeRanged(IAttribute iattribute, String s, double d0, double d1, double d2) {
+ super(iattribute, s, d0);
+ this.a = d1;
+ this.b = d2;
+ if (d1 > d2) {
+ throw new IllegalArgumentException("Minimum value cannot be bigger than maximum value!");
+ } else if (d0 < d1) {
+ throw new IllegalArgumentException("Default value cannot be lower than minimum value!");
+ } else if (d0 > d2) {
+ throw new IllegalArgumentException("Default value cannot be bigger than maximum value!");
+ }
+ }
+
+ public AttributeRanged a(String s) {
+ this.c = s;
+ return this;
+ }
+
+ public String g() {
+ return this.c;
+ }
+
+ public double a(double d0) {
+ d0 = MathHelper.a(d0, this.a, this.b);
+ return d0;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java
new file mode 100644
index 0000000..54140f7
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BlockTNT.java
@@ -0,0 +1,98 @@
+package net.minecraft.server;
+
+public class BlockTNT extends Block {
+
+ public static final BlockStateBoolean EXPLODE = BlockStateBoolean.of("explode");
+
+ public BlockTNT() {
+ super(Material.TNT);
+ this.w(this.blockStateList.getBlockData().set(BlockTNT.EXPLODE, Boolean.valueOf(false)));
+ this.a(CreativeModeTab.d);
+ }
+
+ public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) {
+ super.onPlace(world, blockposition, iblockdata);
+ if (world.isBlockIndirectlyPowered(blockposition)) {
+ this.postBreak(world, blockposition, iblockdata.set(BlockTNT.EXPLODE, Boolean.valueOf(true)));
+ world.setAir(blockposition);
+ }
+
+ }
+
+ public void doPhysics(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) {
+ if (world.isBlockIndirectlyPowered(blockposition)) {
+ this.postBreak(world, blockposition, iblockdata.set(BlockTNT.EXPLODE, Boolean.valueOf(true)));
+ world.setAir(blockposition);
+ }
+
+ }
+
+ public void wasExploded(World world, BlockPosition blockposition, Explosion explosion) {
+ if (!world.isClientSide) {
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource());
+
+ entitytntprimed.setFuseTicks((short) (world.random.nextInt(entitytntprimed.getFuseTicks() / 4) + entitytntprimed.getFuseTicks() / 8));
+ world.addEntity(entitytntprimed);
+ }
+ }
+
+ public void postBreak(World world, BlockPosition blockposition, IBlockData iblockdata) {
+ this.a(world, blockposition, iblockdata, (EntityLiving) null);
+ }
+
+ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityLiving entityliving) {
+ if (!world.isClientSide) {
+ if (((Boolean) iblockdata.get(BlockTNT.EXPLODE)).booleanValue()) {
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), entityliving);
+
+ world.addEntity(entitytntprimed);
+ world.a((EntityHuman) null, entitytntprimed.locX, entitytntprimed.locY, entitytntprimed.locZ, SoundEffects.gj, SoundCategory.BLOCKS, 1.0F, 1.0F);
+ }
+
+ }
+ }
+
+ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack, EnumDirection enumdirection, float f, float f1, float f2) {
+ if (itemstack != null && (itemstack.getItem() == Items.FLINT_AND_STEEL || itemstack.getItem() == Items.FIRE_CHARGE)) {
+ this.a(world, blockposition, iblockdata.set(BlockTNT.EXPLODE, Boolean.valueOf(true)), (EntityLiving) entityhuman);
+ world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 11);
+ if (itemstack.getItem() == Items.FLINT_AND_STEEL) {
+ itemstack.damage(1, entityhuman);
+ } else if (!entityhuman.abilities.canInstantlyBuild) {
+ --itemstack.count;
+ }
+
+ return true;
+ } else {
+ return super.interact(world, blockposition, iblockdata, entityhuman, enumhand, itemstack, enumdirection, f, f1, f2);
+ }
+ }
+
+ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
+ if (!world.isClientSide && entity instanceof EntityArrow) {
+ EntityArrow entityarrow = (EntityArrow) entity;
+
+ if (entityarrow.isBurning()) {
+ this.a(world, blockposition, world.getType(blockposition).set(BlockTNT.EXPLODE, Boolean.valueOf(true)), entityarrow.shooter instanceof EntityLiving ? (EntityLiving) entityarrow.shooter : null);
+ world.setAir(blockposition);
+ }
+ }
+
+ }
+
+ public boolean a(Explosion explosion) {
+ return false;
+ }
+
+ public IBlockData fromLegacyData(int i) {
+ return this.getBlockData().set(BlockTNT.EXPLODE, Boolean.valueOf((i & 1) > 0));
+ }
+
+ public int toLegacyData(IBlockData iblockdata) {
+ return ((Boolean) iblockdata.get(BlockTNT.EXPLODE)).booleanValue() ? 1 : 0;
+ }
+
+ protected BlockStateList getStateList() {
+ return new BlockStateList(this, new IBlockState[] { BlockTNT.EXPLODE});
+ }
+}
diff --git a/src/main/java/net/minecraft/server/CommandDispatcher.java b/src/main/java/net/minecraft/server/CommandDispatcher.java
new file mode 100644
index 0000000..3e4a31b
--- /dev/null
+++ b/src/main/java/net/minecraft/server/CommandDispatcher.java
@@ -0,0 +1,125 @@
+package net.minecraft.server;
+
+import java.util.Iterator;
+
+public class CommandDispatcher extends CommandHandler implements ICommandDispatcher {
+
+ private final MinecraftServer a;
+
+ public CommandDispatcher(MinecraftServer minecraftserver) {
+ this.a = minecraftserver;
+ this.a((ICommand) (new CommandTime()));
+ this.a((ICommand) (new CommandGamemode()));
+ this.a((ICommand) (new CommandDifficulty()));
+ this.a((ICommand) (new CommandGamemodeDefault()));
+ this.a((ICommand) (new CommandKill()));
+ this.a((ICommand) (new CommandToggleDownfall()));
+ this.a((ICommand) (new CommandWeather()));
+ this.a((ICommand) (new CommandXp()));
+ this.a((ICommand) (new CommandTp()));
+ this.a((ICommand) (new CommandGive()));
+ this.a((ICommand) (new CommandReplaceItem()));
+ this.a((ICommand) (new CommandStats()));
+ this.a((ICommand) (new CommandEffect()));
+ this.a((ICommand) (new CommandEnchant()));
+ this.a((ICommand) (new CommandParticle()));
+ this.a((ICommand) (new CommandMe()));
+ this.a((ICommand) (new CommandSeed()));
+ this.a((ICommand) (new CommandHelp()));
+ this.a((ICommand) (new CommandDebug()));
+ this.a((ICommand) (new CommandTell()));
+ this.a((ICommand) (new CommandSay()));
+ this.a((ICommand) (new CommandSpawnpoint()));
+ this.a((ICommand) (new CommandSetWorldSpawn()));
+ this.a((ICommand) (new CommandGamerule()));
+ this.a((ICommand) (new CommandClear()));
+ this.a((ICommand) (new CommandTestFor()));
+ this.a((ICommand) (new CommandSpreadPlayers()));
+ this.a((ICommand) (new CommandPlaySound()));
+ this.a((ICommand) (new CommandScoreboard()));
+ this.a((ICommand) (new CommandExecute()));
+ this.a((ICommand) (new CommandTrigger()));
+ this.a((ICommand) (new CommandAchievement()));
+ this.a((ICommand) (new CommandSummon()));
+ this.a((ICommand) (new CommandSetBlock()));
+ this.a((ICommand) (new CommandFill()));
+ this.a((ICommand) (new CommandClone()));
+ this.a((ICommand) (new CommandTestForBlocks()));
+ this.a((ICommand) (new CommandBlockData()));
+ this.a((ICommand) (new CommandTestForBlock()));
+ this.a((ICommand) (new CommandTellRaw()));
+ this.a((ICommand) (new CommandWorldBorder()));
+ this.a((ICommand) (new CommandTitle()));
+ this.a((ICommand) (new CommandEntityData()));
+ if (minecraftserver.aa()) {
+ this.a((ICommand) (new CommandOp()));
+ this.a((ICommand) (new CommandDeop()));
+ this.a((ICommand) (new CommandStop()));
+ this.a((ICommand) (new CommandSaveAll()));
+ this.a((ICommand) (new CommandSaveOff()));
+ this.a((ICommand) (new CommandSaveOn()));
+ this.a((ICommand) (new CommandBanIp()));
+ this.a((ICommand) (new CommandPardonIP()));
+ this.a((ICommand) (new CommandBan()));
+ this.a((ICommand) (new CommandBanList()));
+ this.a((ICommand) (new CommandPardon()));
+ this.a((ICommand) (new CommandKick()));
+ this.a((ICommand) (new CommandList()));
+ this.a((ICommand) (new CommandWhitelist()));
+ this.a((ICommand) (new CommandIdleTimeout()));
+ } else {
+ this.a((ICommand) (new CommandPublish()));
+ }
+
+ CommandAbstract.a((ICommandDispatcher) this);
+ }
+
+ public void a(ICommandListener icommandlistener, ICommand icommand, int i, String s, Object... aobject) {
+ boolean flag = true;
+ MinecraftServer minecraftserver = this.a;
+
+ if (!icommandlistener.getSendCommandFeedback()) {
+ flag = false;
+ }
+
+ ChatMessage chatmessage = new ChatMessage("chat.type.admin", new Object[] { icommandlistener.getName(), new ChatMessage(s, aobject)});
+
+ chatmessage.getChatModifier().setColor(EnumChatFormat.GRAY);
+ chatmessage.getChatModifier().setItalic(Boolean.valueOf(true));
+ if (flag) {
+ Iterator iterator = minecraftserver.getPlayerList().v().iterator();
+
+ while (iterator.hasNext()) {
+ EntityHuman entityhuman = (EntityHuman) iterator.next();
+
+ if (entityhuman != icommandlistener && minecraftserver.getPlayerList().isOp(entityhuman.getProfile()) && icommand.canUse(this.a, icommandlistener)) {
+ boolean flag1 = icommandlistener instanceof MinecraftServer && this.a.s();
+ boolean flag2 = icommandlistener instanceof RemoteControlCommandListener && this.a.r();
+
+ if (flag1 || flag2 || !(icommandlistener instanceof RemoteControlCommandListener) && !(icommandlistener instanceof MinecraftServer)) {
+ entityhuman.sendMessage(chatmessage);
+ }
+ }
+ }
+ }
+
+ if (icommandlistener != minecraftserver && minecraftserver.worldServer[0].getGameRules().getBoolean("logAdminCommands")) {
+ minecraftserver.sendMessage(chatmessage);
+ }
+
+ boolean flag3 = minecraftserver.worldServer[0].getGameRules().getBoolean("sendCommandFeedback");
+
+ if (icommandlistener instanceof CommandBlockListenerAbstract) {
+ flag3 = ((CommandBlockListenerAbstract) icommandlistener).n();
+ }
+
+ if ((i & 1) != 1 && flag3 || icommandlistener instanceof MinecraftServer) {
+ icommandlistener.sendMessage(new ChatMessage(s, aobject));
+ }
+
+ }
+
+ protected MinecraftServer a() {
+ return this.a;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/GameProfileBanEntry.java b/src/main/java/net/minecraft/server/GameProfileBanEntry.java
new file mode 100644
index 0000000..27ce9d9
--- /dev/null
+++ b/src/main/java/net/minecraft/server/GameProfileBanEntry.java
@@ -0,0 +1,47 @@
+package net.minecraft.server;
+
+import com.google.gson.JsonObject;
+import com.mojang.authlib.GameProfile;
+import java.util.Date;
+import java.util.UUID;
+
+public class GameProfileBanEntry extends ExpirableListEntry<GameProfile> {
+
+ public GameProfileBanEntry(GameProfile gameprofile) {
+ this(gameprofile, (Date) null, (String) null, (Date) null, (String) null);
+ }
+
+ public GameProfileBanEntry(GameProfile gameprofile, Date date, String s, Date date1, String s1) {
+ super(gameprofile, date1, s, date1, s1);
+ }
+
+ public GameProfileBanEntry(JsonObject jsonobject) {
+ super(b(jsonobject), jsonobject);
+ }
+
+ protected void a(JsonObject jsonobject) {
+ if (this.getKey() != null) {
+ jsonobject.addProperty("uuid", ((GameProfile) this.getKey()).getId() == null ? "" : ((GameProfile) this.getKey()).getId().toString());
+ jsonobject.addProperty("name", ((GameProfile) this.getKey()).getName());
+ super.a(jsonobject);
+ }
+ }
+
+ private static GameProfile b(JsonObject jsonobject) {
+ if (jsonobject.has("uuid") && jsonobject.has("name")) {
+ String s = jsonobject.get("uuid").getAsString();
+
+ UUID uuid;
+
+ try {
+ uuid = UUID.fromString(s);
+ } catch (Throwable throwable) {
+ return null;
+ }
+
+ return new GameProfile(uuid, jsonobject.get("name").getAsString());
+ } else {
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/GenericAttributes.java b/src/main/java/net/minecraft/server/GenericAttributes.java
new file mode 100644
index 0000000..16aaf1a
--- /dev/null
+++ b/src/main/java/net/minecraft/server/GenericAttributes.java
@@ -0,0 +1,116 @@
+package net.minecraft.server;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.UUID;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+public class GenericAttributes {
+
+ private static final Logger i = LogManager.getLogger();
+ public static final IAttribute maxHealth = (new AttributeRanged((IAttribute) null, "generic.maxHealth", 20.0D, 0.0D, 1024.0D)).a("Max Health").a(true);
+ public static final IAttribute FOLLOW_RANGE = (new AttributeRanged((IAttribute) null, "generic.followRange", 32.0D, 0.0D, 2048.0D)).a("Follow Range");
+ public static final IAttribute c = (new AttributeRanged((IAttribute) null, "generic.knockbackResistance", 0.0D, 0.0D, 1.0D)).a("Knockback Resistance");
+ public static final IAttribute MOVEMENT_SPEED = (new AttributeRanged((IAttribute) null, "generic.movementSpeed", 0.699999988079071D, 0.0D, 1024.0D)).a("Movement Speed").a(true);
+ public static final IAttribute ATTACK_DAMAGE = new AttributeRanged((IAttribute) null, "generic.attackDamage", 2.0D, 0.0D, 2048.0D);
+ public static final IAttribute f = (new AttributeRanged((IAttribute) null, "generic.attackSpeed", 4.0D, 0.0D, 1024.0D)).a(true);
+ public static final IAttribute g = (new AttributeRanged((IAttribute) null, "generic.armor", 0.0D, 0.0D, 30.0D)).a(true);
+ public static final IAttribute h = (new AttributeRanged((IAttribute) null, "generic.luck", 0.0D, -1024.0D, 1024.0D)).a(true);
+
+ public static NBTTagList a(AttributeMapBase attributemapbase) {
+ NBTTagList nbttaglist = new NBTTagList();
+ Iterator iterator = attributemapbase.a().iterator();
+
+ while (iterator.hasNext()) {
+ AttributeInstance attributeinstance = (AttributeInstance) iterator.next();
+
+ nbttaglist.add(a(attributeinstance));
+ }
+
+ return nbttaglist;
+ }
+
+ private static NBTTagCompound a(AttributeInstance attributeinstance) {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+ IAttribute iattribute = attributeinstance.getAttribute();
+
+ nbttagcompound.setString("Name", iattribute.getName());
+ nbttagcompound.setDouble("Base", attributeinstance.b());
+ Collection collection = attributeinstance.c();
+
+ if (collection != null && !collection.isEmpty()) {
+ NBTTagList nbttaglist = new NBTTagList();
+ Iterator iterator = collection.iterator();
+
+ while (iterator.hasNext()) {
+ AttributeModifier attributemodifier = (AttributeModifier) iterator.next();
+
+ if (attributemodifier.e()) {
+ nbttaglist.add(a(attributemodifier));
+ }
+ }
+
+ nbttagcompound.set("Modifiers", nbttaglist);
+ }
+
+ return nbttagcompound;
+ }
+
+ public static NBTTagCompound a(AttributeModifier attributemodifier) {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+
+ nbttagcompound.setString("Name", attributemodifier.b());
+ nbttagcompound.setDouble("Amount", attributemodifier.d());
+ nbttagcompound.setInt("Operation", attributemodifier.c());
+ nbttagcompound.a("UUID", attributemodifier.a());
+ return nbttagcompound;
+ }
+
+ public static void a(AttributeMapBase attributemapbase, NBTTagList nbttaglist) {
+ for (int i = 0; i < nbttaglist.size(); ++i) {
+ NBTTagCompound nbttagcompound = nbttaglist.get(i);
+ AttributeInstance attributeinstance = attributemapbase.a(nbttagcompound.getString("Name"));
+
+ if (attributeinstance != null) {
+ a(attributeinstance, nbttagcompound);
+ } else {
+ GenericAttributes.i.warn("Ignoring unknown attribute \'" + nbttagcompound.getString("Name") + "\'");
+ }
+ }
+
+ }
+
+ private static void a(AttributeInstance attributeinstance, NBTTagCompound nbttagcompound) {
+ attributeinstance.setValue(nbttagcompound.getDouble("Base"));
+ if (nbttagcompound.hasKeyOfType("Modifiers", 9)) {
+ NBTTagList nbttaglist = nbttagcompound.getList("Modifiers", 10);
+
+ for (int i = 0; i < nbttaglist.size(); ++i) {
+ AttributeModifier attributemodifier = a(nbttaglist.get(i));
+
+ if (attributemodifier != null) {
+ AttributeModifier attributemodifier1 = attributeinstance.a(attributemodifier.a());
+
+ if (attributemodifier1 != null) {
+ attributeinstance.c(attributemodifier1);
+ }
+
+ attributeinstance.b(attributemodifier);
+ }
+ }
+ }
+
+ }
+
+ public static AttributeModifier a(NBTTagCompound nbttagcompound) {
+ UUID uuid = nbttagcompound.a("UUID");
+
+ try {
+ return new AttributeModifier(uuid, nbttagcompound.getString("Name"), nbttagcompound.getDouble("Amount"), nbttagcompound.getInt("Operation"));
+ } catch (Exception exception) {
+ GenericAttributes.i.warn("Unable to create attribute: " + exception.getMessage());
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/IntCache.java b/src/main/java/net/minecraft/server/IntCache.java
new file mode 100644
index 0000000..8167fdd
--- /dev/null
+++ b/src/main/java/net/minecraft/server/IntCache.java
@@ -0,0 +1,63 @@
+package net.minecraft.server;
+
+import com.google.common.collect.Lists;
+import java.util.List;
+
+public class IntCache {
+
+ private static int a = 256;
+ private static List<int[]> b = Lists.newArrayList();
+ private static List<int[]> c = Lists.newArrayList();
+ private static List<int[]> d = Lists.newArrayList();
+ private static List<int[]> e = Lists.newArrayList();
+
+ public static synchronized int[] a(int i) {
+ int[] aint;
+
+ if (i <= 256) {
+ if (IntCache.b.isEmpty()) {
+ aint = new int[256];
+ IntCache.c.add(aint);
+ return aint;
+ } else {
+ aint = (int[]) IntCache.b.remove(IntCache.b.size() - 1);
+ IntCache.c.add(aint);
+ return aint;
+ }
+ } else if (i > IntCache.a) {
+ IntCache.a = i;
+ IntCache.d.clear();
+ IntCache.e.clear();
+ aint = new int[IntCache.a];
+ IntCache.e.add(aint);
+ return aint;
+ } else if (IntCache.d.isEmpty()) {
+ aint = new int[IntCache.a];
+ IntCache.e.add(aint);
+ return aint;
+ } else {
+ aint = (int[]) IntCache.d.remove(IntCache.d.size() - 1);
+ IntCache.e.add(aint);
+ return aint;
+ }
+ }
+
+ public static synchronized void a() {
+ if (!IntCache.d.isEmpty()) {
+ IntCache.d.remove(IntCache.d.size() - 1);
+ }
+
+ if (!IntCache.b.isEmpty()) {
+ IntCache.b.remove(IntCache.b.size() - 1);
+ }
+
+ IntCache.d.addAll(IntCache.e);
+ IntCache.b.addAll(IntCache.c);
+ IntCache.e.clear();
+ IntCache.c.clear();
+ }
+
+ public static synchronized String b() {
+ return "cache: " + IntCache.d.size() + ", tcache: " + IntCache.b.size() + ", allocated: " + IntCache.e.size() + ", tallocated: " + IntCache.c.size();
+ }
+}
diff --git a/src/main/java/net/minecraft/server/ItemDoor.java b/src/main/java/net/minecraft/server/ItemDoor.java
new file mode 100644
index 0000000..669940a
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ItemDoor.java
@@ -0,0 +1,66 @@
+package net.minecraft.server;
+
+public class ItemDoor extends Item {
+
+ private Block a;
+
+ public ItemDoor(Block block) {
+ this.a = block;
+ this.a(CreativeModeTab.d);
+ }
+
+ public EnumInteractionResult a(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) {
+ if (enumdirection != EnumDirection.UP) {
+ return EnumInteractionResult.FAIL;
+ } else {
+ IBlockData iblockdata = world.getType(blockposition);
+ Block block = iblockdata.getBlock();
+
+ if (!block.a((IBlockAccess) world, blockposition)) {
+ blockposition = blockposition.shift(enumdirection);
+ }
+
+ if (entityhuman.a(blockposition, enumdirection, itemstack) && this.a.canPlace(world, blockposition)) {
+ EnumDirection enumdirection1 = EnumDirection.fromAngle((double) entityhuman.yaw);
+ int i = enumdirection1.getAdjacentX();
+ int j = enumdirection1.getAdjacentZ();
+ boolean flag = i < 0 && f2 < 0.5F || i > 0 && f2 > 0.5F || j < 0 && f > 0.5F || j > 0 && f < 0.5F;
+
+ a(world, blockposition, enumdirection1, this.a, flag);
+ 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;
+ return EnumInteractionResult.SUCCESS;
+ } else {
+ return EnumInteractionResult.FAIL;
+ }
+ }
+ }
+
+ public static void a(World world, BlockPosition blockposition, EnumDirection enumdirection, Block block, boolean flag) {
+ BlockPosition blockposition1 = blockposition.shift(enumdirection.e());
+ BlockPosition blockposition2 = blockposition.shift(enumdirection.f());
+ int i = (world.getType(blockposition2).l() ? 1 : 0) + (world.getType(blockposition2.up()).l() ? 1 : 0);
+ int j = (world.getType(blockposition1).l() ? 1 : 0) + (world.getType(blockposition1.up()).l() ? 1 : 0);
+ boolean flag1 = world.getType(blockposition2).getBlock() == block || world.getType(blockposition2.up()).getBlock() == block;
+ boolean flag2 = world.getType(blockposition1).getBlock() == block || world.getType(blockposition1.up()).getBlock() == block;
+
+ if ((!flag1 || flag2) && j <= i) {
+ if (flag2 && !flag1 || j < i) {
+ flag = false;
+ }
+ } else {
+ flag = true;
+ }
+
+ BlockPosition blockposition3 = blockposition.up();
+ boolean flag3 = world.isBlockIndirectlyPowered(blockposition) || world.isBlockIndirectlyPowered(blockposition3);
+ IBlockData iblockdata = block.getBlockData().set(BlockDoor.FACING, enumdirection).set(BlockDoor.HINGE, flag ? BlockDoor.EnumDoorHinge.RIGHT : BlockDoor.EnumDoorHinge.LEFT).set(BlockDoor.POWERED, Boolean.valueOf(flag3)).set(BlockDoor.OPEN, Boolean.valueOf(flag3));
+
+ world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER), 2);
+ world.setTypeAndData(blockposition3, iblockdata.set(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 2);
+ world.applyPhysics(blockposition, block);
+ world.applyPhysics(blockposition3, block);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/ItemSkull.java b/src/main/java/net/minecraft/server/ItemSkull.java
new file mode 100644
index 0000000..40338ae
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ItemSkull.java
@@ -0,0 +1,123 @@
+package net.minecraft.server;
+
+import com.mojang.authlib.GameProfile;
+import java.util.UUID;
+
+public class ItemSkull extends Item {
+
+ private static final String[] a = new String[] { "skeleton", "wither", "zombie", "char", "creeper", "dragon"};
+
+ public ItemSkull() {
+ this.a(CreativeModeTab.c);
+ this.setMaxDurability(0);
+ this.a(true);
+ }
+
+ public EnumInteractionResult a(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) {
+ if (enumdirection == EnumDirection.DOWN) {
+ return EnumInteractionResult.FAIL;
+ } else {
+ IBlockData iblockdata = world.getType(blockposition);
+ Block block = iblockdata.getBlock();
+ boolean flag = block.a((IBlockAccess) world, blockposition);
+
+ if (!flag) {
+ if (!world.getType(blockposition).getMaterial().isBuildable()) {
+ return EnumInteractionResult.FAIL;
+ }
+
+ blockposition = blockposition.shift(enumdirection);
+ }
+
+ if (entityhuman.a(blockposition, enumdirection, itemstack) && Blocks.SKULL.canPlace(world, blockposition)) {
+ if (world.isClientSide) {
+ return EnumInteractionResult.SUCCESS;
+ } else {
+ world.setTypeAndData(blockposition, Blocks.SKULL.getBlockData().set(BlockSkull.FACING, enumdirection), 11);
+ int i = 0;
+
+ if (enumdirection == EnumDirection.UP) {
+ i = MathHelper.floor((double) (entityhuman.yaw * 16.0F / 360.0F) + 0.5D) & 15;
+ }
+
+ TileEntity tileentity = world.getTileEntity(blockposition);
+
+ if (tileentity instanceof TileEntitySkull) {
+ TileEntitySkull tileentityskull = (TileEntitySkull) tileentity;
+
+ if (itemstack.getData() == 3) {
+ GameProfile gameprofile = null;
+
+ if (itemstack.hasTag()) {
+ NBTTagCompound nbttagcompound = itemstack.getTag();
+
+ if (nbttagcompound.hasKeyOfType("SkullOwner", 10)) {
+ gameprofile = GameProfileSerializer.deserialize(nbttagcompound.getCompound("SkullOwner"));
+ } else if (nbttagcompound.hasKeyOfType("SkullOwner", 8) && !nbttagcompound.getString("SkullOwner").isEmpty()) {
+ gameprofile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner"));
+ }
+ }
+
+ tileentityskull.setGameProfile(gameprofile);
+ } else {
+ tileentityskull.setSkullType(itemstack.getData());
+ }
+
+ tileentityskull.setRotation(i);
+ Blocks.SKULL.a(world, blockposition, tileentityskull);
+ }
+
+ --itemstack.count;
+ return EnumInteractionResult.SUCCESS;
+ }
+ } else {
+ return EnumInteractionResult.FAIL;
+ }
+ }
+ }
+
+ public int filterData(int i) {
+ return i;
+ }
+
+ public String f_(ItemStack itemstack) {
+ int i = itemstack.getData();
+
+ if (i < 0 || i >= ItemSkull.a.length) {
+ i = 0;
+ }
+
+ return super.getName() + "." + ItemSkull.a[i];
+ }
+
+ public String a(ItemStack itemstack) {
+ if (itemstack.getData() == 3 && itemstack.hasTag()) {
+ if (itemstack.getTag().hasKeyOfType("SkullOwner", 8)) {
+ return LocaleI18n.a("item.skull.player.name", new Object[] { itemstack.getTag().getString("SkullOwner")});
+ }
+
+ if (itemstack.getTag().hasKeyOfType("SkullOwner", 10)) {
+ NBTTagCompound nbttagcompound = itemstack.getTag().getCompound("SkullOwner");
+
+ if (nbttagcompound.hasKeyOfType("Name", 8)) {
+ return LocaleI18n.a("item.skull.player.name", new Object[] { nbttagcompound.getString("Name")});
+ }
+ }
+ }
+
+ return super.a(itemstack);
+ }
+
+ public boolean a(NBTTagCompound nbttagcompound) {
+ super.a(nbttagcompound);
+ if (nbttagcompound.hasKeyOfType("SkullOwner", 8) && !nbttagcompound.getString("SkullOwner").isEmpty()) {
+ GameProfile gameprofile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner"));
+
+ gameprofile = TileEntitySkull.b(gameprofile);
+ nbttagcompound.set("SkullOwner", GameProfileSerializer.serialize(new NBTTagCompound(), gameprofile));
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java
new file mode 100644
index 0000000..2a04b86
--- /dev/null
+++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java
@@ -0,0 +1,90 @@
+package net.minecraft.server;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.DataOutput;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.GZIPOutputStream;
+
+public class NBTCompressedStreamTools {
+
+ public static NBTTagCompound a(InputStream inputstream) throws IOException {
+ DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new GZIPInputStream(inputstream)));
+
+ NBTTagCompound nbttagcompound;
+
+ try {
+ nbttagcompound = a((DataInput) datainputstream, NBTReadLimiter.a);
+ } finally {
+ datainputstream.close();
+ }
+
+ return nbttagcompound;
+ }
+
+ public static void a(NBTTagCompound nbttagcompound, OutputStream outputstream) throws IOException {
+ DataOutputStream dataoutputstream = new DataOutputStream(new BufferedOutputStream(new GZIPOutputStream(outputstream)));
+
+ try {
+ a(nbttagcompound, (DataOutput) dataoutputstream);
+ } finally {
+ dataoutputstream.close();
+ }
+
+ }
+
+ public static NBTTagCompound a(DataInputStream datainputstream) throws IOException {
+ return a((DataInput) datainputstream, NBTReadLimiter.a);
+ }
+
+ public static NBTTagCompound a(DataInput datainput, NBTReadLimiter nbtreadlimiter) throws IOException {
+ NBTBase nbtbase = a(datainput, 0, nbtreadlimiter);
+
+ if (nbtbase instanceof NBTTagCompound) {
+ return (NBTTagCompound) nbtbase;
+ } else {
+ throw new IOException("Root tag must be a named compound tag");
+ }
+ }
+
+ public static void a(NBTTagCompound nbttagcompound, DataOutput dataoutput) throws IOException {
+ a((NBTBase) nbttagcompound, dataoutput);
+ }
+
+ private static void a(NBTBase nbtbase, DataOutput dataoutput) throws IOException {
+ dataoutput.writeByte(nbtbase.getTypeId());
+ if (nbtbase.getTypeId() != 0) {
+ dataoutput.writeUTF("");
+ nbtbase.write(dataoutput);
+ }
+ }
+
+ private static NBTBase a(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException {
+ byte b0 = datainput.readByte();
+
+ if (b0 == 0) {
+ return new NBTTagEnd();
+ } else {
+ datainput.readUTF();
+ NBTBase nbtbase = NBTBase.createTag(b0);
+
+ try {
+ nbtbase.load(datainput, i, nbtreadlimiter);
+ return nbtbase;
+ } catch (IOException ioexception) {
+ CrashReport crashreport = CrashReport.a(ioexception, "Loading NBT data");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("NBT Tag");
+
+ crashreportsystemdetails.a("Tag name", (Object) "[UNNAMED TAG]");
+ crashreportsystemdetails.a("Tag type", (Object) Byte.valueOf(b0));
+ throw new ReportedException(crashreport);
+ }
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/NBTTagByteArray.java b/src/main/java/net/minecraft/server/NBTTagByteArray.java
new file mode 100644
index 0000000..c6b5f70
--- /dev/null
+++ b/src/main/java/net/minecraft/server/NBTTagByteArray.java
@@ -0,0 +1,58 @@
+package net.minecraft.server;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Arrays;
+
+public class NBTTagByteArray extends NBTBase {
+
+ private byte[] data;
+
+ NBTTagByteArray() {}
+
+ public NBTTagByteArray(byte[] abyte) {
+ this.data = abyte;
+ }
+
+ void write(DataOutput dataoutput) throws IOException {
+ dataoutput.writeInt(this.data.length);
+ dataoutput.write(this.data);
+ }
+
+ void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException {
+ nbtreadlimiter.a(192L);
+ int j = datainput.readInt();
+
+ nbtreadlimiter.a((long) (8 * j));
+ this.data = new byte[j];
+ datainput.readFully(this.data);
+ }
+
+ public byte getTypeId() {
+ return (byte) 7;
+ }
+
+ public String toString() {
+ return "[" + this.data.length + " bytes]";
+ }
+
+ public NBTBase clone() {
+ byte[] abyte = new byte[this.data.length];
+
+ System.arraycopy(this.data, 0, abyte, 0, this.data.length);
+ return new NBTTagByteArray(abyte);
+ }
+
+ public boolean equals(Object object) {
+ return super.equals(object) ? Arrays.equals(this.data, ((NBTTagByteArray) object).data) : false;
+ }
+
+ public int hashCode() {
+ return super.hashCode() ^ Arrays.hashCode(this.data);
+ }
+
+ public byte[] c() {
+ return this.data;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/NBTTagIntArray.java b/src/main/java/net/minecraft/server/NBTTagIntArray.java
new file mode 100644
index 0000000..5f17034
--- /dev/null
+++ b/src/main/java/net/minecraft/server/NBTTagIntArray.java
@@ -0,0 +1,76 @@
+package net.minecraft.server;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Arrays;
+
+public class NBTTagIntArray extends NBTBase {
+
+ private int[] data;
+
+ NBTTagIntArray() {}
+
+ public NBTTagIntArray(int[] aint) {
+ this.data = aint;
+ }
+
+ void write(DataOutput dataoutput) throws IOException {
+ dataoutput.writeInt(this.data.length);
+
+ for (int i = 0; i < this.data.length; ++i) {
+ dataoutput.writeInt(this.data[i]);
+ }
+
+ }
+
+ void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException {
+ nbtreadlimiter.a(192L);
+ int j = datainput.readInt();
+
+ nbtreadlimiter.a((long) (32 * j));
+ this.data = new int[j];
+
+ for (int k = 0; k < j; ++k) {
+ this.data[k] = datainput.readInt();
+ }
+
+ }
+
+ public byte getTypeId() {
+ return (byte) 11;
+ }
+
+ public String toString() {
+ String s = "[";
+ int[] aint = this.data;
+ int i = aint.length;
+
+ for (int j = 0; j < i; ++j) {
+ int k = aint[j];
+
+ s = s + k + ",";
+ }
+
+ return s + "]";
+ }
+
+ public NBTBase clone() {
+ int[] aint = new int[this.data.length];
+
+ System.arraycopy(this.data, 0, aint, 0, this.data.length);
+ return new NBTTagIntArray(aint);
+ }
+
+ public boolean equals(Object object) {
+ return super.equals(object) ? Arrays.equals(this.data, ((NBTTagIntArray) object).data) : false;
+ }
+
+ public int hashCode() {
+ return super.hashCode() ^ Arrays.hashCode(this.data);
+ }
+
+ public int[] c() {
+ return this.data;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/NavigationListener.java b/src/main/java/net/minecraft/server/NavigationListener.java
new file mode 100644
index 0000000..f82ea80
--- /dev/null
+++ b/src/main/java/net/minecraft/server/NavigationListener.java
@@ -0,0 +1,69 @@
+package net.minecraft.server;
+
+import java.util.WeakHashMap;
+
+public class NavigationListener implements IWorldAccess {
+
+ private static final Object a = new Object();
+ private final WeakHashMap<NavigationAbstract, Object> b = new WeakHashMap();
+
+ public NavigationListener() {}
+
+ public void a(NavigationAbstract navigationabstract) {
+ this.b.put(navigationabstract, NavigationListener.a);
+ }
+
+ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1, int i) {
+ if (this.a(world, blockposition, iblockdata, iblockdata1)) {
+ NavigationAbstract[] anavigationabstract = (NavigationAbstract[]) this.b.keySet().toArray(new NavigationAbstract[0]);
+ NavigationAbstract[] anavigationabstract1 = anavigationabstract;
+ int j = anavigationabstract.length;
+
+ for (int k = 0; k < j; ++k) {
+ NavigationAbstract navigationabstract = anavigationabstract1[k];
+
+ if (navigationabstract != null && !navigationabstract.i()) {
+ PathEntity pathentity = navigationabstract.k();
+
+ if (pathentity != null && !pathentity.b() && pathentity.d() != 0) {
+ PathPoint pathpoint = navigationabstract.c.c();
+ double d0 = blockposition.distanceSquared(((double) pathpoint.a + navigationabstract.a.locX) / 2.0D, ((double) pathpoint.b + navigationabstract.a.locY) / 2.0D, ((double) pathpoint.c + navigationabstract.a.locZ) / 2.0D);
+ int l = (pathentity.d() - pathentity.e()) * (pathentity.d() - pathentity.e());
+
+ if (d0 < (double) l) {
+ navigationabstract.j();
+ }
+ }
+ }
+ }
+
+ }
+ }
+
+ protected boolean a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {
+ AxisAlignedBB axisalignedbb = iblockdata.d(world, blockposition);
+ AxisAlignedBB axisalignedbb1 = iblockdata1.d(world, blockposition);
+
+ return axisalignedbb != axisalignedbb1 && (axisalignedbb == null || !axisalignedbb.equals(axisalignedbb1));
+ }
+
+ public void a(BlockPosition blockposition) {}
+
+ public void a(int i, int j, int k, int l, int i1, int j1) {}
+
+ public void a(EntityHuman entityhuman, SoundEffect soundeffect, SoundCategory soundcategory, double d0, double d1, double d2, float f, float f1) {}
+
+ public void a(int i, boolean flag, double d0, double d1, double d2, double d3, double d4, double d5, int... aint) {}
+
+ public void a(Entity entity) {}
+
+ public void b(Entity entity) {}
+
+ public void a(SoundEffect soundeffect, BlockPosition blockposition) {}
+
+ public void a(int i, BlockPosition blockposition, int j) {}
+
+ public void a(EntityHuman entityhuman, int i, BlockPosition blockposition, int j) {}
+
+ public void b(int i, BlockPosition blockposition, int j) {}
+}
diff --git a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java
new file mode 100644
index 0000000..86f1be7
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java
@@ -0,0 +1,39 @@
+package net.minecraft.server;
+
+import java.io.IOException;
+
+public class PacketHandshakingInSetProtocol implements Packet<PacketHandshakingInListener> {
+
+ private int a;
+ public String hostname;
+ public int port;
+ private EnumProtocol d;
+
+ public PacketHandshakingInSetProtocol() {}
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException {
+ this.a = packetdataserializer.g();
+ this.hostname = packetdataserializer.c(255);
+ this.port = packetdataserializer.readUnsignedShort();
+ this.d = EnumProtocol.a(packetdataserializer.g());
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException {
+ packetdataserializer.b(this.a);
+ packetdataserializer.a(this.hostname);
+ packetdataserializer.writeShort(this.port);
+ packetdataserializer.b(this.d.a());
+ }
+
+ public void a(PacketHandshakingInListener packethandshakinginlistener) {
+ packethandshakinginlistener.a(this);
+ }
+
+ public EnumProtocol a() {
+ return this.d;
+ }
+
+ public int b() {
+ return this.a;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java b/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java
new file mode 100644
index 0000000..cb0356e
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java
@@ -0,0 +1,30 @@
+package net.minecraft.server;
+
+import java.io.IOException;
+
+public class PacketPlayInArmAnimation implements Packet<PacketListenerPlayIn> {
+
+ private EnumHand a;
+
+ public PacketPlayInArmAnimation() {}
+
+ public PacketPlayInArmAnimation(EnumHand enumhand) {
+ this.a = enumhand;
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException {
+ this.a = (EnumHand) packetdataserializer.a(EnumHand.class);
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException {
+ packetdataserializer.a((Enum) this.a);
+ }
+
+ public void a(PacketListenerPlayIn packetlistenerplayin) {
+ packetlistenerplayin.a(this);
+ }
+
+ public EnumHand a() {
+ return this.a;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayInChat.java b/src/main/java/net/minecraft/server/PacketPlayInChat.java
new file mode 100644
index 0000000..0ab90f3
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayInChat.java
@@ -0,0 +1,34 @@
+package net.minecraft.server;
+
+import java.io.IOException;
+
+public class PacketPlayInChat implements Packet<PacketListenerPlayIn> {
+
+ private String a;
+
+ public PacketPlayInChat() {}
+
+ public PacketPlayInChat(String s) {
+ if (s.length() > 100) {
+ s = s.substring(0, 100);
+ }
+
+ this.a = s;
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException {
+ this.a = packetdataserializer.c(100);
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException {
+ packetdataserializer.a(this.a);
+ }
+
+ public void a(PacketListenerPlayIn packetlistenerplayin) {
+ packetlistenerplayin.a(this);
+ }
+
+ public String a() {
+ return this.a;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java
new file mode 100644
index 0000000..c5147b6
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java
@@ -0,0 +1,38 @@
+package net.minecraft.server;
+
+import java.io.IOException;
+
+public class PacketPlayOutChat implements Packet<PacketListenerPlayOut> {
+
+ private IChatBaseComponent a;
+ private byte b;
+
+ public PacketPlayOutChat() {}
+
+ public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent) {
+ this(ichatbasecomponent, (byte) 1);
+ }
+
+ public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent, byte b0) {
+ this.a = ichatbasecomponent;
+ this.b = b0;
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException {
+ this.a = packetdataserializer.f();
+ this.b = packetdataserializer.readByte();
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException {
+ packetdataserializer.a(this.a);
+ packetdataserializer.writeByte(this.b);
+ }
+
+ public void a(PacketListenerPlayOut packetlistenerplayout) {
+ packetlistenerplayout.a(this);
+ }
+
+ public boolean b() {
+ return this.b == 1 || this.b == 2;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
new file mode 100644
index 0000000..b5dc220
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
@@ -0,0 +1,110 @@
+package net.minecraft.server;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import java.io.IOException;
+
+public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
+
+ private int a;
+ private int b;
+ private int c;
+ private byte[] d;
+ private boolean e;
+
+ public PacketPlayOutMapChunk() {}
+
+ public PacketPlayOutMapChunk(Chunk chunk, boolean flag, int i) {
+ this.a = chunk.locX;
+ this.b = chunk.locZ;
+ this.e = flag;
+ boolean flag1 = !chunk.getWorld().worldProvider.m();
+
+ this.d = new byte[a(chunk, flag, flag1, i)];
+ this.c = a(new PacketDataSerializer(this.f()), chunk, flag, flag1, i);
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException {
+ this.a = packetdataserializer.readInt();
+ this.b = packetdataserializer.readInt();
+ this.e = packetdataserializer.readBoolean();
+ this.c = packetdataserializer.g();
+ int i = packetdataserializer.g();
+
+ if (i > 2097152) {
+ throw new RuntimeException("Chunk Packet trying to allocate too much memory on read.");
+ } else {
+ this.d = new byte[i];
+ packetdataserializer.readBytes(this.d);
+ }
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException {
+ packetdataserializer.writeInt(this.a);
+ packetdataserializer.writeInt(this.b);
+ packetdataserializer.writeBoolean(this.e);
+ packetdataserializer.b(this.c);
+ packetdataserializer.b(this.d.length);
+ packetdataserializer.writeBytes(this.d);
+ }
+
+ public void a(PacketListenerPlayOut packetlistenerplayout) {
+ packetlistenerplayout.a(this);
+ }
+
+ private ByteBuf f() {
+ ByteBuf bytebuf = Unpooled.wrappedBuffer(this.d);
+
+ bytebuf.writerIndex(0);
+ return bytebuf;
+ }
+
+ public static int a(PacketDataSerializer packetdataserializer, Chunk chunk, boolean flag, boolean flag1, int i) {
+ int j = 0;
+ ChunkSection[] achunksection = chunk.getSections();
+ int k = 0;
+
+ for (int l = achunksection.length; k < l; ++k) {
+ ChunkSection chunksection = achunksection[k];
+
+ if (chunksection != Chunk.a && (!flag || !chunksection.a()) && (i & 1 << k) != 0) {
+ j |= 1 << k;
+ chunksection.getBlocks().b(packetdataserializer);
+ packetdataserializer.writeBytes(chunksection.getEmittedLightArray().asBytes());
+ if (flag1) {
+ packetdataserializer.writeBytes(chunksection.getSkyLightArray().asBytes());
+ }
+ }
+ }
+
+ if (flag) {
+ packetdataserializer.writeBytes(chunk.getBiomeIndex());
+ }
+
+ return j;
+ }
+
+ protected static int a(Chunk chunk, boolean flag, boolean flag1, int i) {
+ int j = 0;
+ ChunkSection[] achunksection = chunk.getSections();
+ int k = 0;
+
+ for (int l = achunksection.length; k < l; ++k) {
+ ChunkSection chunksection = achunksection[k];
+
+ if (chunksection != Chunk.a && (!flag || !chunksection.a()) && (i & 1 << k) != 0) {
+ j += chunksection.getBlocks().a();
+ j += chunksection.getEmittedLightArray().asBytes().length;
+ if (flag1) {
+ j += chunksection.getSkyLightArray().asBytes().length;
+ }
+ }
+ }
+
+ if (flag) {
+ j += chunk.getBiomeIndex().length;
+ }
+
+ return j;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PersistentCollection.java b/src/main/java/net/minecraft/server/PersistentCollection.java
new file mode 100644
index 0000000..c29e3f7
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PersistentCollection.java
@@ -0,0 +1,183 @@
+package net.minecraft.server;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import java.io.DataInputStream;
+import java.io.DataOutput;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+public class PersistentCollection {
+
+ private IDataManager b;
+ protected Map<String, PersistentBase> a = Maps.newHashMap();
+ private List<PersistentBase> c = Lists.newArrayList();
+ private Map<String, Short> d = Maps.newHashMap();
+
+ public PersistentCollection(IDataManager idatamanager) {
+ this.b = idatamanager;
+ this.b();
+ }
+
+ public PersistentBase get(Class<? extends PersistentBase> oclass, String s) {
+ PersistentBase persistentbase = (PersistentBase) this.a.get(s);
+
+ if (persistentbase != null) {
+ return persistentbase;
+ } else {
+ if (this.b != null) {
+ try {
+ File file = this.b.getDataFile(s);
+
+ if (file != null && file.exists()) {
+ try {
+ persistentbase = (PersistentBase) oclass.getConstructor(new Class[] { String.class}).newInstance(new Object[] { s});
+ } catch (Exception exception) {
+ throw new RuntimeException("Failed to instantiate " + oclass.toString(), exception);
+ }
+
+ FileInputStream fileinputstream = new FileInputStream(file);
+ NBTTagCompound nbttagcompound = NBTCompressedStreamTools.a((InputStream) fileinputstream);
+
+ fileinputstream.close();
+ persistentbase.a(nbttagcompound.getCompound("data"));
+ }
+ } catch (Exception exception1) {
+ exception1.printStackTrace();
+ }
+ }
+
+ if (persistentbase != null) {
+ this.a.put(s, persistentbase);
+ this.c.add(persistentbase);
+ }
+
+ return persistentbase;
+ }
+ }
+
+ public void a(String s, PersistentBase persistentbase) {
+ if (this.a.containsKey(s)) {
+ this.c.remove(this.a.remove(s));
+ }
+
+ this.a.put(s, persistentbase);
+ this.c.add(persistentbase);
+ }
+
+ public void a() {
+ for (int i = 0; i < this.c.size(); ++i) {
+ PersistentBase persistentbase = (PersistentBase) this.c.get(i);
+
+ if (persistentbase.d()) {
+ this.a(persistentbase);
+ persistentbase.a(false);
+ }
+ }
+
+ }
+
+ private void a(PersistentBase persistentbase) {
+ if (this.b != null) {
+ try {
+ File file = this.b.getDataFile(persistentbase.id);
+
+ if (file != null) {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+
+ persistentbase.b(nbttagcompound);
+ NBTTagCompound nbttagcompound1 = new NBTTagCompound();
+
+ nbttagcompound1.set("data", nbttagcompound);
+ FileOutputStream fileoutputstream = new FileOutputStream(file);
+
+ NBTCompressedStreamTools.a(nbttagcompound1, (OutputStream) fileoutputstream);
+ fileoutputstream.close();
+ }
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+
+ }
+ }
+
+ private void b() {
+ try {
+ this.d.clear();
+ if (this.b == null) {
+ return;
+ }
+
+ File file = this.b.getDataFile("idcounts");
+
+ if (file != null && file.exists()) {
+ DataInputStream datainputstream = new DataInputStream(new FileInputStream(file));
+ NBTTagCompound nbttagcompound = NBTCompressedStreamTools.a(datainputstream);
+
+ datainputstream.close();
+ Iterator iterator = nbttagcompound.c().iterator();
+
+ while (iterator.hasNext()) {
+ String s = (String) iterator.next();
+ NBTBase nbtbase = nbttagcompound.get(s);
+
+ if (nbtbase instanceof NBTTagShort) {
+ NBTTagShort nbttagshort = (NBTTagShort) nbtbase;
+ short short0 = nbttagshort.e();
+
+ this.d.put(s, Short.valueOf(short0));
+ }
+ }
+ }
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+
+ }
+
+ public int a(String s) {
+ Short oshort = (Short) this.d.get(s);
+
+ if (oshort == null) {
+ oshort = Short.valueOf((short) 0);
+ } else {
+ oshort = Short.valueOf((short) (oshort.shortValue() + 1));
+ }
+
+ this.d.put(s, oshort);
+ if (this.b == null) {
+ return oshort.shortValue();
+ } else {
+ try {
+ File file = this.b.getDataFile("idcounts");
+
+ if (file != null) {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+ Iterator iterator = this.d.keySet().iterator();
+
+ while (iterator.hasNext()) {
+ String s1 = (String) iterator.next();
+
+ nbttagcompound.setShort(s1, ((Short) this.d.get(s1)).shortValue());
+ }
+
+ DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(file));
+
+ NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) dataoutputstream);
+ dataoutputstream.close();
+ }
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+
+ return oshort.shortValue();
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
new file mode 100644
index 0000000..b07e7d5
--- /dev/null
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -0,0 +1,67 @@
+package net.minecraft.server;
+
+import com.google.common.collect.Maps;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+
+public class RegionFileCache {
+
+ private static final Map<File, RegionFile> a = Maps.newHashMap();
+
+ public static synchronized RegionFile a(File file, int i, int j) {
+ File file1 = new File(file, "region");
+ File file2 = new File(file1, "r." + (i >> 5) + "." + (j >> 5) + ".mca");
+ RegionFile regionfile = (RegionFile) RegionFileCache.a.get(file2);
+
+ if (regionfile != null) {
+ return regionfile;
+ } else {
+ if (!file1.exists()) {
+ file1.mkdirs();
+ }
+
+ if (RegionFileCache.a.size() >= 256) {
+ a();
+ }
+
+ RegionFile regionfile1 = new RegionFile(file2);
+
+ RegionFileCache.a.put(file2, regionfile1);
+ return regionfile1;
+ }
+ }
+
+ public static synchronized void a() {
+ Iterator iterator = RegionFileCache.a.values().iterator();
+
+ while (iterator.hasNext()) {
+ RegionFile regionfile = (RegionFile) iterator.next();
+
+ try {
+ if (regionfile != null) {
+ regionfile.c();
+ }
+ } catch (IOException ioexception) {
+ ioexception.printStackTrace();
+ }
+ }
+
+ RegionFileCache.a.clear();
+ }
+
+ public static DataInputStream c(File file, int i, int j) {
+ RegionFile regionfile = a(file, i, j);
+
+ return regionfile.a(i & 31, j & 31);
+ }
+
+ public static DataOutputStream d(File file, int i, int j) {
+ RegionFile regionfile = a(file, i, j);
+
+ return regionfile.b(i & 31, j & 31);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java
new file mode 100644
index 0000000..968a1b7
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ServerConnection.java
@@ -0,0 +1,175 @@
+package net.minecraft.server;
+
+import com.google.common.collect.Lists;
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.netty.bootstrap.ServerBootstrap;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelException;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.ChannelOption;
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.epoll.Epoll;
+import io.netty.channel.epoll.EpollEventLoopGroup;
+import io.netty.channel.epoll.EpollServerSocketChannel;
+import io.netty.channel.local.LocalEventLoopGroup;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.channel.socket.nio.NioServerSocketChannel;
+import io.netty.handler.timeout.ReadTimeoutHandler;
+import io.netty.util.concurrent.Future;
+import io.netty.util.concurrent.GenericFutureListener;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.Callable;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+public class ServerConnection {
+
+ private static final Logger e = LogManager.getLogger();
+ public static final LazyInitVar<NioEventLoopGroup> a = new LazyInitVar() {
+ protected NioEventLoopGroup a() {
+ return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Server IO #%d").setDaemon(true).build());
+ }
+
+ protected Object init() {
+ return this.a();
+ }
+ };
+ public static final LazyInitVar<EpollEventLoopGroup> b = new LazyInitVar() {
+ protected EpollEventLoopGroup a() {
+ return new EpollEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Epoll Server IO #%d").setDaemon(true).build());
+ }
+
+ protected Object init() {
+ return this.a();
+ }
+ };
+ public static final LazyInitVar<LocalEventLoopGroup> c = new LazyInitVar() {
+ protected LocalEventLoopGroup a() {
+ return new LocalEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Local Server IO #%d").setDaemon(true).build());
+ }
+
+ protected Object init() {
+ return this.a();
+ }
+ };
+ private final MinecraftServer f;
+ public volatile boolean d;
+ private final List<ChannelFuture> g = Collections.synchronizedList(Lists.<ChannelFuture>newArrayList());
+ private final List<NetworkManager> h = Collections.synchronizedList(Lists.<NetworkManager>newArrayList());
+
+ public ServerConnection(MinecraftServer minecraftserver) {
+ this.f = minecraftserver;
+ this.d = true;
+ }
+
+ public void a(InetAddress inetaddress, int i) throws IOException {
+ List list = this.g;
+
+ synchronized (this.g) {
+ Class oclass;
+ LazyInitVar lazyinitvar;
+
+ if (Epoll.isAvailable() && this.f.ae()) {
+ oclass = EpollServerSocketChannel.class;
+ lazyinitvar = ServerConnection.b;
+ ServerConnection.e.info("Using epoll channel type");
+ } else {
+ oclass = NioServerSocketChannel.class;
+ lazyinitvar = ServerConnection.a;
+ ServerConnection.e.info("Using default channel type");
+ }
+
+ this.g.add(((ServerBootstrap) ((ServerBootstrap) (new ServerBootstrap()).channel(oclass)).childHandler(new ChannelInitializer() {
+ protected void initChannel(Channel channel) throws Exception {
+ try {
+ channel.config().setOption(ChannelOption.TCP_NODELAY, Boolean.valueOf(true));
+ } catch (ChannelException channelexception) {
+ ;
+ }
+
+ channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(ServerConnection.this)).addLast("splitter", new PacketSplitter()).addLast("decoder", new PacketDecoder(EnumProtocolDirection.SERVERBOUND)).addLast("prepender", new PacketPrepender()).addLast("encoder", new PacketEncoder(EnumProtocolDirection.CLIENTBOUND));
+ NetworkManager networkmanager = new NetworkManager(EnumProtocolDirection.SERVERBOUND);
+
+ ServerConnection.this.h.add(networkmanager);
+ channel.pipeline().addLast("packet_handler", networkmanager);
+ networkmanager.setPacketListener(new HandshakeListener(ServerConnection.this.f, networkmanager));
+ }
+ }).group((EventLoopGroup) lazyinitvar.c()).localAddress(inetaddress, i)).bind().syncUninterruptibly());
+ }
+ }
+
+ public void b() {
+ this.d = false;
+ Iterator iterator = this.g.iterator();
+
+ while (iterator.hasNext()) {
+ ChannelFuture channelfuture = (ChannelFuture) iterator.next();
+
+ try {
+ channelfuture.channel().close().sync();
+ } catch (InterruptedException interruptedexception) {
+ ServerConnection.e.error("Interrupted whilst closing channel");
+ }
+ }
+
+ }
+
+ public void c() {
+ List list = this.h;
+
+ synchronized (this.h) {
+ Iterator iterator = this.h.iterator();
+
+ while (iterator.hasNext()) {
+ final NetworkManager networkmanager = (NetworkManager) iterator.next();
+
+ if (!networkmanager.h()) {
+ if (networkmanager.isConnected()) {
+ try {
+ networkmanager.a();
+ } catch (Exception exception) {
+ if (networkmanager.isLocal()) {
+ CrashReport crashreport = CrashReport.a(exception, "Ticking memory connection");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Ticking connection");
+
+ crashreportsystemdetails.a("Connection", new Callable() {
+ public String a() throws Exception {
+ return networkmanager.toString();
+ }
+
+ public Object call() throws Exception {
+ return this.a();
+ }
+ });
+ throw new ReportedException(crashreport);
+ }
+
+ ServerConnection.e.warn("Failed to handle packet for " + networkmanager.getSocketAddress(), exception);
+ final ChatComponentText chatcomponenttext = new ChatComponentText("Internal server error");
+
+ networkmanager.sendPacket(new PacketPlayOutKickDisconnect(chatcomponenttext), new GenericFutureListener() {
+ public void operationComplete(Future future) throws Exception {
+ networkmanager.close(chatcomponenttext);
+ }
+ }, new GenericFutureListener[0]);
+ networkmanager.stopReading();
+ }
+ } else {
+ iterator.remove();
+ networkmanager.handleDisconnection();
+ }
+ }
+ }
+
+ }
+ }
+
+ public MinecraftServer d() {
+ return this.f;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/ServerStatisticManager.java b/src/main/java/net/minecraft/server/ServerStatisticManager.java
new file mode 100644
index 0000000..76bd9c1
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ServerStatisticManager.java
@@ -0,0 +1,212 @@
+package net.minecraft.server;
+
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParseException;
+import com.google.gson.JsonParser;
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+import org.apache.commons.io.FileUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+public class ServerStatisticManager extends StatisticManager {
+
+ private static final Logger b = LogManager.getLogger();
+ private final MinecraftServer c;
+ private final File d;
+ private final Set<Statistic> e = Sets.newHashSet();
+ private int f = -300;
+ private boolean g = false;
+
+ public ServerStatisticManager(MinecraftServer minecraftserver, File file) {
+ this.c = minecraftserver;
+ this.d = file;
+ }
+
+ public void a() {
+ if (this.d.isFile()) {
+ try {
+ this.a.clear();
+ this.a.putAll(this.a(FileUtils.readFileToString(this.d)));
+ } catch (IOException ioexception) {
+ ServerStatisticManager.b.error("Couldn\'t read statistics file " + this.d, ioexception);
+ } catch (JsonParseException jsonparseexception) {
+ ServerStatisticManager.b.error("Couldn\'t parse statistics file " + this.d, jsonparseexception);
+ }
+ }
+
+ }
+
+ public void b() {
+ try {
+ FileUtils.writeStringToFile(this.d, a(this.a));
+ } catch (IOException ioexception) {
+ ServerStatisticManager.b.error("Couldn\'t save stats", ioexception);
+ }
+
+ }
+
+ public void setStatistic(EntityHuman entityhuman, Statistic statistic, int i) {
+ int j = statistic.d() ? this.getStatisticValue(statistic) : 0;
+
+ super.setStatistic(entityhuman, statistic, i);
+ this.e.add(statistic);
+ if (statistic.d() && j == 0 && i > 0) {
+ this.g = true;
+ if (this.c.ax()) {
+ this.c.getPlayerList().sendMessage(new ChatMessage("chat.type.achievement", new Object[] { entityhuman.getScoreboardDisplayName(), statistic.j()}));
+ }
+ }
+
+ if (statistic.d() && j > 0 && i == 0) {
+ this.g = true;
+ if (this.c.ax()) {
+ this.c.getPlayerList().sendMessage(new ChatMessage("chat.type.achievement.taken", new Object[] { entityhuman.getScoreboardDisplayName(), statistic.j()}));
+ }
+ }
+
+ }
+
+ public Set<Statistic> c() {
+ HashSet hashset = Sets.newHashSet(this.e);
+
+ this.e.clear();
+ this.g = false;
+ return hashset;
+ }
+
+ public Map<Statistic, StatisticWrapper> a(String s) {
+ JsonElement jsonelement = (new JsonParser()).parse(s);
+
+ if (!jsonelement.isJsonObject()) {
+ return Maps.newHashMap();
+ } else {
+ JsonObject jsonobject = jsonelement.getAsJsonObject();
+ HashMap hashmap = Maps.newHashMap();
+ Iterator iterator = jsonobject.entrySet().iterator();
+
+ while (iterator.hasNext()) {
+ Entry entry = (Entry) iterator.next();
+ Statistic statistic = StatisticList.getStatistic((String) entry.getKey());
+
+ if (statistic != null) {
+ StatisticWrapper statisticwrapper = new StatisticWrapper();
+
+ if (((JsonElement) entry.getValue()).isJsonPrimitive() && ((JsonElement) entry.getValue()).getAsJsonPrimitive().isNumber()) {
+ statisticwrapper.a(((JsonElement) entry.getValue()).getAsInt());
+ } else if (((JsonElement) entry.getValue()).isJsonObject()) {
+ JsonObject jsonobject1 = ((JsonElement) entry.getValue()).getAsJsonObject();
+
+ if (jsonobject1.has("value") && jsonobject1.get("value").isJsonPrimitive() && jsonobject1.get("value").getAsJsonPrimitive().isNumber()) {
+ statisticwrapper.a(jsonobject1.getAsJsonPrimitive("value").getAsInt());
+ }
+
+ if (jsonobject1.has("progress") && statistic.l() != null) {
+ try {
+ Constructor constructor = statistic.l().getConstructor(new Class[0]);
+ IJsonStatistic ijsonstatistic = (IJsonStatistic) constructor.newInstance(new Object[0]);
+
+ ijsonstatistic.a(jsonobject1.get("progress"));
+ statisticwrapper.a(ijsonstatistic);
+ } catch (Throwable throwable) {
+ ServerStatisticManager.b.warn("Invalid statistic progress in " + this.d, throwable);
+ }
+ }
+ }
+
+ hashmap.put(statistic, statisticwrapper);
+ } else {
+ ServerStatisticManager.b.warn("Invalid statistic in " + this.d + ": Don\'t know what " + (String) entry.getKey() + " is");
+ }
+ }
+
+ return hashmap;
+ }
+ }
+
+ public static String a(Map<Statistic, StatisticWrapper> map) {
+ JsonObject jsonobject = new JsonObject();
+ Iterator iterator = map.entrySet().iterator();
+
+ while (iterator.hasNext()) {
+ Entry entry = (Entry) iterator.next();
+
+ if (((StatisticWrapper) entry.getValue()).b() != null) {
+ JsonObject jsonobject1 = new JsonObject();
+
+ jsonobject1.addProperty("value", Integer.valueOf(((StatisticWrapper) entry.getValue()).a()));
+
+ try {
+ jsonobject1.add("progress", ((StatisticWrapper) entry.getValue()).b().a());
+ } catch (Throwable throwable) {
+ ServerStatisticManager.b.warn("Couldn\'t save statistic " + ((Statistic) entry.getKey()).e() + ": error serializing progress", throwable);
+ }
+
+ jsonobject.add(((Statistic) entry.getKey()).name, jsonobject1);
+ } else {
+ jsonobject.addProperty(((Statistic) entry.getKey()).name, Integer.valueOf(((StatisticWrapper) entry.getValue()).a()));
+ }
+ }
+
+ return jsonobject.toString();
+ }
+
+ public void d() {
+ Iterator iterator = this.a.keySet().iterator();
+
+ while (iterator.hasNext()) {
+ Statistic statistic = (Statistic) iterator.next();
+
+ this.e.add(statistic);
+ }
+
+ }
+
+ public void a(EntityPlayer entityplayer) {
+ int i = this.c.ap();
+ HashMap hashmap = Maps.newHashMap();
+
+ if (this.g || i - this.f > 300) {
+ this.f = i;
+ Iterator iterator = this.c().iterator();
+
+ while (iterator.hasNext()) {
+ Statistic statistic = (Statistic) iterator.next();
+
+ hashmap.put(statistic, Integer.valueOf(this.getStatisticValue(statistic)));
+ }
+ }
+
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutStatistic(hashmap));
+ }
+
+ public void updateStatistics(EntityPlayer entityplayer) {
+ HashMap hashmap = Maps.newHashMap();
+ Iterator iterator = AchievementList.e.iterator();
+
+ while (iterator.hasNext()) {
+ Achievement achievement = (Achievement) iterator.next();
+
+ if (this.hasAchievement(achievement)) {
+ hashmap.put(achievement, Integer.valueOf(this.getStatisticValue(achievement)));
+ this.e.remove(achievement);
+ }
+ }
+
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutStatistic(hashmap));
+ }
+
+ public boolean e() {
+ return this.g;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java
new file mode 100644
index 0000000..dacba33
--- /dev/null
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java
@@ -0,0 +1,239 @@
+package net.minecraft.server;
+
+import com.google.common.collect.Maps;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.concurrent.Callable;
+
+public abstract class StructureGenerator extends WorldGenBase {
+
+ private PersistentStructure a;
+ protected Map<Long, StructureStart> c = Maps.newHashMap();
+
+ public StructureGenerator() {}
+
+ public abstract String a();
+
+ protected final synchronized void a(World world, final int i, final int j, int k, int l, ChunkSnapshot chunksnapshot) {
+ this.a(world);
+ if (!this.c.containsKey(Long.valueOf(ChunkCoordIntPair.a(i, j)))) {
+ this.f.nextInt();
+
+ try {
+ if (this.a(i, j)) {
+ StructureStart structurestart = this.b(i, j);
+
+ this.c.put(Long.valueOf(ChunkCoordIntPair.a(i, j)), structurestart);
+ if (structurestart.a()) {
+ this.a(i, j, structurestart);
+ }
+ }
+
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Exception preparing structure feature");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Feature being prepared");
+
+ crashreportsystemdetails.a("Is feature chunk", new Callable() {
+ public String a() throws Exception {
+ return StructureGenerator.this.a(i, j) ? "True" : "False";
+ }
+
+ public Object call() throws Exception {
+ return this.a();
+ }
+ });
+ crashreportsystemdetails.a("Chunk location", (Object) String.format("%d,%d", new Object[] { Integer.valueOf(i), Integer.valueOf(j)}));
+ crashreportsystemdetails.a("Chunk pos hash", new Callable() {
+ public String a() throws Exception {
+ return String.valueOf(ChunkCoordIntPair.a(i, j));
+ }
+
+ public Object call() throws Exception {
+ return this.a();
+ }
+ });
+ crashreportsystemdetails.a("Structure type", new Callable() {
+ public String a() throws Exception {
+ return StructureGenerator.this.getClass().getCanonicalName();
+ }
+
+ public Object call() throws Exception {
+ return this.a();
+ }
+ });
+ throw new ReportedException(crashreport);
+ }
+ }
+ }
+
+ public synchronized boolean a(World world, Random random, ChunkCoordIntPair chunkcoordintpair) {
+ this.a(world);
+ int i = (chunkcoordintpair.x << 4) + 8;
+ int j = (chunkcoordintpair.z << 4) + 8;
+ boolean flag = false;
+ Iterator iterator = this.c.values().iterator();
+
+ while (iterator.hasNext()) {
+ StructureStart structurestart = (StructureStart) iterator.next();
+
+ if (structurestart.a() && structurestart.a(chunkcoordintpair) && structurestart.b().a(i, j, i + 15, j + 15)) {
+ structurestart.a(world, random, new StructureBoundingBox(i, j, i + 15, j + 15));
+ structurestart.b(chunkcoordintpair);
+ flag = true;
+ this.a(structurestart.e(), structurestart.f(), structurestart);
+ }
+ }
+
+ return flag;
+ }
+
+ public boolean b(BlockPosition blockposition) {
+ this.a(this.g);
+ return this.c(blockposition) != null;
+ }
+
+ protected StructureStart c(BlockPosition blockposition) {
+ Iterator iterator = this.c.values().iterator();
+
+ while (iterator.hasNext()) {
+ StructureStart structurestart = (StructureStart) iterator.next();
+
+ if (structurestart.a() && structurestart.b().b((BaseBlockPosition) blockposition)) {
+ Iterator iterator1 = structurestart.c().iterator();
+
+ while (iterator1.hasNext()) {
+ StructurePiece structurepiece = (StructurePiece) iterator1.next();
+
+ if (structurepiece.c().b((BaseBlockPosition) blockposition)) {
+ return structurestart;
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public boolean b(World world, BlockPosition blockposition) {
+ this.a(world);
+ Iterator iterator = this.c.values().iterator();
+
+ StructureStart structurestart;
+
+ do {
+ if (!iterator.hasNext()) {
+ return false;
+ }
+
+ structurestart = (StructureStart) iterator.next();
+ } while (!structurestart.a() || !structurestart.b().b((BaseBlockPosition) blockposition));
+
+ return true;
+ }
+
+ public BlockPosition getNearestGeneratedFeature(World world, BlockPosition blockposition) {
+ this.g = world;
+ this.a(world);
+ this.f.setSeed(world.getSeed());
+ long i = this.f.nextLong();
+ long j = this.f.nextLong();
+ long k = (long) (blockposition.getX() >> 4) * i;
+ long l = (long) (blockposition.getZ() >> 4) * j;
+
+ this.f.setSeed(k ^ l ^ world.getSeed());
+ this.a(world, blockposition.getX() >> 4, blockposition.getZ() >> 4, 0, 0, (ChunkSnapshot) null);
+ double d0 = Double.MAX_VALUE;
+ BlockPosition blockposition1 = null;
+ Iterator iterator = this.c.values().iterator();
+
+ BlockPosition blockposition2;
+ double d1;
+
+ while (iterator.hasNext()) {
+ StructureStart structurestart = (StructureStart) iterator.next();
+
+ if (structurestart.a()) {
+ StructurePiece structurepiece = (StructurePiece) structurestart.c().get(0);
+
+ blockposition2 = structurepiece.a();
+ d1 = blockposition2.k(blockposition);
+ if (d1 < d0) {
+ d0 = d1;
+ blockposition1 = blockposition2;
+ }
+ }
+ }
+
+ if (blockposition1 != null) {
+ return blockposition1;
+ } else {
+ List list = this.E_();
+
+ if (list != null) {
+ BlockPosition blockposition3 = null;
+ Iterator iterator1 = list.iterator();
+
+ while (iterator1.hasNext()) {
+ blockposition2 = (BlockPosition) iterator1.next();
+ d1 = blockposition2.k(blockposition);
+ if (d1 < d0) {
+ d0 = d1;
+ blockposition3 = blockposition2;
+ }
+ }
+
+ return blockposition3;
+ } else {
+ return null;
+ }
+ }
+ }
+
+ protected List<BlockPosition> E_() {
+ return null;
+ }
+
+ protected void a(World world) {
+ if (this.a == null) {
+ this.a = (PersistentStructure) world.a(PersistentStructure.class, this.a());
+ if (this.a == null) {
+ this.a = new PersistentStructure(this.a());
+ world.a(this.a(), (PersistentBase) this.a);
+ } else {
+ NBTTagCompound nbttagcompound = this.a.a();
+ Iterator iterator = nbttagcompound.c().iterator();
+
+ while (iterator.hasNext()) {
+ String s = (String) iterator.next();
+ NBTBase nbtbase = nbttagcompound.get(s);
+
+ if (nbtbase.getTypeId() == 10) {
+ NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbtbase;
+
+ if (nbttagcompound1.hasKey("ChunkX") && nbttagcompound1.hasKey("ChunkZ")) {
+ int i = nbttagcompound1.getInt("ChunkX");
+ int j = nbttagcompound1.getInt("ChunkZ");
+ StructureStart structurestart = WorldGenFactory.a(nbttagcompound1, world);
+
+ if (structurestart != null) {
+ this.c.put(Long.valueOf(ChunkCoordIntPair.a(i, j)), structurestart);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+ private void a(int i, int j, StructureStart structurestart) {
+ this.a.a(structurestart.a(i, j), i, j);
+ this.a.c();
+ }
+
+ protected abstract boolean a(int i, int j);
+
+ protected abstract StructureStart b(int i, int j);
+}
diff --git a/src/main/java/net/minecraft/server/WorldGenLargeFeature.java b/src/main/java/net/minecraft/server/WorldGenLargeFeature.java
new file mode 100644
index 0000000..462dc76
--- /dev/null
+++ b/src/main/java/net/minecraft/server/WorldGenLargeFeature.java
@@ -0,0 +1,139 @@
+package net.minecraft.server;
+
+import com.google.common.collect.Lists;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Map.Entry;
+
+public class WorldGenLargeFeature extends StructureGenerator {
+
+ private static final List<BiomeBase> a = Arrays.asList(new BiomeBase[] { Biomes.d, Biomes.s, Biomes.w, Biomes.x, Biomes.h, Biomes.n, Biomes.F});
+ private List<BiomeBase.BiomeMeta> b;
+ private int d;
+ private int h;
+
+ public WorldGenLargeFeature() {
+ this.b = Lists.newArrayList();
+ this.d = 32;
+ this.h = 8;
+ this.b.add(new BiomeBase.BiomeMeta(EntityWitch.class, 1, 1, 1));
+ }
+
+ public WorldGenLargeFeature(Map<String, String> map) {
+ this();
+ Iterator iterator = map.entrySet().iterator();
+
+ while (iterator.hasNext()) {
+ Entry entry = (Entry) iterator.next();
+
+ if (((String) entry.getKey()).equals("distance")) {
+ this.d = MathHelper.a((String) entry.getValue(), this.d, this.h + 1);
+ }
+ }
+
+ }
+
+ public String a() {
+ return "Temple";
+ }
+
+ protected boolean a(int i, int j) {
+ int k = i;
+ int l = j;
+
+ if (i < 0) {
+ i -= this.d - 1;
+ }
+
+ if (j < 0) {
+ j -= this.d - 1;
+ }
+
+ int i1 = i / this.d;
+ int j1 = j / this.d;
+ Random random = this.g.a(i1, j1, 14357617);
+
+ i1 *= this.d;
+ j1 *= this.d;
+ i1 += random.nextInt(this.d - this.h);
+ j1 += random.nextInt(this.d - this.h);
+ if (k == i1 && l == j1) {
+ BiomeBase biomebase = this.g.getWorldChunkManager().getBiome(new BlockPosition(k * 16 + 8, 0, l * 16 + 8));
+
+ if (biomebase == null) {
+ return false;
+ }
+
+ Iterator iterator = WorldGenLargeFeature.a.iterator();
+
+ while (iterator.hasNext()) {
+ BiomeBase biomebase1 = (BiomeBase) iterator.next();
+
+ if (biomebase == biomebase1) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ protected StructureStart b(int i, int j) {
+ return new WorldGenLargeFeature.WorldGenLargeFeatureStart(this.g, this.f, i, j);
+ }
+
+ public boolean a(BlockPosition blockposition) {
+ StructureStart structurestart = this.c(blockposition);
+
+ if (structurestart != null && structurestart instanceof WorldGenLargeFeature.WorldGenLargeFeatureStart && !structurestart.a.isEmpty()) {
+ StructurePiece structurepiece = (StructurePiece) structurestart.a.get(0);
+
+ return structurepiece instanceof WorldGenRegistration.WorldGenWitchHut;
+ } else {
+ return false;
+ }
+ }
+
+ public List<BiomeBase.BiomeMeta> b() {
+ return this.b;
+ }
+
+ public static class WorldGenLargeFeatureStart extends StructureStart {
+
+ public WorldGenLargeFeatureStart() {}
+
+ public WorldGenLargeFeatureStart(World world, Random random, int i, int j) {
+ this(world, random, i, j, world.getBiome(new BlockPosition(i * 16 + 8, 0, j * 16 + 8)));
+ }
+
+ public WorldGenLargeFeatureStart(World world, Random random, int i, int j, BiomeBase biomebase) {
+ super(i, j);
+ if (biomebase != Biomes.w && biomebase != Biomes.x) {
+ if (biomebase == Biomes.h) {
+ WorldGenRegistration.WorldGenWitchHut worldgenregistration_worldgenwitchhut = new WorldGenRegistration.WorldGenWitchHut(random, i * 16, j * 16);
+
+ this.a.add(worldgenregistration_worldgenwitchhut);
+ } else if (biomebase != Biomes.d && biomebase != Biomes.s) {
+ if (biomebase == Biomes.n || biomebase == Biomes.F) {
+ WorldGenRegistration.b worldgenregistration_b = new WorldGenRegistration.b(random, i * 16, j * 16);
+
+ this.a.add(worldgenregistration_b);
+ }
+ } else {
+ WorldGenRegistration.WorldGenPyramidPiece worldgenregistration_worldgenpyramidpiece = new WorldGenRegistration.WorldGenPyramidPiece(random, i * 16, j * 16);
+
+ this.a.add(worldgenregistration_worldgenpyramidpiece);
+ }
+ } else {
+ WorldGenRegistration.WorldGenJungleTemple worldgenregistration_worldgenjungletemple = new WorldGenRegistration.WorldGenJungleTemple(random, i * 16, j * 16);
+
+ this.a.add(worldgenregistration_worldgenjungletemple);
+ }
+
+ this.d();
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/WorldGenVillage.java b/src/main/java/net/minecraft/server/WorldGenVillage.java
new file mode 100644
index 0000000..2f43742
--- /dev/null
+++ b/src/main/java/net/minecraft/server/WorldGenVillage.java
@@ -0,0 +1,138 @@
+package net.minecraft.server;
+
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Map.Entry;
+
+public class WorldGenVillage extends StructureGenerator {
+
+ public static final List<BiomeBase> a = Arrays.asList(new BiomeBase[] { Biomes.c, Biomes.d, Biomes.K});
+ private int b;
+ private int d;
+ private int h;
+
+ public WorldGenVillage() {
+ this.d = 32;
+ this.h = 8;
+ }
+
+ public WorldGenVillage(Map<String, String> map) {
+ this();
+ Iterator iterator = map.entrySet().iterator();
+
+ while (iterator.hasNext()) {
+ Entry entry = (Entry) iterator.next();
+
+ if (((String) entry.getKey()).equals("size")) {
+ this.b = MathHelper.a((String) entry.getValue(), this.b, 0);
+ } else if (((String) entry.getKey()).equals("distance")) {
+ this.d = MathHelper.a((String) entry.getValue(), this.d, this.h + 1);
+ }
+ }
+
+ }
+
+ public String a() {
+ return "Village";
+ }
+
+ protected boolean a(int i, int j) {
+ int k = i;
+ int l = j;
+
+ if (i < 0) {
+ i -= this.d - 1;
+ }
+
+ if (j < 0) {
+ j -= this.d - 1;
+ }
+
+ int i1 = i / this.d;
+ int j1 = j / this.d;
+ Random random = this.g.a(i1, j1, 10387312);
+
+ i1 *= this.d;
+ j1 *= this.d;
+ i1 += random.nextInt(this.d - this.h);
+ j1 += random.nextInt(this.d - this.h);
+ if (k == i1 && l == j1) {
+ boolean flag = this.g.getWorldChunkManager().a(k * 16 + 8, l * 16 + 8, 0, WorldGenVillage.a);
+
+ if (flag) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ protected StructureStart b(int i, int j) {
+ return new WorldGenVillage.WorldGenVillageStart(this.g, this.f, i, j, this.b);
+ }
+
+ public static class WorldGenVillageStart extends StructureStart {
+
+ private boolean c;
+
+ public WorldGenVillageStart() {}
+
+ public WorldGenVillageStart(World world, Random random, int i, int j, int k) {
+ super(i, j);
+ List list = WorldGenVillagePieces.a(random, k);
+ WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece = new WorldGenVillagePieces.WorldGenVillageStartPiece(world.getWorldChunkManager(), 0, random, (i << 4) + 2, (j << 4) + 2, list, k);
+
+ this.a.add(worldgenvillagepieces_worldgenvillagestartpiece);
+ worldgenvillagepieces_worldgenvillagestartpiece.a((StructurePiece) worldgenvillagepieces_worldgenvillagestartpiece, this.a, random);
+ List list1 = worldgenvillagepieces_worldgenvillagestartpiece.g;
+ List list2 = worldgenvillagepieces_worldgenvillagestartpiece.f;
+
+ int l;
+
+ while (!list1.isEmpty() || !list2.isEmpty()) {
+ StructurePiece structurepiece;
+
+ if (list1.isEmpty()) {
+ l = random.nextInt(list2.size());
+ structurepiece = (StructurePiece) list2.remove(l);
+ structurepiece.a((StructurePiece) worldgenvillagepieces_worldgenvillagestartpiece, this.a, random);
+ } else {
+ l = random.nextInt(list1.size());
+ structurepiece = (StructurePiece) list1.remove(l);
+ structurepiece.a((StructurePiece) worldgenvillagepieces_worldgenvillagestartpiece, this.a, random);
+ }
+ }
+
+ this.d();
+ l = 0;
+ Iterator iterator = this.a.iterator();
+
+ while (iterator.hasNext()) {
+ StructurePiece structurepiece1 = (StructurePiece) iterator.next();
+
+ if (!(structurepiece1 instanceof WorldGenVillagePieces.WorldGenVillageRoadPiece)) {
+ ++l;
+ }
+ }
+
+ this.c = l > 2;
+ }
+
+ public boolean a() {
+ return this.c;
+ }
+
+ public void a(NBTTagCompound nbttagcompound) {
+ super.a(nbttagcompound);
+ nbttagcompound.setBoolean("Valid", this.c);
+ }
+
+ public void b(NBTTagCompound nbttagcompound) {
+ super.b(nbttagcompound);
+ this.c = nbttagcompound.getBoolean("Valid");
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/WorldGenVillagePieces.java b/src/main/java/net/minecraft/server/WorldGenVillagePieces.java
deleted file mode 100644
index 35d3ed1..0000000
--- a/src/main/java/net/minecraft/server/WorldGenVillagePieces.java
+++ /dev/null
@@ -1,1690 +0,0 @@
-package net.minecraft.server;
-
-import com.google.common.collect.Lists;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Random;
-
-public class WorldGenVillagePieces {
-
- public static void a() {
- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageLibrary.class, "ViBH");
- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageFarm2.class, "ViDF");
- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageFarm.class, "ViF");
- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageLight.class, "ViL");
- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageButcher.class, "ViPH");
- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageHouse.class, "ViSH");
- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageHut.class, "ViSmH");
- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageTemple.class, "ViST");
- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageBlacksmith.class, "ViS");
- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageStartPiece.class, "ViStart");
- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageRoad.class, "ViSR");
- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageHouse2.class, "ViTRH");
- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageWell.class, "ViW");
- }
-
- public static List<WorldGenVillagePieces.WorldGenVillagePieceWeight> a(Random random, int i) {
- ArrayList arraylist = Lists.newArrayList();
-
- arraylist.add(new WorldGenVillagePieces.WorldGenVillagePieceWeight(WorldGenVillagePieces.WorldGenVillageHouse.class, 4, MathHelper.nextInt(random, 2 + i, 4 + i * 2)));
- arraylist.add(new WorldGenVillagePieces.WorldGenVillagePieceWeight(WorldGenVillagePieces.WorldGenVillageTemple.class, 20, MathHelper.nextInt(random, 0 + i, 1 + i)));
- arraylist.add(new WorldGenVillagePieces.WorldGenVillagePieceWeight(WorldGenVillagePieces.WorldGenVillageLibrary.class, 20, MathHelper.nextInt(random, 0 + i, 2 + i)));
- arraylist.add(new WorldGenVillagePieces.WorldGenVillagePieceWeight(WorldGenVillagePieces.WorldGenVillageHut.class, 3, MathHelper.nextInt(random, 2 + i, 5 + i * 3)));
- arraylist.add(new WorldGenVillagePieces.WorldGenVillagePieceWeight(WorldGenVillagePieces.WorldGenVillageButcher.class, 15, MathHelper.nextInt(random, 0 + i, 2 + i)));
- arraylist.add(new WorldGenVillagePieces.WorldGenVillagePieceWeight(WorldGenVillagePieces.WorldGenVillageFarm2.class, 3, MathHelper.nextInt(random, 1 + i, 4 + i)));
- arraylist.add(new WorldGenVillagePieces.WorldGenVillagePieceWeight(WorldGenVillagePieces.WorldGenVillageFarm.class, 3, MathHelper.nextInt(random, 2 + i, 4 + i * 2)));
- arraylist.add(new WorldGenVillagePieces.WorldGenVillagePieceWeight(WorldGenVillagePieces.WorldGenVillageBlacksmith.class, 15, MathHelper.nextInt(random, 0, 1 + i)));
- arraylist.add(new WorldGenVillagePieces.WorldGenVillagePieceWeight(WorldGenVillagePieces.WorldGenVillageHouse2.class, 8, MathHelper.nextInt(random, 0 + i, 3 + i * 2)));
- Iterator iterator = arraylist.iterator();
-
- while (iterator.hasNext()) {
- if (((WorldGenVillagePieces.WorldGenVillagePieceWeight) iterator.next()).d == 0) {
- iterator.remove();
- }
- }
-
- return arraylist;
- }
-
- private static int a(List<WorldGenVillagePieces.WorldGenVillagePieceWeight> list) {
- boolean flag = false;
- int i = 0;
-
- WorldGenVillagePieces.WorldGenVillagePieceWeight worldgenvillagepieces_worldgenvillagepieceweight;
-
- for (Iterator iterator = list.iterator(); iterator.hasNext(); i += worldgenvillagepieces_worldgenvillagepieceweight.b) {
- worldgenvillagepieces_worldgenvillagepieceweight = (WorldGenVillagePieces.WorldGenVillagePieceWeight) iterator.next();
- if (worldgenvillagepieces_worldgenvillagepieceweight.d > 0 && worldgenvillagepieces_worldgenvillagepieceweight.c < worldgenvillagepieces_worldgenvillagepieceweight.d) {
- flag = true;
- }
- }
-
- return flag ? i : -1;
- }
-
- private static WorldGenVillagePieces.WorldGenVillagePiece a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, WorldGenVillagePieces.WorldGenVillagePieceWeight worldgenvillagepieces_worldgenvillagepieceweight, List<StructurePiece> list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) {
- Class oclass = worldgenvillagepieces_worldgenvillagepieceweight.a;
- Object object = null;
-
- if (oclass == WorldGenVillagePieces.WorldGenVillageHouse.class) {
- object = WorldGenVillagePieces.WorldGenVillageHouse.a(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection, l);
- } else if (oclass == WorldGenVillagePieces.WorldGenVillageTemple.class) {
- object = WorldGenVillagePieces.WorldGenVillageTemple.a(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection, l);
- } else if (oclass == WorldGenVillagePieces.WorldGenVillageLibrary.class) {
- object = WorldGenVillagePieces.WorldGenVillageLibrary.a(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection, l);
- } else if (oclass == WorldGenVillagePieces.WorldGenVillageHut.class) {
- object = WorldGenVillagePieces.WorldGenVillageHut.a(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection, l);
- } else if (oclass == WorldGenVillagePieces.WorldGenVillageButcher.class) {
- object = WorldGenVillagePieces.WorldGenVillageButcher.a(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection, l);
- } else if (oclass == WorldGenVillagePieces.WorldGenVillageFarm2.class) {
- object = WorldGenVillagePieces.WorldGenVillageFarm2.a(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection, l);
- } else if (oclass == WorldGenVillagePieces.WorldGenVillageFarm.class) {
- object = WorldGenVillagePieces.WorldGenVillageFarm.a(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection, l);
- } else if (oclass == WorldGenVillagePieces.WorldGenVillageBlacksmith.class) {
- object = WorldGenVillagePieces.WorldGenVillageBlacksmith.a(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection, l);
- } else if (oclass == WorldGenVillagePieces.WorldGenVillageHouse2.class) {
- object = WorldGenVillagePieces.WorldGenVillageHouse2.a(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection, l);
- }
-
- return (WorldGenVillagePieces.WorldGenVillagePiece) object;
- }
-
- private static WorldGenVillagePieces.WorldGenVillagePiece c(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List<StructurePiece> list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) {
- int i1 = a(worldgenvillagepieces_worldgenvillagestartpiece.e);
-
- if (i1 <= 0) {
- return null;
- } else {
- int j1 = 0;
-
- while (j1 < 5) {
- ++j1;
- int k1 = random.nextInt(i1);
- Iterator iterator = worldgenvillagepieces_worldgenvillagestartpiece.e.iterator();
-
- while (iterator.hasNext()) {
- WorldGenVillagePieces.WorldGenVillagePieceWeight worldgenvillagepieces_worldgenvillagepieceweight = (WorldGenVillagePieces.WorldGenVillagePieceWeight) iterator.next();
-
- k1 -= worldgenvillagepieces_worldgenvillagepieceweight.b;
- if (k1 < 0) {
- if (!worldgenvillagepieces_worldgenvillagepieceweight.a(l) || worldgenvillagepieces_worldgenvillagepieceweight == worldgenvillagepieces_worldgenvillagestartpiece.d && worldgenvillagepieces_worldgenvillagestartpiece.e.size() > 1) {
- break;
- }
-
- WorldGenVillagePieces.WorldGenVillagePiece worldgenvillagepieces_worldgenvillagepiece = a(worldgenvillagepieces_worldgenvillagestartpiece, worldgenvillagepieces_worldgenvillagepieceweight, list, random, i, j, k, enumdirection, l);
-
- if (worldgenvillagepieces_worldgenvillagepiece != null) {
- ++worldgenvillagepieces_worldgenvillagepieceweight.c;
- worldgenvillagepieces_worldgenvillagestartpiece.d = worldgenvillagepieces_worldgenvillagepieceweight;
- if (!worldgenvillagepieces_worldgenvillagepieceweight.a()) {
- worldgenvillagepieces_worldgenvillagestartpiece.e.remove(worldgenvillagepieces_worldgenvillagepieceweight);
- }
-
- return worldgenvillagepieces_worldgenvillagepiece;
- }
- }
- }
- }
-
- StructureBoundingBox structureboundingbox = WorldGenVillagePieces.WorldGenVillageLight.a(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection);
-
- if (structureboundingbox != null) {
- return new WorldGenVillagePieces.WorldGenVillageLight(worldgenvillagepieces_worldgenvillagestartpiece, l, random, structureboundingbox, enumdirection);
- } else {
- return null;
- }
- }
- }
-
- private static StructurePiece d(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List<StructurePiece> list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) {
- if (l > 50) {
- return null;
- } else if (Math.abs(i - worldgenvillagepieces_worldgenvillagestartpiece.c().a) <= 112 && Math.abs(k - worldgenvillagepieces_worldgenvillagestartpiece.c().c) <= 112) {
- WorldGenVillagePieces.WorldGenVillagePiece worldgenvillagepieces_worldgenvillagepiece = c(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection, l + 1);
-
- if (worldgenvillagepieces_worldgenvillagepiece != null) {
- int i1 = (worldgenvillagepieces_worldgenvillagepiece.l.a + worldgenvillagepieces_worldgenvillagepiece.l.d) / 2;
- int j1 = (worldgenvillagepieces_worldgenvillagepiece.l.c + worldgenvillagepieces_worldgenvillagepiece.l.f) / 2;
- int k1 = worldgenvillagepieces_worldgenvillagepiece.l.d - worldgenvillagepieces_worldgenvillagepiece.l.a;
- int l1 = worldgenvillagepieces_worldgenvillagepiece.l.f - worldgenvillagepieces_worldgenvillagepiece.l.c;
- int i2 = k1 > l1 ? k1 : l1;
-
- if (worldgenvillagepieces_worldgenvillagestartpiece.h().a(i1, j1, i2 / 2 + 4, WorldGenVillage.a)) {
- list.add(worldgenvillagepieces_worldgenvillagepiece);
- worldgenvillagepieces_worldgenvillagestartpiece.f.add(worldgenvillagepieces_worldgenvillagepiece);
- return worldgenvillagepieces_worldgenvillagepiece;
- }
- }
-
- return null;
- } else {
- return null;
- }
- }
-
- private static StructurePiece e(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List<StructurePiece> list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) {
- if (l > 3 + worldgenvillagepieces_worldgenvillagestartpiece.c) {
- return null;
- } else if (Math.abs(i - worldgenvillagepieces_worldgenvillagestartpiece.c().a) <= 112 && Math.abs(k - worldgenvillagepieces_worldgenvillagestartpiece.c().c) <= 112) {
- StructureBoundingBox structureboundingbox = WorldGenVillagePieces.WorldGenVillageRoad.a(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection);
-
- if (structureboundingbox != null && structureboundingbox.b > 10) {
- WorldGenVillagePieces.WorldGenVillageRoad worldgenvillagepieces_worldgenvillageroad = new WorldGenVillagePieces.WorldGenVillageRoad(worldgenvillagepieces_worldgenvillagestartpiece, l, random, structureboundingbox, enumdirection);
- int i1 = (worldgenvillagepieces_worldgenvillageroad.l.a + worldgenvillagepieces_worldgenvillageroad.l.d) / 2;
- int j1 = (worldgenvillagepieces_worldgenvillageroad.l.c + worldgenvillagepieces_worldgenvillageroad.l.f) / 2;
- int k1 = worldgenvillagepieces_worldgenvillageroad.l.d - worldgenvillagepieces_worldgenvillageroad.l.a;
- int l1 = worldgenvillagepieces_worldgenvillageroad.l.f - worldgenvillagepieces_worldgenvillageroad.l.c;
- int i2 = k1 > l1 ? k1 : l1;
-
- if (worldgenvillagepieces_worldgenvillagestartpiece.h().a(i1, j1, i2 / 2 + 4, WorldGenVillage.a)) {
- list.add(worldgenvillagepieces_worldgenvillageroad);
- worldgenvillagepieces_worldgenvillagestartpiece.g.add(worldgenvillagepieces_worldgenvillageroad);
- return worldgenvillagepieces_worldgenvillageroad;
- }
- }
-
- return null;
- } else {
- return null;
- }
- }
-
- static class SyntheticClass_1 {
-
- static final int[] a = new int[EnumDirection.values().length];
-
- static {
- try {
- WorldGenVillagePieces.SyntheticClass_1.a[EnumDirection.NORTH.ordinal()] = 1;
- } catch (NoSuchFieldError nosuchfielderror) {
- ;
- }
-
- try {
- WorldGenVillagePieces.SyntheticClass_1.a[EnumDirection.SOUTH.ordinal()] = 2;
- } catch (NoSuchFieldError nosuchfielderror1) {
- ;
- }
-
- try {
- WorldGenVillagePieces.SyntheticClass_1.a[EnumDirection.WEST.ordinal()] = 3;
- } catch (NoSuchFieldError nosuchfielderror2) {
- ;
- }
-
- try {
- WorldGenVillagePieces.SyntheticClass_1.a[EnumDirection.EAST.ordinal()] = 4;
- } catch (NoSuchFieldError nosuchfielderror3) {
- ;
- }
-
- }
- }
-
- public static class WorldGenVillageLight extends WorldGenVillagePieces.WorldGenVillagePiece {
-
- public WorldGenVillageLight() {}
-
- public WorldGenVillageLight(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, StructureBoundingBox structureboundingbox, EnumDirection enumdirection) {
- super(worldgenvillagepieces_worldgenvillagestartpiece, i);
- this.a(enumdirection);
- this.l = structureboundingbox;
- }
-
- public static StructureBoundingBox a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List<StructurePiece> list, Random random, int i, int j, int k, EnumDirection enumdirection) {
- StructureBoundingBox structureboundingbox = StructureBoundingBox.a(i, j, k, 0, 0, 0, 3, 4, 2, enumdirection);
-
- return StructurePiece.a(list, structureboundingbox) != null ? null : structureboundingbox;
- }
-
- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) {
- if (this.h < 0) {
- this.h = this.b(world, structureboundingbox);
- if (this.h < 0) {
- return true;
- }
-
- this.l.a(0, this.h - this.l.e + 4 - 1, 0);
- }
-
- this.a(world, structureboundingbox, 0, 0, 0, 2, 3, 1, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false);
- this.a(world, Blocks.FENCE.getBlockData(), 1, 0, 0, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 1, 1, 0, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 1, 2, 0, structureboundingbox);
- this.a(world, Blocks.WOOL.fromLegacyData(EnumColor.WHITE.getInvColorIndex()), 1, 3, 0, structureboundingbox);
- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.EAST), 2, 3, 0, structureboundingbox);
- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.NORTH), 1, 3, 1, structureboundingbox);
- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.WEST), 0, 3, 0, structureboundingbox);
- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.SOUTH), 1, 3, -1, structureboundingbox);
- return true;
- }
- }
-
- public static class WorldGenVillageFarm2 extends WorldGenVillagePieces.WorldGenVillagePiece {
-
- private Block a;
- private Block b;
- private Block c;
- private Block d;
-
- public WorldGenVillageFarm2() {}
-
- public WorldGenVillageFarm2(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, StructureBoundingBox structureboundingbox, EnumDirection enumdirection) {
- super(worldgenvillagepieces_worldgenvillagestartpiece, i);
- this.a(enumdirection);
- this.l = structureboundingbox;
- this.a = this.a(random);
- this.b = this.a(random);
- this.c = this.a(random);
- this.d = this.a(random);
- }
-
- protected void a(NBTTagCompound nbttagcompound) {
- super.a(nbttagcompound);
- nbttagcompound.setInt("CA", Block.REGISTRY.a(this.a));
- nbttagcompound.setInt("CB", Block.REGISTRY.a(this.b));
- nbttagcompound.setInt("CC", Block.REGISTRY.a(this.c));
- nbttagcompound.setInt("CD", Block.REGISTRY.a(this.d));
- }
-
- protected void b(NBTTagCompound nbttagcompound) {
- super.b(nbttagcompound);
- this.a = Block.getById(nbttagcompound.getInt("CA"));
- this.b = Block.getById(nbttagcompound.getInt("CB"));
- this.c = Block.getById(nbttagcompound.getInt("CC"));
- this.d = Block.getById(nbttagcompound.getInt("CD"));
- if (!(this.a instanceof BlockCrops)) {
- this.a = Blocks.WHEAT;
- }
-
- if (!(this.b instanceof BlockCrops)) {
- this.b = Blocks.CARROTS;
- }
-
- if (!(this.c instanceof BlockCrops)) {
- this.c = Blocks.POTATOES;
- }
-
- if (!(this.d instanceof BlockCrops)) {
- this.d = Blocks.BEETROOT;
- }
-
- }
-
- private Block a(Random random) {
- switch (random.nextInt(10)) {
- case 0:
- case 1:
- return Blocks.CARROTS;
-
- case 2:
- case 3:
- return Blocks.POTATOES;
-
- case 4:
- return Blocks.BEETROOT;
-
- default:
- return Blocks.WHEAT;
- }
- }
-
- public static WorldGenVillagePieces.WorldGenVillageFarm2 a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List<StructurePiece> list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) {
- StructureBoundingBox structureboundingbox = StructureBoundingBox.a(i, j, k, 0, 0, 0, 13, 4, 9, enumdirection);
-
- return a(structureboundingbox) && StructurePiece.a(list, structureboundingbox) == null ? new WorldGenVillagePieces.WorldGenVillageFarm2(worldgenvillagepieces_worldgenvillagestartpiece, l, random, structureboundingbox, enumdirection) : null;
- }
-
- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) {
- if (this.h < 0) {
- this.h = this.b(world, structureboundingbox);
- if (this.h < 0) {
- return true;
- }
-
- this.l.a(0, this.h - this.l.e + 4 - 1, 0);
- }
-
- this.a(world, structureboundingbox, 0, 1, 0, 12, 4, 8, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 0, 1, 2, 0, 7, Blocks.FARMLAND.getBlockData(), Blocks.FARMLAND.getBlockData(), false);
- this.a(world, structureboundingbox, 4, 0, 1, 5, 0, 7, Blocks.FARMLAND.getBlockData(), Blocks.FARMLAND.getBlockData(), false);
- this.a(world, structureboundingbox, 7, 0, 1, 8, 0, 7, Blocks.FARMLAND.getBlockData(), Blocks.FARMLAND.getBlockData(), false);
- this.a(world, structureboundingbox, 10, 0, 1, 11, 0, 7, Blocks.FARMLAND.getBlockData(), Blocks.FARMLAND.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 0, 0, 0, 0, 8, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false);
- this.a(world, structureboundingbox, 6, 0, 0, 6, 0, 8, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false);
- this.a(world, structureboundingbox, 12, 0, 0, 12, 0, 8, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 0, 0, 11, 0, 0, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 0, 8, 11, 0, 8, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false);
- this.a(world, structureboundingbox, 3, 0, 1, 3, 0, 7, Blocks.WATER.getBlockData(), Blocks.WATER.getBlockData(), false);
- this.a(world, structureboundingbox, 9, 0, 1, 9, 0, 7, Blocks.WATER.getBlockData(), Blocks.WATER.getBlockData(), false);
-
- int i;
- int j;
-
- for (i = 1; i <= 7; ++i) {
- j = ((BlockCrops) this.a).g();
- int k = j / 3;
-
- this.a(world, this.a.fromLegacyData(MathHelper.nextInt(random, k, j)), 1, 1, i, structureboundingbox);
- this.a(world, this.a.fromLegacyData(MathHelper.nextInt(random, k, j)), 2, 1, i, structureboundingbox);
- int l = ((BlockCrops) this.b).g();
- int i1 = l / 3;
-
- this.a(world, this.b.fromLegacyData(MathHelper.nextInt(random, i1, l)), 4, 1, i, structureboundingbox);
- this.a(world, this.b.fromLegacyData(MathHelper.nextInt(random, i1, l)), 5, 1, i, structureboundingbox);
- int j1 = ((BlockCrops) this.c).g();
- int k1 = j1 / 3;
-
- this.a(world, this.c.fromLegacyData(MathHelper.nextInt(random, k1, j1)), 7, 1, i, structureboundingbox);
- this.a(world, this.c.fromLegacyData(MathHelper.nextInt(random, k1, j1)), 8, 1, i, structureboundingbox);
- int l1 = ((BlockCrops) this.d).g();
- int i2 = l1 / 3;
-
- this.a(world, this.d.fromLegacyData(MathHelper.nextInt(random, i2, l1)), 10, 1, i, structureboundingbox);
- this.a(world, this.d.fromLegacyData(MathHelper.nextInt(random, i2, l1)), 11, 1, i, structureboundingbox);
- }
-
- for (i = 0; i < 9; ++i) {
- for (j = 0; j < 13; ++j) {
- this.b(world, j, 4, i, structureboundingbox);
- this.b(world, Blocks.DIRT.getBlockData(), j, -1, i, structureboundingbox);
- }
- }
-
- return true;
- }
- }
-
- public static class WorldGenVillageFarm extends WorldGenVillagePieces.WorldGenVillagePiece {
-
- private Block a;
- private Block b;
-
- public WorldGenVillageFarm() {}
-
- public WorldGenVillageFarm(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, StructureBoundingBox structureboundingbox, EnumDirection enumdirection) {
- super(worldgenvillagepieces_worldgenvillagestartpiece, i);
- this.a(enumdirection);
- this.l = structureboundingbox;
- this.a = this.a(random);
- this.b = this.a(random);
- }
-
- protected void a(NBTTagCompound nbttagcompound) {
- super.a(nbttagcompound);
- nbttagcompound.setInt("CA", Block.REGISTRY.a(this.a));
- nbttagcompound.setInt("CB", Block.REGISTRY.a(this.b));
- }
-
- protected void b(NBTTagCompound nbttagcompound) {
- super.b(nbttagcompound);
- this.a = Block.getById(nbttagcompound.getInt("CA"));
- this.b = Block.getById(nbttagcompound.getInt("CB"));
- }
-
- private Block a(Random random) {
- switch (random.nextInt(10)) {
- case 0:
- case 1:
- return Blocks.CARROTS;
-
- case 2:
- case 3:
- return Blocks.POTATOES;
-
- case 4:
- return Blocks.BEETROOT;
-
- default:
- return Blocks.WHEAT;
- }
- }
-
- public static WorldGenVillagePieces.WorldGenVillageFarm a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List<StructurePiece> list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) {
- StructureBoundingBox structureboundingbox = StructureBoundingBox.a(i, j, k, 0, 0, 0, 7, 4, 9, enumdirection);
-
- return a(structureboundingbox) && StructurePiece.a(list, structureboundingbox) == null ? new WorldGenVillagePieces.WorldGenVillageFarm(worldgenvillagepieces_worldgenvillagestartpiece, l, random, structureboundingbox, enumdirection) : null;
- }
-
- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) {
- if (this.h < 0) {
- this.h = this.b(world, structureboundingbox);
- if (this.h < 0) {
- return true;
- }
-
- this.l.a(0, this.h - this.l.e + 4 - 1, 0);
- }
-
- this.a(world, structureboundingbox, 0, 1, 0, 6, 4, 8, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 0, 1, 2, 0, 7, Blocks.FARMLAND.getBlockData(), Blocks.FARMLAND.getBlockData(), false);
- this.a(world, structureboundingbox, 4, 0, 1, 5, 0, 7, Blocks.FARMLAND.getBlockData(), Blocks.FARMLAND.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 0, 0, 0, 0, 8, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false);
- this.a(world, structureboundingbox, 6, 0, 0, 6, 0, 8, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 0, 0, 5, 0, 0, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 0, 8, 5, 0, 8, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false);
- this.a(world, structureboundingbox, 3, 0, 1, 3, 0, 7, Blocks.WATER.getBlockData(), Blocks.WATER.getBlockData(), false);
-
- int i;
- int j;
-
- for (i = 1; i <= 7; ++i) {
- j = ((BlockCrops) this.a).g();
- int k = j / 3;
-
- this.a(world, this.a.fromLegacyData(MathHelper.nextInt(random, k, j)), 1, 1, i, structureboundingbox);
- this.a(world, this.a.fromLegacyData(MathHelper.nextInt(random, k, j)), 2, 1, i, structureboundingbox);
- int l = ((BlockCrops) this.b).g();
- int i1 = l / 3;
-
- this.a(world, this.b.fromLegacyData(MathHelper.nextInt(random, i1, l)), 4, 1, i, structureboundingbox);
- this.a(world, this.b.fromLegacyData(MathHelper.nextInt(random, i1, l)), 5, 1, i, structureboundingbox);
- }
-
- for (i = 0; i < 9; ++i) {
- for (j = 0; j < 7; ++j) {
- this.b(world, j, 4, i, structureboundingbox);
- this.b(world, Blocks.DIRT.getBlockData(), j, -1, i, structureboundingbox);
- }
- }
-
- return true;
- }
- }
-
- public static class WorldGenVillageBlacksmith extends WorldGenVillagePieces.WorldGenVillagePiece {
-
- private boolean a;
-
- public WorldGenVillageBlacksmith() {}
-
- public WorldGenVillageBlacksmith(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, StructureBoundingBox structureboundingbox, EnumDirection enumdirection) {
- super(worldgenvillagepieces_worldgenvillagestartpiece, i);
- this.a(enumdirection);
- this.l = structureboundingbox;
- }
-
- public static WorldGenVillagePieces.WorldGenVillageBlacksmith a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List<StructurePiece> list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) {
- StructureBoundingBox structureboundingbox = StructureBoundingBox.a(i, j, k, 0, 0, 0, 10, 6, 7, enumdirection);
-
- return a(structureboundingbox) && StructurePiece.a(list, structureboundingbox) == null ? new WorldGenVillagePieces.WorldGenVillageBlacksmith(worldgenvillagepieces_worldgenvillagestartpiece, l, random, structureboundingbox, enumdirection) : null;
- }
-
- protected void a(NBTTagCompound nbttagcompound) {
- super.a(nbttagcompound);
- nbttagcompound.setBoolean("Chest", this.a);
- }
-
- protected void b(NBTTagCompound nbttagcompound) {
- super.b(nbttagcompound);
- this.a = nbttagcompound.getBoolean("Chest");
- }
-
- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) {
- if (this.h < 0) {
- this.h = this.b(world, structureboundingbox);
- if (this.h < 0) {
- return true;
- }
-
- this.l.a(0, this.h - this.l.e + 6 - 1, 0);
- }
-
- this.a(world, structureboundingbox, 0, 1, 0, 9, 4, 6, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 0, 0, 9, 0, 6, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 4, 0, 9, 4, 6, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 5, 0, 9, 5, 6, Blocks.STONE_SLAB.getBlockData(), Blocks.STONE_SLAB.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 5, 1, 8, 5, 5, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 1, 0, 2, 3, 0, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 1, 0, 0, 4, 0, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false);
- this.a(world, structureboundingbox, 3, 1, 0, 3, 4, 0, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 1, 6, 0, 4, 6, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false);
- this.a(world, Blocks.PLANKS.getBlockData(), 3, 3, 1, structureboundingbox);
- this.a(world, structureboundingbox, 3, 1, 2, 3, 3, 2, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 4, 1, 3, 5, 3, 3, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 1, 1, 0, 3, 5, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 1, 6, 5, 3, 6, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 5, 1, 0, 5, 3, 0, Blocks.FENCE.getBlockData(), Blocks.FENCE.getBlockData(), false);
- this.a(world, structureboundingbox, 9, 1, 0, 9, 3, 0, Blocks.FENCE.getBlockData(), Blocks.FENCE.getBlockData(), false);
- this.a(world, structureboundingbox, 6, 1, 4, 9, 4, 6, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, Blocks.FLOWING_LAVA.getBlockData(), 7, 1, 5, structureboundingbox);
- this.a(world, Blocks.FLOWING_LAVA.getBlockData(), 8, 1, 5, structureboundingbox);
- this.a(world, Blocks.IRON_BARS.getBlockData(), 9, 2, 5, structureboundingbox);
- this.a(world, Blocks.IRON_BARS.getBlockData(), 9, 2, 4, structureboundingbox);
- this.a(world, structureboundingbox, 7, 2, 4, 8, 2, 5, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false);
- this.a(world, Blocks.COBBLESTONE.getBlockData(), 6, 1, 3, structureboundingbox);
- this.a(world, Blocks.FURNACE.getBlockData(), 6, 2, 3, structureboundingbox);
- this.a(world, Blocks.FURNACE.getBlockData(), 6, 3, 3, structureboundingbox);
- this.a(world, Blocks.DOUBLE_STONE_SLAB.getBlockData(), 8, 1, 1, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 2, 2, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 2, 4, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 2, 2, 6, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 4, 2, 6, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 2, 1, 4, structureboundingbox);
- this.a(world, Blocks.WOODEN_PRESSURE_PLATE.getBlockData(), 2, 2, 4, structureboundingbox);
- this.a(world, Blocks.PLANKS.getBlockData(), 1, 1, 5, structureboundingbox);
- this.a(world, Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.NORTH), 2, 1, 5, structureboundingbox);
- this.a(world, Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.WEST), 1, 1, 4, structureboundingbox);
- if (!this.a && structureboundingbox.b((BaseBlockPosition) (new BlockPosition(this.a(5, 5), this.d(1), this.b(5, 5))))) {
- this.a = true;
- this.a(world, structureboundingbox, random, 5, 1, 5, LootTables.e);
- }
-
- int i;
-
- for (i = 6; i <= 8; ++i) {
- if (this.a(world, i, 0, -1, structureboundingbox).getMaterial() == Material.AIR && this.a(world, i, -1, -1, structureboundingbox).getMaterial() != Material.AIR) {
- this.a(world, Blocks.STONE_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.NORTH), i, 0, -1, structureboundingbox);
- }
- }
-
- for (i = 0; i < 7; ++i) {
- for (int j = 0; j < 10; ++j) {
- this.b(world, j, 6, i, structureboundingbox);
- this.b(world, Blocks.COBBLESTONE.getBlockData(), j, -1, i, structureboundingbox);
- }
- }
-
- this.a(world, structureboundingbox, 7, 1, 1, 1);
- return true;
- }
-
- protected int c(int i, int j) {
- return 3;
- }
- }
-
- public static class WorldGenVillageHouse2 extends WorldGenVillagePieces.WorldGenVillagePiece {
-
- public WorldGenVillageHouse2() {}
-
- public WorldGenVillageHouse2(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, StructureBoundingBox structureboundingbox, EnumDirection enumdirection) {
- super(worldgenvillagepieces_worldgenvillagestartpiece, i);
- this.a(enumdirection);
- this.l = structureboundingbox;
- }
-
- public static WorldGenVillagePieces.WorldGenVillageHouse2 a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List<StructurePiece> list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) {
- StructureBoundingBox structureboundingbox = StructureBoundingBox.a(i, j, k, 0, 0, 0, 9, 7, 12, enumdirection);
-
- return a(structureboundingbox) && StructurePiece.a(list, structureboundingbox) == null ? new WorldGenVillagePieces.WorldGenVillageHouse2(worldgenvillagepieces_worldgenvillagestartpiece, l, random, structureboundingbox, enumdirection) : null;
- }
-
- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) {
- if (this.h < 0) {
- this.h = this.b(world, structureboundingbox);
- if (this.h < 0) {
- return true;
- }
-
- this.l.a(0, this.h - this.l.e + 7 - 1, 0);
- }
-
- this.a(world, structureboundingbox, 1, 1, 1, 7, 4, 4, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false);
- this.a(world, structureboundingbox, 2, 1, 6, 8, 4, 10, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false);
- this.a(world, structureboundingbox, 2, 0, 5, 8, 0, 10, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 0, 1, 7, 0, 4, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 0, 0, 0, 3, 5, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 8, 0, 0, 8, 3, 10, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 0, 0, 7, 2, 0, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 0, 5, 2, 1, 5, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 2, 0, 6, 2, 3, 10, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 3, 0, 10, 7, 3, 10, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 2, 0, 7, 3, 0, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 2, 5, 2, 3, 5, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 4, 1, 8, 4, 1, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 4, 4, 3, 4, 4, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 5, 2, 8, 5, 3, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, Blocks.PLANKS.getBlockData(), 0, 4, 2, structureboundingbox);
- this.a(world, Blocks.PLANKS.getBlockData(), 0, 4, 3, structureboundingbox);
- this.a(world, Blocks.PLANKS.getBlockData(), 8, 4, 2, structureboundingbox);
- this.a(world, Blocks.PLANKS.getBlockData(), 8, 4, 3, structureboundingbox);
- this.a(world, Blocks.PLANKS.getBlockData(), 8, 4, 4, structureboundingbox);
- IBlockData iblockdata = Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.NORTH);
- IBlockData iblockdata1 = Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.SOUTH);
- IBlockData iblockdata2 = Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.WEST);
- IBlockData iblockdata3 = Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.EAST);
-
- int i;
- int j;
-
- for (i = -1; i <= 2; ++i) {
- for (j = 0; j <= 8; ++j) {
- this.a(world, iblockdata, j, 4 + i, i, structureboundingbox);
- if ((i > -1 || j <= 1) && (i > 0 || j <= 3) && (i > 1 || j <= 4 || j >= 6)) {
- this.a(world, iblockdata1, j, 4 + i, 5 - i, structureboundingbox);
- }
- }
- }
-
- this.a(world, structureboundingbox, 3, 4, 5, 3, 4, 10, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 7, 4, 2, 7, 4, 10, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 4, 5, 4, 4, 5, 10, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 6, 5, 4, 6, 5, 10, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 5, 6, 3, 5, 6, 10, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
-
- for (i = 4; i >= 1; --i) {
- this.a(world, Blocks.PLANKS.getBlockData(), i, 2 + i, 7 - i, structureboundingbox);
-
- for (j = 8 - i; j <= 10; ++j) {
- this.a(world, iblockdata3, i, 2 + i, j, structureboundingbox);
- }
- }
-
- this.a(world, Blocks.PLANKS.getBlockData(), 6, 6, 3, structureboundingbox);
- this.a(world, Blocks.PLANKS.getBlockData(), 7, 5, 4, structureboundingbox);
- this.a(world, iblockdata2, 6, 6, 4, structureboundingbox);
-
- for (i = 6; i <= 8; ++i) {
- for (j = 5; j <= 10; ++j) {
- this.a(world, iblockdata2, i, 12 - i, j, structureboundingbox);
- }
- }
-
- this.a(world, Blocks.LOG.getBlockData(), 0, 2, 1, structureboundingbox);
- this.a(world, Blocks.LOG.getBlockData(), 0, 2, 4, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 2, 2, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 2, 3, structureboundingbox);
- this.a(world, Blocks.LOG.getBlockData(), 4, 2, 0, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 5, 2, 0, structureboundingbox);
- this.a(world, Blocks.LOG.getBlockData(), 6, 2, 0, structureboundingbox);
- this.a(world, Blocks.LOG.getBlockData(), 8, 2, 1, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 8, 2, 2, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 8, 2, 3, structureboundingbox);
- this.a(world, Blocks.LOG.getBlockData(), 8, 2, 4, structureboundingbox);
- this.a(world, Blocks.PLANKS.getBlockData(), 8, 2, 5, structureboundingbox);
- this.a(world, Blocks.LOG.getBlockData(), 8, 2, 6, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 8, 2, 7, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 8, 2, 8, structureboundingbox);
- this.a(world, Blocks.LOG.getBlockData(), 8, 2, 9, structureboundingbox);
- this.a(world, Blocks.LOG.getBlockData(), 2, 2, 6, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 2, 2, 7, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 2, 2, 8, structureboundingbox);
- this.a(world, Blocks.LOG.getBlockData(), 2, 2, 9, structureboundingbox);
- this.a(world, Blocks.LOG.getBlockData(), 4, 4, 10, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 5, 4, 10, structureboundingbox);
- this.a(world, Blocks.LOG.getBlockData(), 6, 4, 10, structureboundingbox);
- this.a(world, Blocks.PLANKS.getBlockData(), 5, 5, 10, structureboundingbox);
- this.a(world, Blocks.AIR.getBlockData(), 2, 1, 0, structureboundingbox);
- this.a(world, Blocks.AIR.getBlockData(), 2, 2, 0, structureboundingbox);
- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.NORTH), 2, 3, 1, structureboundingbox);
- this.a(world, structureboundingbox, random, 2, 1, 0, EnumDirection.NORTH);
- this.a(world, structureboundingbox, 1, 0, -1, 3, 2, -1, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false);
- if (this.a(world, 2, 0, -1, structureboundingbox).getMaterial() == Material.AIR && this.a(world, 2, -1, -1, structureboundingbox).getMaterial() != Material.AIR) {
- this.a(world, iblockdata, 2, 0, -1, structureboundingbox);
- }
-
- for (i = 0; i < 5; ++i) {
- for (j = 0; j < 9; ++j) {
- this.b(world, j, 7, i, structureboundingbox);
- this.b(world, Blocks.COBBLESTONE.getBlockData(), j, -1, i, structureboundingbox);
- }
- }
-
- for (i = 5; i < 11; ++i) {
- for (j = 2; j < 9; ++j) {
- this.b(world, j, 7, i, structureboundingbox);
- this.b(world, Blocks.COBBLESTONE.getBlockData(), j, -1, i, structureboundingbox);
- }
- }
-
- this.a(world, structureboundingbox, 4, 1, 2, 2);
- return true;
- }
- }
-
- public static class WorldGenVillageButcher extends WorldGenVillagePieces.WorldGenVillagePiece {
-
- public WorldGenVillageButcher() {}
-
- public WorldGenVillageButcher(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, StructureBoundingBox structureboundingbox, EnumDirection enumdirection) {
- super(worldgenvillagepieces_worldgenvillagestartpiece, i);
- this.a(enumdirection);
- this.l = structureboundingbox;
- }
-
- public static WorldGenVillagePieces.WorldGenVillageButcher a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List<StructurePiece> list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) {
- StructureBoundingBox structureboundingbox = StructureBoundingBox.a(i, j, k, 0, 0, 0, 9, 7, 11, enumdirection);
-
- return a(structureboundingbox) && StructurePiece.a(list, structureboundingbox) == null ? new WorldGenVillagePieces.WorldGenVillageButcher(worldgenvillagepieces_worldgenvillagestartpiece, l, random, structureboundingbox, enumdirection) : null;
- }
-
- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) {
- if (this.h < 0) {
- this.h = this.b(world, structureboundingbox);
- if (this.h < 0) {
- return true;
- }
-
- this.l.a(0, this.h - this.l.e + 7 - 1, 0);
- }
-
- this.a(world, structureboundingbox, 1, 1, 1, 7, 4, 4, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false);
- this.a(world, structureboundingbox, 2, 1, 6, 8, 4, 10, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false);
- this.a(world, structureboundingbox, 2, 0, 6, 8, 0, 10, Blocks.DIRT.getBlockData(), Blocks.DIRT.getBlockData(), false);
- this.a(world, Blocks.COBBLESTONE.getBlockData(), 6, 0, 6, structureboundingbox);
- this.a(world, structureboundingbox, 2, 1, 6, 2, 1, 10, Blocks.FENCE.getBlockData(), Blocks.FENCE.getBlockData(), false);
- this.a(world, structureboundingbox, 8, 1, 6, 8, 1, 10, Blocks.FENCE.getBlockData(), Blocks.FENCE.getBlockData(), false);
- this.a(world, structureboundingbox, 3, 1, 10, 7, 1, 10, Blocks.FENCE.getBlockData(), Blocks.FENCE.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 0, 1, 7, 0, 4, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 0, 0, 0, 3, 5, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 8, 0, 0, 8, 3, 5, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 0, 0, 7, 1, 0, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 0, 5, 7, 1, 5, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 2, 0, 7, 3, 0, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 2, 5, 7, 3, 5, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 4, 1, 8, 4, 1, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 4, 4, 8, 4, 4, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 5, 2, 8, 5, 3, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, Blocks.PLANKS.getBlockData(), 0, 4, 2, structureboundingbox);
- this.a(world, Blocks.PLANKS.getBlockData(), 0, 4, 3, structureboundingbox);
- this.a(world, Blocks.PLANKS.getBlockData(), 8, 4, 2, structureboundingbox);
- this.a(world, Blocks.PLANKS.getBlockData(), 8, 4, 3, structureboundingbox);
- IBlockData iblockdata = Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.NORTH);
- IBlockData iblockdata1 = Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.SOUTH);
- IBlockData iblockdata2 = Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.WEST);
-
- int i;
- int j;
-
- for (i = -1; i <= 2; ++i) {
- for (j = 0; j <= 8; ++j) {
- this.a(world, iblockdata, j, 4 + i, i, structureboundingbox);
- this.a(world, iblockdata1, j, 4 + i, 5 - i, structureboundingbox);
- }
- }
-
- this.a(world, Blocks.LOG.getBlockData(), 0, 2, 1, structureboundingbox);
- this.a(world, Blocks.LOG.getBlockData(), 0, 2, 4, structureboundingbox);
- this.a(world, Blocks.LOG.getBlockData(), 8, 2, 1, structureboundingbox);
- this.a(world, Blocks.LOG.getBlockData(), 8, 2, 4, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 2, 2, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 2, 3, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 8, 2, 2, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 8, 2, 3, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 2, 2, 5, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 3, 2, 5, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 5, 2, 0, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 6, 2, 5, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 2, 1, 3, structureboundingbox);
- this.a(world, Blocks.WOODEN_PRESSURE_PLATE.getBlockData(), 2, 2, 3, structureboundingbox);
- this.a(world, Blocks.PLANKS.getBlockData(), 1, 1, 4, structureboundingbox);
- this.a(world, iblockdata, 2, 1, 4, structureboundingbox);
- this.a(world, iblockdata2, 1, 1, 3, structureboundingbox);
- this.a(world, structureboundingbox, 5, 0, 1, 7, 0, 3, Blocks.DOUBLE_STONE_SLAB.getBlockData(), Blocks.DOUBLE_STONE_SLAB.getBlockData(), false);
- this.a(world, Blocks.DOUBLE_STONE_SLAB.getBlockData(), 6, 1, 1, structureboundingbox);
- this.a(world, Blocks.DOUBLE_STONE_SLAB.getBlockData(), 6, 1, 2, structureboundingbox);
- this.a(world, Blocks.AIR.getBlockData(), 2, 1, 0, structureboundingbox);
- this.a(world, Blocks.AIR.getBlockData(), 2, 2, 0, structureboundingbox);
- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.NORTH), 2, 3, 1, structureboundingbox);
- this.a(world, structureboundingbox, random, 2, 1, 0, EnumDirection.NORTH);
- if (this.a(world, 2, 0, -1, structureboundingbox).getMaterial() == Material.AIR && this.a(world, 2, -1, -1, structureboundingbox).getMaterial() != Material.AIR) {
- this.a(world, iblockdata, 2, 0, -1, structureboundingbox);
- }
-
- this.a(world, Blocks.AIR.getBlockData(), 6, 1, 5, structureboundingbox);
- this.a(world, Blocks.AIR.getBlockData(), 6, 2, 5, structureboundingbox);
- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.SOUTH), 6, 3, 4, structureboundingbox);
- this.a(world, structureboundingbox, random, 6, 1, 5, EnumDirection.SOUTH);
-
- for (i = 0; i < 5; ++i) {
- for (j = 0; j < 9; ++j) {
- this.b(world, j, 7, i, structureboundingbox);
- this.b(world, Blocks.COBBLESTONE.getBlockData(), j, -1, i, structureboundingbox);
- }
- }
-
- this.a(world, structureboundingbox, 4, 1, 2, 2);
- return true;
- }
-
- protected int c(int i, int j) {
- return i == 0 ? 4 : super.c(i, j);
- }
- }
-
- public static class WorldGenVillageHut extends WorldGenVillagePieces.WorldGenVillagePiece {
-
- private boolean a;
- private int b;
-
- public WorldGenVillageHut() {}
-
- public WorldGenVillageHut(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, StructureBoundingBox structureboundingbox, EnumDirection enumdirection) {
- super(worldgenvillagepieces_worldgenvillagestartpiece, i);
- this.a(enumdirection);
- this.l = structureboundingbox;
- this.a = random.nextBoolean();
- this.b = random.nextInt(3);
- }
-
- protected void a(NBTTagCompound nbttagcompound) {
- super.a(nbttagcompound);
- nbttagcompound.setInt("T", this.b);
- nbttagcompound.setBoolean("C", this.a);
- }
-
- protected void b(NBTTagCompound nbttagcompound) {
- super.b(nbttagcompound);
- this.b = nbttagcompound.getInt("T");
- this.a = nbttagcompound.getBoolean("C");
- }
-
- public static WorldGenVillagePieces.WorldGenVillageHut a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List<StructurePiece> list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) {
- StructureBoundingBox structureboundingbox = StructureBoundingBox.a(i, j, k, 0, 0, 0, 4, 6, 5, enumdirection);
-
- return a(structureboundingbox) && StructurePiece.a(list, structureboundingbox) == null ? new WorldGenVillagePieces.WorldGenVillageHut(worldgenvillagepieces_worldgenvillagestartpiece, l, random, structureboundingbox, enumdirection) : null;
- }
-
- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) {
- if (this.h < 0) {
- this.h = this.b(world, structureboundingbox);
- if (this.h < 0) {
- return true;
- }
-
- this.l.a(0, this.h - this.l.e + 6 - 1, 0);
- }
-
- this.a(world, structureboundingbox, 1, 1, 1, 3, 5, 4, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 0, 0, 3, 0, 4, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 0, 1, 2, 0, 3, Blocks.DIRT.getBlockData(), Blocks.DIRT.getBlockData(), false);
- if (this.a) {
- this.a(world, structureboundingbox, 1, 4, 1, 2, 4, 3, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false);
- } else {
- this.a(world, structureboundingbox, 1, 5, 1, 2, 5, 3, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false);
- }
-
- this.a(world, Blocks.LOG.getBlockData(), 1, 4, 0, structureboundingbox);
- this.a(world, Blocks.LOG.getBlockData(), 2, 4, 0, structureboundingbox);
- this.a(world, Blocks.LOG.getBlockData(), 1, 4, 4, structureboundingbox);
- this.a(world, Blocks.LOG.getBlockData(), 2, 4, 4, structureboundingbox);
- this.a(world, Blocks.LOG.getBlockData(), 0, 4, 1, structureboundingbox);
- this.a(world, Blocks.LOG.getBlockData(), 0, 4, 2, structureboundingbox);
- this.a(world, Blocks.LOG.getBlockData(), 0, 4, 3, structureboundingbox);
- this.a(world, Blocks.LOG.getBlockData(), 3, 4, 1, structureboundingbox);
- this.a(world, Blocks.LOG.getBlockData(), 3, 4, 2, structureboundingbox);
- this.a(world, Blocks.LOG.getBlockData(), 3, 4, 3, structureboundingbox);
- this.a(world, structureboundingbox, 0, 1, 0, 0, 3, 0, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false);
- this.a(world, structureboundingbox, 3, 1, 0, 3, 3, 0, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 1, 4, 0, 3, 4, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false);
- this.a(world, structureboundingbox, 3, 1, 4, 3, 3, 4, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 1, 1, 0, 3, 3, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 3, 1, 1, 3, 3, 3, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 1, 0, 2, 3, 0, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 1, 4, 2, 3, 4, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 2, 2, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 3, 2, 2, structureboundingbox);
- if (this.b > 0) {
- this.a(world, Blocks.FENCE.getBlockData(), this.b, 1, 3, structureboundingbox);
- this.a(world, Blocks.WOODEN_PRESSURE_PLATE.getBlockData(), this.b, 2, 3, structureboundingbox);
- }
-
- this.a(world, Blocks.AIR.getBlockData(), 1, 1, 0, structureboundingbox);
- this.a(world, Blocks.AIR.getBlockData(), 1, 2, 0, structureboundingbox);
- this.a(world, structureboundingbox, random, 1, 1, 0, EnumDirection.NORTH);
- if (this.a(world, 1, 0, -1, structureboundingbox).getMaterial() == Material.AIR && this.a(world, 1, -1, -1, structureboundingbox).getMaterial() != Material.AIR) {
- this.a(world, Blocks.STONE_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.NORTH), 1, 0, -1, structureboundingbox);
- }
-
- for (int i = 0; i < 5; ++i) {
- for (int j = 0; j < 4; ++j) {
- this.b(world, j, 6, i, structureboundingbox);
- this.b(world, Blocks.COBBLESTONE.getBlockData(), j, -1, i, structureboundingbox);
- }
- }
-
- this.a(world, structureboundingbox, 1, 1, 2, 1);
- return true;
- }
- }
-
- public static class WorldGenVillageLibrary extends WorldGenVillagePieces.WorldGenVillagePiece {
-
- public WorldGenVillageLibrary() {}
-
- public WorldGenVillageLibrary(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, StructureBoundingBox structureboundingbox, EnumDirection enumdirection) {
- super(worldgenvillagepieces_worldgenvillagestartpiece, i);
- this.a(enumdirection);
- this.l = structureboundingbox;
- }
-
- public static WorldGenVillagePieces.WorldGenVillageLibrary a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List<StructurePiece> list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) {
- StructureBoundingBox structureboundingbox = StructureBoundingBox.a(i, j, k, 0, 0, 0, 9, 9, 6, enumdirection);
-
- return a(structureboundingbox) && StructurePiece.a(list, structureboundingbox) == null ? new WorldGenVillagePieces.WorldGenVillageLibrary(worldgenvillagepieces_worldgenvillagestartpiece, l, random, structureboundingbox, enumdirection) : null;
- }
-
- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) {
- if (this.h < 0) {
- this.h = this.b(world, structureboundingbox);
- if (this.h < 0) {
- return true;
- }
-
- this.l.a(0, this.h - this.l.e + 9 - 1, 0);
- }
-
- this.a(world, structureboundingbox, 1, 1, 1, 7, 5, 4, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 0, 0, 8, 0, 5, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 5, 0, 8, 5, 5, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 6, 1, 8, 6, 4, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 7, 2, 8, 7, 3, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
-
- int i;
-
- for (int j = -1; j <= 2; ++j) {
- for (i = 0; i <= 8; ++i) {
- this.a(world, Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.NORTH), i, 6 + j, j, structureboundingbox);
- this.a(world, Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.SOUTH), i, 6 + j, 5 - j, structureboundingbox);
- }
- }
-
- this.a(world, structureboundingbox, 0, 1, 0, 0, 1, 5, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 1, 5, 8, 1, 5, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 8, 1, 0, 8, 1, 4, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 2, 1, 0, 7, 1, 0, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 2, 0, 0, 4, 0, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 2, 5, 0, 4, 5, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 8, 2, 5, 8, 4, 5, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 8, 2, 0, 8, 4, 0, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 2, 1, 0, 4, 4, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 2, 5, 7, 4, 5, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 8, 2, 1, 8, 4, 4, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 2, 0, 7, 4, 0, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 4, 2, 0, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 5, 2, 0, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 6, 2, 0, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 4, 3, 0, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 5, 3, 0, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 6, 3, 0, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 2, 2, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 2, 3, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 3, 2, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 3, 3, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 8, 2, 2, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 8, 2, 3, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 8, 3, 2, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 8, 3, 3, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 2, 2, 5, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 3, 2, 5, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 5, 2, 5, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 6, 2, 5, structureboundingbox);
- this.a(world, structureboundingbox, 1, 4, 1, 7, 4, 1, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 4, 4, 7, 4, 4, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 3, 4, 7, 3, 4, Blocks.BOOKSHELF.getBlockData(), Blocks.BOOKSHELF.getBlockData(), false);
- this.a(world, Blocks.PLANKS.getBlockData(), 7, 1, 4, structureboundingbox);
- this.a(world, Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.EAST), 7, 1, 3, structureboundingbox);
- IBlockData iblockdata = Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.NORTH);
-
- this.a(world, iblockdata, 6, 1, 4, structureboundingbox);
- this.a(world, iblockdata, 5, 1, 4, structureboundingbox);
- this.a(world, iblockdata, 4, 1, 4, structureboundingbox);
- this.a(world, iblockdata, 3, 1, 4, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 6, 1, 3, structureboundingbox);
- this.a(world, Blocks.WOODEN_PRESSURE_PLATE.getBlockData(), 6, 2, 3, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 4, 1, 3, structureboundingbox);
- this.a(world, Blocks.WOODEN_PRESSURE_PLATE.getBlockData(), 4, 2, 3, structureboundingbox);
- this.a(world, Blocks.CRAFTING_TABLE.getBlockData(), 7, 1, 1, structureboundingbox);
- this.a(world, Blocks.AIR.getBlockData(), 1, 1, 0, structureboundingbox);
- this.a(world, Blocks.AIR.getBlockData(), 1, 2, 0, structureboundingbox);
- this.a(world, structureboundingbox, random, 1, 1, 0, EnumDirection.NORTH);
- if (this.a(world, 1, 0, -1, structureboundingbox).getMaterial() == Material.AIR && this.a(world, 1, -1, -1, structureboundingbox).getMaterial() != Material.AIR) {
- this.a(world, Blocks.STONE_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.NORTH), 1, 0, -1, structureboundingbox);
- }
-
- for (i = 0; i < 6; ++i) {
- for (int k = 0; k < 9; ++k) {
- this.b(world, k, 9, i, structureboundingbox);
- this.b(world, Blocks.COBBLESTONE.getBlockData(), k, -1, i, structureboundingbox);
- }
- }
-
- this.a(world, structureboundingbox, 2, 1, 2, 1);
- return true;
- }
-
- protected int c(int i, int j) {
- return 1;
- }
- }
-
- public static class WorldGenVillageTemple extends WorldGenVillagePieces.WorldGenVillagePiece {
-
- public WorldGenVillageTemple() {}
-
- public WorldGenVillageTemple(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, StructureBoundingBox structureboundingbox, EnumDirection enumdirection) {
- super(worldgenvillagepieces_worldgenvillagestartpiece, i);
- this.a(enumdirection);
- this.l = structureboundingbox;
- }
-
- public static WorldGenVillagePieces.WorldGenVillageTemple a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List<StructurePiece> list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) {
- StructureBoundingBox structureboundingbox = StructureBoundingBox.a(i, j, k, 0, 0, 0, 5, 12, 9, enumdirection);
-
- return a(structureboundingbox) && StructurePiece.a(list, structureboundingbox) == null ? new WorldGenVillagePieces.WorldGenVillageTemple(worldgenvillagepieces_worldgenvillagestartpiece, l, random, structureboundingbox, enumdirection) : null;
- }
-
- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) {
- if (this.h < 0) {
- this.h = this.b(world, structureboundingbox);
- if (this.h < 0) {
- return true;
- }
-
- this.l.a(0, this.h - this.l.e + 12 - 1, 0);
- }
-
- this.a(world, structureboundingbox, 1, 1, 1, 3, 3, 7, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 5, 1, 3, 9, 3, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 0, 0, 3, 0, 8, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 1, 0, 3, 10, 0, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 1, 1, 0, 10, 3, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 4, 1, 1, 4, 10, 3, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 0, 4, 0, 4, 7, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 4, 0, 4, 4, 4, 7, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 1, 8, 3, 4, 8, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 5, 4, 3, 10, 4, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 5, 5, 3, 5, 7, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 9, 0, 4, 9, 4, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 4, 0, 4, 4, 4, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, Blocks.COBBLESTONE.getBlockData(), 0, 11, 2, structureboundingbox);
- this.a(world, Blocks.COBBLESTONE.getBlockData(), 4, 11, 2, structureboundingbox);
- this.a(world, Blocks.COBBLESTONE.getBlockData(), 2, 11, 0, structureboundingbox);
- this.a(world, Blocks.COBBLESTONE.getBlockData(), 2, 11, 4, structureboundingbox);
- this.a(world, Blocks.COBBLESTONE.getBlockData(), 1, 1, 6, structureboundingbox);
- this.a(world, Blocks.COBBLESTONE.getBlockData(), 1, 1, 7, structureboundingbox);
- this.a(world, Blocks.COBBLESTONE.getBlockData(), 2, 1, 7, structureboundingbox);
- this.a(world, Blocks.COBBLESTONE.getBlockData(), 3, 1, 6, structureboundingbox);
- this.a(world, Blocks.COBBLESTONE.getBlockData(), 3, 1, 7, structureboundingbox);
- IBlockData iblockdata = Blocks.STONE_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.NORTH);
- IBlockData iblockdata1 = Blocks.STONE_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.WEST);
- IBlockData iblockdata2 = Blocks.STONE_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.EAST);
-
- this.a(world, iblockdata, 1, 1, 5, structureboundingbox);
- this.a(world, iblockdata, 2, 1, 6, structureboundingbox);
- this.a(world, iblockdata, 3, 1, 5, structureboundingbox);
- this.a(world, iblockdata1, 1, 2, 7, structureboundingbox);
- this.a(world, iblockdata2, 3, 2, 7, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 2, 2, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 3, 2, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 4, 2, 2, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 4, 3, 2, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 6, 2, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 7, 2, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 4, 6, 2, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 4, 7, 2, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 2, 6, 0, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 2, 7, 0, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 2, 6, 4, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 2, 7, 4, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 3, 6, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 4, 3, 6, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 2, 3, 8, structureboundingbox);
- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.SOUTH), 2, 4, 7, structureboundingbox);
- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.EAST), 1, 4, 6, structureboundingbox);
- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.WEST), 3, 4, 6, structureboundingbox);
- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.NORTH), 2, 4, 5, structureboundingbox);
- IBlockData iblockdata3 = Blocks.LADDER.getBlockData().set(BlockLadder.FACING, EnumDirection.WEST);
-
- int i;
-
- for (i = 1; i <= 9; ++i) {
- this.a(world, iblockdata3, 3, i, 3, structureboundingbox);
- }
-
- this.a(world, Blocks.AIR.getBlockData(), 2, 1, 0, structureboundingbox);
- this.a(world, Blocks.AIR.getBlockData(), 2, 2, 0, structureboundingbox);
- this.a(world, structureboundingbox, random, 2, 1, 0, EnumDirection.NORTH);
- if (this.a(world, 2, 0, -1, structureboundingbox).getMaterial() == Material.AIR && this.a(world, 2, -1, -1, structureboundingbox).getMaterial() != Material.AIR) {
- this.a(world, iblockdata, 2, 0, -1, structureboundingbox);
- }
-
- for (i = 0; i < 9; ++i) {
- for (int j = 0; j < 5; ++j) {
- this.b(world, j, 12, i, structureboundingbox);
- this.b(world, Blocks.COBBLESTONE.getBlockData(), j, -1, i, structureboundingbox);
- }
- }
-
- this.a(world, structureboundingbox, 2, 1, 2, 1);
- return true;
- }
-
- protected int c(int i, int j) {
- return 2;
- }
- }
-
- public static class WorldGenVillageHouse extends WorldGenVillagePieces.WorldGenVillagePiece {
-
- private boolean a;
-
- public WorldGenVillageHouse() {}
-
- public WorldGenVillageHouse(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, StructureBoundingBox structureboundingbox, EnumDirection enumdirection) {
- super(worldgenvillagepieces_worldgenvillagestartpiece, i);
- this.a(enumdirection);
- this.l = structureboundingbox;
- this.a = random.nextBoolean();
- }
-
- protected void a(NBTTagCompound nbttagcompound) {
- super.a(nbttagcompound);
- nbttagcompound.setBoolean("Terrace", this.a);
- }
-
- protected void b(NBTTagCompound nbttagcompound) {
- super.b(nbttagcompound);
- this.a = nbttagcompound.getBoolean("Terrace");
- }
-
- public static WorldGenVillagePieces.WorldGenVillageHouse a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List<StructurePiece> list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) {
- StructureBoundingBox structureboundingbox = StructureBoundingBox.a(i, j, k, 0, 0, 0, 5, 6, 5, enumdirection);
-
- return StructurePiece.a(list, structureboundingbox) != null ? null : new WorldGenVillagePieces.WorldGenVillageHouse(worldgenvillagepieces_worldgenvillagestartpiece, l, random, structureboundingbox, enumdirection);
- }
-
- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) {
- if (this.h < 0) {
- this.h = this.b(world, structureboundingbox);
- if (this.h < 0) {
- return true;
- }
-
- this.l.a(0, this.h - this.l.e + 6 - 1, 0);
- }
-
- this.a(world, structureboundingbox, 0, 0, 0, 4, 0, 4, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
- this.a(world, structureboundingbox, 0, 4, 0, 4, 4, 4, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 4, 1, 3, 4, 3, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, Blocks.COBBLESTONE.getBlockData(), 0, 1, 0, structureboundingbox);
- this.a(world, Blocks.COBBLESTONE.getBlockData(), 0, 2, 0, structureboundingbox);
- this.a(world, Blocks.COBBLESTONE.getBlockData(), 0, 3, 0, structureboundingbox);
- this.a(world, Blocks.COBBLESTONE.getBlockData(), 4, 1, 0, structureboundingbox);
- this.a(world, Blocks.COBBLESTONE.getBlockData(), 4, 2, 0, structureboundingbox);
- this.a(world, Blocks.COBBLESTONE.getBlockData(), 4, 3, 0, structureboundingbox);
- this.a(world, Blocks.COBBLESTONE.getBlockData(), 0, 1, 4, structureboundingbox);
- this.a(world, Blocks.COBBLESTONE.getBlockData(), 0, 2, 4, structureboundingbox);
- this.a(world, Blocks.COBBLESTONE.getBlockData(), 0, 3, 4, structureboundingbox);
- this.a(world, Blocks.COBBLESTONE.getBlockData(), 4, 1, 4, structureboundingbox);
- this.a(world, Blocks.COBBLESTONE.getBlockData(), 4, 2, 4, structureboundingbox);
- this.a(world, Blocks.COBBLESTONE.getBlockData(), 4, 3, 4, structureboundingbox);
- this.a(world, structureboundingbox, 0, 1, 1, 0, 3, 3, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 4, 1, 1, 4, 3, 3, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, structureboundingbox, 1, 1, 4, 3, 3, 4, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 2, 2, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 2, 2, 4, structureboundingbox);
- this.a(world, Blocks.GLASS_PANE.getBlockData(), 4, 2, 2, structureboundingbox);
- this.a(world, Blocks.PLANKS.getBlockData(), 1, 1, 0, structureboundingbox);
- this.a(world, Blocks.PLANKS.getBlockData(), 1, 2, 0, structureboundingbox);
- this.a(world, Blocks.PLANKS.getBlockData(), 1, 3, 0, structureboundingbox);
- this.a(world, Blocks.PLANKS.getBlockData(), 2, 3, 0, structureboundingbox);
- this.a(world, Blocks.PLANKS.getBlockData(), 3, 3, 0, structureboundingbox);
- this.a(world, Blocks.PLANKS.getBlockData(), 3, 2, 0, structureboundingbox);
- this.a(world, Blocks.PLANKS.getBlockData(), 3, 1, 0, structureboundingbox);
- if (this.a(world, 2, 0, -1, structureboundingbox).getMaterial() == Material.AIR && this.a(world, 2, -1, -1, structureboundingbox).getMaterial() != Material.AIR) {
- this.a(world, Blocks.STONE_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.NORTH), 2, 0, -1, structureboundingbox);
- }
-
- this.a(world, structureboundingbox, 1, 1, 1, 3, 3, 3, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false);
- if (this.a) {
- this.a(world, Blocks.FENCE.getBlockData(), 0, 5, 0, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 1, 5, 0, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 2, 5, 0, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 3, 5, 0, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 4, 5, 0, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 0, 5, 4, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 1, 5, 4, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 2, 5, 4, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 3, 5, 4, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 4, 5, 4, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 4, 5, 1, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 4, 5, 2, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 4, 5, 3, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 0, 5, 1, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 0, 5, 2, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 0, 5, 3, structureboundingbox);
- }
-
- if (this.a) {
- IBlockData iblockdata = Blocks.LADDER.getBlockData().set(BlockLadder.FACING, EnumDirection.SOUTH);
-
- this.a(world, iblockdata, 3, 1, 3, structureboundingbox);
- this.a(world, iblockdata, 3, 2, 3, structureboundingbox);
- this.a(world, iblockdata, 3, 3, 3, structureboundingbox);
- this.a(world, iblockdata, 3, 4, 3, structureboundingbox);
- }
-
- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.NORTH), 2, 3, 1, structureboundingbox);
-
- for (int i = 0; i < 5; ++i) {
- for (int j = 0; j < 5; ++j) {
- this.b(world, j, 6, i, structureboundingbox);
- this.b(world, Blocks.COBBLESTONE.getBlockData(), j, -1, i, structureboundingbox);
- }
- }
-
- this.a(world, structureboundingbox, 1, 1, 2, 1);
- return true;
- }
- }
-
- public static class WorldGenVillageRoad extends WorldGenVillagePieces.WorldGenVillageRoadPiece {
-
- private int a;
-
- public WorldGenVillageRoad() {}
-
- public WorldGenVillageRoad(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, StructureBoundingBox structureboundingbox, EnumDirection enumdirection) {
- super(worldgenvillagepieces_worldgenvillagestartpiece, i);
- this.a(enumdirection);
- this.l = structureboundingbox;
- this.a = Math.max(structureboundingbox.c(), structureboundingbox.e());
- }
-
- protected void a(NBTTagCompound nbttagcompound) {
- super.a(nbttagcompound);
- nbttagcompound.setInt("Length", this.a);
- }
-
- protected void b(NBTTagCompound nbttagcompound) {
- super.b(nbttagcompound);
- this.a = nbttagcompound.getInt("Length");
- }
-
- public void a(StructurePiece structurepiece, List<StructurePiece> list, Random random) {
- boolean flag = false;
-
- int i;
- StructurePiece structurepiece1;
-
- for (i = random.nextInt(5); i < this.a - 8; i += 2 + random.nextInt(5)) {
- structurepiece1 = this.a((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, 0, i);
- if (structurepiece1 != null) {
- i += Math.max(structurepiece1.l.c(), structurepiece1.l.e());
- flag = true;
- }
- }
-
- for (i = random.nextInt(5); i < this.a - 8; i += 2 + random.nextInt(5)) {
- structurepiece1 = this.b((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, 0, i);
- if (structurepiece1 != null) {
- i += Math.max(structurepiece1.l.c(), structurepiece1.l.e());
- flag = true;
- }
- }
-
- EnumDirection enumdirection = this.e();
-
- if (flag && random.nextInt(3) > 0 && enumdirection != null) {
- switch (WorldGenVillagePieces.SyntheticClass_1.a[enumdirection.ordinal()]) {
- case 1:
- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.a - 1, this.l.b, this.l.c, EnumDirection.WEST, this.d());
- break;
-
- case 2:
- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.a - 1, this.l.b, this.l.f - 2, EnumDirection.WEST, this.d());
- break;
-
- case 3:
- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.a, this.l.b, this.l.c - 1, EnumDirection.NORTH, this.d());
- break;
-
- case 4:
- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.d - 2, this.l.b, this.l.c - 1, EnumDirection.NORTH, this.d());
- }
- }
-
- if (flag && random.nextInt(3) > 0 && enumdirection != null) {
- switch (WorldGenVillagePieces.SyntheticClass_1.a[enumdirection.ordinal()]) {
- case 1:
- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.d + 1, this.l.b, this.l.c, EnumDirection.EAST, this.d());
- break;
-
- case 2:
- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.d + 1, this.l.b, this.l.f - 2, EnumDirection.EAST, this.d());
- break;
-
- case 3:
- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.a, this.l.b, this.l.f + 1, EnumDirection.SOUTH, this.d());
- break;
-
- case 4:
- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.d - 2, this.l.b, this.l.f + 1, EnumDirection.SOUTH, this.d());
- }
- }
-
- }
-
- public static StructureBoundingBox a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List<StructurePiece> list, Random random, int i, int j, int k, EnumDirection enumdirection) {
- for (int l = 7 * MathHelper.nextInt(random, 3, 5); l >= 7; l -= 7) {
- StructureBoundingBox structureboundingbox = StructureBoundingBox.a(i, j, k, 0, 0, 0, 3, 3, l, enumdirection);
-
- if (StructurePiece.a(list, structureboundingbox) == null) {
- return structureboundingbox;
- }
- }
-
- return null;
- }
-
- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) {
- IBlockData iblockdata = this.a(Blocks.GRAVEL.getBlockData());
- IBlockData iblockdata1 = this.a(Blocks.COBBLESTONE.getBlockData());
-
- for (int i = this.l.a; i <= this.l.d; ++i) {
- for (int j = this.l.c; j <= this.l.f; ++j) {
- BlockPosition blockposition = new BlockPosition(i, 64, j);
-
- if (structureboundingbox.b((BaseBlockPosition) blockposition)) {
- blockposition = world.q(blockposition).down();
- world.setTypeAndData(blockposition, iblockdata, 2);
- world.setTypeAndData(blockposition.down(), iblockdata1, 2);
- }
- }
- }
-
- return true;
- }
- }
-
- public abstract static class WorldGenVillageRoadPiece extends WorldGenVillagePieces.WorldGenVillagePiece {
-
- public WorldGenVillageRoadPiece() {}
-
- protected WorldGenVillageRoadPiece(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i) {
- super(worldgenvillagepieces_worldgenvillagestartpiece, i);
- }
- }
-
- public static class WorldGenVillageStartPiece extends WorldGenVillagePieces.WorldGenVillageWell {
-
- public WorldChunkManager a;
- public boolean b;
- public int c;
- public WorldGenVillagePieces.WorldGenVillagePieceWeight d;
- public List<WorldGenVillagePieces.WorldGenVillagePieceWeight> e;
- public List<StructurePiece> f = Lists.newArrayList();
- public List<StructurePiece> g = Lists.newArrayList();
-
- public WorldGenVillageStartPiece() {}
-
- public WorldGenVillageStartPiece(WorldChunkManager worldchunkmanager, int i, Random random, int j, int k, List<WorldGenVillagePieces.WorldGenVillagePieceWeight> list, int l) {
- super((WorldGenVillagePieces.WorldGenVillageStartPiece) null, 0, random, j, k);
- this.a = worldchunkmanager;
- this.e = list;
- this.c = l;
- BiomeBase biomebase = worldchunkmanager.getBiome(new BlockPosition(j, 0, k), Biomes.b);
-
- this.b = biomebase == Biomes.d || biomebase == Biomes.s;
- this.a(this.b);
- }
-
- public WorldChunkManager h() {
- return this.a;
- }
- }
-
- public static class WorldGenVillageWell extends WorldGenVillagePieces.WorldGenVillagePiece {
-
- public WorldGenVillageWell() {}
-
- public WorldGenVillageWell(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, int j, int k) {
- super(worldgenvillagepieces_worldgenvillagestartpiece, i);
- this.a(EnumDirection.EnumDirectionLimit.HORIZONTAL.a(random));
- if (this.e().k() == EnumDirection.EnumAxis.Z) {
- this.l = new StructureBoundingBox(j, 64, k, j + 6 - 1, 78, k + 6 - 1);
- } else {
- this.l = new StructureBoundingBox(j, 64, k, j + 6 - 1, 78, k + 6 - 1);
- }
-
- }
-
- public void a(StructurePiece structurepiece, List<StructurePiece> list, Random random) {
- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.a - 1, this.l.e - 4, this.l.c + 1, EnumDirection.WEST, this.d());
- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.d + 1, this.l.e - 4, this.l.c + 1, EnumDirection.EAST, this.d());
- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.a + 1, this.l.e - 4, this.l.c - 1, EnumDirection.NORTH, this.d());
- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.a + 1, this.l.e - 4, this.l.f + 1, EnumDirection.SOUTH, this.d());
- }
-
- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) {
- if (this.h < 0) {
- this.h = this.b(world, structureboundingbox);
- if (this.h < 0) {
- return true;
- }
-
- this.l.a(0, this.h - this.l.e + 3, 0);
- }
-
- this.a(world, structureboundingbox, 1, 0, 1, 4, 12, 4, Blocks.COBBLESTONE.getBlockData(), Blocks.FLOWING_WATER.getBlockData(), false);
- this.a(world, Blocks.AIR.getBlockData(), 2, 12, 2, structureboundingbox);
- this.a(world, Blocks.AIR.getBlockData(), 3, 12, 2, structureboundingbox);
- this.a(world, Blocks.AIR.getBlockData(), 2, 12, 3, structureboundingbox);
- this.a(world, Blocks.AIR.getBlockData(), 3, 12, 3, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 1, 13, 1, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 1, 14, 1, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 4, 13, 1, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 4, 14, 1, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 1, 13, 4, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 1, 14, 4, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 4, 13, 4, structureboundingbox);
- this.a(world, Blocks.FENCE.getBlockData(), 4, 14, 4, structureboundingbox);
- this.a(world, structureboundingbox, 1, 15, 1, 4, 15, 4, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false);
-
- for (int i = 0; i <= 5; ++i) {
- for (int j = 0; j <= 5; ++j) {
- if (j == 0 || j == 5 || i == 0 || i == 5) {
- this.a(world, Blocks.GRAVEL.getBlockData(), j, 11, i, structureboundingbox);
- this.b(world, j, 12, i, structureboundingbox);
- }
- }
- }
-
- return true;
- }
- }
-
- abstract static class WorldGenVillagePiece extends StructurePiece {
-
- protected int h = -1;
- private int a;
- private boolean b;
-
- public WorldGenVillagePiece() {}
-
- protected WorldGenVillagePiece(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i) {
- super(i);
- if (worldgenvillagepieces_worldgenvillagestartpiece != null) {
- this.b = worldgenvillagepieces_worldgenvillagestartpiece.b;
- }
-
- }
-
- protected void a(NBTTagCompound nbttagcompound) {
- nbttagcompound.setInt("HPos", this.h);
- nbttagcompound.setInt("VCount", this.a);
- nbttagcompound.setBoolean("Desert", this.b);
- }
-
- protected void b(NBTTagCompound nbttagcompound) {
- this.h = nbttagcompound.getInt("HPos");
- this.a = nbttagcompound.getInt("VCount");
- this.b = nbttagcompound.getBoolean("Desert");
- }
-
- protected StructurePiece a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List<StructurePiece> list, Random random, int i, int j) {
- EnumDirection enumdirection = this.e();
-
- if (enumdirection != null) {
- switch (WorldGenVillagePieces.SyntheticClass_1.a[enumdirection.ordinal()]) {
- case 1:
- return WorldGenVillagePieces.d(worldgenvillagepieces_worldgenvillagestartpiece, list, random, this.l.a - 1, this.l.b + i, this.l.c + j, EnumDirection.WEST, this.d());
-
- case 2:
- return WorldGenVillagePieces.d(worldgenvillagepieces_worldgenvillagestartpiece, list, random, this.l.a - 1, this.l.b + i, this.l.c + j, EnumDirection.WEST, this.d());
-
- case 3:
- return WorldGenVillagePieces.d(worldgenvillagepieces_worldgenvillagestartpiece, list, random, this.l.a + j, this.l.b + i, this.l.c - 1, EnumDirection.NORTH, this.d());
-
- case 4:
- return WorldGenVillagePieces.d(worldgenvillagepieces_worldgenvillagestartpiece, list, random, this.l.a + j, this.l.b + i, this.l.c - 1, EnumDirection.NORTH, this.d());
- }
- }
-
- return null;
- }
-
- protected StructurePiece b(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List<StructurePiece> list, Random random, int i, int j) {
- EnumDirection enumdirection = this.e();
-
- if (enumdirection != null) {
- switch (WorldGenVillagePieces.SyntheticClass_1.a[enumdirection.ordinal()]) {
- case 1:
- return WorldGenVillagePieces.d(worldgenvillagepieces_worldgenvillagestartpiece, list, random, this.l.d + 1, this.l.b + i, this.l.c + j, EnumDirection.EAST, this.d());
-
- case 2:
- return WorldGenVillagePieces.d(worldgenvillagepieces_worldgenvillagestartpiece, list, random, this.l.d + 1, this.l.b + i, this.l.c + j, EnumDirection.EAST, this.d());
-
- case 3:
- return WorldGenVillagePieces.d(worldgenvillagepieces_worldgenvillagestartpiece, list, random, this.l.a + j, this.l.b + i, this.l.f + 1, EnumDirection.SOUTH, this.d());
-
- case 4:
- return WorldGenVillagePieces.d(worldgenvillagepieces_worldgenvillagestartpiece, list, random, this.l.a + j, this.l.b + i, this.l.f + 1, EnumDirection.SOUTH, this.d());
- }
- }
-
- return null;
- }
-
- protected int b(World world, StructureBoundingBox structureboundingbox) {
- int i = 0;
- int j = 0;
- BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
-
- for (int k = this.l.c; k <= this.l.f; ++k) {
- for (int l = this.l.a; l <= this.l.d; ++l) {
- blockposition_mutableblockposition.c(l, 64, k);
- if (structureboundingbox.b((BaseBlockPosition) blockposition_mutableblockposition)) {
- i += Math.max(world.q(blockposition_mutableblockposition).getY(), world.worldProvider.getSeaLevel());
- ++j;
- }
- }
- }
-
- if (j == 0) {
- return -1;
- } else {
- return i / j;
- }
- }
-
- protected static boolean a(StructureBoundingBox structureboundingbox) {
- return structureboundingbox != null && structureboundingbox.b > 10;
- }
-
- protected void a(World world, StructureBoundingBox structureboundingbox, int i, int j, int k, int l) {
- if (this.a < l) {
- for (int i1 = this.a; i1 < l; ++i1) {
- int j1 = this.a(i + i1, k);
- int k1 = this.d(j);
- int l1 = this.b(i + i1, k);
-
- if (!structureboundingbox.b((BaseBlockPosition) (new BlockPosition(j1, k1, l1)))) {
- break;
- }
-
- ++this.a;
- EntityVillager entityvillager = new EntityVillager(world);
-
- entityvillager.setPositionRotation((double) j1 + 0.5D, (double) k1, (double) l1 + 0.5D, 0.0F, 0.0F);
- entityvillager.prepare(world.D(new BlockPosition(entityvillager)), (GroupDataEntity) null);
- entityvillager.setProfession(this.c(i1, entityvillager.getProfession()));
- world.addEntity(entityvillager, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason
- }
-
- }
- }
-
- protected int c(int i, int j) {
- return j;
- }
-
- protected IBlockData a(IBlockData iblockdata) {
- if (this.b) {
- if (iblockdata.getBlock() == Blocks.LOG || iblockdata.getBlock() == Blocks.LOG2) {
- return Blocks.SANDSTONE.getBlockData();
- }
-
- if (iblockdata.getBlock() == Blocks.COBBLESTONE) {
- return Blocks.SANDSTONE.fromLegacyData(BlockSandStone.EnumSandstoneVariant.DEFAULT.a());
- }
-
- if (iblockdata.getBlock() == Blocks.PLANKS) {
- return Blocks.SANDSTONE.fromLegacyData(BlockSandStone.EnumSandstoneVariant.SMOOTH.a());
- }
-
- if (iblockdata.getBlock() == Blocks.OAK_STAIRS) {
- return Blocks.SANDSTONE_STAIRS.getBlockData().set(BlockStairs.FACING, iblockdata.get(BlockStairs.FACING));
- }
-
- if (iblockdata.getBlock() == Blocks.STONE_STAIRS) {
- return Blocks.SANDSTONE_STAIRS.getBlockData().set(BlockStairs.FACING, iblockdata.get(BlockStairs.FACING));
- }
-
- if (iblockdata.getBlock() == Blocks.GRAVEL) {
- return Blocks.SANDSTONE.getBlockData();
- }
- }
-
- return iblockdata;
- }
-
- protected void a(World world, IBlockData iblockdata, int i, int j, int k, StructureBoundingBox structureboundingbox) {
- IBlockData iblockdata1 = this.a(iblockdata);
-
- super.a(world, iblockdata1, i, j, k, structureboundingbox);
- }
-
- protected void a(World world, StructureBoundingBox structureboundingbox, int i, int j, int k, int l, int i1, int j1, IBlockData iblockdata, IBlockData iblockdata1, boolean flag) {
- IBlockData iblockdata2 = this.a(iblockdata);
- IBlockData iblockdata3 = this.a(iblockdata1);
-
- super.a(world, structureboundingbox, i, j, k, l, i1, j1, iblockdata2, iblockdata3, flag);
- }
-
- protected void b(World world, IBlockData iblockdata, int i, int j, int k, StructureBoundingBox structureboundingbox) {
- IBlockData iblockdata1 = this.a(iblockdata);
-
- super.b(world, iblockdata1, i, j, k, structureboundingbox);
- }
-
- protected void a(boolean flag) {
- this.b = flag;
- }
- }
-
- public static class WorldGenVillagePieceWeight {
-
- public Class<? extends WorldGenVillagePieces.WorldGenVillagePiece> a;
- public final int b;
- public int c;
- public int d;
-
- public WorldGenVillagePieceWeight(Class<? extends WorldGenVillagePieces.WorldGenVillagePiece> oclass, int i, int j) {
- this.a = oclass;
- this.b = i;
- this.d = j;
- }
-
- public boolean a(int i) {
- return this.d == 0 || this.c < this.d;
- }
-
- public boolean a() {
- return this.d == 0 || this.c < this.d;
- }
- }
-}
diff --git a/src/main/java/org/spigotmc/SneakyThrow.java b/src/main/java/org/spigotmc/SneakyThrow.java
new file mode 100644
index 0000000..31fc0a9
--- /dev/null
+++ b/src/main/java/org/spigotmc/SneakyThrow.java
@@ -0,0 +1,15 @@
+package org.spigotmc;
+
+public class SneakyThrow
+{
+
+ public static void sneaky(Throwable t)
+ {
+ throw SneakyThrow.<RuntimeException>superSneaky( t );
+ }
+
+ private static <T extends Throwable> T superSneaky(Throwable t) throws T
+ {
+ throw (T) t;
+ }
+}
--
2.5.0