Jump to content

strumshot

Members
  • Posts

    133
  • Joined

  • Last visited

Everything posted by strumshot

  1. O.K., I follow you so far, but TileEntityChest, BlockChest, and IInventory all seem to reference 'slots' only via an int[] with an ItemStack. What file/class am I missing that impliments a Slot class? Or am I going rogue on this one and writing entirely new methods to handle the ItemStacks; one that we are referring to as a "slot?"
  2. I am working on a mod in which my current challenge is to interrupt a player removing a certain item from a chest. The item I would be interrupting is an original item, and the chest itself is also custom. These portion are complete and work properly. My guess is that I may be trying to hook an item interaction event or container/inventory interaction event. Can someone point me in the right direction? After sifting through the base code and GitHub refernces, I am still scratching my head on where to start with this one... If it helps, the classes that I have already overridden for my custom chest are the BlockChest and TileEntityChest classes. I don't believe any of the code I already have will serve to help answer the question, but let me know if I need to post any! Thanks!
  3. For the life of me, I can't load a custom item texture. As the image shows, it sure appears to say there is no file at the exact location where there is a file. I hate to bring such a seemingly simple issue here, but what am I not seeing?
  4. Sorry for just now getting around to posting the solution, but here goes: List l = world.getEntitiesWithinAABB(EntityItemFrame.class, AxisAlignedBB.getBoundingBox((double) x - 1.0d,(double) y + 2.0d,(double) z + 1.0d,(double) x,(double) y + 3.0d,(double) z + 2.0d)); if (l.size() > 0) { // found an item frame! EntityItemFrame f = (EntityItemFrame) l.get(0); ItemStack istack = f.getDisplayedItem(); if (istack != null && istack.stackSize > 0) { // found item in frame } For anyone else happening upon this, this is how you find item frames and the items within them relative to another block location! Thanks!
  5. at mod.xtronius.htsm.tileEntity.TileEntityCage.readFromNBT(TileEntityCage.java:161) ~[TileEntityCage.class:?] ..Could you post the entirety of TileEntityCage.java and highlight line 161? This would be helpful in solving your problem.
  6. I know this is a bit out of date, but in case anyone else wonders across this, I had to address this issue when adding a /reply command to private messages. While it may be a bit overkill, perhaps you could parse outgoing text through a custom method and split it at any spaces, and add your desired formatting before each word. In my scenario I had to iterate through the String[] 'parameters' and manually add spaces, so I also added the chat formatting, which fully addressed the issue. It generically could look something like this: String s = ""; String[] m = message.split(" "); for(String t : m){ s += formatString; s += t; s += " "; } ...where message = the original message and formatString = the desired formatting and s = your new, completed message. It feels overkill, but it works! Hope that helps.
  7. Right, the entity part I had found, but not that method. I haven't worked with AABB yet, but I'm sure I can power through it. Thanks! I'll post my exact findings if it helps any further modders.
  8. I am having an issues finding documentation or assistance in working with item frames. I write this post after three days of not finding so much as one page or discussion on even the basics of item frames. A search on these forums returns only crashlogs in an almost unreadable search response. Here is my situation and question: In my current project, upon a player walking on a custom block, which I will call the 'key' block, I check the blocks near this key block to determine if the player has built a structure to proper arrangement - a properly built multi-block structure. If the structure is not properly built, then following methods (teleportation in this case) will not occur. Determining a block type by location is simple and well documented, and I have had no issues checking for a proper build of blocks. if (world.getBlock(x + 0, y + 2, z + 1) == Blocks.quartz_block) ...where x,y,z is the key block location, triggered by the onEntityWalking event in the custom key block. However, I would like one of the required units to be an item frame, but how do I check for an item frame relative to the key block? I've tried several get properties and conversions, but to no avail. I believe I need to find an EntityItemFrame, but there has to be a simple answer. The 'block' returns as air, for example. Also I want to determine if the contents of the item frame match a certain criteria, and I imagine I will have that question as well when I get there. Any help would be appreciated.
×
×
  • Create New...

Important Information

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