Jump to content

defiant810

Members
  • Posts

    18
  • Joined

  • Last visited

Everything posted by defiant810

  1. I have never even heard of ISimpleBlockRenderingHandler. I took a look at it, it was super easy to implement. This is exactly what I needed! Thanks a ton.
  2. What do you mean BlockIds are going to be obsolete in the next forge? Could you give me a link to that, or at least explain it. Also I would prefer a way to do this is if it is possible, for simplicity.
  3. No we specifically made it to have a TileEntity, because there are 4 growth stages (empty, growing, grown, and flowered), as well as we have 6 or 7 different types of vines, with more planned. The empty stage is not tied to a vine type, but every other growth stage is, so that is 3 stages for each of the types of vine. We are also compacting all of them into a single block to save on block ids, and to make it simpler to manage.
  4. In my mod I am trying to make a block that has a render Id of 6 (crops), but also has a TileEntity associated with it to store what growth stage it is in (it is a support structure that can grow different kinds of vines on it). This means that I also want to be able to return a different texture based on the growth stage and type of vine that it is growing. The problem is that in the RenderBlocks class, when it is time to get the texture needed for the icon, all blocks with render type 6 have "getIcon(int, int)" called, which does not allow me to access the TileEntity at the given point and use it to return the proper icon. The method I need is "getBlockTexture(IBlockAccess, int, int, int, int)" since that allows me to access the TileEntity stored at that point, but it is never called for all blocks of render Id 6. I know that you can access the RenderBlocks and therefore its IBlockAccess field using "Minecraft.getMinecraft().renderGlobal.globalRenderBlocks.blockAccess", but there is no way to get the current position that the renderer is rendering at, so I still cant access the proper TileEntity. I have also tried making a custom TESR that just overrides the active texture and then calls the renderBlockCrop() method in RenderBlocks, but then the block appears invisible. My question would be how to get around this without making a new TESR and basically copying the rendering code for crops, which I could do but would like to avoid if possible.
  5. *Facepalm* I completely forgot about the world.isRemote flag. And that appears to have fixed my error, there are no longer any ghost ItemStacks appearing. Thanks to everyone who helped.
  6. A link to source would be massively appreciated. And how would one make sure that the item spawn only happens on the server? Would the @Sided annotation do that, ir does it need to happen some other way?
  7. So I tried making a method that takes the item if it is invalid, sets the slot to null, and ejects the item into the world. Good news: it works. Bad news: it works twice. Whenever it ejects the ItemStack, it makes one legit version that can be picked up, and then it also ejects a ghost version of the same stack that cant be picked up; it just sits there and mocks you. Here is the TileEntity code: @Override public void setInventorySlotContents(int slot, ItemStack toPut) { inventory[slot] = toPut; if(toPut != null) { if(toPut.itemID == Item.stick.shiftedIndex) { this.capsuleContained = CapsuleType.LOW; } else if(toPut.itemID == Item.pickaxeWood.shiftedIndex) { this.capsuleContained = CapsuleType.MEDIUM; } else if(toPut.itemID == Item.shovelWood.shiftedIndex) { this.capsuleContained = CapsuleType.HIGH; } else { capsuleContained = CapsuleType.NONE; checkSlot(slot); } } else { capsuleContained = CapsuleType.NONE; } if(toPut != null && toPut.stackSize > getInventoryStackLimit()) { toPut.stackSize = getInventoryStackLimit(); } } @Override protected void checkSlot(int slot) { ItemStack contents = getStackInSlot(slot); boolean valid = (contents.itemID == Item.stick.shiftedIndex || contents.itemID == Item.pickaxeWood.shiftedIndex || contents.itemID == Item.shovelWood.shiftedIndex); if(!valid) { inventory[slot] = null; dropItem(contents); } } And here is the dropItem method from the super class: protected void dropItem(ItemStack contents) { Random rand = new Random(); float rx = rand.nextFloat() * 0.8F + 0.1F; float ry = rand.nextFloat() * 0.8F + 0.1F; float rz = rand.nextFloat() * 0.8F + 0.1F; EntityItem entity = new EntityItem(this.getWorldObj(), this.xCoord + rx, this.yCoord + ry, this.zCoord + rz, new ItemStack(contents.itemID, contents.stackSize, contents.getItemDamage())); if(contents.hasTagCompound()) { entity.item.setTagCompound((NBTTagCompound)contents.getTagCompound().copy()); } entity.motionX = rand.nextGaussian() * 0.8f; entity.motionY = rand.nextGaussian() * 0.8f; entity.motionZ = rand.nextGaussian() * 0.8f; this.getWorldObj().spawnEntityInWorld(entity); } I don't see where it could be creating two stacks. This is (almost) the same code I use to eject the items out of my other blocks, and that works just fine. EDIT: Here are the two files that are being used here: https://github.com/SeanMoss/QuantumCraft/tree/master/src/common/quantumcraft/common/tileentity
  8. I looked through the same two classes and came up with the same results. I guess the dropping the inventory solution will be good temporarily until I figure out how to block items from slots, if it is possible.
  9. Hmmm... OK, that makes sense. Does anyone out there know if there is a method that defines what can and can't be put into certain slots? Or another way to solve this problem?
  10. Hey there, quick question: How does one block certain items from going into an inventory (like how the vanilla Furnace doesn't allow non-fuels in the bottom slot)? Right now this is my code in my tile entity: @Override public void setInventorySlotContents(int slot, ItemStack toPut) { ItemStack old = getStackInSlot(slot); if (toPut != null && (toPut.itemID == Item.stick.shiftedIndex || toPut.itemID == Item.pickaxeWood.shiftedIndex || toPut.itemID == Item.shovelWood.shiftedIndex)) { inventory[slot] = toPut; if (toPut.itemID == Item.stick.shiftedIndex) { capsuleContained = CapsuleType.LOW; } else if (toPut.itemID == Item.pickaxeWood.shiftedIndex) { capsuleContained = CapsuleType.MEDIUM; } else if (toPut.itemID == Item.shovelWood.shiftedIndex) { capsuleContained = CapsuleType.HIGH; } if(toPut.stackSize > getInventoryStackLimit()) { toPut.stackSize = getInventoryStackLimit(); } } else if (toPut == null) { inventory[slot] = toPut; capsuleContained = CapsuleType.NONE; } else { //It eats other items... } } As of right now, the inventory (of only one slot) only allows sticks, wooden picks, and wooden shovels (testing items). When I try to put other things in, instead of doing nothing, the slot remains empty but the original item disappears. How can I make it so that item doesn't disappear, and just stays in the player's cursor? And yes, I've already looked at the furnace code, it didn't help.
  11. I tried storing a time-based variable that updates ever render cycle in the TileEntity for the block (not the TESR), and I got a smooth, per-block animation going. It works, but I don't know if it is the most efficient. Can anyone confirm this? Also, after looking at the Buildcraft Engine rendering code, I saw that they have a system that binds multiple textures per render call. So that answers my question as to that problem.
  12. Thanks for the reply. If you look at the code in my mod, you will see that I am using a TileEntitySpecialRenderer already. I am wondering where to increment the rotation amount each time; somewhere like the render() method, because that is called at set intervals each second, or does it have to go somewhere else? Also, I was asking how to do multitexturing, like Buildcraft does with it's engines. I know about the binding new textures between rendering calls method, but is there some way to tell different modelrenderers to offset the texture?
  13. I have a couple of questions about using Model Renderers to make custom blocks, and would appreciate help: [*]How do I bind different textures to different boxes in the model renderer? [*]How to I animate the parts (like change rotation over time)? I'm sure that the texture binding/offsetting is simple. But how would one animate the blocks like Buildcraft? I know it has something to do with ticks, but how to update the renderer on each tick is what I don't understand. Here is the source code to my mod: https://github.com/SeanMoss/QuantumCraft. Here is a screenshot of the block: http://imgur.com/ZGKbK.
  14. I believe that that is a action that is inherited from the Entity class when you extend it. Bt don't quote me on that, I'm not sure. Take a look around the code for Entity and look at other Entity tutorials to see if you cant find something there.
  15. Where (if there are any) could I find an OgenGL rendering tutorial for Minecraft. I would like to make custom shaped blocks in my mod, like the pumps in RedPower, or like the new blocks in XyCraft or crystals in the old Thaumcraft. It would appear that tutorial makers avoid this subject like the plague for whatever reason, and I would like to know where a tutorial for this is, if there is any. If not, a tutorial on OpenGL in general, and a basic starting point for using it in Minecraft would be great. Thanks in advance if anyone can help me on my search.
  16. Ah indeed there is. Thank you, sir, for pointing out the obvious.
  17. Just like the title says: how would one set up your MCP folder as a GitHub repo? I know the whole process of making a new repo and syncing it with GitHub and everything, but there doesnt seem to be any way to directly link only my mod package with GitHub from the eclipse/... folder or the src/... folder. The eclipse/Minecraft/bin/<my package> folder has both my client and server files together, but they are all .class compiled files already. I am looking for the .java source files, which are in the src/common/<my package> and src/minecraft/<my package>, but they aren't all in one folder which is what I think Git needs for a repository. Mod devs like pahimar have a repo set up that syncs their files as they are edited. (EE3: https://github.com/pahimar/Equivalent-Exchange-3, in case you didn't know.) Does anyone know if he has a direct link to his modding folder, so he can sync it strait away as he saves new files, or would one have to drag and drop the new/saved files into another folder with the various source files all together, and then sync them with a Git client? Or is there a way to make a Git repo that points to multiple paths at the same time? Just wondering as a group of friends and I are going to begin developing a mod and we would like to have a straight up, easy way to share files (or as easy as Git can get). Again, please don't link to a "How to Use GitHub" article. I am already pretty familiar with Git. Unless it is a "How to Make a Git Repo Point to Multiple Paths" link, if that is even possible. Thanks.
×
×
  • Create New...

Important Information

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