net.minecraft.world.biome.Biome Java Examples

The following examples show how to use net.minecraft.world.biome.Biome. 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: TraverseWorld.java    From Traverse-Legacy-1-12-2 with MIT License 7 votes vote down vote up
public static void register(Version versionAdded,
                            Biome biome,
                            BiomeType type,
                            String name,
                            int weight,
                            boolean disabled,
                            boolean canSpawn,
                            VillageReplacements villageReplacements,
                            RegistryEvent.Register<Biome> event,
                            BiomeDictionary.Type... biomeDictTypes) {
	if (!disabled) {
		biome.setRegistryName(new ResourceLocation(TraverseConstants.MOD_ID, name));
		event.getRegistry().register(biome);
		for (BiomeDictionary.Type biomeDictType : biomeDictTypes) {
			BiomeDictionary.addTypes(biome, biomeDictType);
		}
		biomeList.add(new TraverseBiomeEntry(biome, type, weight, canSpawn, !TraverseConfig.disallowVillages && villageReplacements != NO_VILLAGES, versionAdded));
		if (!TraverseConfig.disallowVillages && villageReplacements != NO_VILLAGES && villageReplacements != NO_REPLACEMENTS) {
			villageReplacementBiomes.put(biome, villageReplacements);
		}
	}
}
 
Example #2
Source File: WorldGenBambooShot.java    From Sakura_mod with MIT License 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,IChunkProvider chunkProvider) {
    int x = chunkX * 16;
    int z = chunkZ * 16;
    
    Biome biome = world.getBiomeForCoordsBody(new BlockPos(x, 0, z));
    if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.DEAD)
    		||BiomeDictionary.hasType(biome, BiomeDictionary.Type.SANDY)) {
      return;
    }
    
       if (random.nextFloat() < SakuraConfig.bambooshot_weight / 4000.0F)
    {
      int posX = x+ world.rand.nextInt(16) + 8;
      int posZ = z+ world.rand.nextInt(16) + 8;
      BlockPos newPos = WorldUtil.findGround(world, new BlockPos(posX, 0, posZ), true, true, true);
      if ((newPos != null) && (BlockLoader.BAMBOOSHOOT.canBlockStay(world, newPos))) {
        world.setBlockState(newPos, BlockLoader.BAMBOOSHOOT.getDefaultState(), 2);
      }
    }
}
 
Example #3
Source File: ItemBiomeChanger.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
@Override
public void useNetworkData(EntityPlayer player, Side side, byte id,
		NBTTagCompound nbt, ItemStack stack) {
	if(id == -1) {
		//If -1 then discover current biome
		((SatelliteBiomeChanger)getSatellite(stack)).addBiome(Biome.getIdForBiome(player.world.getBiome(new BlockPos((int)player.posX, 0, (int)player.posZ))));
		player.closeScreen();
	}
	if(id == 0) {
		int biomeId = nbt.getInteger("biome");

		
			setBiomeId(stack, biomeId);
		player.closeScreen();
	}
}
 
Example #4
Source File: CraftChunk.java    From Kettle with GNU General Public License v3.0 6 votes vote down vote up
private static float[] getTemperatures(BiomeProvider chunkmanager, int chunkX, int chunkZ) {
    Biome[] biomes = chunkmanager.getBiomes(null, chunkX, chunkZ, 16, 16);
    float[] temps = new float[biomes.length];

    for (int i = 0; i < biomes.length; i++) {
        float temp = biomes[i].getDefaultTemperature(); // Vanilla of olde: ((int) biomes[i].temperature * 65536.0F) / 65536.0F

        if (temp > 1F) {
            temp = 1F;
        }

        temps[i] = temp;
    }

    return temps;
}
 
Example #5
Source File: CachedGridEntry.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
public CachedGridEntry(World world, int gridX, int gridZ, int primerChunkX, int primerChunkZ) {
    this.gridX = gridX;
    this.gridZ = gridZ;
    long worldSeed = world.getSeed();
    this.gridRandom = new XSTR(31 * 31 * gridX + gridZ * 31 + Long.hashCode(worldSeed));

    int gridSizeX = WorldGeneratorImpl.GRID_SIZE_X * 16;
    int gridSizeZ = WorldGeneratorImpl.GRID_SIZE_Z * 16;
    BlockPos blockPos = new BlockPos(gridX * gridSizeX + gridSizeX / 2, world.getActualHeight(), gridZ * gridSizeZ + gridSizeZ / 2);
    Biome currentBiome = world.getBiomeProvider().getBiome(blockPos);
    this.cachedDepositMap = new ArrayList<>(WorldGenRegistry.INSTANCE.getCachedBiomeVeins(world.provider, currentBiome));

    this.worldSeaLevel = world.getSeaLevel();
    this.masterEntry = searchMasterOrNull(world);
    if (masterEntry == null) {
        Chunk primerChunk = world.getChunkFromChunkCoords(primerChunkX, primerChunkZ);
        BlockPos heightSpot = findOptimalSpot(gridX, gridZ, primerChunkX, primerChunkZ);
        int masterHeight = world.getHeight(heightSpot).getY();
        int masterBottomHeight = world.getTopSolidOrLiquidBlock(heightSpot).getY();
        this.masterEntry = primerChunk.getCapability(GTWorldGenCapability.CAPABILITY, null);
        this.masterEntry = new GTWorldGenCapability();
        this.masterEntry.setMaxHeight(masterHeight, masterBottomHeight);
    }

    triggerVeinsGeneration();
}
 
Example #6
Source File: AdvancedRocketry.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
@SubscribeEvent
public void register(RegistryEvent.Register<Biome> evt)
{
    System.out.println("REGISTERING BIOMES");
       AdvancedRocketryBiomes.moonBiome = new BiomeGenMoon(config.get(BIOMECATETORY, "moonBiomeId", 110).getInt(), true);
       AdvancedRocketryBiomes.alienForest = new BiomeGenAlienForest(config.get(BIOMECATETORY, "alienForestBiomeId", 111).getInt(), true);
       AdvancedRocketryBiomes.hotDryBiome = new BiomeGenHotDryRock(config.get(BIOMECATETORY, "hotDryBiome", 112).getInt(), true);
       AdvancedRocketryBiomes.spaceBiome = new BiomeGenSpace(config.get(BIOMECATETORY, "spaceBiomeId", 113).getInt(), true);
       AdvancedRocketryBiomes.stormLandsBiome = new BiomeGenStormland(config.get(BIOMECATETORY, "stormLandsBiomeId", 114).getInt(), true);
       AdvancedRocketryBiomes.crystalChasms = new BiomeGenCrystal(config.get(BIOMECATETORY, "crystalChasmsBiomeId", 115).getInt(), true);
       AdvancedRocketryBiomes.swampDeepBiome = new BiomeGenDeepSwamp(config.get(BIOMECATETORY, "deepSwampBiomeId", 116).getInt(), true);
       AdvancedRocketryBiomes.marsh = new BiomeGenMarsh(config.get(BIOMECATETORY, "marsh", 117).getInt(), true);
       AdvancedRocketryBiomes.oceanSpires = new BiomeGenOceanSpires(config.get(BIOMECATETORY, "oceanSpires", 118).getInt(), true);
       AdvancedRocketryBiomes.moonBiomeDark = new BiomeGenMoonDark(config.get(BIOMECATETORY, "moonBiomeDarkId", 119).getInt(), true);

       AdvancedRocketryBiomes.instance.registerBiome(AdvancedRocketryBiomes.moonBiome, evt.getRegistry());
       AdvancedRocketryBiomes.instance.registerBiome(AdvancedRocketryBiomes.alienForest, evt.getRegistry());
       AdvancedRocketryBiomes.instance.registerBiome(AdvancedRocketryBiomes.hotDryBiome, evt.getRegistry());
       AdvancedRocketryBiomes.instance.registerBiome(AdvancedRocketryBiomes.spaceBiome, evt.getRegistry());
       AdvancedRocketryBiomes.instance.registerBiome(AdvancedRocketryBiomes.stormLandsBiome, evt.getRegistry());
       AdvancedRocketryBiomes.instance.registerBiome(AdvancedRocketryBiomes.crystalChasms, evt.getRegistry());
       AdvancedRocketryBiomes.instance.registerBiome(AdvancedRocketryBiomes.swampDeepBiome, evt.getRegistry());
       AdvancedRocketryBiomes.instance.registerBiome(AdvancedRocketryBiomes.marsh, evt.getRegistry());
       AdvancedRocketryBiomes.instance.registerBiome(AdvancedRocketryBiomes.oceanSpires, evt.getRegistry());
       AdvancedRocketryBiomes.instance.registerBiome(AdvancedRocketryBiomes.moonBiomeDark, evt.getRegistry());
}
 
