@CustomRegistry public static void init() { Biome.BiomeProperties properties = new Biome.BiomeProperties("Rubber Plantation"); properties.setTemperature(0.95F); properties.setRainfall(0.95F); properties.setBaseHeight(0.45F); properties.setHeightVariation(0.4F); rubberPlantationBiome = new RubberPlantationBiome(properties); rubberPlantationBiome.setRegistryName(new ResourceLocation(TRConstants.MOD_ID, "rubberPlantation")); GameRegistry.register(rubberPlantationBiome); BiomeManager.addBiome(BiomeManager.BiomeType.WARM, new BiomeManager.BiomeEntry(rubberPlantationBiome, 20)); BiomeManager.addSpawnBiome(rubberPlantationBiome); BiomeProvider.allowedBiomes.add(rubberPlantationBiome); }
/** * creates a new world chunk manager for WorldProvider */ protected void createBiomeProvider() { this.field_191067_f = true; WorldType worldtype = this.worldObj.getWorldInfo().getTerrainType(); if (worldtype == WorldType.FLAT) { FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.createFlatGeneratorFromString(this.worldObj.getWorldInfo().getGeneratorOptions()); this.biomeProvider = new BiomeProviderSingle(Biome.getBiome(flatgeneratorinfo.getBiome(), Biomes.DEFAULT)); } else if (worldtype == WorldType.DEBUG_WORLD) { this.biomeProvider = new BiomeProviderSingle(Biomes.PLAINS); } else { this.biomeProvider = new BiomeProvider(this.worldObj.getWorldInfo()); } }
public Biome getBiome(BlockPos pos, BiomeProvider provider) { int i = pos.getX() & 15; int j = pos.getZ() & 15; int k = this.blockBiomeArray[j << 4 | i] & 255; if (k == 255) { Biome biome = provider.getBiome(pos, Biomes.PLAINS); k = Biome.getIdForBiome(biome); this.blockBiomeArray[j << 4 | i] = (byte)(k & 255); } Biome biome1 = Biome.getBiome(k); return biome1 == null ? Biomes.PLAINS : biome1; }
public Start(BiomeProvider chunkManagerIn, int p_i2104_2_, Random rand, int p_i2104_4_, int p_i2104_5_, List<StructureVillagePieces.PieceWeight> p_i2104_6_, int p_i2104_7_) { super((StructureVillagePieces.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); if (biome instanceof BiomeDesert) { this.structureType = 1; } else if (biome instanceof BiomeSavanna) { this.structureType = 2; } else if (biome instanceof BiomeTaiga) { this.structureType = 3; } this.func_189924_a(this.structureType); this.isZombieInfested = rand.nextInt(50) == 0; }
public Start(BiomeProvider chunkManagerIn, int p_i2104_2_, Random rand, int p_i2104_4_, int p_i2104_5_, List<StructureVillagePieces.PieceWeight> p_i2104_6_, int p_i2104_7_) { super((StructureVillagePieces.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; if (biome instanceof BiomeDesert) { this.structureType = 1; } else if (biome instanceof BiomeSavanna) { this.structureType = 2; } else if (biome instanceof BiomeTaiga) { this.structureType = 3; } this.func_189924_a(this.structureType); this.isZombieInfested = rand.nextInt(50) == 0; }
private void overrideBiomeProvider(int dimension, World world) { // Don't accidentally re-wrap our own BiomeProvider... if (world.getBiomeProvider() instanceof BiomeProviderPaintedBiomes) { return; } PaintedBiomes.logger.info("Wrapping the BiomeProvider (of type {}) of dimension {} with {}", world.getBiomeProvider().getClass().getName(), dimension, BiomeProviderPaintedBiomes.class.getName()); try { // Re-initialize the ImageHandler when a world loads, to update config values etc. ImageHandler imageHandler = ImageHandler.getImageHandler(dimension).init(world.getSeed()); BiomeProvider newBiomeProvider = new BiomeProviderPaintedBiomes(world, world.getBiomeProvider(), imageHandler); ReflectionHelper.setPrivateValue(WorldProvider.class, world.provider, newBiomeProvider, "field_76578_c", "biomeProvider"); } catch (UnableToAccessFieldException e) { PaintedBiomes.logger.error("Failed to wrap the BiomeProvider of dimension " + dimension); } }
@Override public BiomeProvider getBiomeProvider() { if(m_realProvider != null) { return m_realProvider.getBiomeProvider(); } else { return super.getBiomeProvider(); } }
@Override public BiomeProvider getBiomeProvider() { if (m_proxyWorld != null && Util.isPrefixInCallStack(m_modPrefix)) { return m_proxyWorld.getBiomeProvider(); } else if (m_realWorld != null) { return m_realWorld.getBiomeProvider(); } else { return super.getBiomeProvider(); } }
@Override public BiomeProvider getBiomeProvider() { if (m_proxyProvider != null && Util.isPrefixInCallStack(m_modPrefix)) { return m_proxyProvider.getBiomeProvider(); } else if (m_realProvider != null) { return m_realProvider.getBiomeProvider(); } else { return super.getBiomeProvider(); } }
public static BiomeProviderATG getATGBiomeProvider(World world) { BiomeProvider provider = world.getBiomeProvider(); if (provider instanceof BiomeProviderATG) { return (BiomeProviderATG)provider; } //todo: if deemed necessary, some form of recursive field search in case the biome provider is wrapped return null; }
private void convertFile(File baseFolder, Iterable<File> regionFiles, BiomeProvider p_75813_3_, int p_75813_4_, int p_75813_5_, IProgressUpdate progress) { for (File file1 : regionFiles) { this.convertChunks(baseFolder, file1, p_75813_3_, p_75813_4_, p_75813_5_, progress); ++p_75813_4_; int i = (int)Math.round(100.0D * (double)p_75813_4_ / (double)p_75813_5_); progress.setLoadingProgress(i); } }
public static void addSpawnBiome(Biome biome) { if (!BiomeProvider.allowedBiomes.contains(biome)) { BiomeProvider.allowedBiomes.add(biome); } }
public static void removeSpawnBiome(Biome biome) { if (BiomeProvider.allowedBiomes.contains(biome)) { BiomeProvider.allowedBiomes.remove(biome); } }
@Gamma @Hook("net.minecraft.world.biome.BiomeProvider#getBiomes") public static final Hook.Result getBiomes(BiomeProvider provider, @Nullable Biome[] oldBiomeList, int x, int z, int width, int depth, boolean cacheFlag) { if (debug_biome_flag) return Hook.Result.VOID; Biome result[] = new Biome[width * depth]; Arrays.fill(result, getBiome()); return new Hook.Result(result); }
@Gamma @Hook("net.minecraft.world.biome.BiomeProvider#getBiomes") public static final Hook.Result getBiome(BiomeProvider provider, BlockPos pos, Biome defaultBiome) { if (debug_biome_flag) return Hook.Result.VOID; return new Hook.Result(getBiome()); }
@Gamma @Hook("net.minecraft.world.biome.BiomeProvider#getBiomesForGeneration") public static final Hook.Result getBiomesForGeneration(BiomeProvider provider, Biome[] biomes, int x, int z, int width, int height) { if (debug_biome_flag) return Hook.Result.VOID; Biome result[] = new Biome[width * height]; Arrays.fill(result, getBiome()); return new Hook.Result(result); }
@Gamma @Hook("net.minecraft.world.biome.BiomeProvider#areBiomesViable") public static final Hook.Result areBiomesViable(BiomeProvider provider, int x, int z, int radius, List<Biome> allowed) { if (debug_biome_flag) return Hook.Result.VOID; Biome biome = getBiome(); return allowed.stream().filter(b -> b != biome).count() > 0 ? Hook.Result.FALSE : Hook.Result.TRUE; }
public static void overrideBiomeProvider(World world) { // For WorldProviderSurfaceJED the BiomeProvider has already been set in WorldProviderSurfaceJED#init() if ((world.provider instanceof WorldProviderSurfaceJED) == false) { int dimension = world.provider.getDimension(); String biomeName = DimensionConfig.instance().getBiomeFor(dimension); Biome biome = biomeName != null ? Biome.REGISTRY.getObject(new ResourceLocation(biomeName)) : null; if (biome != null && ((world.provider.getBiomeProvider() instanceof BiomeProviderSingle) == false || world.provider.getBiomeProvider().getBiome(BlockPos.ORIGIN) != biome)) { BiomeProvider biomeProvider = new BiomeProviderSingle(biome); JustEnoughDimensions.logInfo("WorldUtils.overrideBiomeProvider: Overriding the BiomeProvider for dimension {} with {}" + " using the biome '{}'", dimension, biomeProvider.getClass().getName(), biomeName); try { field_WorldProvider_biomeProvider.set(world.provider, biomeProvider); } catch (Exception e) { JustEnoughDimensions.logger.error("Failed to override the BiomeProvider of dimension {}", dimension); } } } }
public BiomeProviderPaintedBiomes(World world, BiomeProvider biomeProviderParent, ImageHandler imageHandler) { super(world.getWorldInfo()); this.parent = biomeProviderParent; this.imageHandler = imageHandler; this.biomeCache = new BiomeCache(this); }
public Start(BiomeProvider chunkManagerIn, int p_i2104_2_, Random rand, int p_i2104_4_, int p_i2104_5_, List<StructureOmotholPieces.PieceWeight> p_i2104_6_, int p_i2104_7_) { super((StructureOmotholPieces.Start)null, 0, rand, p_i2104_4_, p_i2104_5_); worldChunkMngr = chunkManagerIn; structureVillageWeightedPieceList = p_i2104_6_; terrainType = p_i2104_7_; Biome biomegenbase = chunkManagerIn.getBiome(new BlockPos(p_i2104_4_, 0, p_i2104_5_), Biomes.OCEAN); // inDesert = biomegenbase == Biome.desert || biomegenbase == Biome.desertHills; biome = biomegenbase; }
@Override public BiomeProvider getBiomeProvider(World world) { return new FirmaBiomeProvider(world.getSeed(), this, world.getWorldInfo().getGeneratorOptions()); }
public static String getBiomeName(int x, int z) { BiomeProvider provider = getWorld().getBiomeProvider(); return getChunkFromBlockCoords(x, z).getBiome(new BlockPos(x, 0, z), provider).getBiomeName(); }
public BiomeProvider getBiomeProvider() { return this.biomeProvider; }
@Override public BiomeProvider getBiomeProvider(World world) { return new BiomeProviderATG(world); }
/** * creates a spawn position at random within 256 blocks of 0,0 */ private void createSpawnPosition(WorldSettings settings) { if (!this.provider.canRespawnHere()) { this.worldInfo.setSpawn(BlockPos.ORIGIN.up(this.provider.getAverageGroundLevel())); } else if (this.worldInfo.getTerrainType() == WorldType.DEBUG_WORLD) { this.worldInfo.setSpawn(BlockPos.ORIGIN.up()); } else { this.findingSpawnPoint = true; BiomeProvider biomeprovider = this.provider.getBiomeProvider(); List<Biome> list = biomeprovider.getBiomesToSpawnIn(); Random random = new Random(this.getSeed()); BlockPos blockpos = biomeprovider.findBiomePosition(0, 0, 256, list, random); int i = 8; int j = this.provider.getAverageGroundLevel(); int k = 8; if (blockpos != null) { i = blockpos.getX(); k = blockpos.getZ(); } else { LOGGER.warn("Unable to find spawn biome"); } int l = 0; while (!this.provider.canCoordinateBeSpawn(i, k)) { i += random.nextInt(64) - random.nextInt(64); k += random.nextInt(64) - random.nextInt(64); ++l; if (l == 1000) { break; } } this.worldInfo.setSpawn(new BlockPos(i, j, k)); this.findingSpawnPoint = false; if (settings.isBonusChestEnabled()) { this.createBonusChest(); } } }
/** * copies a 32x32 chunk set from par2File to par1File, via AnvilConverterData */ private void convertChunks(File baseFolder, File p_75811_2_, BiomeProvider biomeSource, int p_75811_4_, int p_75811_5_, IProgressUpdate progressCallback) { try { String s = p_75811_2_.getName(); RegionFile regionfile = new RegionFile(p_75811_2_); RegionFile regionfile1 = new RegionFile(new File(baseFolder, s.substring(0, s.length() - ".mcr".length()) + ".mca")); for (int i = 0; i < 32; ++i) { for (int j = 0; j < 32; ++j) { if (regionfile.isChunkSaved(i, j) && !regionfile1.isChunkSaved(i, j)) { DataInputStream datainputstream = regionfile.getChunkDataInputStream(i, j); if (datainputstream == null) { LOGGER.warn("Failed to fetch input stream"); } else { NBTTagCompound nbttagcompound = CompressedStreamTools.read(datainputstream); datainputstream.close(); NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Level"); ChunkLoader.AnvilConverterData chunkloader$anvilconverterdata = ChunkLoader.load(nbttagcompound1); NBTTagCompound nbttagcompound2 = new NBTTagCompound(); NBTTagCompound nbttagcompound3 = new NBTTagCompound(); nbttagcompound2.setTag("Level", nbttagcompound3); ChunkLoader.convertToAnvilFormat(chunkloader$anvilconverterdata, nbttagcompound3, biomeSource); DataOutputStream dataoutputstream = regionfile1.getChunkDataOutputStream(i, j); CompressedStreamTools.write(nbttagcompound2, dataoutputstream); dataoutputstream.close(); } } } int k = (int)Math.round(100.0D * (double)(p_75811_4_ * 1024) / (double)(p_75811_5_ * 1024)); int l = (int)Math.round(100.0D * (double)((i + 1) * 32 + p_75811_4_ * 1024) / (double)(p_75811_5_ * 1024)); if (l > k) { progressCallback.setLoadingProgress(l); } } regionfile.close(); regionfile1.close(); } catch (IOException ioexception) { ioexception.printStackTrace(); } }
public BlockPos getClosestStrongholdPos(World worldIn, BlockPos pos, boolean p_180706_3_) { this.worldObj = worldIn; BiomeProvider biomeprovider = worldIn.getBiomeProvider(); return biomeprovider.func_190944_c() && biomeprovider.func_190943_d() != Biomes.ROOFED_FOREST ? null : func_191069_a(worldIn, this, pos, 80, 20, 10387319, true, 100, p_180706_3_); }
public BiomeProvider getBiomeProvider() { return this.provider.getBiomeProvider(); }
/** * creates a spawn position at random within 256 blocks of 0,0 */ private void createSpawnPosition(WorldSettings settings) { if (!this.provider.canRespawnHere()) { this.worldInfo.setSpawn(BlockPos.ORIGIN.up(this.provider.getAverageGroundLevel())); } else if (this.worldInfo.getTerrainType() == WorldType.DEBUG_WORLD) { this.worldInfo.setSpawn(BlockPos.ORIGIN.up()); } else { if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(this, settings)) return; this.findingSpawnPoint = true; BiomeProvider biomeprovider = this.provider.getBiomeProvider(); List<Biome> list = biomeprovider.getBiomesToSpawnIn(); Random random = new Random(this.getSeed()); BlockPos blockpos = biomeprovider.findBiomePosition(0, 0, 256, list, random); int i = 8; int j = this.provider.getAverageGroundLevel(); int k = 8; if (blockpos != null) { i = blockpos.getX(); k = blockpos.getZ(); } else { LOGGER.warn("Unable to find spawn biome"); } int l = 0; while (!this.provider.canCoordinateBeSpawn(i, k)) { i += random.nextInt(64) - random.nextInt(64); k += random.nextInt(64) - random.nextInt(64); ++l; if (l == 1000) { break; } } this.worldInfo.setSpawn(new BlockPos(i, j, k)); this.findingSpawnPoint = false; if (settings.isBonusChestEnabled()) { this.createBonusChest(); } } }
@Override public BiomeProvider getBiomeProvider(World world) { return new BiomeProviderExP(world.getWorldInfo()); }
public BiomeCacheExP(BiomeProvider chunkManagerIn) { super(chunkManagerIn); this.chunkManager = chunkManagerIn; }
@Override public Biome getBiome(BlockPos pos, BiomeProvider provider) { return Biomes.PLAINS; }
@Override public BiomeProvider getBiomeProvider() { return this.parent.getBiomeProvider(); }