mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
Remove all raw usages of BSH, improve API generics
This commit is contained in:
committed by
IronApollo
parent
1d87642b52
commit
590b7e23a9
@ -22,7 +22,7 @@ package com.sk89q.worldedit.util;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@ -32,9 +32,9 @@ import java.util.Objects;
|
||||
public final class LocatedBlock {
|
||||
|
||||
private final BlockVector3 location;
|
||||
private final BlockStateHolder block;
|
||||
private final BaseBlock block;
|
||||
|
||||
public LocatedBlock(BlockVector3 location, BlockStateHolder block) {
|
||||
public LocatedBlock(BlockVector3 location, BaseBlock block) {
|
||||
this.location = checkNotNull(location);
|
||||
this.block = checkNotNull(block);
|
||||
}
|
||||
@ -43,7 +43,7 @@ public final class LocatedBlock {
|
||||
return location;
|
||||
}
|
||||
|
||||
public BlockStateHolder getBlock() {
|
||||
public BaseBlock getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,7 @@ public class TreeGenerator {
|
||||
* @return whether a block was changed
|
||||
* @throws MaxChangedBlocksException thrown if too many blocks are changed
|
||||
*/
|
||||
private static boolean setChanceBlockIfAir(EditSession session, BlockVector3 position, BlockStateHolder block, double probability)
|
||||
private static <B extends BlockStateHolder<B>> boolean setChanceBlockIfAir(EditSession session, BlockVector3 position, B block, double probability)
|
||||
throws MaxChangedBlocksException {
|
||||
return Math.random() <= probability && setBlockIfAir(session, position, block);
|
||||
}
|
||||
@ -263,7 +263,7 @@ public class TreeGenerator {
|
||||
* @return if block was changed
|
||||
* @throws MaxChangedBlocksException thrown if too many blocks are changed
|
||||
*/
|
||||
private static boolean setBlockIfAir(EditSession session, BlockVector3 position, BlockStateHolder block) throws MaxChangedBlocksException {
|
||||
private static <B extends BlockStateHolder<B>> boolean setBlockIfAir(EditSession session, BlockVector3 position, B block) throws MaxChangedBlocksException {
|
||||
return session.getBlock(position).getBlockType().getMaterial().isAir() && session.setBlock(position, block);
|
||||
}
|
||||
}
|
||||
|
@ -51,8 +51,8 @@ public class LocatedBlockList implements Iterable<LocatedBlock> {
|
||||
list.add(setBlockCall);
|
||||
}
|
||||
|
||||
public void add(BlockVector3 location, BlockStateHolder block) {
|
||||
add(new LocatedBlock(location, block));
|
||||
public <B extends BlockStateHolder<B>> void add(BlockVector3 location, B block) {
|
||||
add(new LocatedBlock(location, block.toBaseBlock()));
|
||||
}
|
||||
|
||||
public int size() {
|
||||
|
Reference in New Issue
Block a user