crwdns141731:0crwdne141731:0

crwdns141735:0crwdne141735:0

crwdns156487:0:javadoc:crwdnd156487:0:javadoc:crwdnd156487:0:javadoc:crwdne156487:0

import org.spongepowered.api.block.BlockTypes;
import org.spongepowered.api.world.server.ServerLocation;
import org.spongepowered.api.world.server.ServerWorld;

public void setToSponge(ServerLocation blockLoc) {
    blockLoc.setBlockType(BlockTypes.SPONGE);
}

crwdns141739:0:javadoc:crwdne141739:0

crwdns141741:0crwdne141741:0

crwdns156489:0:javadoc:crwdnd156489:0:javadoc:crwdnd156489:0:javadoc:crwdne156489:0

import org.spongepowered.api.Sponge;
import org.spongepowered.api.block.BlockState;
import org.spongepowered.api.data.Keys;

public void setToWetSponge(ServerLocation blockLoc) {
    BlockState state = BlockTypes.SPONGE.get().getDefaultState();
    BlockState newState = state.with(Keys.IS_WET, true).get();
    blockLoc.setBlock(newState);
}

crwdns156491:0:javadoc:crwdnd156491:0:javadoc:crwdne156491:0

crwdns156493:0crwdne156493:0

public void faceEast(ServerLocation blockLoc) {
    BlockState state = blockLoc.block();
    Optional<BlockState> withEastState = state.with(Keys.DIRECTION, Direction.EAST);
    if (withEastState.isPresent()) {
        blockLoc.setBlock(dirtState);
    }
}

crwdns156495:0:javadoc:crwdne156495:0

public void dry(ServerLocation blockLoc) {
    BlockState wetState = blockLoc.block();
    Optional<BlockState> dryState = wetState.without(Keys.IS_WET);
    if (dryState.isPresent()) {
        blockLoc.setBlock(dryState.get());
    }
}

crwdns156497:0:javadoc:crwdne156497:0

crwdns141755:0crwdne141755:0

crwdns141757:0:javadoc:crwdnd141757:0:javadoc:crwdne141757:0

import org.spongepowered.api.block.BlockSnapshot;
import org.spongepowered.api.world.BlockChangeFlags;

public void copyBlock(ServerLocation from, ServerLocation to) {
    BlockSnapshot snapshot = from.createSnapshot();
    to.restoreSnapshot(snapshot, false, BlockChangeFlags.ALL);
}