@SubscribeEvent public void onEvent(ChunkProviderEvent.ReplaceBiomeBlocks event){ int dim = event.world.provider.getDimensionId(); if(this.replacedMapGensDimensions.contains(dim)){ //don't touch, we already replaced it return; } this.replacedMapGensDimensions.add(dim); IChunkProvider prov = event.chunkProvider; if(!(prov instanceof ChunkProviderGenerate)){ return; } List<Field> genFields = ReflectionUtil.getFieldsByType(MapGenBase.class, ChunkProviderGenerate.class, false); for(Field field : genFields){ MapGenBase value = ReflectionUtil.getValue(field, prov, MapGenBase.class); value = WorldGenUtil.tileableMapGen(value); ReflectionUtil.setValue(field, prov, value); } }
@Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { // chunkX <<= 4; // chunkZ <<= 4; BlockPos pos = new BlockPos(chunkX, 1, chunkZ); if (chunkGenerator instanceof ChunkProviderGenerate || chunkGenerator.getClass().toString().contains("ChunkProviderRTG")) { this.generateOverworld(world, random, chunkX, chunkZ); if (Config.genBiomeStones == true) { this.genBiomeStone(world, chunkX, chunkZ, random); } } else if (chunkGenerator instanceof ChunkProviderHell) { this.generateNether(world, random, chunkX, chunkZ); } else if (chunkGenerator instanceof ChunkProviderEnd) { this.generateEnd(world, random, chunkX, chunkZ); } }
/** * @author jamierocks - 24th October 2016 * @reason To use custom ChunkProviders where necessary */ @Overwrite public IChunkProvider createChunkGenerator() { final IChunkProvider chunkProvider = this.terrainType == WorldType.FLAT ? new ChunkProviderFlat(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : (this.terrainType == WorldType.DEBUG_WORLD ? new ChunkProviderDebug(this.worldObj) : (this.terrainType == WorldType.CUSTOMIZED ? new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings))); if (this.dimensionType.hasChunkProvider()) { final ChunkProviderCustom chunkProviderCustom = this.dimensionType.getChunkProvider(); chunkProviderCustom.setWorld((net.canarymod.api.world.World) this.worldObj); return new NeptuneChunkProviderCustom(chunkProviderCustom, chunkProvider); } else { return chunkProvider; } }
@Override public boolean isOreGeneratedInWorld(World world, IChunkProvider chunkGenerator) { if (!this.shouldGenerate) { return false; } if (this.ignoreSurface && chunkGenerator instanceof ChunkProviderGenerate) { return false; } if (this.ignoreNether && chunkGenerator instanceof ChunkProviderHell) { return false; } if (this.ignoreEnd && chunkGenerator instanceof ChunkProviderEnd) { return false; } return true; }
@Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { if (chunkGenerator instanceof ChunkProviderGenerate) { mod.generateSurface(world, random, chunkX << 4, chunkZ << 4); } else if (chunkGenerator instanceof ChunkProviderHell) { mod.generateNether(world, random, chunkX << 4, chunkZ << 4); } }
/** * Returns a new chunk provider which generates chunks for this world */ public IChunkProvider createChunkGenerator() { return (IChunkProvider)(this.terrainType == WorldType.FLAT ? new ChunkProviderFlat(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : (this.terrainType == WorldType.DEBUG_WORLD ? new ChunkProviderDebug(this.worldObj) : (this.terrainType == WorldType.CUSTOMIZED ? new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings)))); }
public void setTarget(String target, int type) { this.timeToLive = TimeUtil.secsToTicks(10); this.spiritType = type; try { if(target.equals("Village")) { IChunkProvider ex; for(ex = super.worldObj.getChunkProvider(); ex != null && ex instanceof ChunkProviderServer; ex = ((ChunkProviderServer)ex).currentChunkProvider) { ; } if(ex != null) { if(ex instanceof ChunkProviderFlat) { if(fieldStructureGenerators == null) { fieldStructureGenerators = ReflectionHelper.findField(ChunkProviderFlat.class, new String[]{"structureGenerators", "field_82696_f", "f"}); } Iterator iterator = ((List)fieldStructureGenerators.get((ChunkProviderFlat)ex)).iterator(); while(iterator.hasNext()) { if(this.setWaypointTo(iterator.next(), MapGenVillage.class)) { return; } } } else if(ex instanceof ChunkProviderGenerate) { if(fieldVillageGenerator == null) { fieldVillageGenerator = ReflectionHelper.findField(ChunkProviderGenerate.class, new String[]{"villageGenerator", "field_73224_v", "v"}); } if(fieldVillageGenerator != null) { this.setWaypointTo(fieldVillageGenerator.get((ChunkProviderGenerate)ex), MapGenVillage.class); } } else if(ex instanceof ChunkProviderHell) { this.setWaypointTo(((ChunkProviderHell)ex).genNetherBridge); } } } } catch (IllegalAccessException var5) { ; } }
/** * Returns a new chunk provider which generates chunks for this world */ public IChunkProvider createChunkGenerator() { return (IChunkProvider)(this.terrainType == WorldType.FLAT ? new ChunkProviderFlat(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.field_82913_c) : new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled())); }
public IChunkProvider getChunkGenerator(World world, String generatorOptions) { return (this == FLAT ? new ChunkProviderFlat(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions) : new ChunkProviderGenerate(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled())); }
public IChunkProvider func_76555_c() { return (IChunkProvider)(this.field_76577_b == WorldType.field_77138_c?new ChunkProviderFlat(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c):new ChunkProviderGenerate(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r())); }