summaryrefslogtreecommitdiff
path: root/src/main/java/jp/plusplus/fbs/world/structure
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/jp/plusplus/fbs/world/structure')
-rw-r--r--src/main/java/jp/plusplus/fbs/world/structure/MapGenSealdLib.classbin0 -> 1846 bytes
-rw-r--r--src/main/java/jp/plusplus/fbs/world/structure/MapGenSealdLib.java75
-rw-r--r--src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy$Start.classbin0 -> 1019 bytes
-rw-r--r--src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy$Structure.classbin0 -> 7928 bytes
-rw-r--r--src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy.classbin0 -> 2065 bytes
-rw-r--r--src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy.java379
-rw-r--r--src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLib1.classbin0 -> 4515 bytes
-rw-r--r--src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLib1.java115
-rw-r--r--src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLibStart.classbin0 -> 1490 bytes
-rw-r--r--src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLibStart.java49
10 files changed, 618 insertions, 0 deletions
diff --git a/src/main/java/jp/plusplus/fbs/world/structure/MapGenSealdLib.class b/src/main/java/jp/plusplus/fbs/world/structure/MapGenSealdLib.class
new file mode 100644
index 0000000..2301f28
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/world/structure/MapGenSealdLib.class
Binary files differ
diff --git a/src/main/java/jp/plusplus/fbs/world/structure/MapGenSealdLib.java b/src/main/java/jp/plusplus/fbs/world/structure/MapGenSealdLib.java
new file mode 100644
index 0000000..4baa9bb
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/world/structure/MapGenSealdLib.java
@@ -0,0 +1,75 @@
+package jp.plusplus.fbs.world.structure;
+
+import jp.plusplus.fbs.FBS;
+import net.minecraft.entity.item.EntityEnderEye;
+import net.minecraft.item.ItemEnderEye;
+import net.minecraft.world.World;
+import net.minecraft.world.gen.structure.MapGenScatteredFeature;
+import net.minecraft.world.gen.structure.MapGenStructure;
+import net.minecraft.world.gen.structure.StructureStart;
+
+import java.util.Random;
+
+/**
+ * Createdby pluslus_Fon 2015/06/06.
+ */
+public class MapGenSealdLib extends MapGenStructure {
+ public MapGenSealdLib() {
+ }
+
+ @Override
+ public String func_143025_a() {
+ return "Sealed Library";
+ }
+
+ @Override
+ protected boolean canSpawnStructureAtCoords(int i, int j) {
+ boolean f=isLibraryChunk(worldObj, i, j);
+ //if(f) FBS.logger.info("generated at:"+i+","+j);
+ //EntityEnderEye
+ //ItemEnderEye
+ return f;
+ }
+
+ @Override
+ protected StructureStart getStructureStart(int i, int j) {
+ return new StructureSealedLibStart(this.worldObj, this.rand, i, j);
+ }
+
+ /**
+ * それが図書館生成チャンクであるかどうか
+ *
+ * @param x
+ * @param z
+ * @return
+ */
+ public static boolean isLibraryChunk(World w, int x, int z) {
+ int max = 4;
+ int min = 1;
+
+ int k = x;
+ int l = z;
+
+ if (x < 0) {
+ x -= max - 1;
+ }
+
+ if (z < 0) {
+ z -= max - 1;
+ }
+
+ int i1 = x / max;
+ int j1 = z / max;
+
+ long seed = (long) i1 * 341873128712L + (long) j1 * 132897987541L + w.getWorldInfo().getSeed() + (long) 14357617;
+ Random random = new Random(seed);
+
+ i1 *= max;
+ j1 *= max;
+ i1 += random.nextInt(max - min);
+ j1 += random.nextInt(max - min);
+
+ return (k == i1 && l == j1);
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy$Start.class b/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy$Start.class
new file mode 100644
index 0000000..b077be6
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy$Start.class
Binary files differ
diff --git a/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy$Structure.class b/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy$Structure.class
new file mode 100644
index 0000000..c572eae
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy$Structure.class
Binary files differ
diff --git a/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy.class b/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy.class
new file mode 100644
index 0000000..504b193
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy.class
Binary files differ
diff --git a/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy.java b/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy.java
new file mode 100644
index 0000000..7114085
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy.java
@@ -0,0 +1,379 @@
+package jp.plusplus.fbs.world.structure;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.block.BlockCore;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockRotatedPillar;
+import net.minecraft.block.BlockStairs;
+import net.minecraft.init.Blocks;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.gen.structure.*;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/08/24.
+ * 「魔力の秋」にのみ生成される、地上でありながら書物を得られる構造物
+ *
+ * こんなクッソ面倒な仕様にしやがって!
+ * もっと他にやり方あっただろ!
+ */
+public class MapGenStudy extends MapGenStructure {
+ private int maxDistanceBetweenScatteredFeatures=12;
+ private int minDistanceBetweenScatteredFeatures=3;
+
+ @Override
+ public String func_143025_a() {
+ return "Study";
+ }
+
+ @Override
+ protected boolean canSpawnStructureAtCoords(int p_75047_1_, int p_75047_2_) {
+ int k = p_75047_1_;
+ int l = p_75047_2_;
+
+ //
+ //if(k%4==0 || l%4==0) return true;
+
+ if (p_75047_1_ < 0) {
+ p_75047_1_ -= this.maxDistanceBetweenScatteredFeatures - 1;
+ }
+
+ if (p_75047_2_ < 0) {
+ p_75047_2_ -= this.maxDistanceBetweenScatteredFeatures - 1;
+ }
+
+ int i1 = p_75047_1_ / this.maxDistanceBetweenScatteredFeatures;
+ int j1 = p_75047_2_ / this.maxDistanceBetweenScatteredFeatures;
+ Random random = this.worldObj.setRandomSeed(i1, j1, 14357617);
+ i1 *= this.maxDistanceBetweenScatteredFeatures;
+ j1 *= this.maxDistanceBetweenScatteredFeatures;
+ i1 += random.nextInt(this.maxDistanceBetweenScatteredFeatures - this.minDistanceBetweenScatteredFeatures);
+ j1 += random.nextInt(this.maxDistanceBetweenScatteredFeatures - this.minDistanceBetweenScatteredFeatures);
+
+ if (k == i1 && l == j1) {
+ //FBS.logger.info("generated at:"+p_75047_1_+","+p_75047_2_);
+
+ BiomeGenBase biomegenbase = this.worldObj.getWorldChunkManager().getBiomeGenAt(k * 16 + 8, l * 16 + 8);
+ if(biomegenbase== Registry.biomeAutumn){
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ protected StructureStart getStructureStart(int i, int j) {
+ return new Start(this.worldObj, this.rand, i, j);
+ }
+
+ //----------------------------------------------------------------------------------
+ // 起点
+ //----------------------------------------------------------------------------------
+ public static class Start extends StructureStart {
+ public Start() {
+ }
+
+ public Start(World p_i2060_1_, Random rand, int x, int z) {
+ super(x, z);
+ components.add(new Structure(rand, x*16,100,z*16));
+ this.updateBoundingBox();
+ }
+ }
+
+ public static class Structure extends StructureComponent {
+ protected int width;
+ protected int height;
+ protected int depth;
+ protected int field_74936_d = -1;
+ protected boolean[] hasShelf={false, false, false};
+ protected boolean[] judged={false, false, false};
+
+ public Structure() {
+ }
+
+ protected Structure(Random rand, int x, int y, int z) {
+ super(0);
+ this.width = 27;
+ this.height = 9;
+ this.depth = 17;
+ this.coordBaseMode = rand.nextInt(4);
+
+ switch (this.coordBaseMode) {
+ case 0:
+ case 2:
+ this.boundingBox = new StructureBoundingBox(x, y, z, x + width - 1, y + height - 1, z + depth - 1);
+ break;
+ default:
+ this.boundingBox = new StructureBoundingBox(x, y, z, x + depth - 1, y + height - 1, z + width - 1);
+ }
+ }
+
+ protected void func_143012_a(NBTTagCompound p_143012_1_) {
+ p_143012_1_.setInteger("Width", this.width);
+ p_143012_1_.setInteger("Height", this.height);
+ p_143012_1_.setInteger("Depth", this.depth);
+ p_143012_1_.setInteger("HPos", this.field_74936_d);
+ for(int i=0;i<3;i++){
+ p_143012_1_.setBoolean("Judged"+i, judged[i]);
+ p_143012_1_.setBoolean("HasShelf"+i, hasShelf[i]);
+ }
+ }
+
+ protected void func_143011_b(NBTTagCompound p_143011_1_) {
+ this.width = p_143011_1_.getInteger("Width");
+ this.height = p_143011_1_.getInteger("Height");
+ this.depth = p_143011_1_.getInteger("Depth");
+ this.field_74936_d = p_143011_1_.getInteger("HPos");
+ for(int i=0;i<3;i++){
+ judged[i]=p_143011_1_.getBoolean("Judged"+i);
+ hasShelf[i]=p_143011_1_.getBoolean("HasShelf"+i);
+ }
+ }
+
+ /**
+ * offsetYを計算する
+ * @param p_74935_1_
+ * @param p_74935_2_
+ * @param p_74935_3_
+ * @return
+ */
+ protected boolean func_74935_a(World p_74935_1_, StructureBoundingBox p_74935_2_, int p_74935_3_) {
+ if (this.field_74936_d >= 0) {
+ return true;
+ } else {
+ int j = 0;
+ int k = 0;
+ int maxY=0;
+
+ for (int l = this.boundingBox.minZ; l <= this.boundingBox.maxZ; ++l) {
+ for (int i1 = this.boundingBox.minX; i1 <= this.boundingBox.maxX; ++i1) {
+ if (p_74935_2_.isVecInside(i1, 70, l)) {
+ int __i=Math.max(p_74935_1_.getTopSolidOrLiquidBlock(i1, l), p_74935_1_.provider.getAverageGroundLevel());
+ j += __i;
+ ++k;
+ if(maxY<__i) maxY=__i;
+ }
+ }
+ }
+
+ if (k == 0) {
+ return false;
+ } else {
+ this.field_74936_d = j / k;
+ field_74936_d=maxY;
+ this.boundingBox.offset(0, this.field_74936_d - this.boundingBox.minY + p_74935_3_, 0);
+ return true;
+ }
+ }
+ }
+
+ @Override
+ public boolean addComponentParts(World w, Random rand, StructureBoundingBox box) {
+ if (!this.func_74935_a(w, box, 0)){
+ return false;
+ }
+
+ int west,east,north,south;
+
+ fillWithAir(w, box, 0,0,0,26,8,16);
+
+ //-----------------------------------------------------------------
+ // 階段の設置
+ //-----------------------------------------------------------------
+ west=getMetadataWithOffset(Blocks.oak_stairs, 4);
+ east=getMetadataWithOffset(Blocks.oak_stairs, 5);
+ north=getMetadataWithOffset(Blocks.oak_stairs, 2);
+ south=getMetadataWithOffset(Blocks.oak_stairs, 3);
+ fillWithMetadataBlocks(w, box, 12, 0, 1, 14, 0, 1, Blocks.oak_stairs, south, Blocks.oak_stairs, south, false);
+ fillWithMetadataBlocks(w, box, 12, 1, 2, 14, 1, 2, Blocks.oak_stairs, south, Blocks.oak_stairs, south, false);
+
+ fillWithMetadataBlocks(w, box, 11, 0, 0, 11, 0, 2, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 11, 1, 1, 11, 1, 2, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 11, 2, 2, 11, 2, 2, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 15, 0, 0, 15, 0, 2, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 15, 1, 1, 15, 1, 2, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 15, 2, 2, 15, 2, 2, Blocks.fence, 0, Blocks.fence, 0, false);
+
+ //-----------------------------------------------------------------
+ // 屋根の設置
+ //-----------------------------------------------------------------
+ west=getMetadataWithOffset(Blocks.stone_brick_stairs, 0);
+ east=getMetadataWithOffset(Blocks.stone_brick_stairs, 1);
+ north=getMetadataWithOffset(Blocks.stone_brick_stairs, 2);
+ south=getMetadataWithOffset(Blocks.stone_brick_stairs, 3);
+ fillWithMetadataBlocks(w, box, 0, 5, 2, 26, 5, 2, Blocks.stone_brick_stairs, south, Blocks.stone_brick_stairs, south, false);
+ fillWithMetadataBlocks(w, box, 0, 5, 16, 26, 5, 16, Blocks.stone_brick_stairs, north, Blocks.stone_brick_stairs, north, false);
+ fillWithMetadataBlocks(w, box, 0, 5, 3, 0, 5, 15, Blocks.stone_brick_stairs, west, Blocks.stone_brick_stairs, west, false);
+ fillWithMetadataBlocks(w, box, 26, 5, 3, 26, 5, 15, Blocks.stone_brick_stairs, east, Blocks.stone_brick_stairs, east, false);
+
+ fillWithMetadataBlocks(w, box, 1, 6, 3, 25, 6, 3, Blocks.stone_brick_stairs, south, Blocks.stone_brick_stairs, south, false);
+ fillWithMetadataBlocks(w, box, 1, 6, 15, 25, 6, 15, Blocks.stone_brick_stairs, north, Blocks.stone_brick_stairs, north, false);
+ fillWithMetadataBlocks(w, box, 1, 6, 4, 1, 6, 14, Blocks.stone_brick_stairs, west, Blocks.stone_brick_stairs, west, false);
+ fillWithMetadataBlocks(w, box, 25, 6, 4, 25, 6, 14, Blocks.stone_brick_stairs, east, Blocks.stone_brick_stairs, east, false);
+
+ fillWithMetadataBlocks(w, box, 2, 7, 4, 24, 7, 4, Blocks.stone_brick_stairs, south, Blocks.stone_brick_stairs, south, false);
+ fillWithMetadataBlocks(w, box, 2, 7, 14, 24, 7, 14, Blocks.stone_brick_stairs, north, Blocks.stone_brick_stairs, north, false);
+ fillWithMetadataBlocks(w, box, 2, 7, 5, 2, 7, 13, Blocks.stone_brick_stairs, west, Blocks.stone_brick_stairs, west, false);
+ fillWithMetadataBlocks(w, box, 24, 7, 5, 24, 7, 13, Blocks.stone_brick_stairs, east, Blocks.stone_brick_stairs, east, false);
+
+ fillWithMetadataBlocks(w, box, 3, 8, 5, 23, 8, 13, Blocks.stone_slab, 5, Blocks.stone_slab, 5, false);
+
+ //-----------------------------------------------------------------
+ // 土台の設置
+ //-----------------------------------------------------------------
+ //原木の向き
+ west=east=(coordBaseMode==0 || coordBaseMode==2)?8:4;
+ north=south=(coordBaseMode==0 || coordBaseMode==2)?4:8;
+
+ //柵 基礎
+ fillWithMetadataBlocks(w, box, 1, 0, 3, 25, 0, 3, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 1, 0, 15, 25, 0, 15, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 1, 0, 4, 1, 0, 14, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 25, 0, 4, 25, 0, 14, Blocks.fence, 0, Blocks.fence, 0, false);
+ int my;
+
+ /*
+ for(int dx=boundingBox.minX;dx<=boundingBox.maxX;dx++){
+ for(my=w.getHeightValue(dx, boundingBox.minZ);my<=boundingBox.minY;my++){
+ w.setBlock(dx, my, boundingBox.minZ, Blocks.fence);
+ }
+ for(my=w.getHeightValue(dx, boundingBox.maxZ);my<=boundingBox.minY;my++){
+ w.setBlock(dx, my, boundingBox.minZ, Blocks.fence);
+ }
+ }
+ for(int dz=boundingBox.minZ+1;dz<=boundingBox.maxZ-1;dz++){
+ for(my=w.getHeightValue(boundingBox.minX, dz);my<=boundingBox.minY;my++){
+ w.setBlock(boundingBox.minX, my, dz, Blocks.fence);
+ }
+ for(my=w.getHeightValue(boundingBox.maxX, dz);my<=boundingBox.minY;my++){
+ w.setBlock(boundingBox.maxX, my, dz, Blocks.fence);
+ }
+ }
+ */
+
+ //木材
+ fillWithMetadataBlocks(w, box, 1,1,3, 25,1,15, Blocks.planks, 0, Blocks.planks, 0, false);
+
+ //原木 外枠
+ fillWithMetadataBlocks(w, box, 1, 1, 3, 25, 1, 3, Blocks.log, south, Blocks.log, south, false);
+ fillWithMetadataBlocks(w, box, 1, 1, 15, 25, 1, 15, Blocks.log, south, Blocks.log, south, false);
+ fillWithMetadataBlocks(w, box, 1, 1, 4, 1, 1, 14, Blocks.log, west, Blocks.log, west, false);
+ fillWithMetadataBlocks(w, box, 25, 1, 4, 25, 1, 14, Blocks.log, west, Blocks.log, west, false);
+
+ //原木 内枠
+ fillWithMetadataBlocks(w, box, 4, 1, 6, 22, 1, 6, Blocks.log, south, Blocks.log, south, false);
+ fillWithMetadataBlocks(w, box, 4, 1, 12, 22, 1, 12, Blocks.log, west, Blocks.log, west, false);
+ for(int i=0;i<4;i++){
+ fillWithMetadataBlocks(w, box, 4+i*6, 1, 7, 4+i*6, 1, 11, Blocks.log, west, Blocks.log, west, false);
+ }
+
+ //-----------------------------------------------------------------
+ // 障子の設置
+ //-----------------------------------------------------------------
+ fillWithMetadataBlocks(w, box, 4, 2, 6, 22, 4, 12, Blocks.wool, 0, Blocks.wool, 0, false);
+ for(int i=0;i<3;i++){
+ fillWithAir(w, box, 5+i*6,2,7, 9+i*6,4,11);
+ }
+
+ //-----------------------------------------------------------------
+ // 柵の設置
+ //-----------------------------------------------------------------
+ fillWithMetadataBlocks(w, box, 1, 2, 3, 11, 2, 3, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 15, 2, 3, 25, 2, 3, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 1, 2, 15, 25, 2, 15, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 1, 2, 3, 1, 2, 15, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 25, 2, 3, 25, 2, 15, Blocks.fence, 0, Blocks.fence, 0, false);
+
+ fillWithMetadataBlocks(w, box, 4, 6, 6, 22, 7, 6, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 4, 6, 12, 22, 7, 12, Blocks.fence, 0, Blocks.fence, 0, false);
+ for(int i=0;i<4;i++){
+ fillWithMetadataBlocks(w, box, 4+6*i, 6, 6, 4+6*i, 7, 12, Blocks.fence, 0, Blocks.fence, 0, false);
+ }
+
+
+ for(int i=0;i<11;i++){
+ if(i!=5) fillWithMetadataBlocks(w, box, 3+2*i, 3, 3, 3+2*i, 4, 3, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 3+2*i, 3, 15, 3+2*i, 4, 15, Blocks.fence, 0, Blocks.fence, 0, false);
+ }
+ for(int i=0;i<5;i++){
+ fillWithMetadataBlocks(w, box, 1, 3, 5+2*i, 1, 4, 5+2*i, Blocks.fence, 0, Blocks.fence, 0, false);
+ fillWithMetadataBlocks(w, box, 25, 3, 5+2*i, 25, 4, 5+2*i, Blocks.fence, 0, Blocks.fence, 0, false);
+ }
+
+ //-----------------------------------------------------------------
+ // 枠組みの設置
+ //-----------------------------------------------------------------
+ fillWithMetadataBlocks(w, box, 1, 5, 3, 25, 5, 3, Blocks.log, south, Blocks.log, south, false);
+ fillWithMetadataBlocks(w, box, 1, 5, 15, 25, 5, 15, Blocks.log, south, Blocks.log, south, false);
+ fillWithMetadataBlocks(w, box, 1, 5, 3, 1, 5, 15, Blocks.log, west, Blocks.log, west, false);
+ fillWithMetadataBlocks(w, box, 25, 5, 3, 25, 5, 15, Blocks.log, west, Blocks.log, west, false);
+
+ fillWithMetadataBlocks(w, box, 1, 0, 3, 1, 5, 3, Blocks.log, 0, Blocks.log, 0, false);
+ fillWithMetadataBlocks(w, box, 1, 0, 15, 1, 5, 15, Blocks.log, 0, Blocks.log, 0, false);
+ fillWithMetadataBlocks(w, box, 25, 0, 3, 25, 5, 3, Blocks.log, 0, Blocks.log, 0, false);
+ fillWithMetadataBlocks(w, box, 25, 0, 15, 25, 5, 15, Blocks.log, 0, Blocks.log, 0, false);
+
+ fillWithMetadataBlocks(w, box, 4, 5, 6, 22, 5, 6, Blocks.log, south, Blocks.log, south, false);
+ fillWithMetadataBlocks(w, box, 4, 5, 12, 22, 5, 12, Blocks.log, south, Blocks.log, south, false);
+ for(int i=0;i<4;i++){
+ fillWithMetadataBlocks(w, box, 4+i*6, 5, 7, 4+i*6, 5, 12, Blocks.log, west, Blocks.log, west, false);
+ fillWithMetadataBlocks(w, box, 4+i*6, 0, 6, 4+i*6, 7, 6, Blocks.log, 0, Blocks.log, 0, false);
+ fillWithMetadataBlocks(w, box, 4+i*6, 0, 12, 4+i*6, 7, 12, Blocks.log, 0, Blocks.log, 0, false);
+ }
+
+
+ //-----------------------------------------------------------------
+ // 本棚の設置
+ //-----------------------------------------------------------------
+ for(int i=0;i<3;i++){
+ if(!judged[i]){
+ judged[i]=true;
+ hasShelf[i]=rand.nextFloat()<0.65f;
+ }
+ if(hasShelf[i]) {
+ for (int xx = 6; xx <= 8; xx++) {
+ for (int zz = 8; zz <= 10; zz++) {
+ placeBlockAtCurrentPosition(w, BlockCore.bookshelf, getNum(rand, 4), xx + 6 * i, 2, zz, box);
+ }
+ }
+ }
+ }
+
+ //-----------------------------------------------------------------
+ // たいまつの設置
+ //-----------------------------------------------------------------
+ int[]tx={5, 7, 9, 7};
+ int[]tz={9, 11, 9, 7};
+
+ placeBlockAtCurrentPosition(w, Blocks.torch, 0, 7, 5, 5, box);
+ placeBlockAtCurrentPosition(w, Blocks.torch, 0, 13, 5, 5, box);
+ placeBlockAtCurrentPosition(w, Blocks.torch, 0, 19, 5, 5, box);
+ placeBlockAtCurrentPosition(w, Blocks.torch, 0, 7, 5, 13, box);
+ placeBlockAtCurrentPosition(w, Blocks.torch, 0, 13, 5, 13, box);
+ placeBlockAtCurrentPosition(w, Blocks.torch, 0, 19, 5, 13, box);
+ placeBlockAtCurrentPosition(w, Blocks.torch, 0, 7, 5, 5, box);
+ placeBlockAtCurrentPosition(w, Blocks.torch, 0, 13, 5, 5, box);
+ placeBlockAtCurrentPosition(w, Blocks.torch, 0, 3, 5, 9, box);
+ placeBlockAtCurrentPosition(w, Blocks.torch, 0, 23, 5, 9, box);
+ for(int k=0;k<3;k++){
+ for(int i=0;i<4;i++){
+ placeBlockAtCurrentPosition(w, Blocks.torch, 0, tx[i]+k*6, 5, tz[i], box);
+ }
+ }
+
+ return true;
+ }
+
+ protected int getNum(Random rand, int max){
+ if(rand.nextFloat()<=0.8f){
+ return 1+rand.nextInt(max);
+ }
+ return 0;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLib1.class b/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLib1.class
new file mode 100644
index 0000000..8484f6d
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLib1.class
Binary files differ
diff --git a/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLib1.java b/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLib1.java
new file mode 100644
index 0000000..7f2428f
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLib1.java
@@ -0,0 +1,115 @@
+package jp.plusplus.fbs.world.structure;
+
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.block.BlockCore;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.tileentity.TileEntityChest;
+import net.minecraft.world.World;
+import net.minecraft.world.gen.structure.StructureBoundingBox;
+import net.minecraft.world.gen.structure.StructureComponent;
+
+import java.util.Random;
+
+/**
+ * Createdby pluslus_Fon 2015/06/06.
+ * 1つの図書館からだいたい16.8冊手に入る?
+ */
+public class StructureSealedLib1 extends StructureComponent {
+ private boolean chest=false;
+
+ public StructureSealedLib1(){}
+ public StructureSealedLib1(int par1, Random rand, int x, int y, int z) {
+ this.coordBaseMode = 0;
+
+ //y=6+rand.nextInt(40-6+1);
+ this.boundingBox = new StructureBoundingBox(x, y, z, x + 11, y+6, z + 11);
+ }
+ @Override
+ protected void func_143012_a(NBTTagCompound tag) {
+ tag.setBoolean("Chest", this.chest);
+ }
+
+ @Override
+ protected void func_143011_b(NBTTagCompound tag) {
+ chest = tag.getBoolean("Chest");
+ }
+
+ @Override
+ public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) {
+ int[] bx={1,1,2,3, 7,8,9,9, 9,9,8,7, 3,2,1,1};
+ int[] bz={3,2,1,1, 1,1,2,3, 7,8,9,9, 9,9,8,7};
+ int[] wx={1,9,9,1};
+ int[] wz={1,1,9,9};
+ int[] tx={1,5,9,5};
+ int[] tz={5,1,5,9};
+
+ this.fillWithBlocks(world, box, 0, 0, 0, 10, 5, 10, BlockCore.plank, BlockCore.plank, false);
+ this.fillWithBlocks(world, box, 1, 1, 1, 9, 4, 9, Blocks.air, Blocks.air, false);
+
+ for(int i=0;i<bx.length;i++){
+ for(int k=0;k<4;k++){
+ this.placeBlockAtCurrentPosition(world, BlockCore.bookshelf, getNum(rand, 2), bx[i], 1+k, bz[i], box);
+ }
+ }
+ for(int i=0;i<wx.length;i++){
+ for(int k=0;k<4;k++){
+ this.placeBlockAtCurrentPosition(world, BlockCore.plank, 0, wx[i], 1+k, wz[i], box);
+ }
+ }
+
+ for(int i=0;i<3;i++){
+ for(int n=0;n<3;n++){
+ for(int k=0;k<4;k++){
+ if(i==1 && n==1){
+ //if(k>0) this.placeBlockAtCurrentPosition(world, BlockCore.plank, 0, 4+i, 1+k, 4+n, box);
+ }
+ else this.placeBlockAtCurrentPosition(world, BlockCore.bookshelf, getNum(rand, 4), 4+i, 1+k, 4+n, box);
+ }
+ }
+ }
+ /*
+ for(int k=0;k<4;k++){
+ this.placeBlockAtCurrentPosition(world, BlockCore.plank, 0, 5, 1+k, 5, box);
+ }
+ */
+
+ for(int i=0;i<tx.length;i++){
+ this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, tx[i], 2, tz[i], box);
+ }
+
+ //chest
+ if(!chest){
+ int cx=getXWithOffset(5, 5), cy=getYWithOffset(1), cz=getZWithOffset(5, 5);
+
+ if(box.isVecInside(cx, cy, cz) && world.getBlock(cx, cy, cz)!=Blocks.chest){
+ world.setBlock(cx, cy, cz, Blocks.chest, 0, 2);
+ TileEntity te=world.getTileEntity(cx,cy,cz);
+ if(te instanceof TileEntityChest){
+ TileEntityChest e=(TileEntityChest)te;
+ ItemStack[] items=new ItemStack[e.getSizeInventory()];
+ Registry.GetChestContents(0, items, 0.15f);
+ for(int i=0;i<items.length;i++){
+ e.setInventorySlotContents(i, items[i]);
+ }
+ }
+ chest=true;
+ }
+ }
+ //placeBlockAtCurrentPosition(world, Blocks.chest, 0, 5, 1, 5, box);
+
+ //world.setBlock(i1, j1, k1, Blocks.chest, 0, 2);
+
+ //FMLLog.severe("generated at "+box.getCenterX()+","+box.getCenterY()+","+box.getCenterZ());
+ return true;
+ }
+
+ protected int getNum(Random rand, int max){
+ if(rand.nextFloat()<=0.15f){
+ return 1+rand.nextInt(max);
+ }
+ return 0;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLibStart.class b/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLibStart.class
new file mode 100644
index 0000000..82a6b27
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLibStart.class
Binary files differ
diff --git a/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLibStart.java b/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLibStart.java
new file mode 100644
index 0000000..403f788
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLibStart.java
@@ -0,0 +1,49 @@
+package jp.plusplus.fbs.world.structure;
+
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+import net.minecraft.world.gen.structure.StructureStart;
+
+import java.util.Random;
+
+/**
+ * Createdby pluslus_Fon 2015/06/06.
+ */
+public class StructureSealedLibStart extends StructureStart {
+
+ public StructureSealedLibStart() {}
+
+ public StructureSealedLibStart(World par1World, Random par2Random, int par3, int par4) {
+ super(par3, par4);
+ // 構造物の構成パーツを決定する
+
+ //decides Position
+ int x=par3*16+2,y,z=par4*16+2;
+ /*
+ int sy=0, sym=8*par2Random.nextInt(4);
+ Block b2;
+ do{
+ sy+=8;
+ b2=par1World.getBlock(x,12+sy,z);
+ }while(b2.getMaterial() != Material.water && b2.getMaterial() !=Material.lava && b2.getMaterial()!=Material.air && sy<sym);
+
+ y=12+sy-8;
+ */
+
+ y=par1World.getChunkHeightMapMinimum(x, z)-10-12;
+ if(y<0) y=10;
+ else y=12+par2Random.nextInt(Math.min(y, 50));
+
+ //y=100;
+ StructureSealedLib1 ssl1 = new StructureSealedLib1(0, par2Random, x,y,z);
+ this.components.add(ssl1);
+
+ // 次のパーツを得る
+ ssl1.buildComponent(ssl1, components, par2Random);
+
+ // 構造物全体の占有範囲を更新する
+ this.updateBoundingBox();
+ }
+}