Example #7
Source File: BiomeGenDeepSwamp.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
public BiomeGenDeepSwamp(int biomeId, boolean register) {
	super(new BiomeProperties("DeepSwamp").setBaseHeight(-0.1f).setHeightVariation(0.2f).setRainfall(0.9f).setTemperature(0.9f).setWaterColor(14745518));

       this.setRegistryName(new ResourceLocation("advancedrocketry:DeepSwamp"));
	
	this.decorator.treesPerChunk = 10;
       this.decorator.flowersPerChunk = 1;
       this.decorator.deadBushPerChunk = 1;
       this.decorator.mushroomsPerChunk = 8;
       this.decorator.reedsPerChunk = 10;
       this.decorator.clayPerChunk = 1;
       this.decorator.waterlilyPerChunk = 4;
       this.decorator.sandPatchesPerChunk = 0;
       this.decorator.grassPerChunk = 5;
       this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntitySlime.class, 1, 1, 1));
       this.flowers.clear();
       this.addFlower(Blocks.RED_FLOWER.getDefaultState(), 10);
	swampTree = new WorldGenSwampTree(2);
}
 
Example #8
Source File: GenLayerRiverMix.java    From TofuCraftReload with MIT License 6 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.
 */
public int[] getInts(int par1, int par2, int par3, int par4)
{
    int[] aint = this.biomePatternGeneratorChain.getInts(par1, par2, par3, par4);
    int[] aint1 = this.riverPatternGeneratorChain.getInts(par1, par2, par3, par4);
    int[] aint2 = IntCache.getIntCache(par3 * par4);

    for (int i1 = 0; i1 < par3 * par4; ++i1)
    {
        if (aint1[i1] == Biome.getIdForBiome(TofuBiomes.TOFU_RIVER))
        {
            aint2[i1] = aint1[i1] & 255;
        }
        else
        {
            aint2[i1] = aint[i1];
        }
    }

    return aint2;
}
 
Example #9
Source File: GenLayerBiome.java    From TofuCraftReload with MIT License 6 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)
{
    this.parent.getInts(par1, par2, par3, par4);
    int[] aint1 = IntCache.getIntCache(par3 * par4);

    for (int i1 = 0; i1 < par4; ++i1)
    {
        for (int j1 = 0; j1 < par3; ++j1)
        {
            this.initChunkSeed((j1 + par1), (i1 + par2));
            int idx = this.nextInt(this.allowedBiomes.length);
            aint1[j1 + i1 * par3] = Biome.getIdForBiome(this.allowedBiomes[idx]);
        }
    }

    return aint1;
}
 
Example #10
Source File: WorldGenPepper.java    From Sakura_mod with MIT License 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,IChunkProvider chunkProvider) {
    int x = chunkX * 16;
    int z = chunkZ * 16;
    
    Biome biome = world.getBiomeForCoordsBody(new BlockPos(x, 0, z));
    if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.DEAD)
    		||BiomeDictionary.hasType(biome, BiomeDictionary.Type.SANDY)) {
      return;
    }

	if (random.nextFloat() < SakuraConfig.pepper_weight / 4000.0F) {
      int posX = x  + world.rand.nextInt(16) + 8;
      int posZ = z  + world.rand.nextInt(16) + 8;
      BlockPos newPos = WorldUtil.findGround(world, new BlockPos(posX, 0, posZ), true, true, true);
      if ((newPos != null) && (BlockLoader.PEPPER_SPLINT.canPlaceBlockAt(world, newPos))) {
        world.setBlockState(newPos, BlockLoader.PEPPERCROP.getDefaultState(), 2);
      }
    }
}
 
Example #11
Source File: WorldGenVanilla.java    From Sakura_mod with MIT License 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,IChunkProvider chunkProvider) {
    int x = chunkX * 16;
    int z = chunkZ * 16;
    
    Biome biome = world.getBiomeForCoordsBody(new BlockPos(x, 0, z));
    if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.DEAD)
    		||BiomeDictionary.hasType(biome, BiomeDictionary.Type.SANDY)) {
      return;
    }

	if (random.nextFloat() < SakuraConfig.vanilla_weight / 4000.0F)
    {
      int posX = x + world.rand.nextInt(16) + 8;
      int posZ = z + world.rand.nextInt(16) + 8;
      BlockPos newPos = WorldUtil.findGround(world, new BlockPos(posX, 0, posZ), true, true, true);
      if ((newPos != null) && (BlockLoader.VANILLA_SPLINT.canPlaceBlockAt(world, newPos))) {
        world.setBlockState(newPos, BlockLoader.VANILLACROP.getDefaultState(), 2);
      }
    }
}
 
