Jump to content

Draco18s

Members
  • Posts

    16559
  • Joined

  • Last visited

  • Days Won

    156

Everything posted by Draco18s

  1. That is a mite bit trickier, but doable. Your options: 1) Reflections (tricky, as Reflections is not a simple thing) 2) Base class edits (I would hazard you would not like this) 3) Creating custom items and then forcing them into the items array where the vanilla items reside (not entirely kosher)
  2. I didn't forget it, i was just hoping that there would be a way around it without using a tile entity, which there appears not to... Thanks anyway Look for my reply in that thread. The one that starts "Ohsitdude, you don't need custom renderers or TileEntities for this."
  3. There are other ways of handling this. Namely, doing something like this in the item's class @Override public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block) { if (par2Block != Block.oreCoal && par2Block != Block.oreIron && par2Block != Block.oreEmerald && par2Block != Block.oreGold && par2Block != Block.oreDiamond && par2Block != Block.oreNetherQuartz && par2Block != Block.oreLapis && par2Block != Block.oreRedstone && par2Block != Block.oreRedstoneGlowing) { return 0; } else { return 15; } } If the strength vs. the block returns 0 (or less) then no progress is ever made towards breaking it (punching with no/inappropriate tool is roughly 0.25). The 15 could be modified by material the item is made out of, etc. etc. This was just a quick implementation for a mod I'm making where it is not yet important what value is being returned, only that it is sufficiently large.
  4. That's kinda why I made the suggestion. http://forums.dumpshock.com/style_emoticons/default/sarcastic.gif[/img] It's completely bonkers for a protected method ("I'm sorry, this function does something absolutely critical to the functioning of the program that you can't change it") only calls a non-protected ("change this at your whim") method.
  5. You are forgetting that the block class is a singleton and that "instances" of it in the world are not actually instances, but simply a numbered reference. This thread, only a little ways down the first page on this very forum, will provide insight.
  6. It probably has to do with the item renderer pulling icons from the item texture sheet, as the Icon class does not (appear to) contain any information as to which stitched sheet the Icon resides in.
  7. If it's a TileEntity you can pass XYZ coordinates, then use world.getBlockTileEntity(...)
  8. As opposed to say, making an item that extends ItemMapBase (so isMap -> true) which should be utilized in all ways by other objects in the same way as a vanilla map. (isMap is called in one place in the entire Minecraft codebase, which boggles my mind)
  9. It's a final method which calls a non-final method. The "final" in this case appears to be completely arbitrary.
  10. Probably because you're doing it client side. This is the code I pasted if(data != null && par2World.isRemote) { This line checks to make sure that the client is running it because... //oddly this function runs on the server, but directly altering the player entity has no effect. //so instead we end up using packets
  11. blockToCopy is in the wrong scope. It'll be overwritten by every block in your world every render, so its not guaranteed to be the same block when that function is called.
  12. @Override public void onUpdate(ItemStack stack, World world, Entity entity, int n, boolean b) { if (stack.getItemDamage() >= stack.getMaxDamage()) stack.stackSize -= 1; //if this is reduced to 0, it is automatically "destroyed" }
  13. I noticed that item frames still don't use the handy isMap() method to render maps.
  14. Its called by renderItemIntoGUI in RenderItem. There is one other function with the same name that also calls this funciton, passing an extra parameter doRenderItem also calls this function. renderItemIntoGUI also handles mutliple-pass rendering which calls the other function, so while there is a way to render the NBT data driven icon through the multiple-pass renderer, it should not be needed. It's a single icon that needs to be rendered once.
  15. Solution was to render in pass 2 (which is not obvious, but anyway). I want the item icon when it appears in inventories. The only place an ItemStack gets its icon is the quoted function, which calls back to the finalized function in Item.java. I checked out all the other variants of getIcon in the Item class, as I'd said, but two of them don't take the item stack, two of them only cause the item to render in 3D with the indicated icon (the first passing its params to the second), and the last method is final. There aren't any others. So I'm not sure what you're question is.
  16. That does work. Thanks. Already had that function overriden (getIcon) but I didn't think to set multiple render passes (and actually, you want that second function to return a 2: //default public int getRenderPasses(int metadata) { return requiresMultipleRenderPasses() ? 2 : 1; }
  17. AFAICT, this is the only spot where an ItemStack is passed to the Item class in order to get an icon for drawing inventory sprites (as opposed to 3D world sprites). Unfortunately it's final and cannot be overriden (base class editing out the final gets me what I need). All it does is call getIconFromDamage(int par1) , which doesn't have enough info left to get at stack NBT data. public Icon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) (which calls public Icon getIcon(ItemStack stack, int pass) , am already overriding) won't work, as that's the 3D render usage (apparently). The only other function available is public Icon getIconFromDamageForRenderPass(int par1, int par2) which also lacks the ItemStack. Lex has indicated that this must be possible as other mods are doing it, but my guess is that they've written a custom item renderer to handle it (which seems...excessive, as the necessary function is already there, but not modifiable).
  18. public Icon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) (which calls public Icon getIcon(ItemStack stack, int pass) and am currently overriding) doesn't work. The only other functions available are public Icon getIconFromDamageForRenderPass(int par1, int par2) and getIconFromDamage(int par1). which lacks the ItemStack. Oh look: //ItemStack.java public Icon getIconIndex() { return this.getItem().getIconIndex(this); } That calls the function I'm asking about. That's the only method on ItemStack that returns an Icon. I'd hazard a guess that those other mods wrote a custom renderer for their item, which would be unnecessary if the Item class didn't have this function as final.
  19. Currently Item.getIconIndex(ItemStack par1ItemStack) is final and calls another function (which is not) with a lower-typed parameter: getIconFromDamage(int par1). This means that I can't use NBT data to override the inventory icon, only the held model icon.
  20. I know how to use it, I just managed to not-see it.
  21. Huh, I managed to miss that somehow. o..O I mean, I litterally trawled the Item class for every function I would possibly need and managed to grab the wrong canHarvestBlock one. Well damn.
  22. public boolean canHarvestBlock(Block par1Block); If this function determines if blocks drop their resource when mined. However, it isn't passed the ItemStack the player is using to mine the block (thus block-droppage is determined at the Item class level, requiring new Item-IDs to differentiate "tools" from "non tools"). Is there any way around this? My first thought was returning false (no drops) and then fixing it with the onBlockDestroyed() method to cause a drop if there should be one (based on the NBTdata) but this prevents getStrVsBlock() from being called, which means that NBTdata is not used to determine block breaking speed.
  23. Point. However, that's how you make a bounding box.
  24. Why gee, you could open up where this.boundingBox is defined and check: this.boundingBox = AxisAlignedBB.getBoundingBox(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
×
×
  • Create New...

Important Information

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