Jump to content

[1.8.9]GL EROR & Dimension Chank Render Bug


NookerKunG

Recommended Posts

my crash reports

https://pastebin.com/snk1xbUg

17974249_1109848142454814_2127584542_n.png.f267a37bcafe5063a5deec5682768103.png

world provider japanese

package nookerzaza.mods.asiancraft.country.japanese.world;

import net.minecraft.entity.Entity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.storage.WorldInfo;
import net.minecraftforge.client.IRenderHandler;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nookerzaza.mods.asiancraft.core.init.ACcountry;
import nookerzaza.mods.asiancraft.country.japanese.world.gen.ChunkProviderJapanese;
import nookerzaza.mods.asiancraft.country.japanese.world.gen.WorldChunkManagerJapanese;
import nookerzaza.mods.asiancraft.country.japanese.world.render.SkyRendererJapanese;

public class WorldProviderJapanese extends WorldProvider
{
  public void registerWorldChunkManager()
  {
    this.worldChunkMgr = new WorldChunkManagerJapanese(this.worldObj.getSeed());
    this.dimensionId = ACcountry.japanese;
  }
  
  protected void generateLightBrightnessTable()
  {
      float f = 0.0F;

      for (int i = 0; i <= 15; ++i)
      {
          float f1 = 1.0F - (float)i / 15.0F;
          this.lightBrightnessTable[i] = (1.0F - f1) / (f1 * 3.0F + 1.0F) * (1.0F - f) + f;
      }
  }
  
  public IChunkProvider createChunkGenerator()
  {
    return new ChunkProviderJapanese(this.worldObj, this.worldObj.getSeed());
  }
  
  public boolean isSurfaceWorld()
  {
    return true;
  }
  
  public boolean canCoordinateBeSpawn(int par1, int par2){
      return false;
  }
  
  public boolean canSnowAt(BlockPos pos, boolean checkLight)
  {
    return false;
  }
  
  public String getSaveFolder()
  {
    return "Japanese";
  }
  
  public boolean renderClouds()
  {
    return true;
  }
  
  public boolean canRespawnHere()
  {
      return true;
  }
  
  public float setSunSize()
  {
    return 0.12F;
  }
  
  @SideOnly(Side.CLIENT)
	public float setMoonSize() {
		return 4.0F;
	}

  
  public float calculateCelestialAngle(long p_76563_1_, float p_76563_3_)
  {
      int i = (int)(p_76563_1_ % 24000L);
      float f = ((float)i + p_76563_3_) / 24000.0F - 0.25F;

      if (f < 0.0F)
      {
          ++f;
      }

      if (f > 1.0F)
      {
          --f;
      }

      float f1 = 1.0F - (float)((Math.cos((double)f * Math.PI) + 1.0D) / 2.0D);
      f = f + (f1 - f) / 3.0F;
      return f;
  }
  
  @SideOnly(Side.CLIENT)
  public IRenderHandler getSkyRenderer()
  {
    return new SkyRendererJapanese();
  }
  
  @Override
  @SideOnly(Side.CLIENT)
  public float getStarBrightness(float par1)
  {
      float f1 = this.worldObj.getCelestialAngle(par1);
      float f2 = 1.0F - (MathHelper.cos(f1 * (float) Math.PI * 2.0F) * 2.0F + 0.25F);

      if (f2 < 0.0F)
      {
          f2 = 0.0F;
      }

      if (f2 > 1.0F)
      {
          f2 = 1.0F;
      }

      return f2 * f2 * 0.75F;
  }
  
  @SideOnly(Side.CLIENT)
  public Vec3 getFogColor(float p_76562_1_, float p_76562_2_)
  {
    return new Vec3(0.0D, 0.0D, 0.0D);
  }
  
  public Vec3 getSkyColor(Entity cameraEntity, float partialTicks)
  {
    return new Vec3(0.0D, 0.0D, 0.0D);
  }
  
  public float[] calcSunriseSunsetColors(float var1, float var2)
  {
    return null;
  }
  
  public String getInternalNameSuffix()
  {
    return "_japanese";
  }

@Override
public String getDimensionName() {
	return "japanese";
}

}

WorldChunkManager

package nookerzaza.mods.asiancraft.country.japanese.world.gen;

