Remove all raw usages of BSH, improve API generics

This commit is contained in:
Kenzie Togami
2018-12-26 16:39:10 -08:00
committed by IronApollo
parent 1d87642b52
commit 590b7e23a9
105 changed files with 372 additions and 347 deletions

View File

@ -131,7 +131,7 @@ public class RegionIntersection extends AbstractRegion {
return false;
}
@SuppressWarnings({"unchecked", "rawtypes"})
@SuppressWarnings({"unchecked"})
@Override
public Iterator<BlockVector3> iterator() {
Iterator<BlockVector3>[] iterators = (Iterator<BlockVector3>[]) new Iterator[regions.size()];

View File

@ -121,7 +121,7 @@ public class EllipsoidRegionSelector implements RegionSelector, CUIRegion {
@Override
public boolean selectPrimary(BlockVector3 position, SelectorLimits limits) {
if (position.equals(region.getCenter()) && region.getRadius().lengthSq() == 0) {
if (position.equals(region.getCenter().toBlockPoint()) && region.getRadius().lengthSq() == 0) {
return false;
}

View File

@ -24,7 +24,7 @@ import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BaseBlock;
/**
* Generates solid and hollow shapes according to materials returned by the
@ -51,7 +51,7 @@ public abstract class ArbitraryShape {
* @param defaultMaterial The material returned by the pattern for the current block.
* @return material to place or null to not place anything.
*/
protected abstract BlockStateHolder getMaterial(int x, int y, int z, BlockStateHolder defaultMaterial);
protected abstract BaseBlock getMaterial(int x, int y, int z, BaseBlock defaultMaterial);
/**
* Generates the shape.
@ -71,7 +71,7 @@ public abstract class ArbitraryShape {
int z = position.getBlockZ();
if (!hollow) {
final BlockStateHolder material = getMaterial(x, y, z, pattern.apply(position));
BaseBlock material = getMaterial(x, y, z, pattern.apply(position));
if (material != null && editSession.setBlock(position, material)) {
++affected;
}
@ -79,7 +79,7 @@ public abstract class ArbitraryShape {
continue;
}
final BlockStateHolder material = getMaterial(x, y, z, pattern.apply(position));
BaseBlock material = getMaterial(x, y, z, pattern.apply(position));
if (material == null) {
continue;
}

View File

@ -21,7 +21,7 @@ package com.sk89q.worldedit.regions.shape;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BaseBlock;
/**
* Generates solid and hollow shapes according to materials returned by the
@ -34,7 +34,7 @@ public class RegionShape extends ArbitraryShape {
}
@Override
protected BlockStateHolder getMaterial(int x, int y, int z, BlockStateHolder defaultMaterial) {
protected BaseBlock getMaterial(int x, int y, int z, BaseBlock defaultMaterial) {
if (!this.extent.contains(BlockVector3.at(x, y, z))) {
return null;
}