All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fastasyncworldedit.core.extent.BlockTranslateExtent Maven / Gradle / Ivy

Go to download

Blazingly fast Minecraft world manipulation for artists, builders and everyone else.

There is a newer version: 2.9.2
Show newest version
package com.fastasyncworldedit.core.extent;

import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;

public class BlockTranslateExtent extends AbstractDelegateExtent {

    private final int dx;
    private final int dy;
    private final int dz;

    public BlockTranslateExtent(Extent extent, int dx, int dy, int dz) {
        super(extent);
        this.dx = dx;
        this.dy = dy;
        this.dz = dz;
    }

    @Override
    public > boolean setBlock(BlockVector3 location, T block) throws WorldEditException {
        return getExtent().setBlock(location.getX() + dx, location.getY() + dy, location.getZ() + dz, block);
    }

    @Override
    public > boolean setBlock(int x, int y, int z, T block) throws WorldEditException {
        return getExtent().setBlock(x + dx, y + dy, z + dz, block);
    }

    @Override
    public boolean setBiome(BlockVector3 position, BiomeType biome) {
        return super.setBiome(position.add(dx, dy, dz), biome);
    }

    @Override
    public boolean setBiome(int x, int y, int z, BiomeType biome) {
        return super.setBiome(x + dx, y + dy, z + dz, biome);
    }

    @Override
    public BiomeType getBiome(BlockVector3 position) {
        return super.getBiome(position.add(dx, dy, dz));
    }

    @Override
    public BlockState getBlock(BlockVector3 location) {
        return getBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ());
    }

    @Override
    public BlockState getBlock(int x, int y, int z) {
        return super.getBlock(x + dx, y + dy, z + dz);
    }

    @Override
    public BaseBlock getFullBlock(BlockVector3 pos) {
        return super.getFullBlock(pos.add(dx, dy, dz));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy