Jump to content

QuantumLeaf7895

Members
  • Posts

    33
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

QuantumLeaf7895's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. So I was double-checking my read/writeFromNBT methods and in the process noticed that the onDataPacket method didn't actually change the tile entity's data. . . thanks for the suggestions, though. Problem's fixed, for now. God only knows how onDataPacket could somehow not change the tile entity's data while sneakily appearing to. (Although LexManos would probably know better. . .)
  2. So. . . new problem: I've figured out how to sync server and client data, but on world load/unload the client's tile entity resets. Is there any way to automatically send a tile entity description packet when the tile entity's chunk is loaded?
  3. Thanks for that, onDataPacket did the trick. (I can't help but wonder why most vanilla TE classes don't override it. . . ah well, the packet must be handled elsewhere in the code)
  4. Aren't containers designed to be used with GUIs? I'm trying to use TE data to control what textures a block should be rendered with, similar to how signs use TE data to control what text to display. I've tried using getTileEntityDescriptionPacket(), but I can't make the game process built-in (or custom!) TE description packets. I'm working on using Forge's packet handling structure, but although I've managed to send xyz coordinates from server to client I have no idea how to send which world the coordinates originate from. (Strangely, neither Packet132TileEntityData nor Packet130UpdateSign seem to have a "world" field, yet both obviously allow minecraft to identify where the described TE is located. . . must look into that.)
  5. Isn't there a method (getBlockTexture) that takes IBlockAccess as a parameter and returns an icon to display? I was under the impression that the method could be used to grab a block's TE and use data from that to choose a texture to display on a certain side.
  6. So I want to use tile entity data to control what texture the related block uses, a bit like how IndustrialCraft fits so many types of blocks into a single ID, but the problem is that the client stubbornly refuses to store any tile entity data. How can I make the server send tile entity data? I've tried using tile entity description packets but I can't seem to make the client process them. EDIT: So I've figured out how to sync server and client data, but on world load/unload the client's tile entity resets. Is there any way to automatically send a tile entity description packet when the tile entity's chunk is loaded?
  7. Firstly: You can rename parameters in overridden methods. getCollisionBoundingBoxFromPool(World world, int x, int y, int z) is *far* easier on the eyes than (World par1, int par2. . .). Secondly, take another look at the fence's code -- you've changed the collision box so that, instead of starting at the relevant block's x, y, and z coordinates, it starts at the (2,2,2) coordinate -- four levels deep in bedrock, not too far from the initial spawn in the x and z directions, no matter where the relevant block actually *is*. And I apologize that my knowledge of the minecraft engine is somewhat limited, but you might have problems with your block if it extends across chunks. In general, if a something needs to have a collision box larger than 1 block multiple blocks are used instead -- the top and bottom of a door are technically separate blocks, as is the arm of a piston. The fence (and fence gate) is vanilla minecraft's only block that has a collision box extending beyond it's 1x1x1 m cube.
  8. I've also thought about making a block that requires a tool to harvest, but that method doesn't specify what level of tool is required, only that one is. How does vanilla minecraft prevent ore blocks from being mined with wooden picks? I haven't been able to find an example. And what exactly does that "unique block name" in the registerBlock method do? What does it mean, is it different from setBlockName or LanguageRegistry.addName?
  9. At risk of putting my foot in my mouth, there are two problems with your method. Firstly, you're using getSelectedBoundingBoxFromPool. This method, as the name *and javadoc* imply, only affects what happens when a player puts their cursor over the block (and is client-side only, to boot). Take a look at BlockFence, that block is technically 1.5 blocks tall and has an example of what you're trying to do. In addition, I'm worried by your use of 'var5's and 'par2's and other anonymous variables -- it makes code terribly difficult to read. MCP-decompiled code looks like that only because of how the vanilla minecraft code has to be deobfuscated and decombiled. Variable names *that represent what the variable does* are much, much better -- take a look at the methods near the end of Block.java, specifically the bit after the "FORGE START" comment for an example of what I'm talking about.
  10. Hi all, I've been having trouble getting block updates to work properly in two separate places. Firstly, I have a class that uses tile entity data to determine what sprites should go where: @Override @SideOnly(Side.CLIENT) public int getBlockTexture(IBlockAccess access, int x, int y, int z, int side) { if (!(access.getBlockTileEntity(x, y, z) instanceof TileEntityLavaPlate)) { return 0; } TileEntityLavaPlate te = (TileEntityLavaPlate)access.getBlockTileEntity(x, y, z); return (te.getPositionInMacro() != -2) ? 117 : 102; } Else where in the class, I have the following bit of code inside an onBlockAdded method: tileEntity = (TileEntity3x1x3Try2)world.getBlockTileEntity(x, y, z); tileEntity.setPositionInMacro(0); world.markBlockForUpdate(x, y, z); System.out.println("Made Macro Block"); The markBlockForUpdate's javadoc states that the method will re-send tile entity data from server to client, but I can never get the block's texture to change, even when I do get console output when the block is added. Possibly relatedly, I've been working on an item that, when right-clicked, places water source blocks in the world. The only problem is, while I can place a water source block, the placed block is 'still,' and won't spread. How can I make the block update itself? world.setBlockAndMetadataWithNotify(x, y, z, Block.waterStill.blockID, 0); world.scheduleBlockUpdate(x, y, z, Block.waterStill.blockID, 2);
  11. Hi all, I've been working on two unrelated things: The first is a type of item that functions a kind of bucket -- on right-clicking, it can place a liquid source block inside the world. The problem is that after placing the source block, minecraft stubbornly refuses to check if the block (lava or water) can propagate 'flowing' water blocks (IE, such as when a liquid source block is placed above an air or snow block). I'm using the following code inside an onItemRickClickMethod to place the block: world.setBlockWithNotify(x, y, z, liquidToPlaceID); //Where x, y, and z are variables derived from a getMovingObjectPositionFromPlayer's blockX,blockY, and blockZ fields world.scheduleBlockUpdate(x, y, z, liquidToPlaceID, Block.blocksList[liquidToPlaceID].tickRate()); What am I doing wrong? In addition, I'm trying to make a block that outputs redstone. The problem is, while it *will* indirectly power adjacent blocks (shutting off redstone torches, powering two-block-away redstone wires, etc), it won't ever directly power an adjacent redstone block. I'm using the following code to output redstone power (in an block that extends BlockContainer, if that's relevant): @Override public boolean canProvidePower() { return true;//Note redstone will still *render* a connection to this block, it just won't ever be powered by it } @Override public boolean isProvidingStrongPower(IBlockAccess access, int x, int y, int z, int side) { return true; } What am I doing wrong?
  12. I admit that I don't have that much experience with minecraft MP modding, but your insistence of modifying certain values the server should know about client-side only worries me. There are few occasions where doing something serverside but not clientside can go wrong (because the server can update the client about changes), but many where doing something clientside but not serverside can (because the server, IIRC, overrides the client if entity location, block ID at location, etc. differ from one to the other). Some combing of minecraft's ItemStack.java class makes me wonder if the entire removeItemFromPlayer method isn't redundant, and is actually the cause of the problem -- ItemStack's damageItem does something similar (make an itemstack null), but in a slightly different manner. I suggest you check it out.
  13. World.java has a couple methods for setting a block at an arbitrary location to an arbitrary ID -- you probably want to look into those
  14. Precisely what do you mean by that? Something two blocks tall? Something snowman style? Something else? My usual advice for rendering is to look through buildcraft's and EE3's source for something vaguely similar to what you want, and tinker with it until you get the desired result -- though an instinct of mine says that RenderBlock's updateCustomBlockBounds method could be useful for what I *think* you want (which is snowman style)
  15. IIRC, it's in-world block metadata that's limited to 16, an item's damage value should be able to store a range of values more-or-less the same size as java's int type.
×
×
  • Create New...

Important Information

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