mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 03:56:41 +00:00
Remove all raw usages of BSH, improve API generics
This commit is contained in:
committed by
IronApollo
parent
1d87642b52
commit
590b7e23a9
@ -32,8 +32,8 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.DataException;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
import com.sk89q.worldedit.world.storage.InvalidFormatException;
|
||||
@ -254,14 +254,14 @@ public class AnvilChunk implements Chunk {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockStateHolder getBlock(BlockVector3 position) throws DataException {
|
||||
public BaseBlock getBlock(BlockVector3 position) throws DataException {
|
||||
int id = getBlockID(position);
|
||||
int data = getBlockData(position);
|
||||
|
||||
BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(id, data);
|
||||
if (state == null) {
|
||||
WorldEdit.logger.warning("Unknown legacy block " + id + ":" + data + " found when loading legacy anvil chunk.");
|
||||
return BlockTypes.AIR.getDefaultState();
|
||||
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||
}
|
||||
if (state.getMaterial().hasContainer()) {
|
||||
CompoundTag tileEntity = getBlockTileEntity(position);
|
||||
@ -269,6 +269,8 @@ public class AnvilChunk implements Chunk {
|
||||
return new BaseBlock(state, tileEntity);
|
||||
}
|
||||
}
|
||||
return state; }
|
||||
|
||||
return state.toBaseBlock();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.world.DataException;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.storage.InvalidFormatException;
|
||||
@ -231,7 +230,7 @@ public class AnvilChunk13 implements Chunk {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockStateHolder getBlock(BlockVector3 position) throws DataException {
|
||||
public BaseBlock getBlock(BlockVector3 position) throws DataException {
|
||||
int x = position.getX() - rootX * 16;
|
||||
int y = position.getY();
|
||||
int z = position.getZ() - rootZ * 16;
|
||||
@ -249,7 +248,8 @@ public class AnvilChunk13 implements Chunk {
|
||||
CompoundTag tileEntity = getBlockTileEntity(position);
|
||||
if (tileEntity != null) return new BaseBlock(state, tileEntity);
|
||||
}
|
||||
return state;
|
||||
|
||||
return state.toBaseBlock();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,13 +22,13 @@ package com.sk89q.worldedit.world.chunk;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.DataException;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
|
||||
/**
|
||||
* A 16 by 16 block chunk.
|
||||
*/
|
||||
public interface Chunk {
|
||||
|
||||
|
||||
/**
|
||||
* Get a block;
|
||||
*
|
||||
@ -36,6 +36,6 @@ public interface Chunk {
|
||||
* @return block the block
|
||||
* @throws DataException thrown on data error
|
||||
*/
|
||||
BlockStateHolder getBlock(BlockVector3 position) throws DataException;
|
||||
BaseBlock getBlock(BlockVector3 position) throws DataException;
|
||||
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.DataException;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
import com.sk89q.worldedit.world.storage.InvalidFormatException;
|
||||
@ -154,13 +154,9 @@ public class OldChunk implements Chunk {
|
||||
}
|
||||
|
||||
@Override
|
||||
//<<<<<<< HEAD
|
||||
public BlockStateHolder getBlock(BlockVector3 position) throws DataException {
|
||||
if(position.getBlockY() >= 128) return BlockTypes.VOID_AIR.getDefaultState();
|
||||
//=======
|
||||
// public BlockStateHolder getBlock(BlockVector3 position) throws DataException {
|
||||
// if(position.getY() >= 128) return BlockTypes.VOID_AIR.getDefaultState().toBaseBlock();
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
public BaseBlock getBlock(BlockVector3 position) throws DataException {
|
||||
if(position.getY() >= 128) return BlockTypes.VOID_AIR.getDefaultState().toBaseBlock();
|
||||
int id, dataVal;
|
||||
|
||||
int x = position.getX() - rootX * 16;
|
||||
@ -189,13 +185,13 @@ public class OldChunk implements Chunk {
|
||||
BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(id, dataVal);
|
||||
if (state == null) {
|
||||
WorldEdit.logger.warning("Unknown legacy block " + id + ":" + dataVal + " found when loading legacy anvil chunk.");
|
||||
return BlockTypes.AIR.getDefaultState();
|
||||
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||
}
|
||||
if (state.getBlockType().getMaterial().hasContainer()) {
|
||||
CompoundTag tileEntity = getBlockTileEntity(position);
|
||||
if (tileEntity != null) return new BaseBlock(state, tileEntity);
|
||||
}
|
||||
return state;
|
||||
return state.toBaseBlock();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user