diff options
| author | Benjamin Culkin <scorpress@gmail.com> | 2024-08-24 08:16:37 -0400 |
|---|---|---|
| committer | Benjamin Culkin <scorpress@gmail.com> | 2024-08-24 08:16:37 -0400 |
| commit | 70c1354a4a96698758a88c032866288f79de6f5a (patch) | |
| tree | eca51294e84b90a4cb3230bc2c7900469e784184 /src/main/java/jp/plusplus/fbs/world | |
Diffstat (limited to 'src/main/java/jp/plusplus/fbs/world')
59 files changed, 3741 insertions, 0 deletions
diff --git a/src/main/java/jp/plusplus/fbs/world/TeleporterWarp.class b/src/main/java/jp/plusplus/fbs/world/TeleporterWarp.class Binary files differnew file mode 100644 index 0000000..07fb0f1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/TeleporterWarp.class diff --git a/src/main/java/jp/plusplus/fbs/world/TeleporterWarp.java b/src/main/java/jp/plusplus/fbs/world/TeleporterWarp.java new file mode 100644 index 0000000..961ee25 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/TeleporterWarp.java @@ -0,0 +1,44 @@ +package jp.plusplus.fbs.world;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.Entity;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.Direction;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.ChunkCoordIntPair;
+import net.minecraft.world.Teleporter;
+import net.minecraft.world.WorldServer;
+
+/**
+ * Created by plusplus_F on 2015/11/08.
+ */
+public class TeleporterWarp extends Teleporter {
+ public TeleporterWarp(WorldServer p_i1963_1_) {
+ super(p_i1963_1_);
+ }
+
+ @Override
+ public void placeInPortal(Entity p_77185_1_, double p_77185_2_, double p_77185_4_, double p_77185_6_, float p_77185_8_) {
+ int i = MathHelper.floor_double(p_77185_1_.posX);
+ int j = MathHelper.floor_double(p_77185_1_.posY) - 1;
+ int k = MathHelper.floor_double(p_77185_1_.posZ);
+ p_77185_1_.setLocationAndAngles((double) i, (double) j, (double) k, p_77185_1_.rotationYaw, 0.0F);
+ p_77185_1_.motionX = p_77185_1_.motionY = p_77185_1_.motionZ = 0.0D;
+ }
+
+ @Override
+ public boolean placeInExistingPortal(Entity p_77184_1_, double p_77184_2_, double p_77184_4_, double p_77184_6_, float p_77184_8_) {
+ p_77184_1_.setLocationAndAngles(p_77184_1_.posX, p_77184_1_.posY, p_77184_1_.posZ, p_77184_1_.rotationYaw, p_77184_1_.rotationPitch);
+ p_77184_1_.motionX = p_77184_1_.motionY = p_77184_1_.motionZ = 0.0D;
+ return true;
+ }
+
+ @Override
+ public boolean makePortal(Entity p_85188_1_) {
+ return true;
+ }
+
+ @Override
+ public void removeStalePortalLocations(long p_85189_1_){}
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/world/WorldGenGrass.class b/src/main/java/jp/plusplus/fbs/world/WorldGenGrass.class Binary files differnew file mode 100644 index 0000000..9e5e2c8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/WorldGenGrass.class diff --git a/src/main/java/jp/plusplus/fbs/world/WorldGenGrass.java b/src/main/java/jp/plusplus/fbs/world/WorldGenGrass.java new file mode 100644 index 0000000..9428ff4 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/WorldGenGrass.java @@ -0,0 +1,49 @@ +package jp.plusplus.fbs.world;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.tileentity.TileEntityHavestable;
+import net.minecraft.block.Block;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.gen.feature.WorldGenerator;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/2/23.
+ */
+public class WorldGenGrass extends WorldGenerator {
+ private Block field_150552_a;
+ public WorldGenGrass() {
+ field_150552_a = BlockCore.harvestableGrass;
+ }
+
+ public boolean generate(World world, Random rand, int bx, int by, int bz) {
+ BiomeGenBase bgb = world.getBiomeGenForCoords(bx, bz);
+ int id = world.provider.dimensionId;
+
+ //地表
+ if (bgb == BiomeGenBase.forest || bgb == BiomeGenBase.plains || bgb == BiomeGenBase.taiga || bgb == BiomeGenBase.taigaHills || bgb == BiomeGenBase.extremeHills ||
+ bgb == BiomeGenBase.extremeHillsEdge || bgb == BiomeGenBase.extremeHillsPlus || bgb == BiomeGenBase.birchForest || bgb == BiomeGenBase.birchForestHills ||
+ bgb == BiomeGenBase.roofedForest || bgb==BiomeGenBase.jungle || bgb==BiomeGenBase.jungleEdge || bgb==BiomeGenBase.jungleHills ||
+ bgb == Registry.biomeCrack || bgb==Registry.biomeAutumn) {
+
+ for (int l = 0; l < 10; ++l) {
+ int x = bx + rand.nextInt(8) - rand.nextInt(8);
+ int y = by + rand.nextInt(4) - rand.nextInt(4);
+ int z = bz + rand.nextInt(8) - rand.nextInt(8);
+
+ if (world.isAirBlock(x, y, z) && y < 255 && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, 0, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+ return true;
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/world/WorldGenHerbs.class b/src/main/java/jp/plusplus/fbs/world/WorldGenHerbs.class Binary files differnew file mode 100644 index 0000000..9cbd630 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/WorldGenHerbs.class diff --git a/src/main/java/jp/plusplus/fbs/world/WorldGenHerbs.java b/src/main/java/jp/plusplus/fbs/world/WorldGenHerbs.java new file mode 100644 index 0000000..cc83c8e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/WorldGenHerbs.java @@ -0,0 +1,194 @@ +package jp.plusplus.fbs.world;
+
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.tileentity.TileEntityHavestable;
+import net.minecraft.block.Block;
+import net.minecraft.world.World;
+import net.minecraft.world.WorldProviderHell;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.biome.BiomeGenEnd;
+import net.minecraft.world.gen.ChunkProviderEnd;
+import net.minecraft.world.gen.ChunkProviderHell;
+import net.minecraft.world.gen.feature.WorldGenerator;
+import net.minecraftforge.common.BiomeManager;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/11/22.
+ */
+public class WorldGenHerbs extends WorldGenerator {
+ private Block field_150552_a;
+ private boolean isTop;
+
+ public WorldGenHerbs(boolean isTop) {
+ field_150552_a= BlockCore.harvestableHerb;
+ this.isTop=isTop;
+ }
+
+ public boolean generate(World world, Random rand, int bx, int by, int bz) {
+ if(isTop) generateOnGround(world, rand, bx, by, bz);
+ else generateUnderGround(world, rand, bx, by, bz);
+ return true;
+ }
+
+ private void generateOnGround(World world, Random rand, int bx, int by, int bz){
+ BiomeGenBase bgb=world.getBiomeGenForCoords(bx,bz);
+ int meta=0;
+
+ //--------------------------条件によって生成するハーブのmeta値を変える-------------------------------------
+ for(BiomeManager.BiomeEntry be : BiomeManager.getBiomes(BiomeManager.BiomeType.WARM)) {
+ if (bgb == be.biome) {
+ if(rand.nextFloat()<0.4f) meta=1;
+ break;
+ }
+ }
+
+ boolean flag=false;
+ flag=(bgb==BiomeGenBase.desert || bgb==BiomeGenBase.desertHills || bgb==BiomeGenBase.savanna || bgb==BiomeGenBase.savannaPlateau || bgb==BiomeGenBase.mesa || bgb==BiomeGenBase.mesaPlateau|| bgb==BiomeGenBase.mesaPlateau_F);
+ if(!flag){
+ for(BiomeManager.BiomeEntry be : BiomeManager.getBiomes(BiomeManager.BiomeType.DESERT)) {
+ if (bgb == be.biome) {
+ flag=true;
+ break;
+ }
+ }
+ }
+ if(flag && rand.nextFloat()<0.65f){
+ meta=3;
+ }
+
+ if(bgb==Registry.biomeAutumn && rand.nextFloat()<0.4f){
+ meta=2;
+ }
+ if(bgb==Registry.biomeCrack){
+ meta=4;
+ }
+ if(bgb==BiomeGenBase.hell){
+ meta=8;
+ }
+ if(bgb==BiomeGenBase.sky){
+ meta=7;
+ }
+
+ //--------------------------ハーブを生成する-------------------------------------
+ if(meta!=7 && meta!=8){
+ for (int l = 0; l < 16; ++l) {
+ int x = bx + rand.nextInt(8) - rand.nextInt(8);
+ int y = by + rand.nextInt(4) - rand.nextInt(4);
+ int z = bz + rand.nextInt(8) - rand.nextInt(8);
+
+ if (world.isAirBlock(x, y, z) && (!world.provider.hasNoSky || y < 255) && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, meta, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+ else{
+ for (int l = 0; l < 16; ++l) {
+ int x = bx + rand.nextInt(8) - rand.nextInt(8);
+ int y = by + rand.nextInt(4) - rand.nextInt(4);
+ int z = bz + rand.nextInt(8) - rand.nextInt(8);
+
+ if (world.isAirBlock(x, y, z) && y<255 && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, meta, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+ }
+ private void generateUnderGround(World world, Random rand, int bx, int by, int bz){
+ BiomeGenBase bgb=world.getBiomeGenForCoords(bx,bz);
+
+ if(bgb==BiomeGenBase.hell){
+ for (int l = 0; l < 16; ++l) {
+ int x = bx + rand.nextInt(4) - rand.nextInt(4);
+ int y = by + rand.nextInt(2) - rand.nextInt(2);
+ int z = bz + rand.nextInt(4) - rand.nextInt(4);
+
+ if (world.isAirBlock(x, y, z) && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, 8, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+ else
+ if(bgb==BiomeGenBase.sky){
+ for (int l = 0; l < 8; ++l) {
+ int x = bx + rand.nextInt(4) - rand.nextInt(4);
+ int y = by + rand.nextInt(2) - rand.nextInt(2);
+ int z = bz + rand.nextInt(4) - rand.nextInt(4);
+
+ if (world.isAirBlock(x, y, z) && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, 7, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+ else {
+ if(by<32+2){
+ //ゴールドかマンドレイクか。確率
+ if(by<20+2 && rand.nextFloat()<0.5f){
+ for (int l = 0; l < 16; ++l) {
+ int x = bx + rand.nextInt(4) - rand.nextInt(4);
+ int y = by + rand.nextInt(2) - rand.nextInt(2);
+ int z = bz + rand.nextInt(4) - rand.nextInt(4);
+
+ if (world.isAirBlock(x, y, z) && y<16 && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, 6, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+ else{
+ for (int l = 0; l < 16; ++l) {
+ int x = bx + rand.nextInt(4) - rand.nextInt(4);
+ int y = by + rand.nextInt(2) - rand.nextInt(2);
+ int z = bz + rand.nextInt(4) - rand.nextInt(4);
+
+ if (world.isAirBlock(x, y, z) && y<32 && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, 5, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+ }
+ else{
+ //y>=32+2ではテケトーに
+ int meta=rand.nextInt(4);
+ for (int l = 0; l < 32; ++l) {
+ int x = bx + rand.nextInt(4) - rand.nextInt(4);
+ int y = by + rand.nextInt(2) - rand.nextInt(2);
+ int z = bz + rand.nextInt(4) - rand.nextInt(4);
+
+ if (world.isAirBlock(x, y, z) && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, meta, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/world/WorldGenMushroom.class b/src/main/java/jp/plusplus/fbs/world/WorldGenMushroom.class Binary files differnew file mode 100644 index 0000000..16d15bf --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/WorldGenMushroom.class diff --git a/src/main/java/jp/plusplus/fbs/world/WorldGenMushroom.java b/src/main/java/jp/plusplus/fbs/world/WorldGenMushroom.java new file mode 100644 index 0000000..9a9cabb --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/WorldGenMushroom.java @@ -0,0 +1,123 @@ +package jp.plusplus.fbs.world;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.tileentity.TileEntityHavestable;
+import net.minecraft.block.Block;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.gen.feature.WorldGenerator;
+import net.minecraftforge.common.BiomeManager;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/2/23.
+ */
+public class WorldGenMushroom extends WorldGenerator {
+ private Block field_150552_a;
+ private boolean isTop;
+
+ public WorldGenMushroom(boolean isTop) {
+ field_150552_a = BlockCore.harvestableMushroom;
+ this.isTop = isTop;
+ }
+
+ public boolean generate(World world, Random rand, int bx, int by, int bz) {
+ if (isTop) generateOnGround(world, rand, bx, by, bz);
+ else generateUnderGround(world, rand, bx, by, bz);
+ return true;
+ }
+
+ private void generateOnGround(World world, Random rand, int bx, int by, int bz) {
+ BiomeGenBase bgb = world.getBiomeGenForCoords(bx, bz);
+ int id = world.provider.dimensionId;
+
+ //地表
+ if (id == 0 || id == FBS.dimensionAutumnId || id == FBS.dimensionCrackId) {
+ for (int l = 0; l < 8; ++l) {
+ int x = bx + rand.nextInt(8) - rand.nextInt(8);
+ int y = by + rand.nextInt(4) - rand.nextInt(4);
+ int z = bz + rand.nextInt(8) - rand.nextInt(8);
+
+ if (world.isAirBlock(x, y, z) && y < 255 && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, 0, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+
+ //ネザ
+ if (id == -1) {
+ for (int l = 0; l < 16; ++l) {
+ int x = bx + rand.nextInt(8) - rand.nextInt(8);
+ int y = by + rand.nextInt(4) - rand.nextInt(4);
+ int z = bz + rand.nextInt(8) - rand.nextInt(8);
+
+ if (world.isAirBlock(x, y, z) && y < 255 && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, 1, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+
+
+ }
+
+ private void generateUnderGround(World world, Random rand, int bx, int by, int bz) {
+ if (world.provider.dimensionId != 0) return;
+
+ if (by < 50 + 2) {
+ if (by < 30 + 2 && rand.nextFloat() < 0.5f) {
+ for (int l = 0; l < 16; ++l) {
+ int x = bx + rand.nextInt(4) - rand.nextInt(4);
+ int y = by + rand.nextInt(2) - rand.nextInt(2);
+ int z = bz + rand.nextInt(4) - rand.nextInt(4);
+
+ if (world.isAirBlock(x, y, z) && y < 16 && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, 2, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ } else {
+ for (int l = 0; l < 16; ++l) {
+ int x = bx + rand.nextInt(4) - rand.nextInt(4);
+ int y = by + rand.nextInt(2) - rand.nextInt(2);
+ int z = bz + rand.nextInt(4) - rand.nextInt(4);
+
+ if (world.isAirBlock(x, y, z) && y < 32 && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, 1, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+ } else {
+ for (int l = 0; l < 32; ++l) {
+ int x = bx + rand.nextInt(4) - rand.nextInt(4);
+ int y = by + rand.nextInt(2) - rand.nextInt(2);
+ int z = bz + rand.nextInt(4) - rand.nextInt(4);
+
+ if (world.isAirBlock(x, y, z) && this.field_150552_a.canPlaceBlockAt(world, x, y, z)) {
+ if (world.setBlock(x, y, z, this.field_150552_a, 0, 2)) {
+ TileEntityHavestable te = (TileEntityHavestable) world.getTileEntity(x, y, z);
+ te.age = te.ageMax;
+ te.markDirty();
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/world/autumn/ChunkProviderAutumn.class b/src/main/java/jp/plusplus/fbs/world/autumn/ChunkProviderAutumn.class Binary files differnew file mode 100644 index 0000000..2f44634 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/autumn/ChunkProviderAutumn.class diff --git a/src/main/java/jp/plusplus/fbs/world/autumn/ChunkProviderAutumn.java b/src/main/java/jp/plusplus/fbs/world/autumn/ChunkProviderAutumn.java new file mode 100644 index 0000000..925dbb4 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/autumn/ChunkProviderAutumn.java @@ -0,0 +1,123 @@ +package jp.plusplus.fbs.world.autumn;
+
+import cpw.mods.fml.common.eventhandler.Event;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockFalling;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.EnumCreatureType;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.IProgressUpdate;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.ChunkPosition;
+import net.minecraft.world.SpawnerAnimals;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.chunk.Chunk;
+import net.minecraft.world.chunk.IChunkProvider;
+import net.minecraft.world.gen.ChunkProviderGenerate;
+import net.minecraft.world.gen.NoiseGenerator;
+import net.minecraft.world.gen.NoiseGeneratorOctaves;
+import net.minecraft.world.gen.feature.WorldGenDungeons;
+import net.minecraft.world.gen.feature.WorldGenLakes;
+import net.minecraft.world.gen.structure.MapGenMineshaft;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.terraingen.ChunkProviderEvent;
+import net.minecraftforge.event.terraingen.PopulateChunkEvent;
+import net.minecraftforge.event.terraingen.TerrainGen;
+
+import java.util.List;
+import java.util.Random;
+
+import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.*;
+import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE;
+
+/**
+ * Created by plusplus_F on 2015/10/29.
+ */
+public class ChunkProviderAutumn extends ChunkProviderGenerate implements IChunkProvider {
+ private World worldObj;
+ private Random rand = new Random();
+ private boolean mapFeaturesEnabled;
+ private MapGenMineshaft mineshaftGenerator = new MapGenMineshaft();
+
+ public ChunkProviderAutumn(World par1World, long par2, boolean par4) {
+ super(par1World, par2, par4);
+ worldObj = par1World;
+ mapFeaturesEnabled = par4;
+
+ }
+
+ @Override
+ public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) {
+ BlockFalling.fallInstantly = true;
+ int k = p_73153_2_ * 16;
+ int l = p_73153_3_ * 16;
+ BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16);
+ this.rand.setSeed(this.worldObj.getSeed());
+ long i1 = this.rand.nextLong() / 2L * 2L + 1L;
+ long j1 = this.rand.nextLong() / 2L * 2L + 1L;
+ this.rand.setSeed((long) p_73153_2_ * i1 + (long) p_73153_3_ * j1 ^ this.worldObj.getSeed());
+ boolean flag = false;
+
+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag));
+
+ if (this.mapFeaturesEnabled) {
+ this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, p_73153_2_, p_73153_3_);
+ }
+
+ int k1;
+ int l1;
+ int i2;
+
+ if (this.rand.nextInt(4) == 0 && TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, LAKE)) {
+ k1 = k + this.rand.nextInt(16) + 8;
+ l1 = this.rand.nextInt(256);
+ i2 = l + this.rand.nextInt(16) + 8;
+ (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, k1, l1, i2);
+ }
+
+ if (TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, LAVA) && !flag && this.rand.nextInt(8) == 0) {
+ k1 = k + this.rand.nextInt(16) + 8;
+ l1 = this.rand.nextInt(this.rand.nextInt(248) + 8);
+ i2 = l + this.rand.nextInt(16) + 8;
+
+ if (l1 < 63 || this.rand.nextInt(10) == 0) {
+ (new WorldGenLakes(Blocks.lava)).generate(this.worldObj, this.rand, k1, l1, i2);
+ }
+ }
+
+ boolean doGen = TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, DUNGEON);
+ for (k1 = 0; doGen && k1 < 8; ++k1) {
+ l1 = k + this.rand.nextInt(16) + 8;
+ i2 = this.rand.nextInt(256);
+ int j2 = l + this.rand.nextInt(16) + 8;
+ (new WorldGenDungeons()).generate(this.worldObj, this.rand, l1, i2, j2);
+ }
+
+ biomegenbase.decorate(this.worldObj, this.rand, k, l);
+ if (TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, ANIMALS)) {
+ SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand);
+ }
+ k += 8;
+ l += 8;
+
+ doGen = TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, ICE);
+ for (k1 = 0; doGen && k1 < 16; ++k1) {
+ for (l1 = 0; l1 < 16; ++l1) {
+ i2 = this.worldObj.getPrecipitationHeight(k + k1, l + l1);
+
+ if (this.worldObj.isBlockFreezable(k1 + k, i2 - 1, l1 + l)) {
+ this.worldObj.setBlock(k1 + k, i2 - 1, l1 + l, Blocks.ice, 0, 2);
+ }
+
+ if (this.worldObj.func_147478_e(k1 + k, i2, l1 + l, true)) {
+ this.worldObj.setBlock(k1 + k, i2, l1 + l, Blocks.snow_layer, 0, 2);
+ }
+ }
+ }
+
+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag));
+
+ BlockFalling.fallInstantly = false;
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/world/autumn/TeleporterAutumn.class b/src/main/java/jp/plusplus/fbs/world/autumn/TeleporterAutumn.class Binary files differnew file mode 100644 index 0000000..229e639 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/autumn/TeleporterAutumn.class diff --git a/src/main/java/jp/plusplus/fbs/world/autumn/TeleporterAutumn.java b/src/main/java/jp/plusplus/fbs/world/autumn/TeleporterAutumn.java new file mode 100644 index 0000000..8ff296a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/autumn/TeleporterAutumn.java @@ -0,0 +1,354 @@ +package jp.plusplus.fbs.world.autumn;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.block.BlockCore;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockPortal;
+import net.minecraft.entity.Entity;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.Direction;
+import net.minecraft.util.LongHashMap;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.ChunkCoordIntPair;
+import net.minecraft.world.Teleporter;
+import net.minecraft.world.WorldServer;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/11/07.
+ */
+public class TeleporterAutumn extends Teleporter {
+ private final LongHashMap destinationCoordinateCache = new LongHashMap();
+ private final List destinationCoordinateKeys = new ArrayList();
+ private final WorldServer worldServerInstance;
+ private final Random random;
+
+ public TeleporterAutumn(WorldServer p_i1963_1_) {
+ super(p_i1963_1_);
+ worldServerInstance=p_i1963_1_;
+ random=new Random();
+ }
+
+ // 近くにポータルがあったらそこに出現させる処理
+ // このサンプルではネザーポータルの処理をそのまま利用する
+ @Override
+ public boolean placeInExistingPortal(Entity entity, double p_77184_2_, double p_77184_4_, double p_77184_6_, float p_77184_8_) {
+ short short1 = 128;
+ double d3 = -1.0D;
+ int i = 0;
+ int j = 0;
+ int k = 0;
+ int l = MathHelper.floor_double(entity.posX);
+ int i1 = MathHelper.floor_double(entity.posZ);
+ long j1 = ChunkCoordIntPair.chunkXZ2Int(l, i1);
+ boolean flag = true;
+ double z;
+ int l3;
+
+ if (this.destinationCoordinateCache.containsItem(j1)) {
+ Teleporter.PortalPosition portalposition = (Teleporter.PortalPosition) this.destinationCoordinateCache.getValueByKey(j1);
+ d3 = 0.0D;
+ i = portalposition.posX;
+ j = portalposition.posY;
+ k = portalposition.posZ;
+ portalposition.lastUpdateTime = this.worldServerInstance.getTotalWorldTime();
+ flag = false;
+ } else {
+ for (l3 = l - short1; l3 <= l + short1; ++l3) {
+ double d4 = (double) l3 + 0.5D - entity.posX;
+
+ for (int l1 = i1 - short1; l1 <= i1 + short1; ++l1) {
+ double d5 = (double) l1 + 0.5D - entity.posZ;
+
+ for (int i2 = this.worldServerInstance.getActualHeight() - 1; i2 >= 0; --i2) {
+ if (this.worldServerInstance.getBlock(l3, i2, l1) == BlockCore.portal2) {
+ while (this.worldServerInstance.getBlock(l3, i2 - 1, l1) == BlockCore.portal2) {
+ --i2;
+ }
+
+ z = (double) i2 + 0.5D - entity.posY;
+ double d8 = d4 * d4 + z * z + d5 * d5;
+
+ if (d3 < 0.0D || d8 < d3) {
+ d3 = d8;
+ i = l3;
+ j = i2;
+ k = l1;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (d3 >= 0.0D) {
+ if (flag) {
+ this.destinationCoordinateCache.add(j1, new Teleporter.PortalPosition(i, j, k, this.worldServerInstance.getTotalWorldTime()));
+ this.destinationCoordinateKeys.add(Long.valueOf(j1));
+ }
+
+ double x = (double) i + 0.5D;
+ double y = (double) j + 0.5D;
+ z = (double) k + 0.5D;
+
+ entity.motionX = entity.motionY = entity.motionZ = 0.0D;
+
+ entity.setLocationAndAngles(x, y+1, z, entity.rotationYaw, entity.rotationPitch);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ // ポータルを作成する処理
+ // このサンプルではネザーポータルの処理をそのまま利用する
+ @Override
+ public boolean makePortal(Entity p_85188_1_) {
+ byte b0 = 16;
+ double d0 = -1.0D;
+ int i = MathHelper.floor_double(p_85188_1_.posX);
+ int j = MathHelper.floor_double(p_85188_1_.posY);
+ int k = MathHelper.floor_double(p_85188_1_.posZ);
+ int l = i;
+ int i1 = j;
+ int j1 = k;
+ int k1 = 0;
+ int l1 = this.random.nextInt(4);
+ int x;
+ double d1;
+ int z;
+ double d2;
+ int y;
+ int j3;
+ int k3;
+ int l3;
+ int i4;
+ int j4;
+ int k4;
+ int x2;
+ int y2;
+ double d3;
+ double d4;
+
+ for (x = i - b0; x <= i + b0; ++x) {
+ d1 = (double) x + 0.5D - p_85188_1_.posX;
+
+ for (z = k - b0; z <= k + b0; ++z) {
+ d2 = (double) z + 0.5D - p_85188_1_.posZ;
+ label274:
+
+ for (y = this.worldServerInstance.getActualHeight() - 1; y >= 0; --y) {
+ if (this.worldServerInstance.isAirBlock(x, y, z)) {
+ while (y > 0 && this.worldServerInstance.isAirBlock(x, y - 1, z)) {
+ --y;
+ }
+
+ for (j3 = l1; j3 < l1 + 4; ++j3) {
+ k3 = j3 % 2;
+ l3 = 1 - k3;
+
+ if (j3 % 4 >= 2) {
+ k3 = -k3;
+ l3 = -l3;
+ }
+
+ for (i4 = 0; i4 < 3; ++i4) {
+ for (j4 = 0; j4 < 4; ++j4) {
+ for (k4 = -1; k4 < 4; ++k4) {
+ x2 = x + (j4 - 1) * k3 + i4 * l3;
+ y2 = y + k4;
+ int z2 = z + (j4 - 1) * l3 - i4 * k3;
+
+ if (k4 < 0 && !this.worldServerInstance.getBlock(x2, y2, z2).getMaterial().isSolid() || k4 >= 0 && !this.worldServerInstance.isAirBlock(x2, y2, z2)) {
+ continue label274;
+ }
+ }
+ }
+ }
+
+ d3 = (double) y + 0.5D - p_85188_1_.posY;
+ d4 = d1 * d1 + d3 * d3 + d2 * d2;
+
+ if (d0 < 0.0D || d4 < d0) {
+ d0 = d4;
+ l = x;
+ i1 = y;
+ j1 = z;
+ k1 = j3 % 4;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (d0 < 0.0D) {
+ for (x = i - b0; x <= i + b0; ++x) {
+ d1 = (double) x + 0.5D - p_85188_1_.posX;
+
+ for (z = k - b0; z <= k + b0; ++z) {
+ d2 = (double) z + 0.5D - p_85188_1_.posZ;
+ label222:
+
+ for (y = this.worldServerInstance.getActualHeight() - 1; y >= 0; --y) {
+ if (this.worldServerInstance.isAirBlock(x, y, z)) {
+ while (y > 0 && this.worldServerInstance.isAirBlock(x, y - 1, z)) {
+ --y;
+ }
+
+ for (j3 = l1; j3 < l1 + 2; ++j3) {
+ k3 = j3 % 2;
+ l3 = 1 - k3;
+
+ for (i4 = 0; i4 < 4; ++i4) {
+ for (j4 = -1; j4 < 4; ++j4) {
+ k4 = x + (i4 - 1) * k3;
+ x2 = y + j4;
+ y2 = z + (i4 - 1) * l3;
+
+ if (j4 < 0 && !this.worldServerInstance.getBlock(k4, x2, y2).getMaterial().isSolid() || j4 >= 0 && !this.worldServerInstance.isAirBlock(k4, x2, y2)) {
+ continue label222;
+ }
+ }
+ }
+
+ d3 = (double) y + 0.5D - p_85188_1_.posY;
+ d4 = d1 * d1 + d3 * d3 + d2 * d2;
+
+ if (d0 < 0.0D || d4 < d0) {
+ d0 = d4;
+ l = x;
+ i1 = y;
+ j1 = z;
+ k1 = j3 % 2;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ int k5 = l;
+ int j2 = i1;
+ z = j1;
+ int l5 = k1 % 2;
+ int l2 = 1 - l5;
+
+ if (k1 % 4 >= 2) {
+ l5 = -l5;
+ l2 = -l2;
+ }
+
+ boolean flag;
+
+ if (d0 < 0.0D) {
+ if (i1 < 70) {
+ i1 = 70;
+ }
+
+ if (i1 > this.worldServerInstance.getActualHeight() - 10) {
+ i1 = this.worldServerInstance.getActualHeight() - 10;
+ }
+
+ j2 = i1;
+
+ for (y = -1; y <= 1; ++y) {
+ for (j3 = 1; j3 < 3; ++j3) {
+ for (k3 = -1; k3 < 3; ++k3) {
+ l3 = k5 + (j3 - 1) * l5 + y * l2;
+ i4 = j2 + k3;
+ j4 = z + (j3 - 1) * l2 - y * l5;
+ flag = k3 < 0;
+ this.worldServerInstance.setBlock(l3, i4, j4, flag ? BlockCore.plank : Blocks.air);
+ }
+ }
+ }
+ }
+
+ worldServerInstance.setBlock(k5, j2-1, z, BlockCore.portal2, 0, 2);
+ /*
+ for (y = 0; y < 4; ++y) {
+ for (j3 = 0; j3 < 4; ++j3) {
+ for (k3 = -1; k3 < 4; ++k3) {
+ l3 = k5 + (j3 - 1) * l5;
+ i4 = j2 + k3;
+ j4 = z + (j3 - 1) * l2;
+ flag = j3 == 0 || j3 == 3 || k3 == -1 || k3 == 3;
+ this.worldServerInstance.setBlock(l3, i4, j4, (Block) (flag ? BlockCore.plank : BlockCore.portal2), 0, 2);
+ }
+ }
+
+ for (j3 = 0; j3 < 4; ++j3) {
+ for (k3 = -1; k3 < 4; ++k3) {
+ l3 = k5 + (j3 - 1) * l5;
+ i4 = j2 + k3;
+ j4 = z + (j3 - 1) * l2;
+ this.worldServerInstance.notifyBlocksOfNeighborChange(l3, i4, j4, this.worldServerInstance.getBlock(l3, i4, j4));
+ }
+ }
+ }
+ */
+
+ return true;
+ }
+
+ public void removeStalePortalLocations(long p_85189_1_) {
+ if (p_85189_1_ % 100L == 0L) {
+ Iterator iterator = this.destinationCoordinateKeys.iterator();
+ long j = p_85189_1_ - 600L;
+
+ while (iterator.hasNext()) {
+ Long olong = (Long) iterator.next();
+ Teleporter.PortalPosition portalposition = (Teleporter.PortalPosition) this.destinationCoordinateCache.getValueByKey(olong.longValue());
+
+ if (portalposition == null || portalposition.lastUpdateTime < j) {
+ iterator.remove();
+ this.destinationCoordinateCache.remove(olong.longValue());
+ }
+ }
+ }
+ }
+
+ @Override
+ public void placeInPortal(Entity p_77185_1_, double p_77185_2_, double p_77185_4_, double p_77185_6_, float p_77185_8_) {
+ if (!this.placeInExistingPortal(p_77185_1_, p_77185_2_, p_77185_4_, p_77185_6_, p_77185_8_)) {
+ this.makePortal(p_77185_1_);
+ this.placeInExistingPortal(p_77185_1_, p_77185_2_, p_77185_4_, p_77185_6_, p_77185_8_);
+ }
+
+ /*
+ if (this.worldServerInstance.provider.dimensionId != FBS.dimensionAutumnId) {
+ if (!this.placeInExistingPortal(p_77185_1_, p_77185_2_, p_77185_4_, p_77185_6_, p_77185_8_)) {
+ this.makePortal(p_77185_1_);
+ this.placeInExistingPortal(p_77185_1_, p_77185_2_, p_77185_4_, p_77185_6_, p_77185_8_);
+ }
+ } else {
+ int i = MathHelper.floor_double(p_77185_1_.posX);
+ int j = MathHelper.floor_double(p_77185_1_.posY) - 1;
+ int k = MathHelper.floor_double(p_77185_1_.posZ);
+ byte b0 = 1;
+ byte b1 = 0;
+
+ for (int l = -4; l <= 4; ++l) {
+ for (int i1 = -4; i1 <= 4; ++i1) {
+ for (int j1 = -1; j1 < 3; ++j1) {
+ int blockX = i + i1 * b0 + l * b1;
+ int blockY = j + j1;
+ int blockZ = k + i1 * b1 - l * b0;
+ boolean flag = j1 < 0;
+ this.worldServerInstance.setBlock(blockX, blockY, blockZ, flag ? BlockCore.plank : Blocks.air);
+ }
+ }
+ }
+
+ p_77185_1_.setLocationAndAngles((double) i+2, (double) j, (double) k+2, p_77185_1_.rotationYaw, 0.0F);
+ p_77185_1_.motionX = p_77185_1_.motionY = p_77185_1_.motionZ = 0.0D;
+ }
+ */
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/world/autumn/WorldChunkManagerAutumn.class b/src/main/java/jp/plusplus/fbs/world/autumn/WorldChunkManagerAutumn.class Binary files differnew file mode 100644 index 0000000..21d5e51 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/autumn/WorldChunkManagerAutumn.class diff --git a/src/main/java/jp/plusplus/fbs/world/autumn/WorldChunkManagerAutumn.java b/src/main/java/jp/plusplus/fbs/world/autumn/WorldChunkManagerAutumn.java new file mode 100644 index 0000000..9c38067 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/autumn/WorldChunkManagerAutumn.java @@ -0,0 +1,202 @@ +package jp.plusplus.fbs.world.autumn;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.Registry;
+import net.minecraft.world.ChunkPosition;
+import net.minecraft.world.World;
+import net.minecraft.world.WorldType;
+import net.minecraft.world.biome.BiomeCache;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.biome.WorldChunkManager;
+import net.minecraft.world.gen.layer.GenLayer;
+import net.minecraft.world.gen.layer.IntCache;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/10/29.
+ */
+public class WorldChunkManagerAutumn extends WorldChunkManager {
+ // WorldChunkManagerのプライベート変数にはアクセスできないので専用の変数を作成
+ private GenLayer genBiomes;
+ private GenLayer biomeIndexLayer;
+ private BiomeCache biomeCache;
+ private List biomesToSpawnIn;
+
+ public static final BiomeGenBase[] biomeList = new BiomeGenBase[256];
+
+ static {
+ for (int i = 0; i < biomeList.length; ++i) {
+ biomeList[i]=Registry.biomeAutumn;
+ /*
+ if (i % 2 == 0) {
+ biomeList[i] = mushroomIsland;
+ } else if (i % 2 == 1) {
+ biomeList[i] = mesa;
+ }
+ */
+ }
+ }
+
+ protected WorldChunkManagerAutumn() {
+ this.biomeCache = new BiomeCache(this);
+ this.biomesToSpawnIn = new ArrayList();
+ this.biomesToSpawnIn.add(Registry.biomeAutumn);
+ //this.biomesToSpawnIn.addAll(allowedBiomes);
+ }
+
+ public WorldChunkManagerAutumn(long par1, WorldType par3WorldType) {
+ this();
+ GenLayer[] var4 = GenLayer.initializeAllBiomeGenerators(par1, par3WorldType);
+ this.genBiomes = var4[0];
+ this.biomeIndexLayer = var4[1];
+ }
+
+ public WorldChunkManagerAutumn(World par1World) {
+ this(par1World.getSeed(), par1World.getWorldInfo().getTerrainType());
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+ // WorldChunkManagerのプライベート変数を使用するメソッドはすべて再実装
+
+ @Override
+ public List getBiomesToSpawnIn() {
+ return this.biomesToSpawnIn;
+ }
+
+ @Override
+ public BiomeGenBase getBiomeGenAt(int par1, int par2) {
+ return this.biomeCache.getBiomeGenAt(par1, par2);
+ }
+
+ @Override
+ public float[] getRainfall(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5) {
+ IntCache.resetIntCache();
+
+ if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5) {
+ par1ArrayOfFloat = new float[par4 * par5];
+ }
+
+ int[] var6 = this.biomeIndexLayer.getInts(par2, par3, par4, par5);
+
+ for (int var7 = 0; var7 < par4 * par5; ++var7) {
+ float var8 = (float) biomeList[var6[var7]].getIntRainfall() / 65536.0F;
+
+ if (var8 > 1.0F) {
+ var8 = 1.0F;
+ }
+
+ par1ArrayOfFloat[var7] = var8;
+ }
+
+ return par1ArrayOfFloat;
+ }
+
+ @SideOnly(Side.CLIENT)
+ @Override
+ public float getTemperatureAtHeight(float par1, int par2) {
+ return par1;
+ }
+
+ @Override
+ public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) {
+ IntCache.resetIntCache();
+
+ if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) {
+ par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
+ }
+
+ int[] var6 = this.genBiomes.getInts(par2, par3, par4, par5);
+
+ for (int var7 = 0; var7 < par4 * par5; ++var7) {
+ par1ArrayOfBiomeGenBase[var7] = biomeList[var6[var7]];
+ }
+
+ return par1ArrayOfBiomeGenBase;
+ }
+
+ @Override
+ public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) {
+ return this.getBiomeGenAt(par1ArrayOfBiomeGenBase, par2, par3, par4, par5, true);
+ }
+
+ @Override
+ public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5, boolean par6) {
+ IntCache.resetIntCache();
+
+ if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) {
+ par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
+ }
+
+ if (par6 && par4 == 16 && par5 == 16 && (par2 & 15) == 0 && (par3 & 15) == 0) {
+ BiomeGenBase[] var9 = this.biomeCache.getCachedBiomes(par2, par3);
+ System.arraycopy(var9, 0, par1ArrayOfBiomeGenBase, 0, par4 * par5);
+ return par1ArrayOfBiomeGenBase;
+ } else {
+ int[] var7 = this.biomeIndexLayer.getInts(par2, par3, par4, par5);
+
+ for (int var8 = 0; var8 < par4 * par5; ++var8) {
+ par1ArrayOfBiomeGenBase[var8] = biomeList[var7[var8]];
+ }
+
+ return par1ArrayOfBiomeGenBase;
+ }
+ }
+
+ @Override
+ public boolean areBiomesViable(int par1, int par2, int par3, List par4List) {
+ IntCache.resetIntCache();
+ int var5 = par1 - par3 >> 2;
+ int var6 = par2 - par3 >> 2;
+ int var7 = par1 + par3 >> 2;
+ int var8 = par2 + par3 >> 2;
+ int var9 = var7 - var5 + 1;
+ int var10 = var8 - var6 + 1;
+ int[] var11 = this.genBiomes.getInts(var5, var6, var9, var10);
+
+ for (int var12 = 0; var12 < var9 * var10; ++var12) {
+ BiomeGenBase var13 = biomeList[var11[var12]];
+
+ if (!par4List.contains(var13)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public ChunkPosition findBiomePosition(int par1, int par2, int par3, List par4List, Random par5Random) {
+ IntCache.resetIntCache();
+ int var6 = par1 - par3 >> 2;
+ int var7 = par2 - par3 >> 2;
+ int var8 = par1 + par3 >> 2;
+ int var9 = par2 + par3 >> 2;
+ int var10 = var8 - var6 + 1;
+ int var11 = var9 - var7 + 1;
+ int[] var12 = this.genBiomes.getInts(var6, var7, var10, var11);
+ ChunkPosition var13 = null;
+ int var14 = 0;
+
+ for (int var15 = 0; var15 < var10 * var11; ++var15) {
+ int var16 = var6 + var15 % var10 << 2;
+ int var17 = var7 + var15 / var10 << 2;
+ BiomeGenBase var18 = biomeList[var12[var15]];
+
+ if (par4List.contains(var18) && (var13 == null || par5Random.nextInt(var14 + 1) == 0)) {
+ var13 = new ChunkPosition(var16, 0, var17);
+ ++var14;
+ }
+ }
+
+ return var13;
+ }
+
+ @Override
+ public void cleanupCache() {
+ this.biomeCache.cleanupCache();
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/world/autumn/WorldProviderAutumn.class b/src/main/java/jp/plusplus/fbs/world/autumn/WorldProviderAutumn.class Binary files differnew file mode 100644 index 0000000..a320bb1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/autumn/WorldProviderAutumn.class diff --git a/src/main/java/jp/plusplus/fbs/world/autumn/WorldProviderAutumn.java b/src/main/java/jp/plusplus/fbs/world/autumn/WorldProviderAutumn.java new file mode 100644 index 0000000..8622a1b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/autumn/WorldProviderAutumn.java @@ -0,0 +1,57 @@ +package jp.plusplus.fbs.world.autumn;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import net.minecraft.util.ChunkCoordinates;
+import net.minecraft.world.WorldProvider;
+import net.minecraft.world.chunk.IChunkProvider;
+
+/**
+ * Created by plusplus_F on 2015/11/07.
+ */
+public class WorldProviderAutumn extends WorldProvider {
+
+ @Override
+ public String getDimensionName() {
+ return "Eternal Autumn";
+ }
+
+ // 独自のワールドタイプやワールドチャンクマネージャーを設定
+ @Override
+ protected void registerWorldChunkManager() {
+ worldObj.getWorldInfo().setTerrainType(WorldTypeAutumn.worldType);
+ worldChunkMgr = new WorldChunkManagerAutumn(worldObj);
+ setDimension(FBS.dimensionAutumnId);
+ }
+
+ @Override
+ public IChunkProvider createChunkGenerator() {
+ return new ChunkProviderAutumn(worldObj, worldObj.getSeed(), worldObj.getWorldInfo().isMapFeaturesEnabled());
+ }
+
+ @Override
+ public boolean canRespawnHere() {
+ return false;
+ }
+
+ @Override
+ public boolean isSurfaceWorld() {
+ return true;
+ }
+
+ @Override
+ public boolean canCoordinateBeSpawn(int p_76566_1_, int p_76566_2_) {
+ return this.worldObj.getTopBlock(p_76566_1_, p_76566_2_).getMaterial().blocksMovement();
+ }
+
+ @Override
+ public String getWelcomeMessage() {
+ return "Entering the Eternal Autumn";
+ }
+
+ @Override
+ public String getDepartMessage() {
+ return "Leaving the Eternal Autumn";
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/world/autumn/WorldTypeAutumn.class b/src/main/java/jp/plusplus/fbs/world/autumn/WorldTypeAutumn.class Binary files differnew file mode 100644 index 0000000..74691f6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/autumn/WorldTypeAutumn.class diff --git a/src/main/java/jp/plusplus/fbs/world/autumn/WorldTypeAutumn.java b/src/main/java/jp/plusplus/fbs/world/autumn/WorldTypeAutumn.java new file mode 100644 index 0000000..9bdbcda --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/autumn/WorldTypeAutumn.java @@ -0,0 +1,29 @@ +package jp.plusplus.fbs.world.autumn;
+
+import jp.plusplus.fbs.world.crack.ChunkProviderCrack;
+import jp.plusplus.fbs.world.crack.WorldChunkManagerCrack;
+import net.minecraft.world.World;
+import net.minecraft.world.WorldType;
+import net.minecraft.world.biome.WorldChunkManager;
+import net.minecraft.world.chunk.IChunkProvider;
+
+/**
+ * Created by plusplus_F on 2015/10/29.
+ */
+public class WorldTypeAutumn extends WorldType {
+ public static WorldType worldType = new WorldTypeAutumn("Eternal Autumn");
+
+ private WorldTypeAutumn(String name) {
+ super(name);
+ }
+
+ @Override
+ public WorldChunkManager getChunkManager(World world) {
+ return new WorldChunkManagerAutumn(world);
+ }
+
+ @Override
+ public IChunkProvider getChunkGenerator(World world, String generatorOptions) {
+ return new ChunkProviderAutumn(world, world.getSeed(), true);
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/world/biome/BiomeAutumn.class b/src/main/java/jp/plusplus/fbs/world/biome/BiomeAutumn.class Binary files differnew file mode 100644 index 0000000..5fc0aea --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/biome/BiomeAutumn.class diff --git a/src/main/java/jp/plusplus/fbs/world/biome/BiomeAutumn.java b/src/main/java/jp/plusplus/fbs/world/biome/BiomeAutumn.java new file mode 100644 index 0000000..b975f60 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/biome/BiomeAutumn.java @@ -0,0 +1,115 @@ +package jp.plusplus.fbs.world.biome;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.entity.EntityButterfly;
+import net.minecraft.block.BlockFlower;
+import net.minecraft.entity.passive.EntityWolf;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.biome.BiomeGenForest;
+import net.minecraft.world.gen.feature.WorldGenAbstractTree;
+import net.minecraft.world.gen.feature.WorldGenBigMushroom;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/08/20.
+ * 「魔力の秋」バイオーム
+ */
+public class BiomeAutumn extends BiomeGenBase {
+ private int biomeType;
+ protected final WorldGenDirtyOak genOak = new WorldGenDirtyOak(false, false);
+ protected final WorldGenDirtyOak genOakBig = new WorldGenDirtyOak(false, true);
+ protected final WorldGenDirtyOak genBirch = new WorldGenDirtyBirch(false);
+
+ public BiomeAutumn(int id) {
+ super(id);
+ this.biomeType = 0;
+ this.theBiomeDecorator.treesPerChunk = 10;
+ this.theBiomeDecorator.grassPerChunk = 4;
+ setBiomeName("Magical Autumn");
+
+ //表面のブロックは落ち葉
+ this.topBlock= BlockCore.fallenLeaves;
+ this.field_150604_aj=0;
+
+ //地中は土
+ this.fillerBlock=Blocks.dirt;
+ this.field_76754_C=0;
+
+ //知らん
+ this.func_76733_a(5159473);
+ this.setTemperatureRainfall(0.7F, 0.8F);
+
+ //狼と蝶がスポーン
+ this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityWolf.class, 5, 4, 4));
+ //this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityButterfly.class, 8, 4, 4));
+ }
+
+ @Override
+ public WorldGenAbstractTree func_150567_a(Random p_150567_1_) {
+ int r=p_150567_1_.nextInt(100);
+
+ if(r<10) return genOakBig;
+ else if(r<10+15) return genBirch;
+ return genOak;
+ }
+
+ @Override
+ public void decorate(World p_76728_1_, Random p_76728_2_, int p_76728_3_, int p_76728_4_) {
+ int k;
+ int l;
+ int i1;
+ int j1;
+ int k1;
+
+ k = p_76728_2_.nextInt(5) - 3;
+
+ l = 0;
+
+ while (l < k) {
+ i1 = p_76728_2_.nextInt(3);
+
+ if (i1 == 0) {
+ genTallFlowers.func_150548_a(1);
+ } else if (i1 == 1) {
+ genTallFlowers.func_150548_a(4);
+ } else if (i1 == 2) {
+ genTallFlowers.func_150548_a(5);
+ }
+
+ j1 = 0;
+
+ while (true) {
+ if (j1 < 5) {
+ k1 = p_76728_3_ + p_76728_2_.nextInt(16) + 8;
+ int i2 = p_76728_4_ + p_76728_2_.nextInt(16) + 8;
+ int l1 = p_76728_2_.nextInt(p_76728_1_.getHeightValue(k1, i2) + 32);
+
+ if (!genTallFlowers.generate(p_76728_1_, p_76728_2_, k1, l1, i2)) {
+ ++j1;
+ continue;
+ }
+ }
+
+ ++l;
+ break;
+ }
+ }
+
+ super.decorate(p_76728_1_, p_76728_2_, p_76728_3_, p_76728_4_);
+ }
+
+ /**
+ * Provides the basic grass color based on the biome temperature and rainfall
+ */
+ @SideOnly(Side.CLIENT)
+ public int getBiomeGrassColor(int p_150558_1_, int p_150558_2_, int p_150558_3_) {
+ int l = super.getBiomeGrassColor(p_150558_1_, p_150558_2_, p_150558_3_);
+ return (l & 0x00f000)+0xff0f00;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyBirch.class b/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyBirch.class Binary files differnew file mode 100644 index 0000000..070c08f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyBirch.class diff --git a/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyBirch.java b/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyBirch.java new file mode 100644 index 0000000..93a3e60 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyBirch.java @@ -0,0 +1,13 @@ +package jp.plusplus.fbs.world.biome;
+
+/**
+ * Created by plusplus_F on 2015/08/20.
+ * 紅葉した白樺
+ */
+public class WorldGenDirtyBirch extends WorldGenDirtyOak {
+ public WorldGenDirtyBirch(boolean notify) {
+ super(notify, false);
+ woodMeta=2;
+ leaveMeta=1;
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyOak.class b/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyOak.class Binary files differnew file mode 100644 index 0000000..6b88474 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyOak.class diff --git a/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyOak.java b/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyOak.java new file mode 100644 index 0000000..3559b62 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyOak.java @@ -0,0 +1,122 @@ +package jp.plusplus.fbs.world.biome;
+
+import jp.plusplus.fbs.block.BlockCore;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockSapling;
+import net.minecraft.init.Blocks;
+import net.minecraft.world.World;
+import net.minecraft.world.gen.feature.WorldGenAbstractTree;
+import net.minecraft.world.gen.feature.WorldGenTrees;
+import net.minecraftforge.common.util.ForgeDirection;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/08/20.
+ * 「魔力の秋」に生成される紅葉した樫の木
+ */
+public class WorldGenDirtyOak extends WorldGenAbstractTree {
+ private boolean bigger;
+ protected Block wood;
+ protected int woodMeta;
+ protected Block leave;
+ protected int leaveMeta=2;
+
+ public WorldGenDirtyOak(boolean notify, boolean isBig) {
+ super(notify);
+ this.bigger = isBig;
+ wood= Blocks.log;
+ woodMeta=0;
+ leave=BlockCore.leaves;
+ leaveMeta=0;
+ }
+
+ public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_) {
+ int l = p_76484_2_.nextInt(3) + 5;
+
+ if (this.bigger) {
+ l += p_76484_2_.nextInt(7);
+ }
+
+ boolean flag = true;
+
+ if (p_76484_4_ >= 1 && p_76484_4_ + l + 1 <= 256) {
+ int j1;
+ int k1;
+
+ for (int i1 = p_76484_4_; i1 <= p_76484_4_ + 1 + l; ++i1) {
+ byte b0 = 1;
+
+ if (i1 == p_76484_4_) {
+ b0 = 0;
+ }
+
+ if (i1 >= p_76484_4_ + 1 + l - 2) {
+ b0 = 2;
+ }
+
+ for (j1 = p_76484_3_ - b0; j1 <= p_76484_3_ + b0 && flag; ++j1) {
+ for (k1 = p_76484_5_ - b0; k1 <= p_76484_5_ + b0 && flag; ++k1) {
+ if (i1 >= 0 && i1 < 256) {
+ Block block = p_76484_1_.getBlock(j1, i1, k1);
+
+ if (!this.isReplaceable(p_76484_1_, j1, i1, k1)) {
+ flag = false;
+ }
+ } else {
+ flag = false;
+ }
+ }
+ }
+ }
+
+ if (!flag) {
+ return false;
+ } else {
+ Block block2 = p_76484_1_.getBlock(p_76484_3_, p_76484_4_ - 1, p_76484_5_);
+
+ //boolean isSoil = block2.canSustainPlant(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, ForgeDirection.UP, (BlockSapling) Blocks.sapling);
+ boolean isSoil=(block2==BlockCore.fallenLeaves);
+ if (isSoil && p_76484_4_ < 256 - l - 1) {
+ block2.onPlantGrow(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, p_76484_3_, p_76484_4_, p_76484_5_);
+ int k2;
+
+ for (k2 = p_76484_4_ - 3 + l; k2 <= p_76484_4_ + l; ++k2) {
+ j1 = k2 - (p_76484_4_ + l);
+ k1 = 1 - j1 / 2;
+
+ for (int l2 = p_76484_3_ - k1; l2 <= p_76484_3_ + k1; ++l2) {
+ int l1 = l2 - p_76484_3_;
+
+ for (int i2 = p_76484_5_ - k1; i2 <= p_76484_5_ + k1; ++i2) {
+ int j2 = i2 - p_76484_5_;
+
+ if (Math.abs(l1) != k1 || Math.abs(j2) != k1 || p_76484_2_.nextInt(2) != 0 && j1 != 0) {
+ Block block1 = p_76484_1_.getBlock(l2, k2, i2);
+
+ if (block1.isAir(p_76484_1_, l2, k2, i2) || block1.isLeaves(p_76484_1_, l2, k2, i2)) {
+ this.setBlockAndNotifyAdequately(p_76484_1_, l2, k2, i2, leave, leaveMeta);
+ }
+ }
+ }
+ }
+ }
+
+ for (k2 = 0; k2 < l; ++k2) {
+ Block block3 = p_76484_1_.getBlock(p_76484_3_, p_76484_4_ + k2, p_76484_5_);
+
+ if (block3.isAir(p_76484_1_, p_76484_3_, p_76484_4_ + k2, p_76484_5_) || block3.isLeaves(p_76484_1_, p_76484_3_, p_76484_4_ + k2, p_76484_5_)) {
+ this.setBlockAndNotifyAdequately(p_76484_1_, p_76484_3_, p_76484_4_ + k2, p_76484_5_, wood, woodMeta);
+ }
+ }
+
+ return true;
+ } else {
+ return false;
+ }
+ }
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/world/crack/ChunkProviderCrack$Generator.class b/src/main/java/jp/plusplus/fbs/world/crack/ChunkProviderCrack$Generator.class Binary files differnew file mode 100644 index 0000000..1aeb3f9 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/ChunkProviderCrack$Generator.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/ChunkProviderCrack.class b/src/main/java/jp/plusplus/fbs/world/crack/ChunkProviderCrack.class Binary files differnew file mode 100644 index 0000000..67b10d2 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/ChunkProviderCrack.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/ChunkProviderCrack.java b/src/main/java/jp/plusplus/fbs/world/crack/ChunkProviderCrack.java new file mode 100644 index 0000000..a678f33 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/ChunkProviderCrack.java @@ -0,0 +1,406 @@ +package jp.plusplus.fbs.world.crack;
+
+import cpw.mods.fml.common.eventhandler.Event;
+import jp.plusplus.fbs.world.crack.structure.MapGenSchool;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockFalling;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.EnumCreatureType;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.IProgressUpdate;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.ChunkPosition;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.chunk.Chunk;
+import net.minecraft.world.chunk.IChunkProvider;
+import net.minecraft.world.gen.ChunkProviderGenerate;
+import net.minecraft.world.gen.NoiseGenerator;
+import net.minecraft.world.gen.NoiseGeneratorOctaves;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.terraingen.ChunkProviderEvent;
+import net.minecraftforge.event.terraingen.PopulateChunkEvent;
+import net.minecraftforge.event.terraingen.TerrainGen;
+
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/10/29.
+ */
+public class ChunkProviderCrack implements IChunkProvider {
+ private Random endRNG;
+ private NoiseGeneratorOctaves noiseGen1;
+ private NoiseGeneratorOctaves noiseGen2;
+ private NoiseGeneratorOctaves noiseGen3;
+ public NoiseGeneratorOctaves noiseGen4;
+ public NoiseGeneratorOctaves noiseGen5;
+ private World world;
+ private double[] densities;
+ /**
+ * The biomes that are used to generate the chunk
+ */
+ private BiomeGenBase[] biomesForGeneration;
+ double[] noiseData1;
+ double[] noiseData2;
+ double[] noiseData3;
+ double[] noiseData4;
+ double[] noiseData5;
+ int[][] field_73203_h = new int[32][32];
+
+ private MapGenSchool mapGenSchool=new MapGenSchool();
+
+ public ChunkProviderCrack(World p_i2007_1_, long p_i2007_2_) {
+ this.world = p_i2007_1_;
+ this.endRNG = new Random(p_i2007_2_);
+ this.noiseGen1 = new NoiseGeneratorOctaves(this.endRNG, 16);
+ this.noiseGen2 = new NoiseGeneratorOctaves(this.endRNG, 16);
+ this.noiseGen3 = new NoiseGeneratorOctaves(this.endRNG, 8);
+ this.noiseGen4 = new NoiseGeneratorOctaves(this.endRNG, 10);
+ this.noiseGen5 = new NoiseGeneratorOctaves(this.endRNG, 16);
+
+ NoiseGenerator[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5};
+ noiseGens = TerrainGen.getModdedNoiseGenerators(p_i2007_1_, this.endRNG, noiseGens);
+ this.noiseGen1 = (NoiseGeneratorOctaves) noiseGens[0];
+ this.noiseGen2 = (NoiseGeneratorOctaves) noiseGens[1];
+ this.noiseGen3 = (NoiseGeneratorOctaves) noiseGens[2];
+ this.noiseGen4 = (NoiseGeneratorOctaves) noiseGens[3];
+ this.noiseGen5 = (NoiseGeneratorOctaves) noiseGens[4];
+ }
+
+ public void generateChunk(int chunkX, int chunkZ, Block[] blocks, BiomeGenBase[] biomes) {
+ byte base = 2;
+ int noiseWidth = base + 1;
+ byte noiseHeight = 33;
+ int noiseDepth = base + 1;
+ this.densities = this.initializeNoiseField(this.densities, chunkX * base, 0, chunkZ * base, noiseWidth, noiseHeight, noiseDepth);
+
+ for (int i1 = 0; i1 < base; ++i1) {
+ for (int j1 = 0; j1 < base; ++j1) {
+ for (int k1 = 0; k1 < 32; ++k1) {
+ double d0 = 0.25D;
+ double d1 = this.densities[((i1 + 0) * noiseDepth + j1 + 0) * noiseHeight + k1 + 0];
+ double d2 = this.densities[((i1 + 0) * noiseDepth + j1 + 1) * noiseHeight + k1 + 0];
+ double d3 = this.densities[((i1 + 1) * noiseDepth + j1 + 0) * noiseHeight + k1 + 0];
+ double d4 = this.densities[((i1 + 1) * noiseDepth + j1 + 1) * noiseHeight + k1 + 0];
+ double d5 = (this.densities[((i1 + 0) * noiseDepth + j1 + 0) * noiseHeight + k1 + 1] - d1) * d0;
+ double d6 = (this.densities[((i1 + 0) * noiseDepth + j1 + 1) * noiseHeight + k1 + 1] - d2) * d0;
+ double d7 = (this.densities[((i1 + 1) * noiseDepth + j1 + 0) * noiseHeight + k1 + 1] - d3) * d0;
+ double d8 = (this.densities[((i1 + 1) * noiseDepth + j1 + 1) * noiseHeight + k1 + 1] - d4) * d0;
+
+ for (int l1 = 0; l1 < 4; ++l1) {
+ double scale = 0.125D;
+ double d10 = d1;
+ double d11 = d2;
+ double d12 = (d3 - d1) * scale;
+ double d13 = (d4 - d2) * scale;
+
+ for (int i2 = 0; i2 < 8; ++i2) {
+ int index = i2 + i1 * 8 << 11 | 0 + j1 * 8 << 7 | k1 * 4 + l1;
+ short short1 = 128;
+ double d14 = 0.125D;
+ double d15 = d10;
+ double d16 = (d11 - d10) * d14;
+
+ for (int k2 = 0; k2 < 8; ++k2) {
+ Block block = Blocks.air;
+
+ if (d15 > 0.0D) {
+ block = Blocks.dirt;
+ }
+
+ blocks[index] = block;
+ index += short1;
+ d15 += d16;
+ }
+
+ d10 += d12;
+ d11 += d13;
+ }
+
+ d1 += d5;
+ d2 += d6;
+ d3 += d7;
+ d4 += d8;
+ }
+ }
+ }
+ }
+ }
+
+ @Deprecated // Supply metadata to the below function.
+ public void func_147421_b(int p_147421_1_, int p_147421_2_, Block[] p_147421_3_, BiomeGenBase[] p_147421_4_) {
+ replaceBiomeBlocks(p_147421_1_, p_147421_2_, p_147421_3_, p_147421_4_, new byte[p_147421_3_.length]);
+ }
+
+ public void replaceBiomeBlocks(int chunkX, int chunkZ, Block[] blocks, BiomeGenBase[] biomes, byte[] meta) {
+ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, chunkX, chunkZ, blocks, meta, biomes, this.world);
+ MinecraftForge.EVENT_BUS.post(event);
+ if (event.getResult() == Event.Result.DENY) return;
+
+ for (int x = 0; x < 16; ++x) {
+ for (int z = 0; z < 16; ++z) {
+ int dirtCount=0;
+ int dirtToStone=5+endRNG.nextInt(3);
+ for (int j1 = 127; j1 >= 0; --j1) {
+ int index = (z * 16 + x) * 128 + j1;
+ Block block2 = blocks[index];
+
+ if(block2==Blocks.dirt){
+ //地表を草ブロックにする
+ if(dirtCount==0) blocks[index]=Blocks.grass;
+
+ //地中は石にする
+ if(dirtCount>dirtToStone) blocks[index]=Blocks.stone;
+
+ dirtCount++;
+ }
+ }
+ }
+ }
+
+ }
+
+ /**
+ * loads or generates the chunk at the chunk location specified
+ */
+ public Chunk loadChunk(int p_73158_1_, int p_73158_2_) {
+ return this.provideChunk(p_73158_1_, p_73158_2_);
+ }
+
+ /**
+ * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
+ * specified chunk from the map seed and chunk seed
+ * チャンクを生成する
+ */
+ public Chunk provideChunk(int chunkX, int chunkZ) {
+ this.endRNG.setSeed((long) chunkX * 341873128712L + (long) chunkZ * 132897987541L);
+ Block[] ablock = new Block[32768];
+ byte[] meta = new byte[ablock.length];
+ this.biomesForGeneration = this.world.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, chunkX * 16, chunkZ * 16, 16, 16);
+
+ //チャンク内のブロックをまるごと決定する
+ this.generateChunk(chunkX, chunkZ, ablock, this.biomesForGeneration);
+
+ this.replaceBiomeBlocks(chunkX, chunkZ, ablock, this.biomesForGeneration, meta);
+ Chunk chunk = new Chunk(this.world, ablock, meta, chunkX, chunkZ);
+ byte[] abyte = chunk.getBiomeArray();
+
+ for (int k = 0; k < abyte.length; ++k) {
+ abyte[k] = (byte) this.biomesForGeneration[k].biomeID;
+ }
+ chunk.generateSkylightMap();
+ return chunk;
+ }
+
+ /**
+ * generates a subset of the level's terrain data. Takes 7 arguments: the [empty] noise array, the position, and the
+ * size.
+ */
+ private double[] initializeNoiseField(double[] noise, int x, int y, int z, int width, int height, int depth) {
+ ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, noise, x, y, z, width, height, depth);
+ MinecraftForge.EVENT_BUS.post(event);
+ if (event.getResult() == Event.Result.DENY) return event.noisefield;
+
+ if (noise == null) {
+ noise = new double[width * height * depth];
+ }
+
+ double d0 = 684.412D;
+ double d1 = 684.412D;
+ this.noiseData4 = this.noiseGen4.generateNoiseOctaves(this.noiseData4, x, z, width, depth, 1.121D, 1.121D, 0.5D);
+ this.noiseData5 = this.noiseGen5.generateNoiseOctaves(this.noiseData5, x, z, width, depth, 200.0D, 200.0D, 0.5D);
+ d0 *= 2.0D;
+ this.noiseData1 = this.noiseGen3.generateNoiseOctaves(this.noiseData1, x, y, z, width, height, depth, d0 / 80.0D, d1 / 160.0D, d0 / 80.0D);
+ this.noiseData2 = this.noiseGen1.generateNoiseOctaves(this.noiseData2, x, y, z, width, height, depth, d0, d1, d0);
+ this.noiseData3 = this.noiseGen2.generateNoiseOctaves(this.noiseData3, x, y, z, width, height, depth, d0, d1, d0);
+ int k1 = 0;
+ int l1 = 0;
+
+ for (int i2 = 0; i2 < width; ++i2) {
+ for (int j2 = 0; j2 < depth; ++j2) {
+ double d2 = (this.noiseData4[l1] + 256.0D) / 512.0D;
+
+ if (d2 > 1.0D) {
+ d2 = 1.0D;
+ }
+
+ double d3 = this.noiseData5[l1] / 8000.0D;
+
+ if (d3 < 0.0D) {
+ d3 = -d3 * 0.3D;
+ }
+
+ d3 = d3 * 3.0D - 2.0D;
+ float f = (float) (i2 + x - 0) / 1.0F;
+ float f1 = (float) (j2 + z - 0) / 1.0F;
+ float f2 = 100.0F - MathHelper.sqrt_float(f * f + f1 * f1) * 8.0F;
+
+ if (f2 > 80.0F) {
+ f2 = 80.0F;
+ }
+
+ if (f2 < -100.0F) {
+ f2 = -100.0F;
+ }
+
+ if (d3 > 1.0D) {
+ d3 = 1.0D;
+ }
+
+ d3 /= 8.0D;
+ d3 = 0.0D;
+
+ if (d2 < 0.0D) {
+ d2 = 0.0D;
+ }
+
+ d2 += 0.5D;
+ d3 = d3 * (double) height / 16.0D;
+ ++l1;
+ double d4 = (double) height / 2.0D;
+
+ for (int k2 = 0; k2 < height; ++k2) {
+ double d5 = 0.0D;
+ double d6 = ((double) k2 - d4) * 8.0D / d2;
+
+ if (d6 < 0.0D) {
+ d6 *= -1.0D;
+ }
+
+ double d7 = this.noiseData2[k1] / 512.0D;
+ double d8 = this.noiseData3[k1] / 512.0D;
+ double d9 = (this.noiseData1[k1] / 10.0D + 1.0D) / 2.0D;
+
+ if (d9 < 0.0D) {
+ d5 = d7;
+ } else if (d9 > 1.0D) {
+ d5 = d8;
+ } else {
+ d5 = d7 + (d8 - d7) * d9;
+ }
+
+ d5 -= 8.0D;
+ d5 += (double) f2;
+ byte b0 = 2;
+ double d10;
+
+ if (k2 > height / 2 - b0) {
+ d10 = (double) ((float) (k2 - (height / 2 - b0)) / 64.0F);
+
+ if (d10 < 0.0D) {
+ d10 = 0.0D;
+ }
+
+ if (d10 > 1.0D) {
+ d10 = 1.0D;
+ }
+
+ d5 = d5 * (1.0D - d10) + -3000.0D * d10;
+ }
+
+ b0 = 8;
+
+ if (k2 < b0) {
+ d10 = (double) ((float) (b0 - k2) / ((float) b0 - 1.0F));
+ d5 = d5 * (1.0D - d10) + -30.0D * d10;
+ }
+
+ noise[k1] = d5;
+ ++k1;
+ }
+ }
+ }
+
+ return noise;
+ }
+
+ /**
+ * Checks to see if a chunk exists at x, y
+ */
+ public boolean chunkExists(int p_73149_1_, int p_73149_2_) {
+ return true;
+ }
+
+ /**
+ * Populates chunk with ores etc etc
+ */
+ public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) {
+ BlockFalling.fallInstantly = true;
+
+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, world, world.rand, p_73153_2_, p_73153_3_, false));
+
+ int k = p_73153_2_ * 16;
+ int l = p_73153_3_ * 16;
+ BiomeGenBase biomegenbase = this.world.getBiomeGenForCoords(k + 16, l + 16);
+ biomegenbase.decorate(this.world, this.world.rand, k, l);
+
+ mapGenSchool.func_151539_a(this, world, p_73153_2_, p_73153_3_, null);
+ mapGenSchool.generateStructuresInChunk(this.world, this.endRNG, p_73153_2_, p_73153_3_);
+
+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, world, world.rand, p_73153_2_, p_73153_3_, false));
+
+ BlockFalling.fallInstantly = false;
+ }
+
+ /**
+ * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks.
+ * Return true if all chunks have been saved.
+ */
+ public boolean saveChunks(boolean p_73151_1_, IProgressUpdate p_73151_2_) {
+ return true;
+ }
+
+ /**
+ * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently
+ * unimplemented.
+ */
+ public void saveExtraData() {
+ }
+
+ /**
+ * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk.
+ */
+ public boolean unloadQueuedChunks() {
+ return false;
+ }
+
+ /**
+ * Returns if the IChunkProvider supports saving.
+ */
+ public boolean canSave() {
+ return true;
+ }
+
+ /**
+ * Converts the instance data to a readable string.
+ */
+ public String makeString() {
+ return "RandomLevelSource";
+ }
+
+ /**
+ * Returns a list of creatures of the specified type that can spawn at the given location.
+ */
+ public List getPossibleCreatures(EnumCreatureType p_73155_1_, int p_73155_2_, int p_73155_3_, int p_73155_4_) {
+ BiomeGenBase biomegenbase = this.world.getBiomeGenForCoords(p_73155_2_, p_73155_4_);
+ return biomegenbase.getSpawnableList(p_73155_1_);
+ }
+
+ public ChunkPosition func_147416_a(World p_147416_1_, String p_147416_2_, int p_147416_3_, int p_147416_4_, int p_147416_5_) {
+ return null;
+ }
+
+ public int getLoadedChunkCount() {
+ return 0;
+ }
+
+ public void recreateStructures(int p_82695_1_, int p_82695_2_) {
+ }
+
+ public static class Generator extends ChunkProviderGenerate{
+ public Generator(World p_i2006_1_, long p_i2006_2_, boolean p_i2006_4_) {
+ super(p_i2006_1_, p_i2006_2_, p_i2006_4_);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/world/crack/TeleporterToCrack.class b/src/main/java/jp/plusplus/fbs/world/crack/TeleporterToCrack.class Binary files differnew file mode 100644 index 0000000..42d4b98 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/TeleporterToCrack.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/TeleporterToCrack.java b/src/main/java/jp/plusplus/fbs/world/crack/TeleporterToCrack.java new file mode 100644 index 0000000..b57f490 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/TeleporterToCrack.java @@ -0,0 +1,239 @@ +package jp.plusplus.fbs.world.crack;
+
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.tileentity.TileEntityMagicCore;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockEndPortal;
+import net.minecraft.entity.Entity;
+import net.minecraft.init.Blocks;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.Teleporter;
+import net.minecraft.world.WorldServer;
+
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/10/29.
+ */
+public class TeleporterToCrack extends Teleporter {
+ private final WorldServer worldServerInstance;
+ private Random random=new Random();
+
+ public TeleporterToCrack(WorldServer p_i1963_1_) {
+ super(p_i1963_1_);
+ worldServerInstance=p_i1963_1_;
+ }
+
+ // 近くにポータルがあったらそこに出現させる処理
+ // このサンプルではネザーポータルの処理をそのまま利用する
+ @Override
+ public boolean placeInExistingPortal(Entity p_77184_1_, double p_77184_2_, double p_77184_4_, double p_77184_6_, float p_77184_8_) {
+ return super.placeInExistingPortal(p_77184_1_, p_77184_2_, p_77184_4_, p_77184_6_, p_77184_8_);
+ }
+
+ // ポータルを作成する処理
+ @Override
+ public boolean makePortal(Entity p_85188_1_) {
+ byte b0 = 16;
+ double distance = -1.0D;
+ int i = MathHelper.floor_double(p_85188_1_.posX);
+ int j = MathHelper.floor_double(p_85188_1_.posY);
+ int k = MathHelper.floor_double(p_85188_1_.posZ);
+ int l = i;
+ int i1 = j;
+ int j1 = k;
+ int k1 = 0;
+ int l1 = this.random.nextInt(4);
+ int x;
+ double posX;
+ int z;
+ double posZ;
+ int y;
+ int j3;
+ int k3;
+ int l3;
+ int addX;
+ int addZ;
+ int addY;
+ int blockX;
+ int blockY;
+ double tmpY;
+ double tmpDistance;
+
+ for (x = i - b0; x <= i + b0; ++x) {
+ posX = (double) x + 0.5D - p_85188_1_.posX;
+
+ for (z = k - b0; z <= k + b0; ++z) {
+ posZ = (double) z + 0.5D - p_85188_1_.posZ;
+ label274:
+
+ for (y = this.worldServerInstance.getActualHeight() - 1; y >= 0; --y) {
+ if (this.worldServerInstance.isAirBlock(x, y, z)) {
+ while (y > 0 && this.worldServerInstance.isAirBlock(x, y - 1, z)) {
+ --y;
+ }
+
+ for (j3 = l1; j3 < l1 + 4; ++j3) {
+ k3 = j3 % 2;
+ l3 = 1 - k3;
+
+ if (j3 % 4 >= 2) {
+ k3 = -k3;
+ l3 = -l3;
+ }
+
+ for (addX = 0; addX < 5; ++addX) {
+ for (addZ = 0; addZ < 5; ++addZ) {
+ for (addY = -1; addY < 4; ++addY) {
+ blockX = x + (addZ - 1) * k3 + addX * l3;
+ blockY = y + addY;
+ int blockZ = z + (addZ - 1) * l3 - addX * k3;
+
+ if (addY < 0 && !this.worldServerInstance.getBlock(blockX, blockY, blockZ).getMaterial().isSolid() || addY >= 0 && !this.worldServerInstance.isAirBlock(blockX, blockY, blockZ)) {
+ continue label274;
+ }
+ }
+ }
+ }
+
+ tmpY = (double) y + 0.5D - p_85188_1_.posY;
+ tmpDistance = posX * posX + tmpY * tmpY + posZ * posZ;
+
+ if (distance < 0.0D || tmpDistance < distance) {
+ distance = tmpDistance;
+ l = x;
+ i1 = y;
+ j1 = z;
+ k1 = j3 % 4;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (distance < 0.0D) {
+ for (x = i - b0; x <= i + b0; ++x) {
+ posX = (double) x + 0.5D - p_85188_1_.posX;
+
+ for (z = k - b0; z <= k + b0; ++z) {
+ posZ = (double) z + 0.5D - p_85188_1_.posZ;
+ label222:
+
+ for (y = this.worldServerInstance.getActualHeight() - 1; y >= 0; --y) {
+ if (this.worldServerInstance.isAirBlock(x, y, z)) {
+ while (y > 0 && this.worldServerInstance.isAirBlock(x, y - 1, z)) {
+ --y;
+ }
+
+ for (j3 = l1; j3 < l1 + 2; ++j3) {
+ k3 = j3 % 2;
+ l3 = 1 - k3;
+
+ for (addX = 0; addX < 5; ++addX) {
+ for (addZ = -1; addZ < 5; ++addZ) {
+ addY = x + (addX - 1) * k3;
+ blockX = y + addZ;
+ blockY = z + (addX - 1) * l3;
+
+ if (addZ < 0 && !this.worldServerInstance.getBlock(addY, blockX, blockY).getMaterial().isSolid() || addZ >= 0 && !this.worldServerInstance.isAirBlock(addY, blockX, blockY)) {
+ continue label222;
+ }
+ }
+ }
+
+ tmpY = (double) y + 0.5D - p_85188_1_.posY;
+ tmpDistance = posX * posX + tmpY * tmpY + posZ * posZ;
+
+ if (distance < 0.0D || tmpDistance < distance) {
+ distance = tmpDistance;
+ l = x;
+ i1 = y;
+ j1 = z;
+ k1 = j3 % 2;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ int k5 = l;
+ int j2 = i1;
+ z = j1;
+ int l5 = k1 % 2;
+ int l2 = 1 - l5;
+
+ if (k1 % 4 >= 2) {
+ l5 = -l5;
+ l2 = -l2;
+ }
+
+ boolean flag;
+
+ //ポータルの生成処理
+ if (distance < 0.0D) {
+ if (i1 < 70) {
+ i1 = 70;
+ }
+
+ if (i1 > this.worldServerInstance.getActualHeight() - 10) {
+ i1 = this.worldServerInstance.getActualHeight() - 10;
+ }
+
+ j2 = i1;
+
+ for (y = -2; y <= 2; ++y) {
+ for (j3 = -2; j3 < 2; ++j3) {
+ for (k3 = -2; k3 < 3; ++k3) {
+ l3 = k5 + y;
+ addX = j2 + k3;
+ addZ = z + j3;
+ flag = k3 < 0;
+ this.worldServerInstance.setBlock(l3, addX, addZ, flag ? Blocks.obsidian : Blocks.air);
+ }
+ }
+ }
+ }
+
+ this.worldServerInstance.setBlock(k5, j2, z, BlockCore.magicCore);
+ TileEntity te=this.worldServerInstance.getTileEntity(k5, j2, z);
+ if(te instanceof TileEntityMagicCore){
+ ((TileEntityMagicCore) te).setMagicCircle("fbs.warp", 2);
+ }
+
+ /*
+ for (y = 0; y < 4; ++y) {
+ for (j3 = 0; j3 < 4; ++j3) {
+ for (k3 = -1; k3 < 4; ++k3) {
+ l3 = k5 + (j3 - 1) * l5;
+ addX = j2 + k3;
+ addZ = z + (j3 - 1) * l2;
+ flag = j3 == 0 || j3 == 3 || k3 == -1 || k3 == 3;
+ this.worldServerInstance.setBlock(l3, addX, addZ, (Block) (flag ? Blocks.obsidian : Blocks.portal), 0, 2);
+ }
+ }
+
+ for (j3 = 0; j3 < 4; ++j3) {
+ for (k3 = -1; k3 < 4; ++k3) {
+ l3 = k5 + (j3 - 1) * l5;
+ addX = j2 + k3;
+ addZ = z + (j3 - 1) * l2;
+ this.worldServerInstance.notifyBlocksOfNeighborChange(l3, addX, addZ, this.worldServerInstance.getBlock(l3, addX, addZ));
+ }
+ }
+ }
+ */
+
+ return true;
+ }
+
+ // プレイヤーをポータルに出現させる処理
+ // このサンプルではネザーポータルの処理をそのまま利用する
+ @Override
+ public void placeInPortal(Entity p_77185_1_, double p_77185_2_, double p_77185_4_, double p_77185_6_, float p_77185_8_) {
+ super.placeInPortal(p_77185_1_, p_77185_2_, p_77185_4_, p_77185_6_, p_77185_8_);
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/world/crack/WorldChunkManagerCrack.class b/src/main/java/jp/plusplus/fbs/world/crack/WorldChunkManagerCrack.class Binary files differnew file mode 100644 index 0000000..e9e30f6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/WorldChunkManagerCrack.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/WorldChunkManagerCrack.java b/src/main/java/jp/plusplus/fbs/world/crack/WorldChunkManagerCrack.java new file mode 100644 index 0000000..c4b7855 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/WorldChunkManagerCrack.java @@ -0,0 +1,209 @@ +package jp.plusplus.fbs.world.crack;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.world.crack.biome.BiomeGenCrack;
+import net.minecraft.world.ChunkPosition;
+import net.minecraft.world.World;
+import net.minecraft.world.WorldType;
+import net.minecraft.world.biome.BiomeCache;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.biome.WorldChunkManager;
+import net.minecraft.world.gen.layer.GenLayer;
+import net.minecraft.world.gen.layer.IntCache;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+import static net.minecraft.world.biome.BiomeGenBase.mesa;
+import static net.minecraft.world.biome.BiomeGenBase.mushroomIsland;
+
+/**
+ * Created by plusplus_F on 2015/10/29.
+ */
+public class WorldChunkManagerCrack extends WorldChunkManager {
+
+ // WorldChunkManagerのプライベート変数にはアクセスできないので専用の変数を作成
+ private GenLayer genBiomes;
+ private GenLayer biomeIndexLayer;
+ private BiomeCache biomeCache;
+ private List biomesToSpawnIn;
+
+ public static final BiomeGenBase[] biomeList = new BiomeGenBase[256];
+
+ static {
+ for (int i = 0; i < biomeList.length; ++i) {
+ biomeList[i]=Registry.biomeCrack;
+ /*
+ if (i % 2 == 0) {
+ biomeList[i] = mushroomIsland;
+ } else if (i % 2 == 1) {
+ biomeList[i] = mesa;
+ }
+ */
+ }
+ }
+
+ protected WorldChunkManagerCrack() {
+ this.biomeCache = new BiomeCache(this);
+ this.biomesToSpawnIn = new ArrayList();
+ this.biomesToSpawnIn.add(Registry.biomeCrack);
+ //this.biomesToSpawnIn.addAll(allowedBiomes);
+ }
+
+ public WorldChunkManagerCrack(long par1, WorldType par3WorldType) {
+ this();
+ GenLayer[] var4 = GenLayer.initializeAllBiomeGenerators(par1, par3WorldType);
+ this.genBiomes = var4[0];
+ this.biomeIndexLayer = var4[1];
+ }
+
+ public WorldChunkManagerCrack(World par1World) {
+ this(par1World.getSeed(), par1World.getWorldInfo().getTerrainType());
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+ // WorldChunkManagerのプライベート変数を使用するメソッドはすべて再実装
+
+ @Override
+ public List getBiomesToSpawnIn() {
+ return this.biomesToSpawnIn;
+ }
+
+ @Override
+ public BiomeGenBase getBiomeGenAt(int par1, int par2) {
+ return this.biomeCache.getBiomeGenAt(par1, par2);
+ }
+
+ @Override
+ public float[] getRainfall(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5) {
+ IntCache.resetIntCache();
+
+ if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5) {
+ par1ArrayOfFloat = new float[par4 * par5];
+ }
+
+ int[] var6 = this.biomeIndexLayer.getInts(par2, par3, par4, par5);
+
+ for (int var7 = 0; var7 < par4 * par5; ++var7) {
+ float var8 = (float) biomeList[var6[var7]].getIntRainfall() / 65536.0F;
+
+ if (var8 > 1.0F) {
+ var8 = 1.0F;
+ }
+
+ par1ArrayOfFloat[var7] = var8;
+ }
+
+ return par1ArrayOfFloat;
+ }
+
+ @SideOnly(Side.CLIENT)
+ @Override
+ public float getTemperatureAtHeight(float par1, int par2) {
+ return par1;
+ }
+
+ @Override
+ public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) {
+ IntCache.resetIntCache();
+
+ if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) {
+ par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
+ }
+
+ int[] var6 = this.genBiomes.getInts(par2, par3, par4, par5);
+
+ for (int var7 = 0; var7 < par4 * par5; ++var7) {
+ par1ArrayOfBiomeGenBase[var7] = biomeList[var6[var7]];
+ }
+
+ return par1ArrayOfBiomeGenBase;
+ }
+
+ @Override
+ public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) {
+ return this.getBiomeGenAt(par1ArrayOfBiomeGenBase, par2, par3, par4, par5, true);
+ }
+
+ @Override
+ public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5, boolean par6) {
+ IntCache.resetIntCache();
+
+ if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) {
+ par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
+ }
+
+ if (par6 && par4 == 16 && par5 == 16 && (par2 & 15) == 0 && (par3 & 15) == 0) {
+ BiomeGenBase[] var9 = this.biomeCache.getCachedBiomes(par2, par3);
+ System.arraycopy(var9, 0, par1ArrayOfBiomeGenBase, 0, par4 * par5);
+ return par1ArrayOfBiomeGenBase;
+ } else {
+ int[] var7 = this.biomeIndexLayer.getInts(par2, par3, par4, par5);
+
+ for (int var8 = 0; var8 < par4 * par5; ++var8) {
+ //par1ArrayOfBiomeGenBase[var8] = biomeList[var7[var8]];
+ par1ArrayOfBiomeGenBase[var8]=biomeList[0];
+ }
+
+ return par1ArrayOfBiomeGenBase;
+ }
+ }
+
+ @Override
+ public boolean areBiomesViable(int par1, int par2, int par3, List par4List) {
+ IntCache.resetIntCache();
+ int var5 = par1 - par3 >> 2;
+ int var6 = par2 - par3 >> 2;
+ int var7 = par1 + par3 >> 2;
+ int var8 = par2 + par3 >> 2;
+ int var9 = var7 - var5 + 1;
+ int var10 = var8 - var6 + 1;
+ int[] var11 = this.genBiomes.getInts(var5, var6, var9, var10);
+
+ for (int var12 = 0; var12 < var9 * var10; ++var12) {
+ BiomeGenBase var13 = biomeList[var11[var12]];
+
+ if (!par4List.contains(var13)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public ChunkPosition findBiomePosition(int par1, int par2, int par3, List par4List, Random par5Random) {
+ IntCache.resetIntCache();
+ int var6 = par1 - par3 >> 2;
+ int var7 = par2 - par3 >> 2;
+ int var8 = par1 + par3 >> 2;
+ int var9 = par2 + par3 >> 2;
+ int var10 = var8 - var6 + 1;
+ int var11 = var9 - var7 + 1;
+ int[] var12 = this.genBiomes.getInts(var6, var7, var10, var11);
+ ChunkPosition var13 = null;
+ int var14 = 0;
+
+ for (int var15 = 0; var15 < var10 * var11; ++var15) {
+ int var16 = var6 + var15 % var10 << 2;
+ int var17 = var7 + var15 / var10 << 2;
+ BiomeGenBase var18 = biomeList[var12[var15]];
+
+ if (par4List.contains(var18) && (var13 == null || par5Random.nextInt(var14 + 1) == 0)) {
+ var13 = new ChunkPosition(var16, 0, var17);
+ ++var14;
+ }
+ }
+
+ return var13;
+ }
+
+ @Override
+ public void cleanupCache() {
+ this.biomeCache.cleanupCache();
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/world/crack/WorldProviderCrack.class b/src/main/java/jp/plusplus/fbs/world/crack/WorldProviderCrack.class Binary files differnew file mode 100644 index 0000000..d3ae467 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/WorldProviderCrack.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/WorldProviderCrack.java b/src/main/java/jp/plusplus/fbs/world/crack/WorldProviderCrack.java new file mode 100644 index 0000000..64eb846 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/WorldProviderCrack.java @@ -0,0 +1,119 @@ +package jp.plusplus.fbs.world.crack;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import net.minecraft.util.ChunkCoordinates;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.Vec3;
+import net.minecraft.world.WorldProvider;
+import net.minecraft.world.WorldProviderEnd;
+import net.minecraft.world.WorldProviderHell;
+import net.minecraft.world.chunk.IChunkProvider;
+
+/**
+ * Created by plusplus_F on 2015/10/29.
+ */
+public class WorldProviderCrack extends WorldProvider {
+ private float[] skyColors=new float[4];
+
+ @Override
+ public String getDimensionName() {
+ return "Dimension Crack";
+ }
+
+ // 独自のワールドタイプやワールドチャンクマネージャーを設定
+ @Override
+ protected void registerWorldChunkManager() {
+ worldObj.getWorldInfo().setTerrainType(WorldTypeCrack.worldType);
+ worldChunkMgr = new WorldChunkManagerCrack(worldObj);
+ setDimension(FBS.dimensionCrackId);
+ }
+
+ @Override
+ public IChunkProvider createChunkGenerator() {
+ return new ChunkProviderCrack(worldObj, worldObj.getSeed());
+ }
+
+ //太陽の高さ
+ @Override
+ public float calculateCelestialAngle(long p_76563_1_, float p_76563_3_) {
+ int j = (int)(p_76563_1_ % 24000L);
+ float f1 = ((float)j + p_76563_3_) / 24000.0F - 0.25F;
+
+ if (f1 < 0.0F)
+ {
+ ++f1;
+ }
+
+ if (f1 > 1.0F)
+ {
+ --f1;
+ }
+
+ float f2 = f1;
+ f1 = 1.0F - (float)((Math.cos((double)f1 * Math.PI) + 1.0D) / 2.0D);
+ f1 = f2 + (f1 - f2) / 3.0F;
+ return f1;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public float[] calcSunriseSunsetColors(float p_76560_1_, float p_76560_2_) {
+ skyColors[0]=0.35f;
+ skyColors[1]=0.f;
+ skyColors[2]=0.35f;
+ skyColors[3]=1.f;
+ return skyColors;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public Vec3 getFogColor(float p_76562_1_, float p_76562_2_) {
+ return Vec3.createVectorHelper(0.35, 0, 0.35);
+ }
+
+ @Override
+ public boolean canRespawnHere() {
+ return false;
+ }
+
+ @Override
+ public boolean isSurfaceWorld() {
+ return false;
+ }
+
+ @Override
+ public boolean canCoordinateBeSpawn(int p_76566_1_, int p_76566_2_) {
+ return this.worldObj.getTopBlock(p_76566_1_, p_76566_2_).getMaterial().blocksMovement();
+ }
+
+ @Override
+ public ChunkCoordinates getEntrancePortalLocation() {
+ return new ChunkCoordinates(0, 80, 0);
+ }
+
+ @Override
+ public int getAverageGroundLevel() {
+ return 50;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean doesXZShowFog(int p_76568_1_, int p_76568_2_) {
+ return true;
+ }
+
+ public boolean isDaytime()
+ {
+ return false;
+ }
+
+ @Override
+ public String getWelcomeMessage() {
+ return "Entering the Dimension Crack";
+ }
+
+ @Override
+ public String getDepartMessage() {
+ return "Leaving the Dimension Crack";
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/world/crack/WorldTypeCrack.class b/src/main/java/jp/plusplus/fbs/world/crack/WorldTypeCrack.class Binary files differnew file mode 100644 index 0000000..9499586 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/WorldTypeCrack.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/WorldTypeCrack.java b/src/main/java/jp/plusplus/fbs/world/crack/WorldTypeCrack.java new file mode 100644 index 0000000..9f86782 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/WorldTypeCrack.java @@ -0,0 +1,34 @@ +package jp.plusplus.fbs.world.crack;
+
+import net.minecraft.world.World;
+import net.minecraft.world.WorldType;
+import net.minecraft.world.biome.BiomeGenEnd;
+import net.minecraft.world.biome.WorldChunkManager;
+import net.minecraft.world.chunk.IChunkProvider;
+
+/**
+ * Created by plusplus_F on 2015/10/29.
+ */
+public class WorldTypeCrack extends WorldType {
+ public static WorldType worldType = new WorldTypeCrack("Dimension Crack");
+
+ private WorldTypeCrack(String name) {
+ super(name);
+ }
+
+ @Override
+ public WorldChunkManager getChunkManager(World world) {
+ return new WorldChunkManagerCrack(world);
+ }
+
+ @Override
+ public IChunkProvider getChunkGenerator(World world, String generatorOptions) {
+ return new ChunkProviderCrack(world, world.getSeed());
+ }
+
+ @Override
+ public boolean hasVoidParticles(boolean flag)
+ {
+ return false;
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/world/crack/biome/BiomeGenCrack$BiomeCrackDecorator.class b/src/main/java/jp/plusplus/fbs/world/crack/biome/BiomeGenCrack$BiomeCrackDecorator.class Binary files differnew file mode 100644 index 0000000..cb5559a --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/biome/BiomeGenCrack$BiomeCrackDecorator.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/biome/BiomeGenCrack.class b/src/main/java/jp/plusplus/fbs/world/crack/biome/BiomeGenCrack.class Binary files differnew file mode 100644 index 0000000..78ce6c3 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/biome/BiomeGenCrack.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/biome/BiomeGenCrack.java b/src/main/java/jp/plusplus/fbs/world/crack/biome/BiomeGenCrack.java new file mode 100644 index 0000000..6787c5b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/biome/BiomeGenCrack.java @@ -0,0 +1,61 @@ +package jp.plusplus.fbs.world.crack.biome;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import net.minecraft.entity.boss.EntityDragon;
+import net.minecraft.entity.monster.EntityEnderman;
+import net.minecraft.entity.monster.EntityZombie;
+import net.minecraft.init.Blocks;
+import net.minecraft.world.WorldProviderEnd;
+import net.minecraft.world.biome.*;
+import net.minecraft.world.gen.feature.WorldGenAbstractTree;
+import net.minecraft.world.gen.feature.WorldGenSpikes;
+import net.minecraft.world.gen.feature.WorldGenerator;
+import net.minecraftforge.event.terraingen.TerrainGen;
+
+import java.util.Random;
+
+import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.TREE;
+
+/**
+ * Created by plusplus_F on 2015/10/29.
+ */
+public class BiomeGenCrack extends BiomeGenBase {
+ public BiomeGenCrack(int p_i1990_1_) {
+ super(p_i1990_1_, true);
+ this.spawnableMonsterList.clear();
+ this.spawnableCreatureList.clear();
+ this.spawnableWaterCreatureList.clear();
+ this.spawnableCaveCreatureList.clear();
+ this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityZombie.class, 10, 4, 4));
+ this.topBlock = Blocks.dirt;
+ this.fillerBlock = Blocks.dirt;
+ this.theBiomeDecorator = new BiomeCrackDecorator();
+ this.theBiomeDecorator.treesPerChunk = 2;
+ this.theBiomeDecorator.grassPerChunk = 3;
+ this.theBiomeDecorator.flowersPerChunk = 2;
+ this.setTemperatureRainfall(0.7F, 0.F);
+ setBiomeName("Dimension Crack");
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int getSkyColorByTemp(float p_76731_1_) {
+ //return 0xfa000000;
+ return 0xffffffff;
+ }
+
+ @Override
+ public WorldGenAbstractTree func_150567_a(Random p_150567_1_) {
+ return (WorldGenAbstractTree) this.worldGeneratorTrees;
+ }
+
+ public static class BiomeCrackDecorator extends BiomeDecorator {
+ public BiomeCrackDecorator() {
+ }
+
+ protected void genDecorations(BiomeGenBase p_150513_1_) {
+ super.genDecorations(p_150513_1_);
+ }
+ }
+}
\ No newline at end of file diff --git a/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Entrance.class b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Entrance.class Binary files differnew file mode 100644 index 0000000..d80c022 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Entrance.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Hall1.class b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Hall1.class Binary files differnew file mode 100644 index 0000000..6bb9ddd --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Hall1.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Hall2.class b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Hall2.class Binary files differnew file mode 100644 index 0000000..05920c0 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Hall2.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomBase.class b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomBase.class Binary files differnew file mode 100644 index 0000000..1348c27 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomBase.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomClassroom.class b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomClassroom.class Binary files differnew file mode 100644 index 0000000..70b7f2f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomClassroom.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomStudy.class b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomStudy.class Binary files differnew file mode 100644 index 0000000..3fcf404 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomStudy.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomZombie.class b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomZombie.class Binary files differnew file mode 100644 index 0000000..f7ff795 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$RoomZombie.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Stairway.class b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Stairway.class Binary files differnew file mode 100644 index 0000000..02004b6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Stairway.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Start.class b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Start.class Binary files differnew file mode 100644 index 0000000..ef76b04 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool$Start.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool.class b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool.class Binary files differnew file mode 100644 index 0000000..f55291e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool.class diff --git a/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool.java b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool.java new file mode 100644 index 0000000..8a07ad1 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/crack/structure/MapGenSchool.java @@ -0,0 +1,630 @@ +package jp.plusplus.fbs.world.crack.structure;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.block.BlockCore;
+import jp.plusplus.fbs.block.BlockSchoolTable;
+import net.minecraft.block.BlockMobSpawner;
+import net.minecraft.block.BlockStairs;
+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.tileentity.TileEntityMobSpawner;
+import net.minecraft.world.World;
+import net.minecraft.world.gen.structure.MapGenStructure;
+import net.minecraft.world.gen.structure.StructureBoundingBox;
+import net.minecraft.world.gen.structure.StructureComponent;
+import net.minecraft.world.gen.structure.StructureStart;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Created by plusplus_F on 2015/11/08.
+ * がっこう!
+ */
+public class MapGenSchool extends MapGenStructure {
+ public static final int HALL_WIDTH =5;
+ public static final int FLOOR_HEIGHT =6;
+ public static final int ROOM_SIZE =9;
+ public static final int HALL1_NUM =3;
+ public static final int FLOOR_NUM =3;
+
+ @Override
+ public String func_143025_a() {
+ return "School";
+ }
+
+ @Override
+ protected boolean canSpawnStructureAtCoords(int p_75047_1_, int p_75047_2_) {
+ return p_75047_1_==0 & p_75047_2_==0;
+ }
+
+ @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);// 構造物の構成パーツを決定する
+ // 基点はComponentSampleDungeon1
+
+ //高さを求める
+ int maxY=300;
+ for(int i=0;i<16;i++){
+ for(int k=0;k<16;k++){
+ int t= p_i2060_1_.getHeightValue(x, z);
+ if(maxY>t) maxY=t;
+ }
+ }
+
+ Hall1 hall1 = new Hall1(0, rand, (x << 4) + 2, maxY, (z << 4) + 2);
+ this.components.add(hall1);
+
+ // 次のパーツを得る
+ hall1.buildComponent(hall1, components, rand);
+
+ // 次のパーツが決定していないパーツは一時的にstructureComponentsに保持されるので、空になるまで次のパーツの決定を続ける
+ List<StructureComponent> list = hall1.structureComponents;
+ while(!list.isEmpty()) {
+ int k = rand.nextInt(list.size());
+ StructureComponent structurecomponent = list.remove(k);
+ structurecomponent.buildComponent(hall1, this.components, rand);
+ }
+
+ // 構造物全体の占有範囲を更新する
+ this.updateBoundingBox();
+ }
+ }
+
+ public static class Hall1 extends StructureComponent{
+ // 構成パーツリストを記憶するためのリスト
+ public ArrayList<StructureComponent> structureComponents = new ArrayList();
+ public int count;
+
+ public Hall1() {}
+ public Hall1(int par1, Random par2Random, int x, int y, int z) {
+ this(par1, par2Random, x, y, z, 3, 0);
+ }
+ public Hall1(int par1, Random par2Random, int x, int y, int z, int dir, int c){
+ this.coordBaseMode = dir;
+ switch(this.coordBaseMode) {
+ case 0:
+ this.boundingBox=new StructureBoundingBox(x,y,z,x+ HALL_WIDTH,y+ FLOOR_HEIGHT,z+ ROOM_SIZE);
+ break;
+ case 1:
+ this.boundingBox=new StructureBoundingBox(x,y,z,x+ ROOM_SIZE,y+ FLOOR_HEIGHT,z+ HALL_WIDTH);
+ break;
+ case 2:
+ this.boundingBox=new StructureBoundingBox(x,y,z,x+ HALL_WIDTH,y+ FLOOR_HEIGHT,z+ ROOM_SIZE);
+ break;
+ case 3:
+ this.boundingBox=new StructureBoundingBox(x,y,z,x+ ROOM_SIZE,y+ FLOOR_HEIGHT,z+ HALL_WIDTH);
+ break;
+ }
+ count=c;
+ }
+
+ @Override
+ public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) {
+ FBS.logger.info("coord:"+coordBaseMode);
+
+ //廊下
+ int cx = this.boundingBox.minX, cy = this.boundingBox.minY, cz = this.boundingBox.minZ;
+ switch (this.coordBaseMode) {
+ case 0:
+ cx = this.boundingBox.minX;
+ cz = this.boundingBox.minZ - (ROOM_SIZE + 1);
+ break;
+ case 1:
+ cx = this.boundingBox.maxX + 1;
+ cz = this.boundingBox.minZ;
+ break;
+ case 2:
+ cx = this.boundingBox.minX;
+ cz = this.boundingBox.maxZ + 1;
+ break;
+ case 3:
+ cx = this.boundingBox.minX - (ROOM_SIZE + 1);
+ cz = this.boundingBox.minZ;
+ break;
+ }
+ Hall2 h1 = new Hall2(0, par3Random, cx, cy, cz, coordBaseMode, 0, true);
+ ((Hall1) par1StructureComponent).structureComponents.add(h1);
+ par2List.add(h1);
+
+ switch (this.coordBaseMode) {
+ case 2:
+ cx = this.boundingBox.minX;
+ cz = this.boundingBox.minZ - (ROOM_SIZE + 1);
+ break;
+ case 3:
+ cx = this.boundingBox.maxX + 1;
+ cz = this.boundingBox.minZ;
+ break;
+ case 0:
+ cx = this.boundingBox.minX;
+ cz = this.boundingBox.maxZ + 1;
+ break;
+ case 1:
+ cx = this.boundingBox.minX - (ROOM_SIZE + 1);
+ cz = this.boundingBox.minZ;
+ break;
+ }
+ h1 = new Hall2(0, par3Random, cx, cy, cz, coordBaseMode, 0, false);
+ ((Hall1) par1StructureComponent).structureComponents.add(h1);
+ par2List.add(h1);
+
+ //階段
+ if(count<FLOOR_NUM){
+ int rx = boundingBox.minX, ry = boundingBox.minY, rz = boundingBox.minZ;
+ switch (this.coordBaseMode) {
+ case 0:
+ rx = this.boundingBox.minX - (ROOM_SIZE + 1);
+ rz = this.boundingBox.minZ;
+ break;
+ case 1:
+ rx = this.boundingBox.maxX;
+ rz = this.boundingBox.minZ + (ROOM_SIZE + 1);
+ break;
+ case 2:
+ rx = this.boundingBox.minX - (ROOM_SIZE + 1);
+ rz = this.boundingBox.maxZ;
+ break;
+ case 3:
+ rx = this.boundingBox.minX;
+ rz = this.boundingBox.minZ - (ROOM_SIZE + 1);
+ break;
+ }
+ Stairway rm = new Stairway(0, par3Random, rx, ry, rz, coordBaseMode, count);
+ ((Hall1) par1StructureComponent).structureComponents.add(rm);
+ par2List.add(rm);
+ }
+ }
+
+ @Override
+ protected void func_143012_a(NBTTagCompound nbttagcompound) {}
+ @Override
+ protected void func_143011_b(NBTTagCompound nbttagcompound) {}
+
+ @Override
+ public boolean addComponentParts(World world, Random random, StructureBoundingBox structureboundingbox) {
+ // 占有範囲(structureboundingbox)内の指定範囲を指定ブロック&メタデータで埋める
+ // 占有範囲(structureboundingbox)内の指定範囲を空気ブロックで埋める
+ this.fillWithMetadataBlocks(world, structureboundingbox, 0, 0, 0, HALL_WIDTH, FLOOR_HEIGHT, ROOM_SIZE, BlockCore.plank, 0, Blocks.air, 0, false);
+ this.fillWithAir(world, structureboundingbox, 1, 1, 1, HALL_WIDTH - 1, FLOOR_HEIGHT - 1, ROOM_SIZE - 1);
+
+ //道を空ける
+ this.fillWithAir(world, structureboundingbox, 1, 1, 0, HALL_WIDTH - 1, FLOOR_HEIGHT - 1, 0);
+ this.fillWithAir(world, structureboundingbox, 1, 1, ROOM_SIZE, HALL_WIDTH - 1, FLOOR_HEIGHT - 1, ROOM_SIZE);
+
+ //接続用の道を空ける
+ this.fillWithAir(world, structureboundingbox, 0, 1, 1, 0, FLOOR_HEIGHT - 1, ROOM_SIZE - 1);
+ if(count==0) this.fillWithAir(world, structureboundingbox, HALL_WIDTH, 1, 3, HALL_WIDTH, 3, 6);
+ return true;
+ }
+ }
+ public static class Hall2 extends Hall1{
+ boolean nextDir;
+ public Hall2(int par1, Random par2Random, int x, int y, int z, int dir, int c, boolean next){
+ super(par1, par2Random, x, y, z, dir, c);
+ nextDir=next;
+ }
+
+ @Override
+ public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) {
+ //廊下
+ if (count < HALL1_NUM) {
+ int cx = this.boundingBox.minX, cy = this.boundingBox.minY, cz = this.boundingBox.minZ;
+ if (nextDir) {
+ //入り口から向かって右(北側)
+ switch (this.coordBaseMode) {
+ case 0:
+ cx = this.boundingBox.minX;
+ cz = this.boundingBox.minZ - (ROOM_SIZE + 1);
+ break;
+ case 1:
+ cx = this.boundingBox.maxX + 1;
+ cz = this.boundingBox.minZ;
+ break;
+ case 2:
+ cx = this.boundingBox.minX;
+ cz = this.boundingBox.maxZ + 1;
+ break;
+ case 3:
+ cx = this.boundingBox.minX - (ROOM_SIZE + 1);
+ cz = this.boundingBox.minZ;
+ break;
+ }
+ } else {
+ switch (this.coordBaseMode) {
+ case 2:
+ cx = this.boundingBox.minX;
+ cz = this.boundingBox.minZ - (ROOM_SIZE + 1);
+ break;
+ case 3:
+ cx = this.boundingBox.maxX + 1;
+ cz = this.boundingBox.minZ;
+ break;
+ case 1:
+ cx = this.boundingBox.minX;
+ cz = this.boundingBox.maxZ + 1;
+ break;
+ case 0:
+ cx = this.boundingBox.minX - (ROOM_SIZE + 1);
+ cz = this.boundingBox.minZ;
+ break;
+ }
+ }
+ Hall2 h2 = new Hall2(0, par3Random, cx, cy, cz, coordBaseMode, count + 1, nextDir);
+ ((Hall1) par1StructureComponent).structureComponents.add(h2);
+ par2List.add(h2);
+ }
+ //ランダムで部屋を1つ
+ int rx = boundingBox.minX, ry = boundingBox.minY, rz = boundingBox.minZ;
+ switch (this.coordBaseMode) {
+ case 0:
+ rx = this.boundingBox.minX - (ROOM_SIZE + 1);
+ rz = this.boundingBox.minZ;
+ break;
+ case 1:
+ rx = this.boundingBox.maxX;
+ rz = this.boundingBox.minZ - (ROOM_SIZE + 1);
+ break;
+ case 2:
+ rx = this.boundingBox.minX - (ROOM_SIZE + 1);
+ rz = this.boundingBox.maxZ;
+ break;
+ case 3:
+ rx = this.boundingBox.minX;
+ rz = this.boundingBox.minZ - (ROOM_SIZE + 1);
+ break;
+ }
+
+ RoomBase rm;
+ int rr=par3Random.nextInt(3);
+ if(rr==0) rm = new RoomStudy(0, par3Random, rx, ry, rz, coordBaseMode);
+ else if(rr==1) rm = new RoomZombie(0, par3Random, rx, ry, rz, coordBaseMode);
+ else rm = new RoomClassroom(0, par3Random, rx, ry, rz, coordBaseMode);
+
+ ((Hall1) par1StructureComponent).structureComponents.add(rm);
+ par2List.add(rm);
+ }
+
+ @Override
+ public boolean addComponentParts(World world, Random random, StructureBoundingBox structureboundingbox) {
+ // 占有範囲(structureboundingbox)内の指定範囲を指定ブロック&メタデータで埋める
+ // 占有範囲(structureboundingbox)内の指定範囲を空気ブロックで埋める
+ this.fillWithMetadataBlocks(world, structureboundingbox, 0, 0, 0, HALL_WIDTH, FLOOR_HEIGHT, ROOM_SIZE, BlockCore.plank, 0, Blocks.air, 0, false);
+ this.fillWithAir(world, structureboundingbox, 1, 1, 1, HALL_WIDTH - 1, FLOOR_HEIGHT - 1, ROOM_SIZE - 1);
+
+ //道を空ける
+ if (count == HALL1_NUM) {
+ if (nextDir)
+ this.fillWithAir(world, structureboundingbox, 1, 1, ROOM_SIZE, HALL_WIDTH - 1, FLOOR_HEIGHT - 1, ROOM_SIZE);
+ else this.fillWithAir(world, structureboundingbox, 1, 1, 0, HALL_WIDTH - 1, FLOOR_HEIGHT - 1, 0);
+ } else {
+ this.fillWithAir(world, structureboundingbox, 1, 1, 0, HALL_WIDTH - 1, FLOOR_HEIGHT - 1, 0);
+ if (count < 5)
+ this.fillWithAir(world, structureboundingbox, 1, 1, ROOM_SIZE, HALL_WIDTH - 1, FLOOR_HEIGHT - 1, ROOM_SIZE);
+ }
+
+ //接続用の道を空ける
+ this.fillWithAir(world, structureboundingbox, 0, 1, 2, 0, 3, 3);
+ this.fillWithAir(world, structureboundingbox, 0, 1, 6, 0, 3, 7);
+
+ //窓
+ this.fillWithMetadataBlocks(world, structureboundingbox, HALL_WIDTH, 2, 2, HALL_WIDTH, FLOOR_HEIGHT - 2, 7, Blocks.glass_pane, 0, Blocks.air, 0, false);
+
+ return true;
+ }
+ }
+
+ public static class Stairway extends StructureComponent{
+ public int count;
+ public Stairway() {}
+ public Stairway(int par1, Random par2Random, int x, int y, int z, int dir, int count){
+ this.coordBaseMode = dir;
+ this.count=count;
+ switch(this.coordBaseMode) {
+ case 0:
+ this.boundingBox=new StructureBoundingBox(x,y,z,x+ ROOM_SIZE,y+ FLOOR_HEIGHT*2,z+ ROOM_SIZE);
+ break;
+ case 1:
+ this.boundingBox=new StructureBoundingBox(x,y,z,x+ ROOM_SIZE,y+ FLOOR_HEIGHT*2,z+ ROOM_SIZE);
+ break;
+ case 2:
+ this.boundingBox=new StructureBoundingBox(x,y,z,x+ ROOM_SIZE,y+ FLOOR_HEIGHT*2,z+ ROOM_SIZE);
+ break;
+ case 3:
+ this.boundingBox=new StructureBoundingBox(x,y,z,x+ ROOM_SIZE,y+ FLOOR_HEIGHT*2,z+ ROOM_SIZE);
+ break;
+ }
+ }
+
+ @Override
+ public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) {
+ //階段
+ int rx = boundingBox.minX, ry = boundingBox.maxY-FLOOR_HEIGHT, rz = boundingBox.minZ;
+
+ switch (this.coordBaseMode) {
+ case 2:
+ rx = this.boundingBox.maxX+1;
+ rz = this.boundingBox.minZ;
+ break;
+ case 3:
+ rx = this.boundingBox.minX;
+ rz = this.boundingBox.maxZ+1;
+ break;
+ case 0:
+ rx = this.boundingBox.minX-(ROOM_SIZE+1);
+ rz = this.boundingBox.minZ;
+ break;
+ case 1:
+ rx = this.boundingBox.minX;
+ rz = this.boundingBox.maxZ-(ROOM_SIZE+1);
+ break;
+ }
+ /*
+ switch (this.coordBaseMode) {
+ case 2:
+ rx = this.boundingBox.maxX+1;
+ rz = this.boundingBox.minZ+ROOM_SIZE;
+ break;
+ case 3:
+ rx = this.boundingBox.maxX+ROOM_SIZE;
+ rz = this.boundingBox.maxZ+1;
+ break;
+ case 0:
+ rx = this.boundingBox.minX - (HALL_WIDTH + 1);
+ rz = this.boundingBox.minZ;
+ break;
+ case 1:
+ rx = this.boundingBox.minX - ROOM_SIZE;
+ rz = this.boundingBox.minZ - (HALL_WIDTH + 1);
+ break;
+ }
+ */
+
+ Hall1 h1 = new Hall1(0, par3Random, rx, ry, rz, coordBaseMode, count + 1);
+ ((Hall1) par1StructureComponent).structureComponents.add(h1);
+ par2List.add(h1);
+ }
+
+ @Override
+ protected void func_143012_a(NBTTagCompound p_143012_1_) {}
+
+ @Override
+ protected void func_143011_b(NBTTagCompound p_143011_1_) {}
+
+ @Override
+ public boolean addComponentParts(World world, Random p_74875_2_, StructureBoundingBox structureboundingbox) {
+ this.fillWithMetadataBlocks(world, structureboundingbox, 0, 0, 0, ROOM_SIZE, FLOOR_HEIGHT*2, ROOM_SIZE, BlockCore.plank, 0, Blocks.air, 0, false);
+ this.fillWithAir(world, structureboundingbox, 1, 1, 1, ROOM_SIZE-1, FLOOR_HEIGHT*2-1, ROOM_SIZE-1);
+
+ int metaL=getMetadataWithOffset(Blocks.oak_stairs, 1), metaR=getMetadataWithOffset(Blocks.oak_stairs, 0);
+
+ //接続穴
+ this.fillWithAir(world, structureboundingbox, ROOM_SIZE, 1, 1, ROOM_SIZE, FLOOR_HEIGHT*2-1, ROOM_SIZE-1);
+ if(count>0){
+ this.fillWithAir(world, structureboundingbox, 1, 0, 1, ROOM_SIZE, 0, ROOM_SIZE-1);
+
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaR, ROOM_SIZE, 0, 3, structureboundingbox);
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaR, ROOM_SIZE, 0, 4, structureboundingbox);
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaR, ROOM_SIZE, 0, 5, structureboundingbox);
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaR, ROOM_SIZE, 0, 6, structureboundingbox);
+ }
+
+ //階段 0x4=0,
+ for(int i=0;i<3;i++){
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaL, ROOM_SIZE-i, 1+i, 1, structureboundingbox);
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaL, ROOM_SIZE-i, 1+i, 2, structureboundingbox);
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaL, ROOM_SIZE-i, 1+i, 7, structureboundingbox);
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaL, ROOM_SIZE-i, 1+i, 8, structureboundingbox);
+
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaR, ROOM_SIZE+i-2, 4+i, 3, structureboundingbox);
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaR, ROOM_SIZE+i-2, 4+i, 4, structureboundingbox);
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaR, ROOM_SIZE+i-2, 4+i, 5, structureboundingbox);
+ this.placeBlockAtCurrentPosition(world, Blocks.oak_stairs, metaR, ROOM_SIZE+i-2, 4+i, 6, structureboundingbox);
+ }
+
+ this.fillWithMetadataBlocks(world, structureboundingbox, 1, 3, 1, 6, 3, ROOM_SIZE-1, BlockCore.plank, 0, Blocks.air, 0, false);
+
+ return true;
+ }
+
+ }
+
+ public static class Entrance extends StructureComponent{
+ public Entrance() {}
+ public Entrance(int par1, Random par2Random, int x, int y, int z, int dir) {
+ this.coordBaseMode=dir;
+ this.boundingBox=new StructureBoundingBox(x,y,z,x+ HALL_WIDTH,y+ FLOOR_HEIGHT,z+ HALL_WIDTH);
+ }
+
+ @Override
+ protected void func_143012_a(NBTTagCompound p_143012_1_) {}
+
+ @Override
+ protected void func_143011_b(NBTTagCompound p_143011_1_) {}
+
+ @Override
+ public boolean addComponentParts(World world, Random p_74875_2_, StructureBoundingBox structureboundingbox) {
+ this.fillWithMetadataBlocks(world, structureboundingbox, 0, 0, 0, HALL_WIDTH, FLOOR_HEIGHT, HALL_WIDTH, BlockCore.plank, 0, Blocks.air, 0, false);
+ this.fillWithAir(world, structureboundingbox, 1, 1, 1, HALL_WIDTH -1, FLOOR_HEIGHT -1, HALL_WIDTH -1);
+
+ this.fillWithAir(world, structureboundingbox, 1, 1, 0, HALL_WIDTH-1, 3, 0);
+ this.fillWithAir(world, structureboundingbox, 1, 1, HALL_WIDTH, HALL_WIDTH-1, 3, HALL_WIDTH);
+
+ return true;
+ }
+
+ }
+
+ public static class RoomBase extends StructureComponent {
+ public RoomBase() {}
+ public RoomBase(int par1, Random par2Random, int x, int y, int z, int dir) {
+ this.coordBaseMode = dir;
+ this.boundingBox = new StructureBoundingBox(x, y, z, x + ROOM_SIZE, y+FLOOR_HEIGHT, z + ROOM_SIZE);
+ }
+
+ protected boolean hasWindow(){ return true; }
+
+ @Override
+ protected void func_143012_a(NBTTagCompound nbttagcompound) {}
+ @Override
+ protected void func_143011_b(NBTTagCompound nbttagcompound) {}
+
+ @Override
+ public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) {
+ //何にも派生しない
+ }
+
+ @Override
+ public boolean addComponentParts(World world, Random random, StructureBoundingBox structureboundingbox) {
+ this.fillWithMetadataBlocks(world, structureboundingbox, 0, 0, 0, ROOM_SIZE, FLOOR_HEIGHT, ROOM_SIZE, BlockCore.plank, 0, Blocks.air, 0, false);
+ this.fillWithAir(world, structureboundingbox, 1, 1, 1, ROOM_SIZE-1, FLOOR_HEIGHT-1, ROOM_SIZE-1);
+
+ this.fillWithAir(world, structureboundingbox, ROOM_SIZE, 1, 2, ROOM_SIZE, 3, 3);
+ this.fillWithAir(world, structureboundingbox, ROOM_SIZE, 1, 6, ROOM_SIZE, 3, 7);
+
+ if(hasWindow()){
+ this.fillWithMetadataBlocks(world, structureboundingbox, 0, 2, 2, 0, FLOOR_HEIGHT - 2, 3, Blocks.glass_pane, 0, Blocks.air, 0, false);
+ this.fillWithMetadataBlocks(world, structureboundingbox, 0, 2, 6, 0, FLOOR_HEIGHT - 2, 7, Blocks.glass_pane, 0, Blocks.air, 0, false);
+ }
+
+ return true;
+ }
+ }
+
+ public static class RoomStudy extends RoomBase{
+ public RoomStudy() {}
+ public RoomStudy(int par1, Random par2Random, int x, int y, int z, int dir) {
+ super(par1, par2Random, x, y, z, dir);}
+
+ @Override
+ protected boolean hasWindow(){ return true; }
+
+ @Override
+ public boolean addComponentParts(World world, Random random, StructureBoundingBox structureboundingbox) {
+ super.addComponentParts(world, random, structureboundingbox);
+
+ //本
+ for(int y=1;y<=FLOOR_HEIGHT-2;y++){
+ for(int z=1;z<=ROOM_SIZE-1;z++){
+ //this.placeBlockAtCurrentPosition(world, BlockCore.bookshelf, getBookNum(random, 3), 1, y, z, structureboundingbox);
+
+ if(z!=4 && z!=5){
+ this.placeBlockAtCurrentPosition(world, BlockCore.bookshelf, getBookNum(random, 3), 3, y, z, structureboundingbox);
+ this.placeBlockAtCurrentPosition(world, BlockCore.bookshelf, getBookNum(random, 3), 5, y, z, structureboundingbox);
+ }
+ else {
+ this.placeBlockAtCurrentPosition(world, BlockCore.bookshelf, getBookNum(random, 3), 7, y, z, structureboundingbox);
+ }
+ }
+ }
+
+ return true;
+ }
+
+ protected int getBookNum(Random rand, int max){
+ return 2+rand.nextInt(max);
+ }
+ }
+
+ public static class RoomClassroom extends RoomBase{
+ public RoomClassroom() {}
+ public RoomClassroom(int par1, Random par2Random, int x, int y, int z, int dir) {
+ super(par1, par2Random, x, y, z, dir);
+ }
+
+ @Override
+ public boolean addComponentParts(World world, Random random, StructureBoundingBox structureboundingbox) {
+ super.addComponentParts(world, random, structureboundingbox);
+
+ int meta=0;
+ switch (coordBaseMode){
+ case 0:
+ meta=2;
+ break;
+ case 1:
+ meta=5;
+ break;
+ case 2:
+ meta=3;
+ break;
+ case 3:
+ meta=4;
+ break;
+ }
+
+ //学校の机
+ for(int i=0;i<3;i++){
+ for(int k=0;k<4;k++){
+ placeBlockAtCurrentPosition(world, BlockCore.schoolTable, meta, 1+k*2, 1, 2+i*2, structureboundingbox);
+ }
+ }
+
+ //教壇
+ fillWithMetadataBlocks(world, structureboundingbox, 2, 1, 8, 7, 1, 8, Blocks.wooden_slab, 0, Blocks.air, 0, false);
+
+ return true;
+ }
+ }
+
+ public static class RoomZombie extends RoomBase{
+ private boolean chest=false;
+
+ public RoomZombie() {}
+ public RoomZombie(int par1, Random par2Random, int x, int y, int z, int dir) {
+ super(par1, par2Random, x, y, z, dir);
+ }
+
+ @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 random, StructureBoundingBox structureboundingbox) {
+ super.addComponentParts(world, random, structureboundingbox);
+
+ placeBlockAtCurrentPosition(world, Blocks.mob_spawner, 0, 4, 1, 4, structureboundingbox);
+ TileEntity te=world.getTileEntity(getXWithOffset(4, 4), getYWithOffset(1), getZWithOffset(4, 4));
+ if(te instanceof TileEntityMobSpawner){
+ ((TileEntityMobSpawner) te).func_145881_a().setEntityName("Zombie");
+ te.markDirty();
+ }
+
+ //chest
+ if(!chest){
+ int cx=getXWithOffset(1, ROOM_SIZE-1), cy=getYWithOffset(1), cz=getZWithOffset(1, ROOM_SIZE-1);
+ if(structureboundingbox.isVecInside(cx, cy, cz) && world.getBlock(cx, cy, cz)!=Blocks.chest){
+ world.setBlock(cx, cy, cz, Blocks.chest, 0, 2);
+ te=world.getTileEntity(cx,cy,cz);
+ if(te instanceof TileEntityChest){
+ TileEntityChest e=(TileEntityChest)te;
+ ItemStack[] items=new ItemStack[e.getSizeInventory()];
+ Registry.GetChestContents(2, items, 0.25f);
+ for(int i=0;i<items.length;i++){
+ e.setInventorySlotContents(i, items[i]);
+ }
+ }
+ chest=true;
+ }
+ }
+
+ return true;
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/world/structure/MapGenSealdLib.class b/src/main/java/jp/plusplus/fbs/world/structure/MapGenSealdLib.class Binary files differnew file mode 100644 index 0000000..2301f28 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/structure/MapGenSealdLib.class 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 Binary files differnew file mode 100644 index 0000000..b077be6 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy$Start.class 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 Binary files differnew file mode 100644 index 0000000..c572eae --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy$Structure.class diff --git a/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy.class b/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy.class Binary files differnew file mode 100644 index 0000000..504b193 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/structure/MapGenStudy.class 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 Binary files differnew file mode 100644 index 0000000..8484f6d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLib1.class 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 Binary files differnew file mode 100644 index 0000000..82a6b27 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLibStart.class 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();
+ }
+}
|
