Jump to content

[1.8] ]SOLVED]decorator crash on WorldGenWaterLily


Glistre

Recommended Posts

java.lang.IllegalArgumentException: Cannot get property PropertyInteger{name=level, clazz=class java.lang.Integer, values=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]} as it does not exist in BlockState{block=glistremod:block_seaweed, properties=[age]}

at net.minecraft.block.state.BlockState$StateImplementation.getValue(BlockState.java:174) ~[blockState$StateImplementation.class:?]

at net.minecraft.block.Block.canSustainPlant(Block.java:1935) ~[block.class:?]

at net.minecraft.block.BlockBush.canPlaceBlockAt(BlockBush.java:35) ~[blockBush.class:?]

at net.minecraft.world.gen.feature.WorldGenWaterlily.generate(WorldGenWaterlily.java:20) ~[WorldGenWaterlily.class:?]

 

package com.glistre.glistremod.biome;

import java.util.Random;

import com.glistre.glistremod.entities.blacktobie.EntityBlackTobo;
import com.glistre.glistremod.entities.guardian.EntityTobieSkel;
import com.glistre.glistremod.entities.wolf.EntityGlistreWolf;
import com.glistre.glistremod.init.BlockRegistry;
import com.google.common.base.Predicate;

import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFlower;
import net.minecraft.block.BlockFlower.EnumFlowerType;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.state.pattern.BlockHelper;
//import net.minecraft.block.material.Material;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.entity.passive.EntityOcelot;
import net.minecraft.entity.passive.EntityPig;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.BiomeGenForest;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenBigTree;
import net.minecraft.world.gen.feature.WorldGenClay;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraft.world.gen.feature.WorldGenTaiga2;
import net.minecraft.world.gen.feature.WorldGenTallGrass;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.event.world.BlockEvent;