import com.google.common.collect.Lists;
import java.util.List;
import java.util.Random;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ReportedException;
import net.minecraft.world.World;
import net.minecraft.world.WorldType;
import net.minecraft.world.biome.BiomeCache;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.WorldChunkManager;
import net.minecraft.world.gen.layer.GenLayer;
import net.minecraft.world.gen.layer.IntCache;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nookerzaza.mods.asiancraft.country.japanese.world.gen.biome.BiomeJapanese;
import nookerzaza.mods.asiancraft.country.japanese.world.gen.layer.GenLayerJapanese;

public class WorldChunkManagerJapanese extends WorldChunkManager
{
    public static List<BiomeGenBase> allowedBiomes = Lists.newArrayList(BiomeJapanese.japanese_forest, BiomeJapanese.japanese_gloden_pain, BiomeJapanese.japanese_deep_ocean, BiomeJapanese.cherryblossom_forest);
    private GenLayer genBiomes;
    /** A GenLayer containing the indices into BiomeGenBase.biomeList[] */
    private GenLayer biomeIndexLayer;
    /** The biome list. */
    private BiomeCache biomeCache;
    private List<BiomeGenBase> biomesToSpawnIn;
    private String field_180301_f;

    protected WorldChunkManagerJapanese()
    {
        this.biomeCache = new BiomeCache(this);
        this.biomesToSpawnIn = Lists.<BiomeGenBase>newArrayList();
        this.biomesToSpawnIn.addAll(allowedBiomes);
    }

    public WorldChunkManagerJapanese(long seed)
    {
        this();
        GenLayer[] agenlayer = GenLayerJapanese.initializeAllBiomeGenerators(seed);
        this.genBiomes = agenlayer[0];
        this.biomeIndexLayer = agenlayer[1];
    }


    public List<BiomeGenBase> getBiomesToSpawnIn()
    {
        return this.biomesToSpawnIn;
    }

    /**
     * Returns the biome generator
     */
    public BiomeGenBase getBiomeGenerator(BlockPos pos)
    {
        return this.getBiomeGenerator(pos, (BiomeGenBase)null);
    }

    public BiomeGenBase getBiomeGenerator(BlockPos pos, BiomeGenBase biomeGenBaseIn)
    {
        return this.biomeCache.func_180284_a(pos.getX(), pos.getZ(), biomeGenBaseIn);
    }

    /**
     * Returns a list of rainfall values for the specified blocks. Args: listToReuse, x, z, width, length.
     */
    public float[] getRainfall(float[] listToReuse, int x, int z, int width, int length)
    {
        IntCache.resetIntCache();

        if (listToReuse == null || listToReuse.length < width * length)
        {
            listToReuse = new float[width * length];
        }

        int[] aint = this.biomeIndexLayer.getInts(x, z, width, length);

        for (int i = 0; i < width * length; ++i)
        {
                float f = (float)BiomeGenBase.getBiomeFromBiomeList(aint[i], BiomeJapanese.japanese_gloden_pain).getIntRainfall() / 65536.0F;

                if (f > 1.0F)
                {
                    f = 1.0F;
                }

                listToReuse[i] = f;
            }

        return listToReuse;
    }

    /**
     * Return an adjusted version of a given temperature based on the y height
     */
    @SideOnly(Side.CLIENT)
    public float getTemperatureAtHeight(float p_76939_1_, int p_76939_2_)
    {
        return p_76939_1_;
    }

