Jump to content

Changing Water to Ice


Mysticwolf6

Recommended Posts

I've been using the onArmorTick method, however I'm having trouble finding out how to find and replace the right block.  So far I've got this.

 

 

@Override

public void onArmorTick(World world, EntityPlayer player, ItemStack armor) {

int x = (int) player.posX;

int y = (int) (player.posY - 0.5D);

int z = (int) player.posZ;

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

        if(armor.getItem() == ElementalArmor.iceBoots){

if(block == Blocks.water){

world.setBlock(x, y, z, Blocks.ice);

}

        }

}

 

 

Link to comment
Share on other sites

Maybe you can search several blocks around the player and changes the water block(s) to the ice.

 

like:

for(int i = -1; i <= 1; i++)

for(int j = -1; j <= 1; j++)

for(int k = -2; k <= -1; k++){

if(world.getBlock(posX-i, posY-k, posZ-j) is waterblock)

change the block to ice block.

}

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

@Override

public void onArmorTick(World world, EntityPlayer player, ItemStack armor) {
   int x = (int) player.posX;
   int y = (int) (player.posY - 0.5D);
   int z = (int) player.posZ;

   if(armor.getItem() != ElementalArmor.iceBoots) return;

   for(int i = -1; i <= 1; i++)
     for(int j = -1; j <= 1; j++)
       for(int k = -2; k <= -1; k++){
           if(world.getBlock(x-i, y-k, z-j) == Blocks.water)
                world.setBlock(x-i, y-k, z-j, Blocks.ice);
      }
        
}

 

Did you try this?

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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