Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

kaikaii99

Members
  • Joined

  • Last visited

  1. to negate fall damage do this: (based on hydro's code) public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { double calculatedX= 20 * (double) (-MathHelper.sin(player.rotationYaw/ 180.0F * (float) Math.PI)* MathHelper.cos(player.rotationPitch / 180.0F* (float) Math.PI) * 0.4f); double calculatedZ = 20 * (double) (MathHelper.cos(player.rotationYaw / 180.0F * (float) Math.PI)* MathHelper.cos(player.rotationPitch / 180.0F* (float) Math.PI) * 0.4f); double calculatedY = 20 * (double) (-MathHelper.sin((player.rotationPitch)/ 180.0F * (float) Math.PI) * 0.4f); player.fallDamage = 0.0F; player.motionY = calculatedY; //another line of code for another axis //another line of code for the last axis return itemStack; }
  2. Hello Everyone I have a problem, I've been trying to make an item that lets you zoom when certain key is pressed. I have 2 versions Version 1: and Version 2: In version 1 it works almost perfectly, well, i can zoom but with any item in my hand. and in version 2 when i press the key and i have the correct item in my hand, when i release the key, it stays there, the value does not go back. If you help me i will add you to my mod's credits list. Thanks in advance
  3. 1st, it's bulky because i didn't write the most of it, i just edited the itemhoe class, which its obvious. 2nd, Of course its unoptimized, i wrote it as an example, you can just write 1 simple for loop and its done, 3rd maybe he wants to make more 'magic' hoes, its easier if you just extend your class to the MagicHoe class
  4. I think this should work: package kaiKaii99Items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.Event.Result; import net.minecraftforge.event.entity.player.UseHoeEvent; public class SpecialItemHoe extends Item { protected EnumToolMaterial theToolMaterial; public SpecialItemHoe(int par1, EnumToolMaterial par2EnumToolMaterial) { super(par1); this.theToolMaterial = par2EnumToolMaterial; this.maxStackSize = 1; this.setMaxDamage(par2EnumToolMaterial.getMaxUses()); this.setCreativeTab(CreativeTabs.tabTools); } /** * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return * True if something happen and false if it don't. This is for ITEMS, not BLOCKS */ public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) { return false; } else { UseHoeEvent event = new UseHoeEvent(par2EntityPlayer, par1ItemStack, par3World, par4, par5, par6); if (MinecraftForge.EVENT_BUS.post(event)) { return false; } if (event.getResult() == Result.ALLOW) { par1ItemStack.damageItem(1, par2EntityPlayer); return true; } int i1 = par3World.getBlockId(par4, par5, par6); int i2 = par3World.getBlockId(par4+1, par5, par6); int i3 = par3World.getBlockId(par4, par5, par6+1); int i4 = par3World.getBlockId(par4+1, par5, par6+1); int i5 = par3World.getBlockId(par4-1, par5, par6); int i6 = par3World.getBlockId(par4, par5, par6-1); int i7 = par3World.getBlockId(par4-1, par5, par6-1); int i8 = par3World.getBlockId(par4-1, par5, par6+1); int i9 = par3World.getBlockId(par4+1, par5, par6-1); int j1 = par3World.getBlockId(par4, par5 + 1, par6); if ((par7 == 0 || j1 != 0 || i1 != Block.grass.blockID) && i1 != Block.dirt.blockID && i2 != Block.dirt.blockID && i3 != Block.dirt.blockID && i4 != Block.dirt.blockID && i5 != Block.dirt.blockID && i6 != Block.dirt.blockID && i7 != Block.dirt.blockID && i8 != Block.dirt.blockID && i9 != Block.dirt.blockID) { return false; } else { Block block = Block.tilledField; par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), block.stepSound.getStepSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F); if (par3World.isRemote) { return true; } else { par3World.setBlock(par4+1, par5, par6, block.blockID); par3World.setBlock(par4, par5, par6+1, block.blockID); par3World.setBlock(par4+1, par5, par6+1, block.blockID); par3World.setBlock(par4-1, par5, par6, block.blockID); par3World.setBlock(par4, par5, par6-1, block.blockID); par3World.setBlock(par4-1, par5, par6-1, block.blockID); par3World.setBlock(par4-1, par5, par6+1, block.blockID); par3World.setBlock(par4+1, par5, par6-1, block.blockID); par3World.setBlock(par4, par5, par6, block.blockID); par1ItemStack.damageItem(1, par2EntityPlayer); return true; } } } } @SideOnly(Side.CLIENT) /** * Returns True is the item is renderer in full 3D when hold. */ public boolean isFull3D() { return true; } /** * Returns the name of the material this tool is made from as it is declared in EnumToolMaterial (meaning diamond * would return "EMERALD") */ public String getMaterialName() { return this.theToolMaterial.toString(); } } just make an item that extens SpecialItemHoe and done
  5. 1 second i think i got it working its easy
  6. Sorry for my noob question, how do i get the blocks in a 3x3 in a wall? , i mean, i know how to do it on the floor but i had the same problem as Maexx

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.