Jump to content

Changing blocks near a player.


Recommended Posts

Before this gets locked, last i checked this was a place to get help not forced to update to another version of minecraft. If I had wanted to update to a newer version I would have. But I enjoy using 1.7.10. So if you post anything that does not relate to helping me get some information on how to make this work for 1.7.10 then dont even bother posting.


Basically, I am attempting to, after a minecraft day, start replacing the top blocks around the player. i am wanting it to happen every second, not tick, my mod will be a Nuclear Apocalypse mod. and I am trying to get the world to decay from radiation. this is what i was trying but it keeps suspending.




Code: [select]


  public void onServerTick(WorldTickEvent event){



        if(ticks == 20){

            ticks = 0;

            if(event.world.getWorldTime()/24000 >= 1){

              for(int a = 0; a < event.world.playerEntities.size(); a++){

      EntityPlayer player = (EntityPlayer) event.world.playerEntities.get(a);

              int x = player.serverPosX -32 + rand.nextInt(64);

              int z = player.serverPosZ -32 + rand.nextInt(64);

              int y = event.world.getHeightValue(x, z);

              Block block = event.world.getBlock(x, y, z);

      player.addChatComponentMessage(new ChatComponentText("Block Changed at" + x + ", " + y + ", " + z));

      if(block == Blocks.grass){

                  event.world.setBlock(x, y, z, BlockRegistry.irradiatedDirt);

      }else if(block == Blocks.stone){

                  event.world.setBlock(x,y,z, Blocks.cobblestone);










If I have missed something please let me know, and if there is a way for me to accomplish my task better then what I already have please explain to me how. Thanks in advance.

Link to comment
Share on other sites

This topic is now closed to further replies.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.