Jump to content

TheGreyGhost

Members
  • Posts

    3280
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by TheGreyGhost

  1. Your Teleporter code could mark a flag to say "Player X is about to teleport" and when the PlayerChangedDimensionEvent occurs, you will know that it was caused by your teleporter. If the PlayerChangedDimensionEvent occurs but the Teleporter flag is not set for that player, you know it was another portal that did it. -TGG
  2. Hi You've imported the wrong Random. you need java.util.Random not scala.util.Random. For this reason the signature of updateTick doesn't match the base class, so it's not called as you expected, and is why @Override tells you there is a problem. -TGG
  3. Hi Although my line numbers don't link up with yours, I'm guessing the crash is on this line in getTopSolidOrLiquidBlock if (l != 0 && Block.blocksList[l].blockMaterial.blocksMovement() && Block.blocksList[l].blockMaterial != Material.leaves && !Block.blocksList[l].isBlockFoliage(this, x, k, z)) Probably this means that your custom biome has added a new block but you've forgotten to initialise it, so Block.blocksList[l] is still null. -TGG
  4. Hi Looks to me like you are initialising your crafting handler before you have initialised all the items that it uses. You should initialise your blocks, items, and register them in preInit. The recipes should be in load. This link might help explain it further (see Event Handling section) http://greyminecraftcoder.blogspot.com.au/2013/11/how-forge-starts-up-your-code.html -TGG
  5. Ah yeah you're right, I assumed that's what he/she meant, but maybe not @bOh: keen, good luck with it -TGG
  6. Hi That is determined in EntityRenderer.getMouseOver, in particular this bit double d0 = (double)this.mc.playerController.getBlockReachDistance(); this.mc.objectMouseOver = this.mc.renderViewEntity.rayTrace(d0, par1); i.e. PlayerControllerMP:: public float getBlockReachDistance() { return this.currentGameType.isCreative() ? 5.0F : 4.5F; } I don't think there is any easy way to replace PlayerControllerMP with your own class so that you could override getBlockReachDistance(). You will probably need to use ASM + Reflection to change it, I think. There are a few tutorials available on google and on this forum, never used it myself. -TGG
  7. Hi Look into Block.onBlockAdded, Block.canPlaceBlockAt, and Block.onBlockPreDestroy. If you use these to keep track of whether your block is placed or not, you can stop block placement if one already exists. You will need to store the block count somewhere permanent, i.e. so it gets saved every time the world is saved. You could look into world.perWorldStorage for that. -TGG
  8. Hi The problem is - what you are trying to do is create a metadata wall, even though you don't think you are. Coloured blocks (eg wool) store their colour using metadata. So if you want your wall to be made of blocks of different colours, it needs to be a metadata wall. This link might help you understand it better - see the Blocks topics. http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html It is trivial to add a parameter to your constructor for the colour public WallBlock(Block block, int i_metadata) but it's not going to help you any because the metadata is separate from the block, and you will wind up creating 16 different blocks, instead of 1 block with 16 metadata values. In order to place a block with a particular metadata, you need to set up the Item that is used to place the block - ItemBlock- that is what tattyseal meant. For example see ItemCloth, which is used to place wool blocks. Wuppy29 has some very useful tutorials for that. Once the metadata is correct, override the getIcon in the way I suggested to make it return the correct colour when drawing the wall. -TGG
  9. > I was able to get the Icons to show the correct cobblestone color, but when I placed it, it showed a black cobblestone wall, being 0 on the metadata Yes, because you are throwing away the metadata information in this call public IIcon getIcon(int side, int meta) { return icon.getBlockTextureFromSide(side); } use icon.getIcon(int side, int meta) instead -TGG
  10. It's in EntityAgeable. It's used by vanilla to change the size of an entity based on whether it's a child or not. Just changes the size relative to the "normal" size, nothing special. -TGG
  11. Hi Show your code? I suspect what you're trying to do won't be possible in the way you think, because BlockWall already uses metadata for something else. But there's nothing to stop you extending BlockWall with your own Block and overriding the method which returns the texture for rendering getIcon() and a couple of the others as necessary eg getSubBlocks() -TGG
  12. I'm pretty sure it is- although GUI containers do some funny stuff it's true and I don't understand all of it properly. If it doesn't work with an open GUI, then you could try accessing the GUIContainer inventory instead of the player inventory. -TGG
  13. Hi This link might help you debug a NullPointerException http://www.terryanderson.ca/debugging/run.html It nearly always means you've accidentally used a variable before you initialised it (eg with variable = new MyObject() or similar) If you still can't find it, post your CraftingHandler class. -TGG
  14. Hi I would personally approach this by having the ItemTooltipEvent look up which recipes for that Item are available in the player's inventory. Your code should be able to get access to the player's inventory easily though Minecraft.getMinecraft().thePlayer, because there is only one ? Is there any reason that's not suitable? -TGG
  15. Hi The piston will break your block if it's made of the wrong material - perhaps that is the problem. Look at Block.getMobilityFlag() for clues. If no joy with that, try looking in BlockPistonBase.tryExtend() to get a better idea of what is happening; perhaps this line block.dropBlockAsItemWithChance(p_150079_1_, i1, j1, k1, p_150079_1_.getBlockMetadata(i1, j1, k1), chance, 0); -TGG
  16. Hi Yes it is outdated, luckily the concepts haven't changed. It sounds like your changes are right. Does it work it now? If not, post your code again? -TGg
  17. Hi This link might help explain some of the background concepts; see the Item Rendering sections http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html Your code wouldn't work in 1.7.2 anyway, it is missing several things. For example this- what happens if render type is EQUIPPED_BLOCK? @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { if(type == IItemRenderer.ItemRenderType.ENTITY) GL11.glTranslatef(-0.5F, 0.0F, -0.5F); this.render.renderTileEntityAt(this.entity, 0.0D, 0.0D, 0.0D, 0.0F); } -TGG
  18. Hi I think you need randomDisplayTick() and (perhaps - not sure-) this.setTickRandomly(true); Try looking at BlockTorch for clues. Just a general tip - whenever you're overriding a method from a base class (in this case Block), it's a good idea to put @Override before the method. That will help pick up several confusing errors. -TGG
  19. Ah ok. It sounds like your TileEntity on the client is not being updated with the data from the Server. You are probably missing getDescriptionPacket and onDataPacket-? Check out this link: http://widux.net/wiki/index.php?n=ModdingTutorials.BasicTileEntity -TGG
  20. gracious me is this thread still going? So what are we trying to accomplish? After the block is freshly placed, it should check all four spaces next to it, on the same y level. If any of them are empty, and the block underneath the empty space is full, then we fill the space with our block. That's it! Each time we place our block, it will schedule a random UpdateTick, so after a bit of time, that new block will be called with UpdateTick to check for adjacent spaces, and so on, until the block spreads out over the entire plateau. So long as we keep that in mind, the code for that is really pretty simple. No need for random stuff, no need to try the same twenty seven locations 45000 times. public void updateTick(World world, int x, int y, int z, Random random) { if (!world.isRemote) { // execute on server side only to avoid strange ghost blocks and disturbing things checkAndFillBlock(world, x - 1, y, z); checkAndFillBlock(world, x + 1, y, z); checkAndFillBlock(world, x, y, z - 1); checkAndFillBlock(world, x, y, z + 1); } } // check if this block is empty (air) and the block underneath it is solid (not air). If so, fill it with the this Block private void checkAndFillBlock(World world, int wx, int wy, int wz) { if (world.getBlock(wx, wy, wz) == Blocks.air && world.getBlock(wx, wy-1, wz) != Blocks.air) { world.setBlock(wx, wy, wz, this); } } All that other stuff is baggage that I'm guessing you probably don't want, eg getBlockLightValue -> only growing near torches or glowstone. -TGG
  21. Hi This link might help you with the concepts http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html (See the block rendering sections, especially http://greyminecraftcoder.blogspot.com.au/2013/07/rendering-standard-blocks-cubes.html) Hopefully that should help you understand the vanilla code better -TGG
  22. By crikey dude, where did that 45000 come from? You will be running that setBlock loop 45000 times for every block you add. for (int l = 0; l < 45000; ++l) { Another question - what's the point of having a random value for y? And in fact, why are you using random values for x and z as well? Why not just try the four adjacent blocks? This link might help you a bit, perhaps? http://greyminecraftcoder.blogspot.com.au/2013/07/blocks.html -TGG[/code]
  23. Hi I've been trying to use Block.rotateBlock() and I think it could be helpful to provide a method to do out-of-place rotation, i.e. instead of changing the block's metaData, it could accept a "current" metadata value and return the rotated metadata, and let the caller perform the setBlock. A number of blocks break if you try to rotate them in place without changing their neighbours too, eg bed, ladder, sign. It's possible to place multiple blocks at once without them breaking, but only if you know all the rotated metadata in advance. -TGG
  24. Hi What does this line give you this.orientation = ForgeDirection.getOrientation(nbtTagCompound.getInteger("orientation")); System.out.println("readFromNBT- orientation:", this.orientation); Actually, would you pls copy the console output from 1) before the save; and then 2) after exiting the world and reloading it -TGG
  25. Hi Yeah I imagine that Minecraft maintains a read lock on the world files even if it's not saving, so you won't be able move the files. You would need to force minecraft to detach itself from the files, move the files, and then reattach and reload all the chunks again. See ChunkProviderServer and IChunkLoader / AnvilChunkLoader. I'm sure it's possible with enough poking around in the guts of vanilla but I suspect it wouldn't be very robust. Perhaps you can achieve the effect you want a different way- for example, instead of copying new data into the existing world, you could put everything in a new (parallel) dimension and then "invisibly" teleport players there when you want to "update" the world. No need to mess around with files at all then. -TGG
×
×
  • Create New...

Important Information

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