Example #12
Source File: WorldProviderHellVoid.java    From YUNoMakeGoodMap with Apache License 2.0 6 votes vote down vote up
@Override
public Chunk generateChunk(int x, int z)
{
    ChunkPrimer data = new ChunkPrimer();

    if(YUNoMakeGoodMap.instance.shouldGenerateNetherFortress(world))
        genNetherBridge.generate(world, x, z, data);
    else
        genNetherBridge.generate(world, x, z, null);

    Chunk ret = new Chunk(world, data, x, z);
    Biome[] biomes = world.getBiomeProvider().getBiomes(null, x * 16, z * 16, 16, 16);
    byte[] ids = ret.getBiomeArray();

    for (int i = 0; i < ids.length; ++i)
    {
        ids[i] = (byte)Biome.getIdForBiome(biomes[i]);
    }

    ret.generateSkylightMap();
    return ret;
}
 
Example #13
Source File: CommandFindBiome.java    From Traverse-Legacy-1-12-2 with MIT License 5 votes vote down vote up
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
	Biome biome = null;
	if (args.length == 0) {
		sender.sendMessage(new TextComponentString("No biome specified"));
		return;
	}
	for (Biome b : ForgeRegistries.BIOMES.getValues()) {
		String name = b.getRegistryName().toString().replaceAll(" ", "_").toLowerCase();
		if (args[0].equalsIgnoreCase(name)) {
			biome = b;
		}
	}
	if (biome == null) {
		sender.sendMessage(new TextComponentString(TextFormatting.RED + "Error! Biome '" + args[0] + "' cannot be found!"));
		return;
	}
	long start = System.currentTimeMillis();
	final Biome finalBiome = biome;
	new Thread(() -> {
		BlockPos pos = spiralOutwardsLookingForBiome(sender, sender.getEntityWorld(), finalBiome, sender.getPosition().getX(), sender.getPosition().getZ(), TraverseConfig.findBiomeCommandTimeout);
		if (pos == null) {
			server.addScheduledTask(() -> sender.sendMessage(new TextComponentString(TextFormatting.RED + "Error! Biome '" + args[0] + "' could not be found after " + TextFormatting.GRAY + TraverseConfig.findBiomeCommandTimeout + "ms" + TextFormatting.RED + ".")));
			return;
		}
		if (sender instanceof EntityPlayerMP) {
			server.addScheduledTask(() -> {
				EntityPlayerMP playerMP = (EntityPlayerMP) sender;
				playerMP.connection.setPlayerLocation(pos.getX(), 150, pos.getZ(), 0, 0);
				sender.sendMessage(new TextComponentString(TextFormatting.WHITE + "Found '" + finalBiome.getRegistryName().toString() + "' Biome! " + TextFormatting.GRAY + "(" + (System.currentTimeMillis() - start) + "ms)"));
			});
			return;
		}
		server.addScheduledTask(() -> sender.sendMessage(new TextComponentString(TextFormatting.RED + "Error! An unknown error occurred.")));
	}, "Biome Finder - Traverse").start();
}
 
Example #14
Source File: IglooFeatureMixin.java    From carpet-extra with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public List<Biome.SpawnEntry> getMonsterSpawns()
{
    if (CarpetExtraSettings.straySpawningInIgloos)
    {
        return MONSTER_SPAWNS;
    }
    return Collections.emptyList();
}
 
Example #15
Source File: MixinWorld.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
/**
 * Enables the correct weather on ships depending on their position.
 */
@Intrinsic(displace = true)
public Biome vs$getBiomeForCoordsBody(BlockPos pos) {
    Optional<PhysicsObject> physicsObject = ValkyrienUtils
        .getPhysicsObject(World.class.cast(this), pos);

    if (physicsObject.isPresent()) {
        pos = physicsObject.get()
            .getShipTransformationManager()
            .getCurrentTickTransform().transform(pos, TransformType.SUBSPACE_TO_GLOBAL);
    }
    return getBiomeForCoordsBody(pos);
}
 
Example #16
Source File: CraftChunkSnapshot.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
CraftChunkSnapshot(int x, int z, String wname, long wtime, short[][] sectionBlockIDs, byte[][] sectionBlockData, byte[][] sectionSkyLights, byte[][] sectionEmitLights, boolean[] sectionEmpty, int[] hmap, Biome[] biome, double[] biomeTemp, double[] biomeRain) {
    this.x = x;
    this.z = z;
    this.worldname = wname;
    this.captureFulltime = wtime;
    this.blockids = sectionBlockIDs;
    this.blockdata = sectionBlockData;
    this.skylight = sectionSkyLights;
    this.emitlight = sectionEmitLights;
    this.empty = sectionEmpty;
    this.hmap = hmap;
    this.biome = biome;
    this.biomeTemp = biomeTemp;
    this.biomeRain = biomeRain;
}
 
Example #17
Source File: BiomeLushSwamp.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
public BiomeLushSwamp() {
	super(properties);
	decorator.treesPerChunk = 2;
	decorator.flowersPerChunk = 5;
	decorator.deadBushPerChunk = 1;
	decorator.mushroomsPerChunk = 4;
	decorator.reedsPerChunk = 10;
	decorator.clayPerChunk = 1;
	decorator.waterlilyPerChunk = 4;
	decorator.sandPatchesPerChunk = 0;
	decorator.grassPerChunk = 10;

	spawnableMonsterList.add(new Biome.SpawnListEntry(EntitySlime.class, 1, 1, 1));
}
 
Example #18
Source File: TraverseWorld.java    From Traverse-Legacy-1-12-2 with MIT License 5 votes vote down vote up
public static void register(Version versionAdded,
                            Biome biome,
                            BiomeType type,
                            String name,
                            int weight,
                            boolean disabled,
                            boolean canSpawn,
                            RegistryEvent.Register<Biome> event,
                            BiomeDictionary.Type... biomeDictTypes) {
	register(versionAdded, biome, type, name, weight, disabled, canSpawn, NO_VILLAGES, event, biomeDictTypes);

}
 
Example #19
Source File: OilPoolGenerator.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
public static void registerOilLake() {
    for (Biome biome : Biome.BIOMES) {
        if (!biome.getCategory().equals(Biomes.NETHER_WASTES.getCategory()) && !biome.getCategory().equals(Biomes.THE_END.getCategory())) {

            biome.addFeature(GenerationStep.Feature.UNDERGROUND_DECORATION, new ConfiguredFeature<>((LakeFeature) Feature.LAKE, new SingleStateFeatureConfig(GalacticraftBlocks.CRUDE_OIL.getDefaultState())));
        }
    }
}
 
Example #20
Source File: ChunkProviderTofu.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@Override
public Chunk generateChunk(int x, int z) {

    this.chunkX = x;
    this.chunkZ = z;
    this.rand.setSeed((long) x * 341873128712L + (long) z * 132897987541L);
    ChunkPrimer chunkprimer = new ChunkPrimer();
    this.biomesForGeneration = this.world.getBiomeProvider().getBiomes(this.biomesForGeneration, x * 16, z * 16, 16, 16);
    this.setBlocksInChunk(x, z, chunkprimer);
    this.buildSurfaces(chunkprimer);
    this.setBedRock(chunkprimer);

    this.caveGenerator.generate(this.world, x, z, chunkprimer);


    if (this.mapFeaturesEnabled) {
        this.mineshaft.generate(this.world, x, z, chunkprimer);
        this.villageGenerator.generate(this.world, x, z, chunkprimer);
        this.tofuCastle.generate(this.world, x, z, chunkprimer);
    }

    Chunk chunk = new Chunk(this.world, chunkprimer, x, z);
    byte[] abyte = chunk.getBiomeArray();

    for (int i = 0; i < abyte.length; ++i) {
        abyte[i] = (byte) Biome.getIdForBiome(this.biomesForGeneration[i]);
    }

    chunk.generateSkylightMap();
    return chunk;
}
 
