Jump to content

[1.7.10] Replacing a block around the player(s) after a set time


Recommended Posts

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.




   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.