Posted July 14, 201510 yr I am trying to understand why this event is not working. Event @SubscribeEvent public void onWorldTick(TickEvent.WorldTickEvent event){ if(event.side.isServer()){ tick++; if(tick == 1000){ event.world.setBlockState(new BlockPos(0,4,0), blocks.stone.getDefaultState(); } if(tick >= maxTick){ tick = 0; } } The code looks silly and without purpose, but this is a small example of what my code looks like. When it gets to event.world.setBlockState... It returns false, and doesn't place the block. I also get the message when it comes time to place the block, [18:01:19] [server thread/INFO] [FML]: Unloading dimension 1
July 14, 201510 yr It's trying to replace the block at 0, 4, 0 - if that's not loaded, it won't work. Also, what do I know, but I'd use !event.work.isRemote() instead of event.side.isServer(). I'll put something here when I have something of value I need to put at the end of every post. For now it's this mostly pointless text.
July 14, 201510 yr Author It's trying to replace the block at 0, 4, 0 - if that's not loaded, it won't work. Also, what do I know, but I'd use !event.work.isRemote() instead of event.side.isServer(). I'm standing 2 blocks away from the location. Would you know if there'd be a way to force load it? Thanks:)
July 14, 201510 yr If it's loaded I have no idea. Sorry! EDIT: Wait - shouldn't the Blocks in Blocks.stone.getDefaultState() be capatalized? I'll put something here when I have something of value I need to put at the end of every post. For now it's this mostly pointless text.
July 14, 201510 yr Author After further debugging, I found this bit of code. if (iblockstate1 == null) { if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot); return false; } iblockstate1 is null. blockSnapshot is not null.\ it returns false. The code that defines iblockstate1 IBlockState iblockstate1 = chunk.setBlockState(pos, newState); as for capitalizing blocks. Yes. Just a typo on this end. I didn't copy and paste.
July 14, 201510 yr Author Alright, after further debugging... The client side seems to not update, so what I am seeing is not what the server is seeing. The server apparently already placed the block. It returns false if the block it is going to place down is the same block that is already there... or rather, null. I suppose I'm stuck at trying to figure out why the client side is not updating.
July 14, 201510 yr Author ..... ugh... It's spawning the block in the nether. Anyone know the cause of this?
July 15, 201510 yr Author Well, I changed a little bit of code, but nothing much. Improved the way information is stored, and now it works. Still am unsure as to why the blocks were respawning in the nether and I wish I knew why. Thanks for the help
July 15, 201510 yr Author If it's loaded I have no idea. Sorry! Turns out that it will force a chunk to load if it's going to place a block down:)
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.