Example #21
Source File: CommandFindBiome.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
	Biome biome = null;
	if (args.length == 0) {
		sender.sendMessage(new TextComponentString("No biome specified"));
		return;
	}
	for (Biome b : ForgeRegistries.BIOMES.getValues()) {
		String name = b.getRegistryName().toString().replaceAll(" ", "_").toLowerCase();
		if (args[0].equalsIgnoreCase(name)) {
			biome = b;
		}
	}
	if (biome == null) {
		sender.sendMessage(new TextComponentString(TextFormatting.RED + "Error! Biome '" + args[0] + "' cannot be found!"));
		return;
	}
	long start = System.currentTimeMillis();
	final Biome finalBiome = biome;
	new Thread(() -> {
		BlockPos pos = spiralOutwardsLookingForBiome(sender, sender.getEntityWorld(), finalBiome, sender.getPosition().getX(), sender.getPosition().getZ(), TraverseConfig.findBiomeCommandTimeout);
		if (pos == null) {
			server.addScheduledTask(() -> sender.sendMessage(new TextComponentString(TextFormatting.RED + "Error! Biome '" + args[0] + "' could not be found after " + TextFormatting.GRAY + TraverseConfig.findBiomeCommandTimeout + "ms" + TextFormatting.RED + ".")));
			return;
		}
		if (sender instanceof EntityPlayerMP) {
			server.addScheduledTask(() -> {
				EntityPlayerMP playerMP = (EntityPlayerMP) sender;
				playerMP.connection.setPlayerLocation(pos.getX(), 150, pos.getZ(), 0, 0);
				sender.sendMessage(new TextComponentString(TextFormatting.WHITE + "Found '" + finalBiome.getRegistryName().toString() + "' Biome! " + TextFormatting.GRAY + "(" + (System.currentTimeMillis() - start) + "ms)"));
			});
			return;
		}
		server.addScheduledTask(() -> sender.sendMessage(new TextComponentString(TextFormatting.RED + "Error! An unknown error occurred.")));
	}, "Biome Finder - Traverse").start();
}
 
Example #22
Source File: OverworldChunkGeneratorMixin.java    From fabric-carpet with MIT License 5 votes vote down vote up
@Inject(method = "getEntitySpawnList", at = @At(value = "INVOKE", ordinal = 1, shift = At.Shift.BEFORE,
        target = "Lnet/minecraft/world/gen/feature/StructureFeature;isApproximatelyInsideStructure(Lnet/minecraft/world/IWorld;Lnet/minecraft/util/math/BlockPos;)Z"),
        cancellable = true)
private void onGetEntitySpawnList(EntityCategory entityCategory_1, BlockPos blockPos_1,
        CallbackInfoReturnable<List<Biome.SpawnEntry>> cir)
{
    if (CarpetSettings.huskSpawningInTemples)
    {
        if (Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(this.world, blockPos_1))
        {
            cir.setReturnValue(Feature.DESERT_PYRAMID.getMonsterSpawns());
        }
    }
}
 
Example #23
Source File: ItemBiomeChanger.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
private void setBiomeId(ItemStack stack, int id) {
	if(Biome.getBiome(id) != null) {
		SatelliteBase sat = getSatellite(stack);
		if(sat != null && sat instanceof SatelliteBiomeChanger) {
			((SatelliteBiomeChanger)sat).setBiome(id);
		}
	}
}
 
Example #24
Source File: BiomeGenWatermelon.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
public BiomeGenWatermelon(int biomeId, boolean register) {
	super(new BiomeProperties("Watermelon").setBaseHeight(1f).setHeightVariation(0.1f).setTemperature(0.9f).setRainDisabled());
	
	//cold and dry
	
	this.decorator.generateFalls=false;
	this.decorator.flowersPerChunk=0;
	this.decorator.grassPerChunk=0;
	this.decorator.treesPerChunk=0;
	this.fillerBlock = this.topBlock = Blocks.MELON_BLOCK.getDefaultState();
	
	this.spawnableMonsterList.clear();
	this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityEnderman.class, 10, 1, 10));
}
 
Example #25
Source File: GTWorldGen.java    From GT-Classic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
		IChunkProvider chunkProvider) {
	Biome biomegenbase = world.getBiome(new BlockPos(chunkX * 16 + 16, 128, chunkZ * 16 + 16));
	// Any Biome
	GTOreGenerator.generateBasicVein(GTBlocks.oreIridium, GTConfig.generation.iridiumGenerate, GTConfig.generation.iridiumSize, GTConfig.generation.iridiumWeight, 0, 128, Blocks.STONE, world, random, chunkX, chunkZ);
	// Jungle Biomes
	if (BiomeDictionary.hasType(biomegenbase, Type.JUNGLE)) {
		GTOreGenerator.generateBasicVein(GTBlocks.oreSheldonite, GTConfig.generation.sheldoniteGenerate, GTConfig.generation.sheldoniteSize, GTConfig.generation.sheldoniteWeight, 10, 30, Blocks.STONE, world, random, chunkX, chunkZ);
	}
	// Hot Biomes
	if (BiomeDictionary.hasType(biomegenbase, Type.HOT)) {
		GTOreGenerator.generateBasicVein(GTBlocks.oreRuby, GTConfig.generation.rubyGenerate, GTConfig.generation.rubySize, GTConfig.generation.rubyWeight, 0, 48, Blocks.STONE, world, random, chunkX, chunkZ);
	}
	// Ocean Biomes
	if (BiomeDictionary.hasType(biomegenbase, Type.OCEAN) || BiomeDictionary.hasType(biomegenbase, Type.BEACH)) {
		GTOreGenerator.generateBasicVein(GTBlocks.oreSapphire, GTConfig.generation.sapphireGenerate, GTConfig.generation.sapphireSize, GTConfig.generation.sapphireWeight, 0, 48, Blocks.STONE, world, random, chunkX, chunkZ);
	}
	// Forest or Plains Biomes
	if (BiomeDictionary.hasType(biomegenbase, Type.FOREST)
			|| (BiomeDictionary.hasType(biomegenbase, Type.PLAINS))) {
		GTOreGenerator.generateBasicVein(GTBlocks.oreBauxite, GTConfig.generation.bauxiteGenerate, GTConfig.generation.bauxiteSize, GTConfig.generation.bauxiteWeight, 50, 120, Blocks.STONE, world, random, chunkX, chunkZ);
	}
	if (world.provider.getDimensionType().equals(DimensionType.OVERWORLD)) {
		for (Block block : GTBedrockOreHandler.getBedrockOreMap().keySet()) {
			if (GTBedrockOreHandler.shouldGTCHandleGeneration(block)) {
				GTOreGenerator.generateBedrockVein(block, world, random, chunkX, chunkZ);
			}
		}
	}
}
 
Example #26
Source File: ChunkProviderPlanet.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
public void replaceBiomeBlocks(int x, int z, ChunkPrimer primer, Biome[] biomesIn)
{
	if (!net.minecraftforge.event.ForgeEventFactory.onReplaceBiomeBlocks(this, x, z, primer, this.worldObj)) return;
	double d0 = 0.03125D;
	this.depthBuffer = this.surfaceNoise.getRegion(this.depthBuffer, (double)(x * 16), (double)(z * 16), 16, 16, 0.0625D, 0.0625D, 1.0D);

	for (int i = 0; i < 16; ++i)
	{
		for (int j = 0; j < 16; ++j)
		{
			Biome biome = biomesIn[j + i * 16];
			biome.genTerrainBlocks(this.worldObj, this.rand, primer, x * 16 + i, z * 16 + j, this.depthBuffer[j + i * 16]);
		}
	}
}
 
Example #27
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 #28
Source File: Penguins.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void registerEntities(IForgeRegistry<EntityEntry> reg) {
	List<Biome> penguinBiomes = new LinkedList<Biome>();
	for (Entry<ResourceLocation, Biome> e : ForgeRegistries.BIOMES.getEntries())
		if (e.getValue().getTempCategory() == TempCategory.COLD)
			penguinBiomes.add(e.getValue());
	reg.register(EntityEntryBuilder.create().entity(EntityPenguin.class).egg(0x000000, 0xFFFFFF)
					.tracker(32, 4, true).name("community_mod.penguin")
					.spawn(EnumCreatureType.CREATURE, 7, 7, 9, penguinBiomes)
					.id(new ResourceLocation("community_mod", "penguin"), CommunityGlobals.entity_id++).build());
}
 
Example #29
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 #30
Source File: CommandFindBiome.java    From Traverse-Legacy-1-12-2 with MIT License 5 votes vote down vote up
@Override
public List<String> getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos targetPos) {
	if(args.length==1) {
		List<String> strings = new ArrayList<>();
		for (Biome b : ForgeRegistries.BIOMES.getValues()) {
			String s = b.getRegistryName().toString();
			if (s.toLowerCase().contains(args[0].toLowerCase()))
				strings.add(s);
		}

		return strings;
	}
	return Collections.emptyList();
}