MC Modding
Please register and join the community!

[Answered] tree

MC Modding :: Help :: Help

View previous topic View next topic Go down

[Answered] tree

Post by AthosZBrogi on Mon Oct 31, 2011 6:37 am

how do you make a tree only spawn on a certain block, like grass or dirt, or only be able to place that tree block on certain blocks like a cuctus(cactus can only spawn and be placed on sand)


Last edited by AthosZBrogi on Tue Nov 01, 2011 12:46 am; edited 1 time in total

AthosZBrogi
Member

Posts : 12
Join date : 2011-10-24
Age : 20

View user profile

Back to top Go down

Re: [Answered] tree

Post by ikke009 on Mon Oct 31, 2011 10:46 am

try this, i have no idea if it works tho i got it from the BlockCactus.java
Code:

public boolean canBlockStay(World world, int i, int j, int k)
{
    if(world.getBlockMaterial(i - 1, j, k).isSolid())
    {
        int l = world.getBlockId(i, j - 1, k);
        return l == Block.grass.blockID || l == Block.dirt.blockID;
    }
    return true;
}
avatar
ikke009
Member

Posts : 65
Join date : 2011-10-24
Age : 22
Location : The netherlands

View user profile

Back to top Go down

Re: [Answered] tree

Post by lcass on Mon Oct 31, 2011 6:10 pm

well you could use the code in trees already

lcass
Member

Posts : 145
Join date : 2011-10-24
Location : england

View user profile http://www.youtube.com/user/thealcasgroup

Back to top Go down

Re: [Answered] tree

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


MC Modding :: Help :: Help

 
Permissions in this forum:
You cannot reply to topics in this forum