Jump to content

TheGreyGhost

Members
  • Posts

    3280
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by TheGreyGhost

  1. Hi I'd say it shouldn't be too hard, you just need to figure out a way for the TileEntities to keep track of each other, keeping in mind that depending on where the players are standing, some of the chunks might not be loaded (so the TileEntities might be absent). Some random thoughts that might help- Perhaps the linkages between TileEntities might best be stored in the world NBT data (WorldInfo.getAdditionalProperty), eg each "shop" in the world has a structure that lists all the shelves, storage blocks, and cash register blocks. Updated whenever you create or destroy one of the components. Whenever a TileEntity needs to know about one of the others it is linked to, it consults the world NBT data. How will you decide which shelves are linked to which blocks, and how will the user decide which items are placed where on which shelves? Likewise cash registers? Can you link to any within the same shop, or the nearest? How do you designate a "shop"? unique typed-in name? unique player? Will your shelf be like a chest? or will it "show" the item like an item frame does? Important design decision to be made up front I think. I'd recommend you test this with something really simple before leaping straight in with the full design since I reckon this will probably need a couple of prototypes before you hit on the best approach :-) -TGG
  2. Hi Just to confirm - do you know that a Block is only a Block when it is placed? A Block in a person's hand or inventory is an Item, not a Block And just to be confusing, a dropped Item is actually an Entity. There are a few tutorials around on it- see http://wuppy29.blogspot.nl/2013/07/forge-modding-16.html http://www.minecraftforge.net/wiki/Generic_Mod http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html -TGG Sorry if you did already know this stuff, just making sure...
  3. Hear hear! Just one look at their changelog shows how much time they spend on it. Can you imagine the pain of coding mods if there were no Forge, no MCP, no forge forum.
  4. Hi You might find this link helpful http://greyminecraftcoder.blogspot.com.au/2013/08/the-tessellator.html -TGG
  5. You got Null Pointer Exception bug java.lang.NullPointerException at net.craftyx.mod.item.transmutationGem.onUpdate(transmutationGem.java:31) :-) What's your transmutationGem class? -TGG
  6. Hi It looks to me like you're missing the texture for your item (as seen in the hotbar) and the vanilla code is rendering the item in first person. Does it work ok in third person view? These links might be useful perhaps: http://greyminecraftcoder.blogspot.com.au/2013/09/custom-item-rendering-using.html http://greyminecraftcoder.blogspot.com.au/2013/09/sample-code-for-rendering-items.html -TGG
  7. Hi Using my IDE to refactor that canHarvestBlock statement - looks to me like GotoLink is right and it will always return true when material is rock, so your getStrVsRock will never be called-? if (par1Block == Block.obsidian) { return toolMaterial.getHarvestLevel() == 3; } else if (par1Block == Block.blockDiamond || par1Block == Block.oreDiamond) { return toolMaterial.getHarvestLevel() >= 2; } else if (par1Block == Block.oreEmerald || par1Block == Block.blockEmerald) { return toolMaterial.getHarvestLevel() >= 2; } else if (par1Block == Block.blockGold || par1Block == Block.oreGold) { return toolMaterial.getHarvestLevel() >= 2; } else if (par1Block == Block.blockIron || par1Block == Block.oreIron) { return toolMaterial.getHarvestLevel() >= 1; } else if (par1Block == Block.blockLapis || par1Block == Block.oreLapis) { return toolMaterial.getHarvestLevel() >= 1; } else if (par1Block == Block.oreRedstone || par1Block == Block.oreRedstoneGlowing) { return toolMaterial.getHarvestLevel() >= 2; } else if (par1Block.blockMaterial == Material.rock) { return true; } else if (par1Block.blockMaterial == Material.iron) { return true; } else return par1Block.blockMaterial == Material.anvil; -TGG
  8. Hi your getStrVsBlock code has a different signature, the forge code is called first Item. /** * Metadata-sensitive version of getStrVsBlock * @param itemstack The Item Stack * @param block The block the item is trying to break * @param metadata The items current metadata * @return The damage strength */ public float getStrVsBlock(ItemStack itemstack, Block block, int metadata) { return getStrVsBlock(itemstack, block); } - however only overridden in ItemTool Show us your code? -TGG
  9. Hi Never used this method, so this is a random guess - isToolEffective is returning true? ItemTool. /** FORGE: Overridden to allow custom tool effectiveness */ @Override public float getStrVsBlock(ItemStack stack, Block block, int meta) { if (ForgeHooks.isToolEffective(stack, block, meta)) { return efficiencyOnProperMaterial; } return getStrVsBlock(stack, block); } -TGG
  10. Hi Yeah it's possible but it would be a huge amount of work if you wanted all the existing code to recognise it. There are hundreds of references to the 9 slots sprinkled throughout the code. If you just want an extra slot that your own code can put special stuff in (say - like a belt pouch for gold coins), then it's much easier, but still needs quite a bit of modding skill/experience. -TGG
  11. Hi Like GotoLink said, BlockCake is a good clue. If you have a custom renderer, you can use setRenderBounds before your call to renderStandardBlock. Otherwise, an easier way is just to override Block.setBlockBoundsBasedOnState() /** * Updates the blocks bounds based on its current state. Args: world, x, y, z */ public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { this.setBlockBounds(MIN_X, MIN_Y, MIN_Z, MAX_X, MAX_Y, MAX_Z); } Choose the min and max based on the example pictures in the link I pasted earlier... Re proxies: :-) thanks Actually it's funny you ask about proxies because I'm just investigating that myself now and I'll probably put it up on the website in a week or two (depending how long it takes me to figure all the details out!) -TGG
  12. Hi Minecraft has a method to do this (take a 2D texture and turn it into a "slice" with thickness), you should be able to adapt it without too much trouble..? ItemRenderer: /** * Renders an item held in hand as a 2D texture with thickness */ public static void renderItemIn2D(Tessellator par0Tessellator, float par1, float par2, float par3, float par4, int par5, int par6, float thickness) see also http://greyminecraftcoder.blogspot.com.au/2013/08/rendering-dropped-items.html http://greyminecraftcoder.blogspot.com.au/2013/08/rendering-first-person-view-items.html -TGG
  13. Hi you might find this helpful http://greyminecraftcoder.blogspot.com/2013/08/rendering-items.html and the other item link in here http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html -TGG
  14. Hi I'd suggest that it's probably more efficient to make your "booster" blocks into TileEntities. Unlike normal blocks, TileEntity is stored in a list with [x,y,z] coordinate which makes it relatively easy to find if there aren't too many - just ask WorldServer.getAllTileEntityInBox for a list of all tile entities in a certain [x,y,z] range, then step through them to find all the booster blocks. NB this needs to be done on the server side. -TGG WorldServer.getAllTileEntityInBox /** * pars: min x,y,z , max x,y,z */ public List getAllTileEntityInBox(int par1, int par2, int par3, int par4, int par5, int par6)
  15. Hmmm that's a bit of a mystery to me... The code which renders the damage bar is in RenderItem.renderItemOverlayIntoGUI if (par3ItemStack.isItemDamaged()) { int k = (int)Math.round(13.0D - (double)par3ItemStack.getItemDamageForDisplay() * 13.0D / (double)par3ItemStack.getMaxDamage()); int l = (int)Math.round(255.0D - (double)par3ItemStack.getItemDamageForDisplay() * 255.0D / (double)par3ItemStack.getMaxDamage()); I would suggest damaging your item, releasing the right button (so the damage should go to zero), then put a breakpoint on the if(..) line and inspecting par3ItemStack to see why the renderer thinks it is damaged. Either resetting the damage to zero isn't working, or it's the wrong ItemStack, or there's something subtle going on with the use of setDamage (can't think what) -TGG
  16. Hi I don't know of anything stopping them from being wider than the block (although it may lead to strange behaviour). For example the Beacon does this in TileEntity public AxisAlignedBB getRenderBoundingBox() { AxisAlignedBB bb = INFINITE_EXTENT_AABB; Block type = getBlockType(); if (type == Block.enchantmentTable) { bb = AxisAlignedBB.getAABBPool().getAABB(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); } else if (type == Block.chest || type == Block.chestTrapped) { bb = AxisAlignedBB.getAABBPool().getAABB(xCoord - 1, yCoord, zCoord - 1, xCoord + 2, yCoord + 2, zCoord + 2); } else if (type != null && type != Block.beacon) { AxisAlignedBB cbb = getBlockType().getCollisionBoundingBoxFromPool(worldObj, xCoord, yCoord, zCoord); if (cbb != null) { bb = cbb; } } return bb; } i.e. has an infinite bounding box for rendering -TGG
  17. Hi Just a guess - The vanilla code in EntityPlayerMP has a loop in the constructor while (!par2World.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty()) { this.setPosition(this.posX, this.posY + 1.0D, this.posZ); } It looks to me like it keeps trying to find a position where the player can spawn, that doesn't collide with any blocks in the world. Every time it does this, it creates a few bounding boxes. If this keeps looping indefinitely, eventually you will run out of memory. Mind you, I don't understand why it doesn't stop colliding when posY reaches 256 or above since there shouldn't be anything up there? You could verify this by putting some logging code in there eg while (!par2World.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty()) { System.out.println("this.setPosition(" + this.posX + ", " + this.posY + ", " + this.posZ + ");" ); this.setPosition(this.posX, this.posY + 1.0D, this.posZ); } How this might be caused by your config code? beats me.... unless of course your world is filled entirely with compressed dirt? -TGG
  18. Hi I guess the pizza is a block not an item? This link might help http://greyminecraftcoder.blogspot.com.au/2013/07/rendering-non-standard-blocks.html -TGG
  19. Hi To be honest I don't really understand what your code is supposed to do, but I'm pretty sure it's not right... your TileEntity.getRenderBoundingBox() needs to create a bounding box that encloses the entire TileEntity. If your TileEntity is three blocks wide, then the bounding box needs to enclose it. Perhaps you could explain how your TileEntities interact with each other - how big they are, how they render differently. How many TileEntities are in the screenshot to make up the double loop thing? By the way I think the reason it's not rendering at all with the code below is because your bounding box needs to enclose the coordinates of the TileEntity, not 0,0,0 to [1,1,1] eg bb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); not bb = AxisAlignedBB.getBoundingBox(0,0,0,1,1,1); And actually the vanilla code usually uses eg bb = AxisAlignedBB.getAABBPool().getAABB(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); (I don't know why) I don't think extending Block's BoundingBox will help. -TGG
  20. Hi This sample code might be of interest... http://greyminecraftcoder.blogspot.com.au/2013/09/sample-code-for-rendering-items.html (BlockPyramid) Is very similar to the code Busti has posted... -TGG
  21. Hi Sounds like the lighting settings are wrong - Minecraft uses a few different lighting settings which can make your objects look lighter or darker depending on the light source. Do you know about Tessellator.setNormal, .setBrightness, RenderHelper.disableStandardItemLighting, etc? Sometimes the world lighting is updated slowly, so that certain sides of blocks look dark until the game updates the lighting for that block. This happens with vanilla code too. A link or two which might help with lighting settings.... http://greyminecraftcoder.blogspot.com.au/2013/07/block-rendering.html http://greyminecraftcoder.blogspot.com.au/2013/08/lighting.html http://greyminecraftcoder.blogspot.com.au/2013/08/the-tessellator.html http://greyminecraftcoder.blogspot.com.au/2013/09/custom-item-rendering-using.html -TGG
  22. Hi Is your itemstack.setItemDamage(0); actually called? (Checked it with a breakpoint or a System.out.println("itemstack.setItemDamage(0) called"); -TGG
  23. Hi Just a question - why do you need to change the bounding box of a block? If you change it for one block, it will change for all blocks in the world with the same ID since they are all the same instance and the only difference between them is their [x,y,z] and metadata information-? Perhaps you actually need to "pull" the bounding box from the associated TileEntity instead? (eg override Block.getCollisionBoundingBoxFromPool or Block.getSelectedBoundingBoxFromPool to retrieve the information from the block's TileEntity) Alternatively, you could rely on the bounding box of the TileEntity instead of the block, depending on what you are trying to do? -TGG
  24. Hi Wish I'd heard of that before. Do you have a link with more information on it, and where/how it's called from the vanilla code? @TheGreyGhost: Well, the difference to my mind is that the second strategy (overriding a single method) is less likely to be broken if the vanilla classes are updated, compared with overwriting the entire class with a modified copy, or god forbid relying on the bytecode being the same. But I agree it's not as robust as using the forge methods. I agree with you that both ASM and reflection are very powerful tools in the hands of the Java uebercoder, unfortunately those ranks don't include me :-) I also doubt that the extra flexibility is really necessary unless you're doing forge-like magic, i.e. you need to link in other classes at runtime and you don't know in advance what they are. (I understand the ethical objections against shipping even small parts of the Minecraft code, to be honest I really doubt that the Mojang folks would care that much given how long Forge was doing it). At the end of the day I prefer to use chainsaws for cutting trees rather than trimming my nails, and I struggle enough with getting my code to work as it is without trying to get my mind around the extra runtime complexity :-). Maybe once I've got a couple years Java experience I'll think differently... -TGG
  25. Hi yeah it's pretty bad when it just won't work and there aren't any clues why not. I can't see anything obvious wrong with your code (but then - I've never made a custom furnace so that's not saying much..!) So your campfire is pretty much exactly like the vanilla furnace except it looks different, yeah? And when you fixed the particles problem, the progressbar counter messed up? What change did you make that stopped the progressbar from working properly? From memory the vanilla furnace works through a GUIHandler of some sort and there is some fairly complicated synchronisation going on between the client and the server. Also, the furnace changes its blockID depending on whether it is burning or not. So if you get really stuck, I would suggest starting by making an exact copy of the vanilla furnace blocks, tileentity, Container, and GUI classes, and tweaking them one bit at a time to add the various effects you want. Sorry I can't be of more help, I haven't fooled with the furnace at all so this is all guesswork for me -TGG
×
×
  • Create New...

Important Information

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