Hi all,
I'm fairly new to minecraft modding, but I have been struggling with the following issue for a while and couldn't find an answer. I would like to use my mod to create some structures. I have two possible ways of doing this, and as an example I apply both in the following code snippet (which is executed when a key is pressed)
EntityPlayerSP player = Minecraft.getMinecraft().player;
int x = 16 * player.chunkCoordX + 5;
int y = 16 * player.chunkCoordY + 10;
int z = 16 * player.chunkCoordZ + 5;
player.world.setBlockState(new BlockPos(x,y,z), Blocks.STONE.getDefaultState() );
player.sendChatMessage( "/setblock "+ (x) + " " + (y+15) + " " + z + " stone");
When I run minecraft with this mod, open a world, press the relevant key, indeed two blocks appear. Next, I 'save and quite to title' and after that I load the world again. Then only one block (the one created by sendChatMessage) is left. In other words, the blocks created by "player.world.setBlockState" are not saved. I have a preference for using the setBlockState method, but it I would like to know how to save the blocks in that case. Does anybody know what is going on?