clowcadia Posted March 19, 2017 Posted March 19, 2017 is there any easier way to do this private Block getBlock(int x, int y, int z){ BlockPos pos = new BlockPos(x, y, z); IBlockState ibs = test.world.getBlockState(pos); Block block = ibs.getBlock(); return block; } Quote
Draco18s Posted March 19, 2017 Posted March 19, 2017 No. Also stop using xyz and use BlockPos natively. Also don't use Block objects except when absolutely necessary. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
clowcadia Posted March 19, 2017 Author Posted March 19, 2017 how can store blockPos in nbt then Quote
TheMasterGabriel Posted March 19, 2017 Posted March 19, 2017 (edited) On 3/19/2017 at 5:08 AM, clowcadia said: how can store blockPos in nbt then Expand You can serialize a BlockPos instance via BlockPos#toLong(). Save that returned long value to an NBT tag via setLong. To deserialize it, simply use BlockPos.fromLong. Edited March 19, 2017 by TheMasterGabriel 1 Quote
WuestMan Posted March 19, 2017 Posted March 19, 2017 There is a built-in utility for storing BlockPos as NBT data. To create an NBTTag from BlockPos: net.minecraft.nbt.NBTUtil#createPosTag To read BlockPos data from NBTTag: net.minecraft.nbt.NBTUtil#getPosFromTag 1 Quote
Recommended Posts
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.