Jump to content

Sikhstar97

Members
  • Posts

    16
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Sikhstar97's Achievements

Tree Puncher

Tree Puncher (2/8)

-1

Reputation

  1. How would I got about doing the fast fix? Would that be like ammending the current method of getting the icon or is there another method for doing this?
  2. Wow, that worked. Thank you so much. You sir are going on my "awesome list"
  3. Ok so this is my new code: if(player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().itemID == Base.tankEmpty.itemID) { if(event.action == Action.RIGHT_CLICK_AIR) { player.inventory.addItemStackToInventory(new ItemStack(Base.tankAir)); if (!player.capabilities.isCreativeMode && player.inventory.addItemStackToInventory(new ItemStack(Base.tankAir)) == true) { --player.getCurrentEquippedItem().stackSize; } } } I've changed it so that when there's no more space, the empty tank stack size does not decrease. This works fine. However the issue of 2 items returning instead of 1 is back. I can see how the bit && player.inventory.addItemStackToInventory(new ItemStack(Base.tankAir)) == true) causes this. Question: is there a better way to check if the itemstack has been added (one that does not cause 2 of the item to return)?
  4. This looks both complex but also very useful. Someone else helped with a different method, so I'll try both, decide which is the best and then get back to both you and the other helper about which i think works best (so you could use the best method, in my opinion, if you ever need to use it). So I've decided to ditch the "fluid" tanks (they had no use in my mod). So when I right click mid air with an empty tank, an air tank should return (just 1). However, another problem has risen. This topic can be locked now but the following link takes you to my next issue. If you wouldn't mind checking it out, I would be very grateful and thank you 1 gigabyte times. http://www.minecraftforge.net/forum/index.php/topic,13075.msg67737.html
  5. Hum are you sure? The addItemStackToInventory in the brackets of the if statement just checks if its been added. I wouldn't think it would cause it to return twice. I'll try out what you said and get back to you asap. So I tried your recommendation. It didn't work. Now, with space in the inventory, nothing returns but the stack size of empty tanks still decrease and when my inventory is full, the air tank that should be returned is dropped (as it should do). Unfortunately though it did not work. Any other ideas anyone?
  6. All that's done is cause the stack to decrease in size but now NO items are returned at all.
  7. So my last topic I posted in this section on PlayerInteractEvent was a bit messed up. I've rethought what's wrong and fixed it. But now there is a second problem. Here is the code: @ForgeSubscribe public void playerInteractEvent(PlayerInteractEvent event) { EntityPlayer player = event.entityPlayer; if(player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().itemID == Base.tankEmpty.itemID && event.action == Action.RIGHT_CLICK_AIR) { if (!player.capabilities.isCreativeMode) { --player.getCurrentEquippedItem().stackSize; } player.inventory.addItemStackToInventory(new ItemStack(Base.tankAir)); if (!player.inventory.addItemStackToInventory(new ItemStack(Base.tankAir))) { player.dropPlayerItem(new ItemStack(Base.tankAir.itemID, 1, 0)); } } } The code looks fine to me and it works. However, when I play the game and right click mid air with my "tankEmpty", it returns 2 "tankAir" instead of just 1. Does anyone know why this is and how I can fix this? Thanks in advance.
  8. Well the stack of empty buckets will decrease by 1. But I'm not bothered about that because I know how to do it, What happens is that when I right click mid-air, all is fine, but when I right-click water, it's like the game runs the method when right-clicking water AND air (because you're right-clicking water "through" air in a sense). I just need help working around this.
  9. Well when I right click mid-air with the empty custom bucket, it will return a custom item to the player's inventory.
  10. Ok so I took this on board and ditches the handler and used the method within the ItemBucket class (obviosuly in my custom class) I took the following the code and tweaked like so if (par2World.getBlockMaterial(i, j, k) == Material.air && par2World.getBlockMetadata(i, j, k) == 0) { //par2World.setBlockToAir(i, j, k); if (par3EntityPlayer.capabilities.isCreativeMode) { return par1ItemStack; } if (--par1ItemStack.stackSize <= 0) { return new ItemStack(Base.customTankAir); } if (!par3EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Base.customTankAir))) { par3EntityPlayer.dropPlayerItem(new ItemStack(Base.customTankAir.itemID, 1, 0)); } return par1ItemStack; } I replaced Material.air with water and then lava, and the returned item to something else. With water and lava, it works fine. HOWEVER, when I right click mid-air, nothing happens. It's probably because this material has isSolid set to false. Anyway around this?
  11. I have a custom bucket and in the Item*** for the custom bucket, I have code set that allows the bucket to become full when I right click water or lava. However, we I try to do it for air, I obvisouly have to instead use the PlayerInteractEvent in my EventHandler like this: public void playerInteract(PlayerInteractEvent event) { EntityPlayer player = event.entityPlayer; if(player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().itemID == Base.customBucketEmpty.itemID) { if(event.action.equals(Action.RIGHT_CLICK_AIR)) { player.inventory.addItemStackToInventory(new ItemStack(Base.customBucketAir, 1)); if(player.capabilities.isCreativeMode == false) { --player.inventory.getCurrentItem().stackSize; } } } However, this means that when I right click block, the water block disappears, but the air bucket returns instead of water. How can I fix this?
  12. So if I make a mod with the full forge package, then I should get people to install the whole of forge before installing my mod?
  13. By this, I mean if I wanted only the classes of forge that preload a texture index, can I have just those files in my mod download, or do people have to externally download and install the whole of forge?
×
×
  • Create New...

Important Information

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