    /**
     * Returns an array of biomes for the location input.
     */
    public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] biomes, int x, int z, int width, int height)
    {
        IntCache.resetIntCache();

        if (biomes == null || biomes.length < width * height)
        {
            biomes = new BiomeGenBase[width * height];
        }

        int[] aint = this.genBiomes.getInts(x, z, width, height);

            for (int i = 0; i < width * height; ++i)
            {
                biomes[i] = BiomeGenBase.getBiomeFromBiomeList(aint[i], BiomeJapanese.japanese_gloden_pain);
            }

            return biomes;
        }
   

    /**
     * Returns biomes to use for the blocks and loads the other data like temperature and humidity onto the
     * WorldChunkManager Args: oldBiomeList, x, z, width, depth
     */
    public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] oldBiomeList, int x, int z, int width, int depth)
    {
        return this.getBiomeGenAt(oldBiomeList, x, z, width, depth, true);
    }

    /**
     * Return a list of biomes for the specified blocks. Args: listToReuse, x, y, width, length, cacheFlag (if false,
     * don't check biomeCache to avoid infinite loop in BiomeCacheBlock)
     */
    public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] listToReuse, int x, int z, int width, int length, boolean cacheFlag)
    {
        IntCache.resetIntCache();

        if (listToReuse == null || listToReuse.length < width * length)
        {
            listToReuse = new BiomeGenBase[width * length];
        }

        if (cacheFlag && width == 16 && length == 16 && (x & 15) == 0 && (z & 15) == 0)
        {
            BiomeGenBase[] abiomegenbase = this.biomeCache.getCachedBiomes(x, z);
            System.arraycopy(abiomegenbase, 0, listToReuse, 0, width * length);
            return listToReuse;
        }
        else
        {
            int[] aint = this.biomeIndexLayer.getInts(x, z, width, length);

            for (int i = 0; i < width * length; ++i)
            {
                listToReuse[i] = BiomeGenBase.getBiomeFromBiomeList(aint[i], BiomeJapanese.japanese_gloden_pain);
            }

            return listToReuse;
        }
    }

    /**
     * checks given Chunk's Biomes against List of allowed ones
     */
    public boolean areBiomesViable(int p_76940_1_, int p_76940_2_, int p_76940_3_, List<BiomeGenBase> p_76940_4_)
    {
        IntCache.resetIntCache();
        int i = p_76940_1_ - p_76940_3_ >> 2;
        int j = p_76940_2_ - p_76940_3_ >> 2;
        int k = p_76940_1_ + p_76940_3_ >> 2;
        int l = p_76940_2_ + p_76940_3_ >> 2;
        int i1 = k - i + 1;
        int j1 = l - j + 1;
        int[] aint = this.genBiomes.getInts(i, j, i1, j1);

            for (int k1 = 0; k1 < i1 * j1; ++k1)
            {
                BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[k1]);

                if (!p_76940_4_.contains(biomegenbase))
                {
                    return false;
                }
            }

            return true;
        }


    public BlockPos findBiomePosition(int x, int z, int range, List<BiomeGenBase> biomes, Random random)
    {
        IntCache.resetIntCache();
        int i = x - range >> 2;
        int j = z - range >> 2;
        int k = x + range >> 2;
        int l = z + range >> 2;
        int i1 = k - i + 1;
        int j1 = l - j + 1;
        int[] aint = this.genBiomes.getInts(i, j, i1, j1);
        BlockPos blockpos = null;
        int k1 = 0;

        for (int l1 = 0; l1 < i1 * j1; ++l1)
        {
            int i2 = i + l1 % i1 << 2;
            int j2 = j + l1 / i1 << 2;
            BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[l1]);

            if (biomes.contains(biomegenbase) && (blockpos == null || random.nextInt(k1 + 1) == 0))
            {
                blockpos = new BlockPos(i2, 0, j2);
                ++k1;
            }
        }

        return blockpos;
    }

    /**
     * Calls the WorldChunkManager's biomeCache.cleanupCache()
     */
    public void cleanupCache()
    {
        this.biomeCache.cleanupCache();
    }

}

genlayer 

package nookerzaza.mods.asiancraft.country.japanese.world.gen.layer;

import net.minecraft.world.gen.layer.GenLayer;
import net.minecraft.world.gen.layer.GenLayerFuzzyZoom;
import net.minecraft.world.gen.layer.GenLayerVoronoiZoom;
import net.minecraft.world.gen.layer.GenLayerZoom;

public abstract class GenLayerJapanese extends GenLayer
{

	public GenLayerJapanese(long p_i2125_1_) {
		super(p_i2125_1_);
	
	}
	
	 public static GenLayer[] initializeAllBiomeGenerators(long seed)
	  {
		GenLayer biomes = new GenLayerJapaneseBiome(2000L);
		biomes = new GenLayerZoom(1000L, biomes);
		biomes = new GenLayerZoom(1001L, biomes);
		biomes = new GenLayerZoom(1002L, biomes);
		biomes = new GenLayerZoom(1003L, biomes);
		GenLayer genLayerVeronoiZoom = new GenLayerVoronoiZoom(10L, biomes);
	    biomes.initWorldGenSeed(seed);
	    genLayerVeronoiZoom.initWorldGenSeed(seed);
	    return new GenLayer[] { biomes, genLayerVeronoiZoom };
	}

}

genlayerBiome

package nookerzaza.mods.asiancraft.country.japanese.world.gen.layer;

