crwdns122147:0crwdne122147:0

crwdns122149:0crwdne122149:0

crwdns122151:0:javadoc:crwdnd122151:0:javadoc:crwdnd122151:0:javadoc:crwdne122151:0

import org.spongepowered.api.block.BlockTypes;
import org.spongepowered.api.world.Location;
import org.spongepowered.api.world.World;

public void setToSponge(Location<World> blockLoc) {
    blockLoc.setBlockType(BlockTypes.SPONGE);
}

crwdns122153:0:javadoc:crwdne122153:0

crwdns122155:0crwdne122155:0

crwdns122157:0:javadoc:crwdnd122157:0:javadoc:crwdnd122157:0:javadoc:crwdne122157:0

import org.spongepowered.api.Sponge;
import org.spongepowered.api.block.BlockState;
import org.spongepowered.api.data.manipulator.mutable.WetData;

public void setToWetSponge(Location<World> blockLoc) {
    BlockState state = BlockTypes.SPONGE.getDefaultState();
    WetData wetness = Sponge.getDataManager().
        getManipulatorBuilder(WetData.class).get().create();
    wetness.set(wetness.wet().set(true));
    BlockState newState = state.with(wetness.asImmutable()).get();
    blockLoc.setBlock(newState);
}

crwdns122159:0:javadoc:crwdnd122159:0:javadoc:crwdne122159:0

crwdns122161:0crwdne122161:0

import org.spongepowered.api.data.key.Keys;
import
    org.spongepowered.api.data.manipulator.immutable.block.ImmutableDirtData;
import org.spongepowered.api.data.manipulator.mutable.block.DirtData;
import org.spongepowered.api.data.type.DirtTypes;

public void dirtToPodzol(Location<World> blockLoc) {
    BlockState state = blockLoc.getBlock();
    Optional<ImmutableDirtData> dirtDataOpt =
        state.get(ImmutableDirtData.class);

    if (dirtDataOpt.isPresent()) {
        DirtData dirtData = dirtDataOpt.get().asMutable();
        dirtData.set(Keys.DIRT_TYPE, DirtTypes.PODZOL);
        BlockState dirtState = state.with(dirtData.asImmutable()).get();
        blockLoc.setBlock(dirtState);
    }
}

crwdns122163:0:javadoc:crwdne122163:0

crwdns122165:0:javadoc:crwdne122165:0

import
    org.spongepowered.api.data.manipulator.immutable.block.ImmutableWetData;

public void dry(Location<World> blockLoc) {
    BlockState wetState = blockLoc.getBlock();
    Optional<BlockState> dryState = wetState.without(ImmutableWetData.class);
    if (dryState.isPresent()) {
        blockLoc.setBlock(dryState.get());
    }
}

crwdns122167:0:javadoc:crwdne122167:0

crwdns122169:0crwdne122169:0

crwdns122171:0:javadoc:crwdnd122171:0:javadoc:crwdne122171:0

import org.spongepowered.api.block.BlockSnapshot;

public void copyBlock(Location<World> from, Location<World> to) {
    BlockSnapshot snapshot = from.createSnapshot();
    to.setBlock(snapshot.getState());
}