Jump to content

Draco18s

Members
  • Posts

    16559
  • Joined

  • Last visited

  • Days Won

    156

Everything posted by Draco18s

  1. That locates every player inside a 65x65x65 cube (I meant to make it smaller, forgot) and then loops through the list of players inside that volume, and gets their currently active item. All you have to do then is look at that item and decide if that's the item you want to have break the block or not.
  2. His problem is figuring out if the player is holding a given item. Which is harder. Your best bet is to poll the world for all Players in interaction range (4 blocks) and then check their active item. Here's the hard part: AxisAlignedBB aabb = AxisAlignedBB.getAABBPool().getAABB(xCoord-32, yCoord-32, zCoord-32, xCoord+32, yCoord+32, zCoord+32); List w = worldObj.getEntitiesWithinAABB(EntityPlayer.class, aabb); if(w.size() > 0) { //at least one player in range EntityPlayer player; for(int i = 0; i < w.size; i++) { player = w.get(i); player.getHeldItem();//active item as ItemStack } }
  3. And then read that item's NBT data. This isn't "oh, Item ID 1322 increases your health" it "Item ID 1322 {["onOwned":"increaseHealth"}]" vs. "Item ID 1322 {["onOwned":"increaseSpeed"}]" vs. "Item ID 1322 {["onUpdate":"heal1"}]" vs. "Item ID 1322 {["onRightClick":"causeLightning"}]" vs.... Anyway, if we're going to call things features, I think it would be a more interesting "feature" that items in frames are permanent boosts. It's like a litch's phylactery! It just isn't meaningful in SSP: no one can try and sneak into your base and "destroy" your powerbase.
  4. It's not triggered before OR after, none of the item's functions are called. How would you make an item that gives the player bonus health while they are carrying it? I am trying to do this without events, but if I have to for this case I will.
  5. Actually, it's not. I checked.
  6. Step 1: EntityPlayer player != EntityPlayer Step 2: Read the javadoc
  7. public MovingObjectPosition collisionRayTrace(World par1World, int par2, int par3, int par4, Vec3 par5Vec3, Vec3 par6Vec3) { return null; }
  8. World world != World
  9. There's onItemPickup for EntityLivingBase...
  10. Welcome to client-server disparity. You'll want this: public Packet getDescriptionPacket() { NBTTagCompound nbtTag = new NBTTagCompound(); this.writeToNBT(nbtTag); return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 1, nbtTag); } public void onDataPacket(INetworkManager net, Packet132TileEntityData packet) { readFromNBT(packet.data); } Assuming your read/write functions handle your TE's item contents. If it doesn't, it should.
  11. As a result of trying to do attribute boosts when the player owns an item, and trying to avoid performing a complete inventory check onEntityLivingUpdate every N frames for every living entity in order to determine if the item was no longer owned, I have run into an issue: For chests (and chest like objects) I was able to get around the problem by revoking the boost if a container GUI was active. However for ItemFrames this never occurs, the item is simply removed from the player's hand instantly. What I would like would be an additional call in ItemStack's setItemFrame method to tell the ItemStack's item class that it was placed into an ItemFrame i.e. something like this: public void setItemFrame(EntityItemFrame par1EntityItemFrame) { this.itemFrame = par1EntityItemFrame; this.getItem().nowInFrame(par1EntityItemFrame); } This function would be called once with the intent that any effect the Item normally applies to the player can be properly toggled off. It would be nice if there was a similar function for when it's placed into a chest (or other container), but not strictly necessary due to the workaround I have.
  12. . Putting items into item frames doesn't trigger any kind of function either! And doing that doesn't require opening a GUI!
  13. did it still rendered something, like in the image above or did it render nothing? It rendered a blank, off-white cuboid, just like in the OP.
  14. "New"? I opened Eclipse this morning when the only thing that changed from yesterday was that I'd done some work on a different computer, so I moved my updated sourcecode in. The top-level "Minecraft" doodad in the project window indicated an error, but NONE of the subitems had an error. So I ran it, ignored the "project has errors" warning just to see what it would do, got the above error. So I'm redecompiling. Heh.
  15. 2013-10-08 11:33:12 [iNFO] [sTDOUT] ---- Minecraft Crash Report ---- 2013-10-08 11:33:12 [iNFO] [sTDOUT] // Why is it breaking 2013-10-08 11:33:12 [iNFO] [sTDOUT] 2013-10-08 11:33:12 [iNFO] [sTDOUT] Time: 10/8/13 11:33 AM 2013-10-08 11:33:12 [iNFO] [sTDOUT] Description: Initializing game 2013-10-08 11:33:12 [iNFO] [sTDOUT] 2013-10-08 11:33:12 [iNFO] [sTDOUT] java.lang.NoClassDefFoundError: net/minecraft/util/Vec3 2013-10-08 11:33:12 [iNFO] [sTDOUT] at net.minecraft.client.model.PositionTextureVertex.<init>(PositionTextureVertex.java:15) Go Minecraft, go! 9..9 You forgot where you put your Vec3s (class totally exists: I have it open). Also, best crash message ever: "Why is it breaking"
  16. I had something like this happen when I forgot to register my renderer. Hehe.
  17. My problem was one of confusion. And the program is glorious. It messes up the orientation on dispensers frequently (still not sure why)--last use I had 6 dispeners, 3 facing the other three. In the converted code only one is facing the right direction.
  18. You shouldn't use hardcoded numbers. That would be bad if someone changed the ID numbers.
  19. ModPowderCraft.explorerKit.itemID Make sure that you set up your mod to be required-after the parent mod or you'll get a null reference error. Eg: @Mod(modid = "DecayingWorld", name = "Decaying World", version = "4.1.0", dependencies = "required-after:Mystcraft")
  20. You're supposed to make a zip file. I haven't ever seen it done like that.
  21. This might be the problem. Can I see a screenshot of your zip file's folder structure?
  22. You haven't correctly set up your @ModID annotation. Probably. I can't tell. You haven't shown us any code. But Forge is trying to inject your main class and can't find it.
  23. The second one is easier. Not sure about the first, you might try player.moveEntity(par1, par3, par5) For the second one, you're going to need a block that extends BlockContainer. That will generate a new TileEntity (which you will also need to create). This TE can now do all kinds of fancy stuff. You probably also need a custom renderer (ISimpleBlockRenderingHandler is sufficient) though you might be able to get away with metadata based icon selection (via getIcon).
  24. No shit, there isn't a player entity until they log into a world. You're going to need to backtrack the EntityPlayer creation to figure out where the username comes from.
  25. http://stackoverflow.com/questions/833768/java-code-for-getting-current-time
×
×
  • Create New...

Important Information

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