import com.google.common.collect.ImmutableList;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.util.WeightedRandom;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.gen.layer.IntCache;
import net.minecraftforge.common.BiomeManager;
import net.minecraftforge.common.BiomeManager.BiomeEntry;
import net.minecraftforge.common.BiomeManager.BiomeType;
import nookerzaza.mods.asiancraft.country.japanese.world.gen.biome.BiomeJapanese;

public class GenLayerJapaneseBiome
  extends GenLayerJapanese
{
  private List<BiomeManager.BiomeEntry>[] biomes = new ArrayList[BiomeManager.BiomeType.values().length];
  private ArrayList<BiomeManager.BiomeEntry>[] biomesList = setupBiomes();
  
  public GenLayerJapaneseBiome(long seed)
  {
    super(seed);
    for (BiomeManager.BiomeType type : BiomeManager.BiomeType.values())
    {
      ImmutableList<BiomeManager.BiomeEntry> biomesToAdd = getBiomes(type);
      int idx = type.ordinal();
      if (this.biomes[idx] == null) {
        this.biomes[idx] = new ArrayList();
      }
      if (biomesToAdd != null) {
        this.biomes[idx].addAll(biomesToAdd);
      }
    }
  }
  
  private ArrayList<BiomeManager.BiomeEntry>[] setupBiomes()
  {
    ArrayList<BiomeManager.BiomeEntry>[] currentBiomes = new ArrayList[BiomeManager.BiomeType.values().length];
    List<BiomeManager.BiomeEntry> list = new ArrayList();
    list.add(new BiomeManager.BiomeEntry(BiomeJapanese.cherryblossom_forest, 30));
    list.add(new BiomeManager.BiomeEntry(BiomeJapanese.japanese_forest, 20));
    list.add(new BiomeManager.BiomeEntry(BiomeJapanese.japanese_gloden_pain, 20));
    list.add(new BiomeManager.BiomeEntry(BiomeJapanese.japanese_deep_ocean, 30));
    currentBiomes[BiomeManager.BiomeType.COOL.ordinal()] = new ArrayList(list);
    return currentBiomes;
  }
  
  private ImmutableList<BiomeManager.BiomeEntry> getBiomes(BiomeManager.BiomeType type)
  {
    int idx = type.ordinal();
    List<BiomeManager.BiomeEntry> list = idx >= this.biomesList.length ? null : this.biomesList[idx];
    return list != null ? ImmutableList.copyOf(list) : null;
  }
  
  public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight)
  {
    int[] dest = IntCache.getIntCache(areaWidth * areaHeight);
    for (int dz = 0; dz < areaHeight; dz++) {
      for (int dx = 0; dx < areaWidth; dx++)
      {
        initChunkSeed(dx + areaX, dz + areaY);
        dest[(dx + dz * areaWidth)] = getWeightedBiomeEntry(BiomeManager.BiomeType.WARM).biome.biomeID;
      }
    }
    return dest;
  }
  
  protected BiomeManager.BiomeEntry getWeightedBiomeEntry(BiomeManager.BiomeType type)
  {
    List<BiomeManager.BiomeEntry> biomeList = this.biomes[type.ordinal()];
    int totalWeight = WeightedRandom.getTotalWeight(biomeList);
    int weight = BiomeManager.isTypeListModded(type) ? nextInt(totalWeight) : nextInt(totalWeight /10) * 10;
    return (BiomeManager.BiomeEntry)WeightedRandom.getRandomItem(biomeList, weight);
  }

}

BiomeGenBase Japanese

package nookerzaza.mods.asiancraft.country.japanese.world.gen.biome;

import java.util.Random;

import net.minecraft.block.BlockSand;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeDecorator;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.ChunkPrimer;
import nookerzaza.mods.asiancraft.country.japanese.init.JapaneseBlocks;
import nookerzaza.mods.asiancraft.country.japanese.world.gen.BiomeDecoratorJapanese;

public class BiomeJapanese extends BiomeGenBase
{
	public static final BiomeGenBase.Height biomeHeight = new BiomeGenBase.Height(0.1F, 0.2F);
	
	public static BiomeGenBase cherryblossom_forest = new BiomeCherryBlossomForest().setBiomeName("cherryblossom forest").setHeight(height_Default);
	public static BiomeGenBase japanese_forest = new BiomeJapanseForest().setBiomeName("japanese forest").setHeight(height_Default);
	public static BiomeGenBase japanese_gloden_pain = new BiomeJapaneseGlodenPain().setBiomeName("japanese gloden pain").setHeight(height_Default);
	public static BiomeGenBase japanese_deep_ocean = new BiomeJapaneseDeepOcean().setBiomeName("japanese deep ocean").setHeight(height_DeepOceans);
	
	public BiomeJapanese(int id) {
		super(id);
	}
	
	public BiomeDecorator createBiomeDecorator() 
	{
		return new BiomeDecoratorJapanese();
	}

	protected BiomeDecoratorJapanese getBiomeDecorator() 
	{
		return (BiomeDecoratorJapanese) this.theBiomeDecorator;
	}
	
	public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_)
    {
        this.generateBiomeTerrainJapanese(worldIn, rand, chunkPrimerIn, p_180622_4_, p_180622_5_, p_180622_6_);
    }

    public final void generateBiomeTerrainJapanese(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180628_4_, int p_180628_5_, double p_180628_6_)
    {
        int i = worldIn.getSeaLevel();
        IBlockState iblockstate = this.topBlock;
        IBlockState iblockstate1 = this.fillerBlock;
        int j = -1;
        int k = (int)(p_180628_6_ / 3.0D + 3.0D + rand.nextDouble() * 0.25D);
        int l = p_180628_4_ & 15;
        int i1 = p_180628_5_ & 15;
        BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

        for (int j1 = 255; j1 >= 0; --j1)
        {
            if (j1 <= rand.nextInt(5))
            {
                chunkPrimerIn.setBlockState(i1, j1, l, Blocks.bedrock.getDefaultState());
            }
            else
            {
                IBlockState iblockstate2 = chunkPrimerIn.getBlockState(i1, j1, l);

                if (iblockstate2.getBlock().getMaterial() == Material.air)
                {
                    j = -1;
                }
                else if (iblockstate2.getBlock() == JapaneseBlocks.japanese_stone)
                {
                    if (j == -1)
                    {
                        if (k <= 0)
                        {
                            iblockstate = null;
                            iblockstate1 = JapaneseBlocks.japanese_stone.getDefaultState();
                        }
                        else if (j1 >= i - 4 && j1 <= i + 1)
                        {
                            iblockstate = this.topBlock;
                            iblockstate1 = this.fillerBlock;
                        }

                        if (j1 < i && (iblockstate == null || iblockstate.getBlock().getMaterial() == Material.air))
                        {
                            if (this.getFloatTemperature(blockpos$mutableblockpos.set(p_180628_4_, j1, p_180628_5_)) < 0.15F)
                            {
                                iblockstate = Blocks.ice.getDefaultState();
                            }
                            else
                            {
                                iblockstate = Blocks.water.getDefaultState();
                            }
                        }

                        j = k;

                        if (j1 >= i - 1)
                        {
                            chunkPrimerIn.setBlockState(i1, j1, l, iblockstate);
                        }
                        else if (j1 < i - 7 - k)
                        {
                            iblockstate = null;
                            iblockstate1 = JapaneseBlocks.japanese_stone.getDefaultState();
                            chunkPrimerIn.setBlockState(i1, j1, l, Blocks.gravel.getDefaultState());
                        }
                        else
                        {
                            chunkPrimerIn.setBlockState(i1, j1, l, iblockstate1);
                        }
                    }
                    else if (j > 0)
                    {
                        --j;
                        chunkPrimerIn.setBlockState(i1, j1, l, iblockstate1);

                        if (j == 0 && iblockstate1.getBlock() == JapaneseBlocks.JapaneseSand)
                        {
                            j = rand.nextInt(4) + Math.max(0, j1 - 63);
                           // iblockstate1 = iblockstate1.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? Blocks.red_sandstone.getDefaultState() : Blocks.sandstone.getDefaultState();
                        }
                    }
                }
            }
        }
    }

}

Thank you for helping and another question post in this.

Edited by NookerKunG
Link to comment
Share on other sites

Make sure that don't put 0 or smaller integer in GenLayer::nextInt method.

weight/10 could be causing this.

Rendering seems to be related with sky renderer, please post the code.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

By the way, you have a bunch of missing models/variants. You should fix those too.
 

And you have a missing texture:

[12:40:12] [Client thread/WARN]: Failed to load texture: japanese:textures/country/sun.png

java.io.FileNotFoundException: japanese:textures/country/sun.png

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.