Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // MaterialData matdata;
- // BlockState blockstate;
- // Block mechanism;
- // blockstate = mechanism.getBlockState();
- // save the block state and fire an update
- blockstate.setData(matdata);
- blockstate.update(true);
- // FIXME BUKKIT-1858
- // if (!UNOFFICIAL_SERVER_WITH_WORKAROUND) {
- if (true) {
- // Determine attached block
- BlockFace face = BlockFace.SELF;
- if (matdata instanceof Attachable) {
- face = ((Attachable) matdata).getAttachedFace();
- } else if (matdata instanceof PressurePlate) {
- face = BlockFace.DOWN;
- }
- Block atch = mechanism.getRelative(face);
- BlockState stat = atch.getState(); // Store the state, to reapply it
- // 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).
- atch.setTypeId(0, false);
- stat.update(true); // Reapply the state
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement