net.minecraft.init.Biomes Java Examples

The following examples show how to use net.minecraft.init.Biomes. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StructureTofuVillagePieces.java    From TofuCraftReload with MIT License 5 votes vote down vote up
public Start(BiomeProvider chunkManagerIn, int p_i2104_2_, Random rand, int p_i2104_4_, int p_i2104_5_, List<StructureTofuVillagePieces.PieceWeight> p_i2104_6_, int p_i2104_7_) {
    super((Start) null, 0, rand, p_i2104_4_, p_i2104_5_);
    this.worldChunkMngr = chunkManagerIn;
    this.structureVillageWeightedPieceList = p_i2104_6_;
    this.terrainType = p_i2104_7_;
    Biome biome = chunkManagerIn.getBiome(new BlockPos(p_i2104_4_, 0, p_i2104_5_), Biomes.DEFAULT);
    this.biome = biome;
    this.startPiece = this;
    this.func_189924_a(this.field_189928_h);
    this.field_189929_i = rand.nextInt(50) == 0;
}
 
Example #2
Source File: TofuEventLoader.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@SubscribeEvent
  public void decorateBiome(DecorateBiomeEvent.Post event)
  {
      World worldObj = event.getWorld();
      Random rand = event.getRand();
      @SuppressWarnings("deprecation")
BlockPos pos = event.getPos();
      // Hellsoybeans
      if (rand.nextInt(600) < Math.min((Math.abs(pos.getX()) + Math.abs(pos.getZ())) / 2, 400) - 100)
      {
          if (Biome.getIdForBiome(worldObj.getBiome(pos)) == Biome.getIdForBiome(Biomes.HELL))
          {
              int k = pos.getX();
              int l = pos.getZ();
              BlockPos.MutableBlockPos mutable = new BlockPos.MutableBlockPos();
              
              for (int i = 0; i < 10; ++i)
              {
                  int j1 = k + rand.nextInt(16) + 8;
                  int k1 = rand.nextInt(128);
                  int l1 = l + rand.nextInt(16) + 8;
                  mutable.setPos(j1, k1, l1);
                  
                  (new WorldGenCrops((BlockBush)BlockLoader.SOYBEAN_NETHER)
                  		{ 
                  			@Override
						protected IBlockState getStateToPlace() {
                  				return this.plantBlock.getDefaultState().withProperty(BlockSoybeanNether.AGE, 7);
                  			}
                  		})
                  		.generate(worldObj, rand, mutable);           
              }
          }
      }
  }
 
Example #3
Source File: WorldGenLoader.java    From Sakura_mod with MIT License 5 votes vote down vote up
@SubscribeEvent
   public void HotSpringGen(Decorate event) {
   	if(Loader.isModLoaded("tfc"))
   		return;
   	BlockPos pos = event.getChunkPos().getBlock(event.getRand().nextInt(16) + 8, 0, event.getRand().nextInt(16) + 8);
   	BlockPos newPos = WorldUtil.findGround(event.getWorld(),pos, true, false, true);
   	Biome biome = event.getWorld().getBiome(pos);
       
   	if (newPos != null&&event.getWorld().provider instanceof WorldProviderSurface&&biome != Biomes.DESERT && biome != Biomes.DESERT_HILLS && event.getRand().nextFloat() < SakuraConfig.hotspring_weight / 10000.0F) {
           new WorldGenHotSpring().generate(event.getWorld(), event.getRand(), newPos);
       }
}
 
Example #4
Source File: ChunkManagerPlanet.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
/**
 * Return a list of biomes for the specified blocks. Args: listToReuse, x, y, width, length, cacheFlag (if false,
 * don't check biomeCache to avoid infinite loop in BiomeCacheBlock)
 */
@Override
public Biome[] getBiomes(@Nullable Biome[] listToReuse, int x, int z, int width, int length, boolean cacheFlag) {

	GenLayerBiomePlanet.setupBiomesForUse(biomes);
	//return super.getBiomeGenAt(biomeGenBase, x, y, width, length, p_76931_6_);

	IntCache.resetIntCache();

	if (listToReuse == null || listToReuse.length < width * length)
	{
		listToReuse = new Biome[width * length];
	}

	if (cacheFlag && width == 16 && length == 16 && (x & 15) == 0 && (z & 15) == 0)
	{
		Biome[] abiome = this.biomeCache.getCachedBiomes(x, z);
		System.arraycopy(abiome, 0, listToReuse, 0, width * length);
		return listToReuse;
	}
	else
	{
		int[] aint = this.biomeIndexLayer.getInts(x, z, width, length);

		for (int i = 0; i < width * length; ++i)
		{
			listToReuse[i] = Biome.getBiome(aint[i], Biomes.DEFAULT);
		}

		return listToReuse;
	}
}
 
Example #5
Source File: ChunkManagerPlanet.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
public Biome[] getBiomesForGeneration(Biome[] biomes, int x, int z, int width, int height)
{
	GenLayerBiomePlanet.setupBiomesForUse(this.biomes);
	//return super.getBiomesForGeneration(p_76937_1_, p_76937_2_, p_76937_3_, p_76937_4_, p_76937_5_);

	IntCache.resetIntCache();

	if (biomes == null || biomes.length < width * height)
	{
		biomes = new Biome[width * height];
	}

	int[] aint = this.genBiomes.getInts(x, z, width, height);

	try
	{
		for (int i1 = 0; i1 < width * height; ++i1)
		{
			biomes[i1] = Biome.getBiome(aint[i1], Biomes.OCEAN);//AdvancedRocketryBiomes.instance.getBiomeById(aint[i1]);
		}

		return biomes;
	}
	catch (Throwable throwable)
	{
		CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id");
		CrashReportCategory crashreportcategory = crashreport.makeCategory("RawBiomeBlock");
		crashreportcategory.addCrashSection("biomes[] size", Integer.valueOf(biomes.length));
		crashreportcategory.addCrashSection("x", Integer.valueOf(x));
		crashreportcategory.addCrashSection("z", Integer.valueOf(z));
		crashreportcategory.addCrashSection("w", Integer.valueOf(width));
		crashreportcategory.addCrashSection("h", Integer.valueOf(height));
		throw new ReportedException(crashreport);
	}
}
 
Example #6
Source File: GenLayerBiomePlanet.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
protected BiomeEntry getWeightedBiomeEntry()
{
	if(biomeEntries == null || biomeEntries.isEmpty())
		return new BiomeEntry(Biomes.OCEAN, 100);

	List<BiomeEntry> biomeList = biomeEntries;
	int totalWeight = WeightedRandom.getTotalWeight(biomeList);
	int weight = nextInt(totalWeight / 10) * 10;
	return (BiomeEntry)WeightedRandom.getRandomItem(biomeList, weight);
}
 
Example #7
Source File: PLEvent.java    From Production-Line with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onBucketFill(FillBucketEvent event) {
    if (event.getEntityPlayer() != null) {
        Biome biome = event.getWorld().getBiomeForCoordsBody(event.getTarget().getBlockPos());
        if (biome == Biomes.OCEAN || biome == Biomes.DEEP_OCEAN || biome == Biomes.FROZEN_OCEAN) {
            event.setResult(Event.Result.ALLOW);
            event.setFilledBucket(new ItemStack(PLItems.saltWaterBucket));
        }
    }
}
 
Example #8
Source File: CollectorHelper.java    From EmergingTechnology with MIT License 5 votes vote down vote up
public static boolean isInValidBiome(Biome biome) {

        if (EmergingTechnologyConfig.POLYMERS_MODULE.COLLECTOR.biomeRequirementDisabled) {
            return true;
        }

        return biome == Biomes.BEACH || biome == Biomes.OCEAN || biome == Biomes.DEEP_OCEAN;
    }
 
Example #9
Source File: GenLayerAddIsland.java    From TofuCraftReload with MIT License 4 votes vote down vote up
/**
 * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
 * amounts, or biomeList[] indices based on the particular GenLayer subclass.
 */
@Override
public int[] getInts(int par1, int par2, int par3, int par4)
{
    int i1 = par1 - 1;
    int j1 = par2 - 1;
    int k1 = par3 + 2;
    int l1 = par4 + 2;
    int[] aint = this.parent.getInts(i1, j1, k1, l1);
    int[] aint1 = IntCache.getIntCache(par3 * par4);

    for (int i2 = 0; i2 < par4; ++i2)
    {
        for (int j2 = 0; j2 < par3; ++j2)
        {
            int k2 = aint[j2 + 0 + (i2 + 0) * k1];
            int l2 = aint[j2 + 2 + (i2 + 0) * k1];
            int i3 = aint[j2 + 0 + (i2 + 2) * k1];
            int j3 = aint[j2 + 2 + (i2 + 2) * k1];
            int k3 = aint[j2 + 1 + (i2 + 1) * k1];
            this.initChunkSeed((j2 + par1), (i2 + par2));

            if (k3 == 0 && (k2 != 0 || l2 != 0 || i3 != 0 || j3 != 0))
            {
                int l3 = 1;
                int i4 = 1;

                if (k2 != 0 && this.nextInt(l3++) == 0)
                {
                    i4 = k2;
                }

                if (l2 != 0 && this.nextInt(l3++) == 0)
                {
                    i4 = l2;
                }

                if (i3 != 0 && this.nextInt(l3++) == 0)
                {
                    i4 = i3;
                }

                if (j3 != 0 && this.nextInt(l3++) == 0)
                {
                    i4 = j3;
                }

                if (this.nextInt(3) == 0)
                {
                    aint1[j2 + i2 * par3] = i4;
                }
                else if (i4 == Biome.getIdForBiome(Biomes.ICE_PLAINS))
                {
                    aint1[j2 + i2 * par3] = Biome.getIdForBiome(Biomes.FROZEN_OCEAN);
                }
                else
                {
                    aint1[j2 + i2 * par3] = 0;
                }
            }
            else if (k3 > 0 && (k2 == 0 || l2 == 0 || i3 == 0 || j3 == 0))
            {
                if (this.nextInt(5) == 0)
                {
                    if (k3 == Biome.getIdForBiome(Biomes.ICE_PLAINS))
                    {
                        aint1[j2 + i2 * par3] = Biome.getIdForBiome(Biomes.FROZEN_OCEAN);
                    }
                    else
                    {
                        aint1[j2 + i2 * par3] = 0;
                    }
                }
                else
                {
                    aint1[j2 + i2 * par3] = k3;
                }
            }
            else
            {
                aint1[j2 + i2 * par3] = k3;
            }
        }
    }

    return aint1;
}
 
Example #10
Source File: ChunkManagerPlanet.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
public Biome getBiomeGenAt(int x, int z)
{
	return this.biomeCache.getBiome(x, z, Biomes.OCEAN);
}
 
Example #11
Source File: BlockSurgeryTable.java    From Cyberware with MIT License 4 votes vote down vote up
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
{
	if (worldIn.isRemote)
	{
		return true;
	}
	else
	{
		if (state.getValue(PART) != BlockBed.EnumPartType.HEAD)
		{
			pos = pos.offset((EnumFacing)state.getValue(FACING));
			state = worldIn.getBlockState(pos);

			if (state.getBlock() != this)
			{
				return true;
			}
		}

		if (worldIn.provider.canRespawnHere() && worldIn.getBiomeGenForCoords(pos) != Biomes.HELL)
		{
			if (((Boolean)state.getValue(OCCUPIED)).booleanValue())
			{
				EntityPlayer entityplayer = this.getPlayerInBed(worldIn, pos);

				if (entityplayer != null)
				{
					playerIn.addChatComponentMessage(new TextComponentTranslation("tile.bed.occupied", new Object[0]));
					return true;
				}

				state = state.withProperty(OCCUPIED, Boolean.valueOf(false));
				worldIn.setBlockState(pos, state, 4);
			}

			EntityPlayer.SleepResult entityplayer$sleepresult = playerIn.trySleep(pos);

			if (entityplayer$sleepresult == EntityPlayer.SleepResult.OK)
			{
				state = state.withProperty(OCCUPIED, Boolean.valueOf(true));
				worldIn.setBlockState(pos, state, 4);
				return true;
			}
			else
			{
				if (entityplayer$sleepresult == EntityPlayer.SleepResult.NOT_POSSIBLE_NOW)
				{
					playerIn.addChatComponentMessage(new TextComponentTranslation("tile.bed.noSleep", new Object[0]));
				}
				else if (entityplayer$sleepresult == EntityPlayer.SleepResult.NOT_SAFE)
				{
					playerIn.addChatComponentMessage(new TextComponentTranslation("tile.bed.notSafe", new Object[0]));
				}

				return true;
			}
		}
		else
		{
			worldIn.setBlockToAir(pos);
			BlockPos blockpos = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite());

			if (worldIn.getBlockState(blockpos).getBlock() == this)
			{
				worldIn.setBlockToAir(blockpos);
			}

			worldIn.newExplosion((Entity)null, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 5.0F, true, true);
			return true;
		}
	}
}
 
Example #12
Source File: BiomeDesertShrubland.java    From Traverse-Legacy-1-12-2 with MIT License 4 votes vote down vote up
@Override
public int getSkyColorByTemp(float currentTemperature) {
	return Biomes.DESERT.getSkyColorByTemp(currentTemperature);
}
 
Example #13
Source File: BiomeAridHighland.java    From Traverse-Legacy-1-12-2 with MIT License 4 votes vote down vote up
@Override
public int getSkyColorByTemp(float currentTemperature) {
	return Biomes.DESERT.getSkyColorByTemp(currentTemperature);
}
 
Example #14
Source File: BiomeForestedHills.java    From Traverse-Legacy-1-12-2 with MIT License 4 votes vote down vote up
public BiomeForestedHills(BiomeForest.Type type, String name) {
    super(type, new BiomeProperties(name).setTemperature(Biomes.FOREST.getDefaultTemperature()).setRainfall(Biomes.FOREST.getRainfall()).setBaseHeight(Biomes.EXTREME_HILLS.getBaseHeight()).setHeightVariation(Biomes.EXTREME_HILLS.getHeightVariation()));
}
 
Example #15
Source File: OreGenerator.java    From EmergingTechnology with MIT License 4 votes vote down vote up
public void generateWorld(Random random, int chunkX, int chunkZ, World world, boolean newGen) {
    if (!newGen && !EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.RETROGEN) {
        return;
    }

    if (world.provider.getDimension() == DimensionType.OVERWORLD.getId()) {

        if (EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.GENERATE_OVERWORLD) {

            validBiomes = new ArrayList<Biome>();

            validBiomes.add(Biomes.BEACH);
            validBiomes.add(Biomes.OCEAN);
            validBiomes.add(Biomes.DEEP_OCEAN);
            validBiomes.add(Biomes.FROZEN_OCEAN);
            validBiomes.add(Biomes.RIVER);
            validBiomes.add(Biomes.FROZEN_RIVER);
            validBiomes.add(Biomes.SWAMPLAND);

            if (EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.GENERATE_DIRT) {
                addOreSpawn(ModBlocks.polluteddirt, (byte) 0, Blocks.DIRT, world, random, chunkX * 16, chunkZ * 16,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.DIRT_MIN_VEIN_SIZE,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.DIRT_MAX_VEIN_SIZE,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.DIRT_CHANCES_TO_SPAWN,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.DIRT_MIN_Y,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.DIRT_MAX_Y,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.DIRT_BIOME_RESTRICTION);
            }

            if (EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.GENERATE_SAND) {
                addOreSpawn(ModBlocks.pollutedsand, (byte) 0, Blocks.SAND, world, random, chunkX * 16, chunkZ * 16,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.SAND_MIN_VEIN_SIZE,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.SAND_MAX_VEIN_SIZE,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.SAND_CHANCES_TO_SPAWN,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.SAND_MIN_Y,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.SAND_MAX_Y,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.SAND_BIOME_RESTRICTION);
            }

            if (EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.GENERATE_GRAVEL) {
                addOreSpawn(ModBlocks.pollutedgravel, (byte) 0, Blocks.GRAVEL, world, random, chunkX * 16, chunkZ * 16,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.GRAVEL_MIN_VEIN_SIZE,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.GRAVEL_MAX_VEIN_SIZE,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.GRAVEL_CHANCES_TO_SPAWN,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.GRAVEL_MIN_Y,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.GRAVEL_MAX_Y,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.GRAVEL_BIOME_RESTRICTION);
            }
        }
    }

    if (!newGen) {
        world.getChunkFromChunkCoords(chunkX, chunkZ).markDirty();
    }
}
 
Example #16
Source File: TidalHelper.java    From EmergingTechnology with MIT License 4 votes vote down vote up
public static boolean isInValidBiome(Biome biome) {
    return biome == Biomes.BEACH || biome == Biomes.OCEAN || biome == Biomes.DEEP_OCEAN
            || EmergingTechnologyConfig.ELECTRICS_MODULE.TIDALGENERATOR.biomeRequirementDisabled;
}
 
Example #17
Source File: BiomeDesertShrubland.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public int getSkyColorByTemp(float currentTemperature) {
	return Biomes.DESERT.getSkyColorByTemp(currentTemperature);
}
 
Example #18
Source File: BiomeAridHighland.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public int getSkyColorByTemp(float currentTemperature) {
	return Biomes.DESERT.getSkyColorByTemp(currentTemperature);
}
 
Example #19
Source File: BiomeForestedHills.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
public BiomeForestedHills(BiomeForest.Type type, String name) {
    super(type, new BiomeProperties(name).setTemperature(Biomes.FOREST.getDefaultTemperature()).setRainfall(Biomes.FOREST.getRainfall()).setBaseHeight(Biomes.EXTREME_HILLS.getBaseHeight()).setHeightVariation(Biomes.EXTREME_HILLS.getHeightVariation()));
}
 
Example #20
Source File: BlockFuton.java    From Sakura_mod with MIT License 4 votes vote down vote up
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
		EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
	if (worldIn.isRemote) {
		return true;
	}
	if (state.getValue(PART) != EnumPartType.HEAD) {
		pos = pos.offset(state.getValue(FACING));
		state = worldIn.getBlockState(pos);

		if (state.getBlock() != this) {
			return true;
		}
	}

	if (worldIn.provider.canRespawnHere() && worldIn.getBiome(pos) != Biomes.HELL) {
		if (state.getValue(OCCUPIED).booleanValue()) {
			EntityPlayer entityplayer = this.getPlayerInBlanket(worldIn, pos);

			if (entityplayer != null) {
				playerIn.sendMessage(new TextComponentTranslation("tile.bed.occupied"));
				return true;
			}

			state = state.withProperty(OCCUPIED, Boolean.valueOf(false));
			worldIn.setBlockState(pos, state, 4);
		}

		EntityPlayer.SleepResult entityplayer$sleepresult = playerIn.trySleep(pos);

		if (entityplayer$sleepresult == EntityPlayer.SleepResult.OK) {
			state = state.withProperty(OCCUPIED, Boolean.valueOf(true));
			worldIn.setBlockState(pos, state, 4);
			return true;
		}
		if (entityplayer$sleepresult == EntityPlayer.SleepResult.NOT_POSSIBLE_NOW) {
			playerIn.sendMessage(new TextComponentTranslation("tile.bed.noSleep"));
		} else if (entityplayer$sleepresult == EntityPlayer.SleepResult.NOT_SAFE) {
			playerIn.sendMessage(new TextComponentTranslation("tile.bed.notSafe"));
		}

		return true;
	}
	worldIn.setBlockToAir(pos);
	BlockPos blockpos = pos.offset(state.getValue(FACING).getOpposite());

	if (worldIn.getBlockState(blockpos).getBlock() == this) {
		worldIn.setBlockToAir(blockpos);
	}

	worldIn.newExplosion(null, pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, 5.0F, true, true);
	return true;
}
 
Example #21
Source File: GuiEntityRender.java    From WearableBackpacks with MIT License votes vote down vote up
@Override public Biome getBiomeForCoordsBody(BlockPos pos) { return Biomes.DEFAULT; }