Any idea how to overwride block physics?

Discussion in 'Plugin Development' started by BRampersad, May 16, 2013.

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

    BRampersad

    I want to override block physics so i can make them move, like fallingsand but any type of block and in any direction. I was able to modify FallingSand's update logic but it seems like FallingSand is a client effect. That means that Bukkit sends the initial conditions to the client and the client shows the falling motion instead of Bukkit sending the delta x,y and z on each tick and the client changes the block position. I know this because even tho i change the update logic, the client still spawns the fallingblock and makes it fall then the block teleports back to where it should have been under my logic and repeats. The other way i tried was to manually move the blocks using the toplevel bukkit api and not overwriting any block physics in NMS but this has the effect of not being a smooth transition. The block can only move in increments of 1 block and not lie in non-integer coordinates.

    So anyone tried to modify block phsyics and make it smooth? I know its possible (faking piston animation, lava etc?), just need a helping start of where to look and what to override.

    Thanks.
     
  2. Offline

    desht

    I had a play with FallingBlock entities a few months ago (with the aim of making a gravity-gun style plugin), and ultimately came to the same conclusion as you did; too much is happening on the client side for it to work smoothly on the server side, even with some NMS hackery (messing with a subclassed EntityFallingBlock to override its default tendency to fall - see the l_() methods in EntityFallingBlock).

    While it's possible to make a falling block entity "float" on the server side, the client still thinks it's falling and animates it as such. Experimenting with resetting the block's position every tick just lead to horribly twitchy entities - not pretty.

    There was a thread about this a year or so ago: http://forums.bukkit.org/threads/spawn-a-falling-block.93254 - might be of interest.
     
  3. Offline

    BRampersad

    Yeah looks like this isn't possible without major glitching or moving blocks 1 block at a time and replacing the old block with air.
     
Thread Status:
Not open for further replies.

Share This Page