Posted March 11, 201510 yr What i do wrong? package com.BetterArmourAndTools.blocksitems; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.event.entity.player.PlayerEvent; public class FlyRing extends Item{ public FlyRing(int id){ super(); this.setCreativeTab(BetterArmourAndTools.rubyTab); this.setMaxStackSize(1); } @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister reg){ this.itemIcon = reg.registerIcon("BetterArmourAndTools:FlyRing"); } public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { super.onUpdate(par1ItemStack, par2World, par3Entity, par4, par5); EntityPlayer player = (EntityPlayer) par3Entity; ItemStack flyingRingItemStack = new ItemStack(BetterArmourAndTools.FlyRing, 1, 0); for(i = 0; i <= 8; i++) { if(player.inventory.mainInventory[i] != null && player.inventory.mainInventory[i].isItemEqual(flyingRingItemStack)) { player.capabilities.allowFlying = true; }else{ player.capabilites.allowFlying = false; } if(i == { i = 0; } } } } NEWB! in java im sorry
March 11, 201510 yr Author the under ItemStack flyRIngItemStack is red and a fail whats wrong? NEWB! in java im sorry
March 11, 201510 yr Right click -> Source -> Correct Indentation (its magic). Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
March 11, 201510 yr Author Right click -> Source -> Correct Indentation (its magic). this really dont help http://gyazo.com/24c8b987a40c4e592f2b7ca0c9bbdd88 NEWB! in java im sorry
March 11, 201510 yr What up with that && ? Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
March 11, 201510 yr Author idk i found a annother code here on the forum and its from 1.6.4 just copy it and try making it work for i trying to Check if he have FLyRing in inventory he be allowed to have CreativeFly How i check for BetterArmourAndTools.FlyRing = true then player.capabilities.allowFlying how NEWB! in java im sorry
March 11, 201510 yr You can check if the player has an Item in it's inventory with this: player.inventory.hasItem(Item) . You can allow creative flying by setting player.capabilities.allowFlying to true . Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
March 11, 201510 yr Author package com.BetterArmourAndTools.blocksitems; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.event.entity.player.PlayerEvent; public class FlyRing extends Item{ public FlyRing(int id){ super(); this.setCreativeTab(BetterArmourAndTools.rubyTab); this.setMaxStackSize(1); if(player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().ItemID == BetterArmourAndTools.FlyRing) { System.out.println("CALL"); player.capabilities.allowFlying = true; } @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister reg){ this.itemIcon = reg.registerIcon("BetterArmourAndTools:FlyRing"); } } dont think this is the best thing to doo NEWB! in java im sorry
March 11, 201510 yr Author Again. Please, for the love of god use proper indentation. It makes the error obvious. I did it for you this time. I know but this dont work http://gyazo.com/49f32b5a20327815d126115cb69b4f3d player.inventory and player.capabilities i try to use the easy fix but nothing pop up NEWB! in java im sorry
March 11, 201510 yr Author Learn Java. Yeah Yeah its not the first time you say it . i have readed alot of java things but i really dont understand it better so im sorry about thet *Sad face PANDA!* :'( NEWB! in java im sorry
March 11, 201510 yr What he means is you need to learn simple coding in general. For example, when reading the pastebin Diesieben made, I noticed that your public method didn't have a closing brace (}) you opened two braces and only close one. You need to learn how to use simple code like diesie said before tackling things like this. If I were you, I would try a simpler language or learn how IF, AND and NOT functions work and watch a tutorial about how to use them. Learn the language and the general rules about them. 9 times out of 10, indentation WILL help identify a problem. To identify a problem, follow the code; it's a piece of text that should do what you want when you read it in your head and indentation will help you read it. Copying and Pasting is also not learning how to code. It's cheating and you'll learn nothing that way. Try to achieve somethings on your own. For example, create a java app that calls a method that checks if a boolean is true or false and then outputs something to the console, WITHOUT googling for help and copying. Training yourself with exercises like this is what will help you learn how to code.
March 12, 201510 yr Author What he means is you need to learn simple coding in general. For example, when reading the pastebin Diesieben made, I noticed that your public method didn't have a closing brace (}) you opened two braces and only close one. You need to learn how to use simple code like diesie said before tackling things like this. If I were you, I would try a simpler language or learn how IF, AND and NOT functions work and watch a tutorial about how to use them. Learn the language and the general rules about them. 9 times out of 10, indentation WILL help identify a problem. To identify a problem, follow the code; it's a piece of text that should do what you want when you read it in your head and indentation will help you read it. Copying and Pasting is also not learning how to code. It's cheating and you'll learn nothing that way. Try to achieve somethings on your own. For example, create a java app that calls a method that checks if a boolean is true or false and then outputs something to the console, WITHOUT googling for help and copying. Training yourself with exercises like this is what will help you learn how to code. It's not about reading. Stop modding for a while. Follow a Java tutorial and make your own app. Even if it's just a simple calculator. It is important that you create this app without any help, that is not by just copying the steps from a tutorial. Then start modding again. Yes, it will take time, but that's just the way it is. Learning programming takes time. I know i know i gonna stop modding :'( NEWB! in java im sorry
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.