Posted May 18, 201411 yr Hi, I'm trying to make boots that when worn as you are walking, it changes water to ice if you walk on the water. Can someone help me with this?
May 18, 201411 yr I recommend checking out onArmorTickUpdate in the Item.class. You can use it on your boots so that when they are equipped, you can check where the player is and see what block they might be standing on. http://www.slothygaming.com/img/ota.png[/img] If your grammar is shit and you blatantly don't know what you're doing, I will not help you.
May 19, 201411 yr Author 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); } } }
May 19, 201411 yr Well, with the y, I recommend just doing y = ((int)player.posY)-1 http://www.slothygaming.com/img/ota.png[/img] If your grammar is shit and you blatantly don't know what you're doing, I will not help you.
May 19, 201411 yr Author That worked about the same. I should probably specify. It will replace the water block to the east but not to any other direction.
May 19, 201411 yr 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.
May 19, 201411 yr Author That changed the water to ice all around me but only while I'm at least half way in the water.
May 20, 201411 yr @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.
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.