public class GlistreBiome extends BiomeGenBase
{
BiomeDecoratorGlistre customBiomeDecorator;
    private WorldGenerator theWorldGenerator;
    public GlistreBiome(int id)
    {
        super(id);
        this.theWorldGenerator = new WorldGenMinable((IBlockState) BlockRegistry.silver_ore_1.getDefaultState(), 20);
        this.theWorldGenerator = new WorldGenMinable((IBlockState) BlockRegistry.silver_block_1.getDefaultState(), ;
        this.setBiomeName("Glistering Biome");
      //this is the top layer, so the first thing you see will be this block
        //next are the 3-5 layers bellow your top layer

        this.topBlock = (IBlockState) Blocks.grass.getDefaultState();
	this.fillerBlock = (IBlockState) Blocks.dirt.getDefaultState();

	this.theBiomeDecorator = new BiomeDecoratorGlistre();
	customBiomeDecorator = new BiomeDecoratorGlistre();
	customBiomeDecorator =(BiomeDecoratorGlistre)theBiomeDecorator;
	this.theBiomeDecorator = this.createBiomeDecorator();
	this.customBiomeDecorator.seaweedPerChunk = 200;
	this.customBiomeDecorator.seaweedGen = new WorldGenSeaweed(3);
	this.theBiomeDecorator.clayPerChunk = 2;      
        this.theBiomeDecorator.treesPerChunk = 2;
   [b]   this.theBiomeDecorator.waterlilyPerChunk = 150; // what's wrong now? [/b]  
        this.theBiomeDecorator.bigMushroomsPerChunk = 1;
        this.theBiomeDecorator.flowersPerChunk = 100;
        this.theBiomeDecorator.reedsPerChunk = 10;
        this.theBiomeDecorator.grassPerChunk = 10;


        this.spawnableWaterCreatureList.clear();
        this.spawnableMonsterList.clear(); 
        this.spawnableCreatureList.add(new SpawnListEntry(EntityOcelot.class, 10, 1, 1));      
        this.spawnableCreatureList.add(new SpawnListEntry(EntityHorse.class, 20, 5, 7));
        this.spawnableCreatureList.add(new SpawnListEntry(EntityPig.class, 1, 2, 7));     
        this.spawnableMonsterList.add(new SpawnListEntry(EntitySkeleton.class, 1, 1, 1));
        this.spawnableMonsterList.add(new SpawnListEntry(EntityZombie.class, 1, 1, 1));
        this.spawnableCreatureList.add(new SpawnListEntry(EntityGlistreWolf.class, 20, 3, 5));
        this.spawnableCreatureList.add(new SpawnListEntry(EntityTobieSkel.class, 30, 3, 7));
        this.spawnableCreatureList.add(new SpawnListEntry(EntityBlackTobo.class, 10, 1, 2));
        
        this.addFlower(Blocks.yellow_flower.getDefaultState().withProperty(Blocks.yellow_flower.getTypeProperty(), BlockFlower.EnumFlowerType.DANDELION), 30);

        this.addFlower(Blocks.red_flower.getDefaultState().withProperty(Blocks.red_flower.getTypeProperty(), BlockFlower.EnumFlowerType.POPPY), 30);

//        this.addFlower(Blocks.pumpkin, 7, 20);       
//  1.8 pumpkins??     this.addFlower(Blocks.pumpkin.getDefaultState().withProperty(((BlockFlower) Blocks.pumpkin).getTypeProperty(), BlockFlower.EnumFlowerType.DANDELION), 30);

        
//       this.setColor(0x7F007F);
//        this.setColor(0x443333);
        this.canSpawnLightningBolt();
        this.setColor(0x003000);
        this.setEnableSnow();
     
        this.enableSnow = true;
        this.enableRain = true;
        this.isHighHumidity();
        this.setMinMaxHeight(0.75F, 1.1F);
        //first parameter is temp .2F and rain looks like snow, second parameter is rainfall 0F none .5F is normal
        this.setTemperatureRainfall(0.75F, 1.0F);
        
       
    }
@Override
    public void addFlower(IBlockState state, int weight)
{
this.flowers.add(new FlowerEntry(state, weight));
}

    public boolean darkenSkyDuringRain() 
    {        
    	return true;     
    }
    
    public boolean canSpawnLightningBolt() 
    { 
        return this.enableSnow ? true : this.enableRain; 
    } 


private void setMinMaxHeight(float f, float g) 
{

}



    public int getSkyColorByTemp(float par1)
    {
//    	return 0x443333; //grey sky
    	//gold/grey sky
    	return 0xA0A016;
    }

    /**
     * Gets a WorldGen appropriate for this biome.
    */ 
    
    public WorldGenerator getRandomWorldGenForGrass(Random random){
       return random.nextInt(2) == 0 ?  new WorldGenSeaweed(3) : new WorldGenSeaweed(10);
        
   }

    public WorldGenerator getRandomWorldGenForTrees(Random par1Random){
    	return(WorldGenerator)(par1Random.nextInt(1) == 0 ? this.worldGeneratorBigTree : (par1Random.nextInt(6) == 0 ? this.worldGeneratorSwamp : par1Random.nextInt(20) == 0 ? this.worldGeneratorTrees : this.worldGeneratorTrees));
    }
   
    //replaces the block with SilverBlock copied from BlockEmeraldClass
    public void decorate(World worldIn, Random random, BlockPos blockPos)
    {
        super.decorate(worldIn, random, blockPos);
        
        //next two bizarre lines of code is update to 1.8
        for (int chunkX = 0; chunkX < 4; ++chunkX) {
		for (int chunkZ = 0; chunkZ < 4; ++chunkZ) {
        int k = 3 + random.nextInt(6);
        int l;
        
        int i1;
        int j1;
        for (l = 0; l < k; ++l)
        {
            i1 = chunkX + random.nextInt(16);
            j1 = random.nextInt(28) + 4;
            int k1 = chunkZ + random.nextInt(16);


            if (worldIn.getBlockState(blockPos).getBlock().isReplaceableOreGen(worldIn, blockPos, (BlockHelper.forBlock(BlockRegistry.silver_ore_1))))
{

                worldIn.setBlockState(blockPos, (IBlockState) BlockRegistry.silver_block_1.getDefaultState(), 2);

}
        }

        for (k = 0; k < 7; ++k)
        {
            l = chunkX + random.nextInt(16);
            i1 = random.nextInt(64);
            j1 = chunkZ + random.nextInt(16);
            this.theWorldGenerator.generate(worldIn, random, blockPos);
        }
    }

        }  
    }
}

 

Seems to be crashing because of  WorldGenWaterLily

     

   

 

Link to comment
Share on other sites

If your block uses

Material.WATER

,

Block#canSustainPlant

and a lot of other methods expect it to have the

BlockLiquid.LEVEL

property. Your seaweed doesn't.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

If your block uses

Material.WATER

,

Block#canSustainPlant

and a lot of other methods expect it to have the

BlockLiquid.LEVEL

property. Your seaweed doesn't.

 

I believe that has solved it, and removed #getRenderType 1

 

    public static final PropertyInteger LEVEL = PropertyInteger.create("level", 0, 15);

 

Not sure why I am using 16 of these  ... is that required?  Well,  I can fix that later lol

 

 

Link to comment
Share on other sites

If your block uses

Material.WATER

,

Block#canSustainPlant

and a lot of other methods expect it to have the

BlockLiquid.LEVEL

property. Your seaweed doesn't.

 

I believe that has solved it, and removed #getRenderType 1

 

    public static final PropertyInteger LEVEL = PropertyInteger.create("level", 0, 15);

 

Not sure why I am using 16 of these  ... is that required?  Well,  I can fix that later lol

Make sure you're using the

BlockLiquid.LEVEL

property rather than creating your own. Creating your own will work if it has the same name and allowed values as

BlockLiquid.LEVEL

, but it's best to use the existing one.

 

You don't actually need to store the value of the property in the metadata (you can completely ignore it in

Block#getStateFromMeta

and

Block#getMetaFromState

), it just needs to be included in your block's state so outside code can query it and get 0 as the value.

 

On to my next error I have: 

"Caused by: java.lang.IllegalArgumentException: Duplicate id value for 18!

[23:20:07] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.entity.DataWatcher.addObject(DataWatcher.java:58)

[23:20:07] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.glistre.glistremod.entities.wolf.EntityBlackWolf.entityInit(EntityBlackWolf.java:149)

[23:20:07] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]:

 

My EntityBlackWolf and EntityGlistreWolf apparently have the same no idea how or why I have modEntity++ as the id any thoughts on that one ?  I am getting tired and lazy now Choonster lol

This is completely unrelated, create a new topic for it.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.