Change Packets / Make one block look like another.

Discussion in 'Plugin Development' started by Kepler_, Sep 9, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Kepler_

    I want to be able to make all of one type of a block in a world look like another.
    I have nether portals in my spawn...
    Spawn.png
    ... but the obsidian doesn't fit the spawn's theme of stone slabs. How make all obsidian in the spawn world look like double stone slabs (ID=43:6)?

    Also, i cant use worldedit, etc. to change the obsidian because i have a plugin that makes the portals teleport to a specific place. Changing the obsidian will make the plugin not work.

    Thanks!
     
  2. Offline

    Icyene

    Personally I think it looks fine. But the packets won't change anything, as texture is defined by block ID. So there really isn't anything you can do :/
     
  3. Offline

    evilmidget38

    Player has a sendBlockChange method, it should do what you want. It allows you to disguise blocks as other blocks. The only issue here is that you'd have to send these to players whenever they get near the blocks, which ends up as a big complicated process.

    Another option is using a method similar to this one, to make it so it replaces all blocks of one type to another. This is probably more feasible for what you're doing. Just be aware that this may have issues with Players and block breaking(durability of blocks), but in your case, I don't think Players will be breaking the blocks.
     
  4. Offline

    Malikk

    sendBlockChange would only work up until the blocks were clicked on or otherwise had an update, and it would have to be sent multiple times for every player and if actually changing the block's type isn't an option because of a plugin... change your texture pack? lol
     
  5. Offline

    Icyene

    Textures for blocks are handled client side, by block ID. How they act is also defined by block ID. If you changed the block ID of bedrock to that of slabs, it would look like slabs, but not be indestructible/have any of its previous qualities. It would also confuse the real slab. You'd have to do something like:

    Code:Java
    1.  
    2. net.minecraft.server.Block.byId[Block.OBSIDIAN.id] = null;
    3. net.minecraft.server.Block.byId[Block.OBSIDIAN.id] = net.minecraft.server.Block.STONE_SLAB;
    4.  


    But that would change all obsidian to stone slabs, and it would lose the property of even sustaining the creation of a portal. I'm pretty sure that would give an IllegalArgumentException: slot <stone slab id> is already occupied when writing <new block>.

    There really isn't a way do do this properly w/o Spout, and even there it would be glitchy, at best.
     
    evilmidget38 likes this.
  6. Offline

    darkmage0252

    sendBlockChange "disguises" another block with what ever block you want.
     
  7. Offline

    APlusMalware

    This is quite possible without Spout. Changing the packets sent to the client only changes what it appears to the client, not the server. The blocks server side couldn't care less what block ids are sent to the client. Orebfuscator is an excellent example of this.
     
    bobacadodl likes this.
  8. Offline

    bobacadodl

    Couldn't you use sendblockchange and whenever the block gets updated, disguise it again?
     
  9. Offline

    skore87

    You could do a sendblockchange of block id 43 for the doubleslab, or if it is still in the game send 44 with a data of 6 for the look of the top of a stone slab over the whole block.

    Edit: Seems they removed it. :'( Actually it is still "there", but forced to actually be a slab instead of a full block.
     
  10. I think the easiest way would be to change the "plugin that makes the portals teleport to a specific place". If it uses the PlayerPortalEvent it may need a complete rewrite, through...
     
  11. Offline

    Kepler_

    How does orebfuscator change the look of blocks? That seems like what i am looking for.
     
  12. Offline

    skore87

    I'm not trying to be rude, but have you even read the posts on this thread? Everyone's been mentioning the sendblockchange method...
     
    ProSl3nderMan likes this.
  13. Offline

    Kepler_

    I have. I was wondering if orebfuscator used the sendblockchange method, or some other method.
     
  14. Offline

    Kepler_

Thread Status:
Not open for further replies.

Share This Page