update block physics?

Discussion in 'Plugin Development' started by Rogueleader89, Mar 20, 2011.

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

    Rogueleader89

    I'm finishing porting over my plugin from hmod (was waiting for official group support but thats taking too long) but getting snared up on the old hmod etc.getServer().updateBlockPhysics() call. Is there a bukkit equivalent? If not then is there some other way to force redstone wire in an area to check for changes around it? Basically I'm toggling a lever with code and need the toggle to register to turn the redstone on or off.
     
  2. Offline

    Edward Hand

    There are a few functions in the server source that might come in handy. I'd suggest the best to use would be this:
    Code:
    CraftWorld cWorld = (CraftWorld)block.getWorld();
    cWorld.getHandle().h(block.getX(),block.getY(),block.getZ(),block.getTypeId());
    (where 'block' is the lever) which will update the physics of all the blocks around the lever.

    Alternatively, you could use:
    Code:
    CraftWorld cWorld = (CraftWorld)theWorld;
    Block.byId(block.getTypeId()).a(cWorld.getHandle(),block.getX(),block.getY(),block.getZ(),(EntityHuman)null)
    which will simulate clicking on the switch. That does all the block updates and all the rest of it for you, so I'd recommend using that one if you can.
     
  3. Offline

    DiddiZ

    Code:
    block.setData(block.getData() & 127, true);
    Didn' test, but it should enable a lever and apply physics.
     
Thread Status:
Not open for further replies.

Share This Page