Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.45 KB | None | 0 0
  1.     private static final WorldType HEURISTIC_WORLDTYPE = new WorldType("no-op") {
  2.         @Override public IChunkGenerator getChunkGenerator(World world, String options) {
  3.             return null; // now thats something we can detect >:D
  4.         }
  5.     };
  6.  
  7. //in constructor:
  8.  
  9.         boolean useProvider = false;
  10.  
  11.         if (!world.isRemote) {
  12.             if (world.getWorldType() instanceof ICubicWorldType) { // Who do we trust!??!?! D:
  13.  
  14.                 // nasty hack heuristic to see if provider asks its WorldType for a chunk generator
  15.                 //ReflectionUtil.setFieldValueSrg(wp, "field_76577_b", HEURISTIC_WORLDTYPE);
  16.                 provider.terrainType = HEURISTIC_WORLDTYPE;
  17.  
  18.                 IChunkGenerator pro_or_null = provider.createChunkGenerator();
  19.  
  20.                 // clean up
  21.                 //ReflectionUtil.setFieldValueSrg(provider, "field_76577_b", worldObj.getWorldType());
  22.                 provider.terrainType = world.getWorldType();
  23.  
  24.                 if (pro_or_null != null) { // It will be null if it tries to get one form WorldType
  25.  
  26.                     // It was from a vanilla WorldProvider... use it
  27.                     cubeGen = new VanillaCompatibilityGenerator(pro_or_null, worldIn);
  28.                 } else {
  29.  
  30.                     // It was from WorldType, try to use cubic generator
  31.                     cubeGen = ((ICubicWorldType) world.getWorldType()).createCubeGenerator(getCubicWorld());
  32.                     if (cubeGen == null) {
  33.                         useProvider = true;
  34.                     }
  35.                 }
  36.             } else {
  37.                 useProvider = true;
  38.             }
  39.  
  40.             if (useProvider) {
  41.                 cubeGen = new VanillaCompatibilityGenerator(provider.createChunkGenerator(), worldIn);
  42.             }
  43.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement