Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited

Everything posted by DiabolusNeil

  1. Okay. I've tried everything, and I cannot figure out what I'm doing wrong. This seems like the only help there is on this subject: http://pastebin.com/SnPaAvUd, and it doesn't work. Instead of the item being damaged, it gets used up. This is my code that I'm working with: // My item class. public class ItemKnifeBase extends Item { public ItemKnifeBase(ToolMaterial material) { this.setCreativeTab(ToolForgeryMod.tabToolForgery); this.setUnlocalizedName(ToolForgeryMod.MOD_ID + ":knife_" + material.toString().toLowerCase()); this.setTextureName(ToolForgeryMod.RESOURCES_PREFIX + "knife_" + material.toString().toLowerCase()); this.setMaxDamage(material.getMaxUses()); } @Override public ItemStack getContainerItem(ItemStack itemStack) { ItemStack result = itemStack.copy(); result.setItemDamage(result.getItemDamage() + 1); result.stackSize = 1; return result; } @Override public boolean doesContainerItemLeaveCraftingGrid(ItemStack p_77630_1_) { return false; } } // Registering the crafting recipe in the preInit() method. GameRegistry.addShapelessRecipe(new ItemStack(Blocks.planks, 4, 0), new ItemStack(Blocks.log, 1, 0), new ItemStack(TFItems.knife_stone, 1, OreDictionary.WILDCARD_VALUE)); To clarify, the recipe shows up, and I can use it, but instead of damaging the knife, the knife gets used up. And I'm registering the item before the recipe. SOLUTION: You need to add @Override public boolean hasContainerItem() { return true; } to the item's class.
  2. I presume you're trying to do a lot of specific comparisons. You could do this: return (testEntity instanceof EntityZombie || testEntity instanceof EntitySkeleton || testEntity instanceof EntityCreeper); To make the code easier to read, but no, there isn't an easier way to do what you're already doing.
  3. If the mod's not open source, then the mod author(s) don't want you to deobfuscate it.
  4. I suggest you learn more about Java and modding before you tackle something so complex as this.
  5. You need an updated version of Damage Indicators or a downgraded Forge workspace.
  6. Pahimar's open source mod, Equivalent Exchange 3, shows the proper way to to packet handling: https://github.com/pahimar/Equivalent-Exchange-3/tree/master/src/main/java/com/pahimar/ee3/network
  7. Figure out where you have the Minecraft directory used by your Eclipse workspace, and put your wanted mods in the "mods" folder.
  8. Reading the error message would help you. It tells you exactly what the exception is.
  9. Java and JavaScript are two different programming languages. JavaScript is a scripting language used for websites.
  10. This is the code I'm working with: http://pastebin.com/aEAswtBR and I've come across a big problem. Trying to break the block from the block object gathered from world.getBlock() doesn't do anything. Even doing world.getBlockToAir() doesn't do anything. I even tried using a packet handler because I thought the event was only being called client-side only (which it wasn't). Is it a Forge bug? EDIT: It seems that Block.breakBlock() is only for special purposes (i.e. dumping out the contents of an inventory, removing a tile entity, etc) and is not meant for actually breaking a block. What wesserboy said, you need to do something like this: private void breakBlock(World world, int x, int y, int z){ if(world.getBlock(x, y, z) != Blocks.bedrock){ world.getBlock(x, y, z).dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); world.setBlockToAir(x, y, z); } }
  11. If you want to do packet handling yourself, check out the source code of Pahimar's EE3: https://github.com/pahimar/Equivalent-Exchange-3/tree/master/src/main/java/com/pahimar/ee3/network
  12. As I'm sure it can be quite annoying to be pestered with small problems such as this, but what's the point in just writing that? Dude, as this may seem like I'm not putting any "effort" I've done my best effort to learn as I go along. May you please reply with a little bit more help - I'm not asking for someone to write this for me, only to point me in a direction of which I can learn. Small problem? If you don't know Java, then modding is going to be much much harder. Knowing Java is not an option, it is a REQUIREMENT. Learn from Vswe's tutorials:
  13. Look at the Minecraft source code (possibly under the net.minecraft.client.gui package) and see how they do it.
  14. Minalien made a great tutorial for using Scala and the IntelliJ IDEA IDE: http://minalien.com/tutorial-setting-up-forgegradle-for-intellij-idea-scala/
  15. Like what the others said, you need to have sufficient permissions to do the building process. Also, "FileNotFound EXPECTATION"?
  16. Umm... there's no @Mod() annotation. You skipped step 1 of coding a Minecraft mod. @Mod(modid = "MyMod", name = "My Mod", version = "1.0.0") public class MyMod { // Code }
  17. public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if( par1ItemStack.stackTagCompound == null ) par1ItemStack.setTagCompound( new NBTTagCompound( ) ); if(par3EntityPlayer.isSneaking()) { // Here's your problem. Check to see if the world is NOT remote. if (!world.isRemote) { code } if(par2World.isRemote) { ...
  18. I can give you a starting tutorial with item NBT data. All ItemStacks in a world can contain additional data called NBT data. You can write NBT data to an ItemStack like so: public void storeIntegerInItemStackNBT(ItemStack itemStack, String tagKey, int number) { // If an ItemStack doesn't have NBT data associated with it, then the stackTagCompound (returns an NBTTagCompound object) field will be null. if (itemStack.stackTagCompound == null) { // NBTTagCompound is the object that stores an ItemStack's NBT data itemStack.setTagCompound(new NBTTagCompound()); } // NBTTagCompound has many methods to store many data types, including bytes, byte arrays, shorts, integers, Strings, etc. // When storing values using NBTTagCompound, you will also need a key (String) to associate with the value. This is for calling the value later when you want to extract information from an NBTTagCompound object. itemStack.stackTagCompound.setInteger("Key", number); } You can read NBT data from an ItemStack like so: public int readIntegerFromItemStackNBT(ItemStack itemStack, String tagKey) { if (itemStack.stackTagCompound == null) { itemStack.setTagTagCompound(new NBTTagCompound()); } return itemStack.stackTagCompound.getInteger(tagKey); } That's the basics of ItemStack NBT data. You can also check out this: http://www.minecraftforum.net/topic/982336- tutorial for more information.
  19. First, please PLEASE organize your code. It looks horrid. Second, don't use the same name as an object when assigning an object's value. Java (and you) will get confused. Do something like this: public static Item potatoPickaxe; public static void init() { potatoPickaxe = new PotatoPickaxe(); // You don't seem to register your item anywhere. You will need to do something like this, otherwise, your item will not load. GameRegistry.addItem(potatoPickaxe, "item.potatoPickaxe"); } You can also pre-assign objects like so: public static Item potatoPickaxe = new PotatoPickaxe(); public static void init() { // You still need to register the item, though. GameRegistry.registerItem(potatoPickaxe, "item.potatoPickaxe"); } Less code to write, and generally looks nicer.
  20. It doesn't mean that any Javadoc information comes with it. What method in particular are you talking about?
  21. When you're registering the crafting recipes, the items are not registered. Register the items in a preInit() method, then the crafting recipes. Something like this: public void preInit(FMLPreInitializationEvent event) { GameRegistry.registerBlock(BLOCK, "block.testBlock"); // Other items GameRegisrey.addShapelessRecipe(OUTPUT, INPUTS...); // Other recipes } You can register the recipes in the init() method, if you like.
  22. There seems to be no good tutorials for this. I want to have what LexManos explains how to do here: https://www.youtube.com/watch?v=xp2jmt47yTQ, but with IntelliJ instead of Eclipse. Fair warning, I am very new to IntelliJ, and am still getting used to it.
  23. You need to do something like this: this.blockIcon = iIconRegister.registerIcon("MOD_ID:TEXTURE"); If you're defining the block texture, you don't have to add "textures/blocks" to the path. Same for items.
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.