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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I am not using hardcoded recipes, I'm using Vanilla's already existing code for leather armor dying. (via extending and implementing DyeableArmorItem / DyeableLeatherItem respectively) I have actually figured out that it's something to do with registering item colors to the ItemColors instance, but I'm trying to figure out where exactly in my mod's code I would be placing a call to the required event handler. Unfortunately the tutorial is criminally undescriptive. The most I've found is that it has to be done during client initialization. I'm currently trying to do the necessary setup via hijacking the item registry since trying to modify the item classes directly (via using SubscribeEvent in the item's constructor didn't work. Class so far: // mrrp mrow - mcmod item painter v1.0 - catzrule ch package catzadvitems.init; import net.minecraft.client.color.item.ItemColors; import net.minecraft.world.item.Item; import net.minecraftforge.registries.ObjectHolder; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.client.event.ColorHandlerEvent; import catzadvitems.item.DyeableWoolArmorItem; @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public class Painter { @ObjectHolder("cai:dyeable_wool_chestplate") public static final Item W_CHEST = null; @ObjectHolder("cai:dyeable_wool_leggings") public static final Item W_LEGS = null; @ObjectHolder("cai:dyeable_wool_boots") public static final Item W_SOCKS = null; public Painter() { // left blank, idk if forge throws a fit if constructors are missing, not taking the chance of it happening. } @SubscribeEvent public static void init(FMLClientSetupEvent event) { new Painter(); } @Mod.EventBusSubscriber private static class ForgeBusEvents { @SubscribeEvent public static void registerItemColors(ColorHandlerEvent.Item event) { ItemColors col = event.getItemColors(); col.register(DyeableUnderArmorItem::getItemDyedColor, W_CHEST, W_LEGS, W_SOCKS); //placeholder for other dye-able items here later.. } } } (for those wondering, i couldn't think of a creative wool helmet name)
    • nvm found out it was because i had create h and not f
    • Maybe there's something happening in the 'leather armor + dye' recipe itself that would be updating the held item texture?
    • @SubscribeEvent public static void onRenderPlayer(RenderPlayerEvent.Pre e) { e.setCanceled(true); model.renderToBuffer(e.getPoseStack(), pBuffer, e.getPackedLight(), 0f, 0f, 0f, 0f, 0f); //ToaPlayerRenderer.render(); } Since getting the render method from a separate class is proving to be bit of a brick wall for me (but seems to be the solution in older versions of minecraft/forge) I've decided to try and pursue using the renderToBuffer method directly from the model itself. I've tried this route before but can't figure out what variables to feed it for the vertexConsumer and still can't seem to figure it out; if this is even a path to pursue.  The vanilla model files do not include any form of render methods, and seem to be fully constructed from their layer definitions? Their renderer files seem to take their layers which are used by the render method in the vanilla MobRenderer class. But for modded entities we @Override this function and don't have to feed the method variables because of that? I assume that the render method in the extended renderer takes the layer definitions from the renderer classes which take those from the model files. Or maybe instead of trying to use a render method I should be calling the super from the renderer like   new ToaPlayerRenderer(context, false); Except I'm not sure what I would provide for context? There's a context method in the vanilla EntityRendererProvider class which doesn't look especially helpful. I've been trying something like <e.getEntity(), model<e.getEntity()>> since that generally seems to be what is provided to the renderers for context, but I don't know if it's THE context I'm looking for? Especially since the method being called doesn't want to take this or variations of this.   In short; I feel like I'm super super close but I have to be missing something obvious? Maybe this insane inane ramble post will provide some insight into this puzzle?
  • Topics

×
×
  • Create New...

Important Information

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