Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static final WorldType HEURISTIC_WORLDTYPE = new WorldType("no-op") {
- @Override public IChunkGenerator getChunkGenerator(World world, String options) {
- return null; // now thats something we can detect >:D
- }
- };
- //in constructor:
- boolean useProvider = false;
- if (!world.isRemote) {
- if (world.getWorldType() instanceof ICubicWorldType) { // Who do we trust!??!?! D:
- // nasty hack heuristic to see if provider asks its WorldType for a chunk generator
- //ReflectionUtil.setFieldValueSrg(wp, "field_76577_b", HEURISTIC_WORLDTYPE);
- provider.terrainType = HEURISTIC_WORLDTYPE;
- IChunkGenerator pro_or_null = provider.createChunkGenerator();
- // clean up
- //ReflectionUtil.setFieldValueSrg(provider, "field_76577_b", worldObj.getWorldType());
- provider.terrainType = world.getWorldType();
- if (pro_or_null != null) { // It will be null if it tries to get one form WorldType
- // It was from a vanilla WorldProvider... use it
- cubeGen = new VanillaCompatibilityGenerator(pro_or_null, worldIn);
- } else {
- // It was from WorldType, try to use cubic generator
- cubeGen = ((ICubicWorldType) world.getWorldType()).createCubeGenerator(getCubicWorld());
- if (cubeGen == null) {
- useProvider = true;
- }
- }
- } else {
- useProvider = true;
- }
- if (useProvider) {
- cubeGen = new VanillaCompatibilityGenerator(provider.createChunkGenerator(), worldIn);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement