Started by
popguy12
on
Topic category: Help with Minecraft modding (Java Edition)
Hey everyone! i have a problem with my plants and seeds. i created an item that is the seeds and then in the events did the when clicked on block (hand loc.) and set the case to be blockAt(i,j,k)== farmland and then place a plant at i, j+1, k but it won't place it. help please? also would the case blockAt(i,j,k)!= farmland work? thyanks in advance!
You will need a block and an item. The block itself would be the plant (Using Cross or X render). The item would simply be the seed used to craft it. Go into the plant after its been made and change the parameters to remove the block if tiled land is not located under it. Then have it constantly set the tiled land to tiled land. This way the land does not go back to being normal dirt. What you want to do next is get your item or seeds, go into its special parameters. Make it so when you click on a block if that block is tiled land; then make sure the block has an air block above it. If not this may cause some problems in the future. After that you will want to have it; Set Block Y + 1 the block version of the plant. Then have it consume 1 of the seeds. - Hope this helps, if this doesnt work I dont know what to tell you, because this is the method that I use.
-Best regards SpidroTech™.
thanks
Just a heads up. If you are attempting to make something with growing stages. This is how you would do it. Go to random tick. Stack Event. Give it a 5% chance probability. Stack Event Check if the block above it is air. Stack Event Make sure the block 2 under it is not Sugar Cane/ What eves. Set block Y + 1. Sugar Cane/What eves.
With this method however you will need a variable thrown in so that it wont automatically break the sugar cane due to the fact that the block below it is not tiled land/sand. Or you could make a stack event that will destroy the block with drop if it is not Sugar Cane or Sand under it.
With Wheat you do the same random prob growing chance. But it sets the same Y to the next block. If you do something like Wheat which would have many stages it can sometimes get confusing and or complicated.
-With regards SpidroTechnology™.
+ What mod is this for?
Yeah, this code doesnt work. Try this one:
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
return super.canPlaceBlockAt(worldIn, pos) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock());
}
protected boolean canPlaceBlockOn(Block ground)
{
return ground == net.minecraft.init.Blocks.dirt;
}
I put dirt because if you place any block in farmland it becomes dirt, so you can add a new block or something, but remember you must change return ground == mcreator.Blocks.block;
I hope it works
@#4 dont really understand the code. do i put it in the custom code?