Hey guys, at the moment I'm making an item that will detect grass and dirt nearby, and when right clicked will change dirt and grass to farmland, and add crops ontop. I've looked for some assistance on this, and have found something like this, but it does not work at world.getBlock does not exist.
Any help would be appreciated. I also need some assistance with world.setBlockWithNotify, world.getBlockMetadata, and world.setBlockMetaDataWithNotify, as NONE of these seem to work anymore.
Have you looked through the World class? The methods probably still exist, they might just have been renamed or not deobfuscated yet (so they may be named something like func_70000_a).
Metadata has been replaced with BlockStates, so the metadata methods may not exist any more.
I don't have Forge for 1.8 set up yet, so I can't help much more than this.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
I've taken a look around and found nothing. On a side note, why would it not be obfuscated yet?
On another note, I notice I'm using 3 integer values, while most simply require a Blockpos....
Okay. SO I've the .getBlock to work with master801's solution. I've tried a similar solution for world.setBlockWithNotify, world.getBlockMetaData, and World.setBlockMetadataWithNotify
I hate to actually ask for code, and I am asking for a lot. I am just having a lot of trouble.
I've tried changing world.getBlockMetadata with world.getBlockState, and changed it to blockpos2 (my defined thingy), then had to change int to something else. I tried Block, but then the (l < 7) is no longer valid. I'm a bit stuck. The l < 7 refers to the metadata of wheat.
Okay, so I've now resolved all the errors, but it does not seem to work. I don't know where I've gone wrong, but I am really really stuck now. I don't know where the issue comes in.
Here's the whole code on right click.
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
SoundHandler.onEntityPlay("earthgem", world, entityplayer, 1.0F, 1.0F);
itemstack.damageItem(1, entityplayer);
for (int c = -2; c < 4; c++) {
for (int a = -3; a < 3; a++) {
for (int b = -3; b < 3; b++)
{
BlockPos blockpos1 = new BlockPos((int)(entityplayer.posX + a), (int)(entityplayer.posY - 2.0D + c), (int)(entityplayer.posZ + b));
BlockPos blockpos2 = new BlockPos((int)(entityplayer.posX + a), (int)(entityplayer.posY - 1.0D + c), (int)(entityplayer.posZ + b));
Block crop = world.getBlockState(blockpos1).getBlock();
Block cropAbove = world.getBlockState(blockpos1).getBlock();
if (((crop == Blocks.dirt) || (crop == Blocks.grass)) && (random.nextInt(5) == 0) && (cropAbove == Blocks.air))
{
for (int x = 0; x < 15; x++)
world.setBlockState(blockpos1, Blocks.farmland.getDefaultState());
world.setBlockState(blockpos2, Blocks.wheat.getDefaultState());
}
int l = world.getBlockState(blockpos2).getBlock().getMetaFromState(world.getBlockState(blockpos2));
if ((l < 7) && ((crop == Blocks.wheat) || (crop == Blocks.farmland))) {
world.setBlockState(blockpos2, world.getBlockState(blockpos2), l + 1);
}
}
}
}
return itemstack;
}
Bad link, do you have another? Having the same issue with a different desired effect, having to do with particles.
Looked through the forge git but didn't see the methods list anywhere.
Need to get a blockstate, but that doesn't exist properly anymore.
Grammar and punctuation are the difference between; "I helped my uncle, Jack, off his horse." & i helped my uncle jack off his horse. We're on the internet, no intonation or body language, so why would your language skills be less important?
Bad link, do you have another? Having the same issue with a different desired effect, having to do with particles.
Looked through the forge git but didn't see the methods list anywhere.
Need to get a blockstate, but that doesn't exist properly anymore.
Thanks very much, went sniffing through the forge source in eclipse and noticed you can get meta from a state which it's its own var now.
Very nicely made honestly, just a pain sifting through the new stuff. I like the Vector3s they put in too, it's how I'm used to coding lol.
Rollback Post to RevisionRollBack
Grammar and punctuation are the difference between; "I helped my uncle, Jack, off his horse." & i helped my uncle jack off his horse. We're on the internet, no intonation or body language, so why would your language skills be less important?
Any help would be appreciated. I also need some assistance with world.setBlockWithNotify, world.getBlockMetadata, and world.setBlockMetaDataWithNotify, as NONE of these seem to work anymore.
Metadata has been replaced with BlockStates, so the metadata methods may not exist any more.
I don't have Forge for 1.8 set up yet, so I can't help much more than this.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
On another note, I notice I'm using 3 integer values, while most simply require a Blockpos....
So like,
It does not recognize worldObj ? Sorry if I'm making silly mistakes or something
I hate to actually ask for code, and I am asking for a lot. I am just having a lot of trouble.
only the last 2
world.getBlockMetaData, and world.setBlockMetadataWithNotify
I've tried changing world.getBlockMetadata with world.getBlockState, and changed it to blockpos2 (my defined thingy), then had to change int to something else. I tried Block, but then the (l < 7) is no longer valid. I'm a bit stuck. The l < 7 refers to the metadata of wheat.
Here's the whole code on right click.
I'm still ignoring all questions about modding with 1.8 until it is more stable. I think that is what the majority of modders are doing.
[url=2482915-wip-arkcraft-survival-evolved-dinos-taming]
Both for blockpos1
-_____-
Now I need to find out why it won't grow wheat further.
activate javascript
Looked through the forge git but didn't see the methods list anywhere.
Need to get a blockstate, but that doesn't exist properly anymore.
Grammar and punctuation are the difference between; "I helped my uncle, Jack, off his horse." & i helped my uncle jack off his horse. We're on the internet, no intonation or body language, so why would your language skills be less important?
new links
methods
https://github.com/MinecraftForge/MCPData/blob/master/data/methods.csv
fields
https://github.com/MinecraftForge/MCPData/blob/master/data/fields.csv
Very nicely made honestly, just a pain sifting through the new stuff. I like the Vector3s they put in too, it's how I'm used to coding lol.
Grammar and punctuation are the difference between; "I helped my uncle, Jack, off his horse." & i helped my uncle jack off his horse. We're on the internet, no intonation or body language, so why would your language skills be less important?