Advertisement
riking

Untitled

Apr 21st, 2014
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. // MaterialData matdata;
  2. // BlockState blockstate;
  3. // Block mechanism;
  4. // blockstate = mechanism.getBlockState();
  5.  
  6. // save the block state and fire an update
  7. blockstate.setData(matdata);
  8. blockstate.update(true);
  9.  
  10. // FIXME BUKKIT-1858
  11. // if (!UNOFFICIAL_SERVER_WITH_WORKAROUND) {
  12. if (true) {
  13.     // Determine attached block
  14.     BlockFace face = BlockFace.SELF;
  15.     if (matdata instanceof Attachable) {
  16.         face = ((Attachable) matdata).getAttachedFace();
  17.     } else if (matdata instanceof PressurePlate) {
  18.         face = BlockFace.DOWN;
  19.     }
  20.  
  21.     Block atch = mechanism.getRelative(face);
  22.     BlockState stat = atch.getState(); // Store the state, to reapply it
  23.     // Trying to update with no changes does nothing, so we first set it to air, with no physics (so that the mechanism doesn't come off).
  24.     atch.setTypeId(0, false);
  25.     stat.update(true); // Reapply the state
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement