From 70c1354a4a96698758a88c032866288f79de6f5a Mon Sep 17 00:00:00 2001 From: Benjamin Culkin Date: Sat, 24 Aug 2024 08:16:37 -0400 Subject: Initial commit --- .../fbs/world/structure/MapGenSealdLib.class | Bin 0 -> 1846 bytes .../fbs/world/structure/MapGenSealdLib.java | 75 ++++ .../fbs/world/structure/MapGenStudy$Start.class | Bin 0 -> 1019 bytes .../world/structure/MapGenStudy$Structure.class | Bin 0 -> 7928 bytes .../plusplus/fbs/world/structure/MapGenStudy.class | Bin 0 -> 2065 bytes .../plusplus/fbs/world/structure/MapGenStudy.java | 379 +++++++++++++++++++++ .../fbs/world/structure/StructureSealedLib1.class | Bin 0 -> 4515 bytes .../fbs/world/structure/StructureSealedLib1.java | 115 +++++++ .../world/structure/StructureSealedLibStart.class | Bin 0 -> 1490 bytes .../world/structure/StructureSealedLibStart.java | 49 +++ 10 files changed, 618 insertions(+) create mode 100644 src/main/java/jp/plusplus/fbs/world/structure/MapGenSealdLib.class create mode 100644 src/main/java/jp/plusplus/fbs/world/structure/MapGenSealdLib.java create mode 100644 src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy$Start.class create mode 100644 src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy$Structure.class create mode 100644 src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy.class create mode 100644 src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy.java create mode 100644 src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLib1.class create mode 100644 src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLib1.java create mode 100644 src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLibStart.class create mode 100644 src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLibStart.java (limited to 'src/main/java/jp/plusplus/fbs/world/structure') 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 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/world/structure/MapGenSealdLib.class 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 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy$Start.class 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 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy$Structure.class 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 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy.class 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 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLib1.class 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;i0) 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