#877: Improve and simplify CraftBlockState
By: blablubbabc <lukas@wirsindwir.de>
This commit is contained in:
@@ -84,6 +84,7 @@ import org.bukkit.craftbukkit.CraftStatistic;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||
import org.bukkit.craftbukkit.block.CraftBlockStates;
|
||||
import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||
@@ -734,7 +735,7 @@ public class CraftEventFactory {
|
||||
* BlockFadeEvent
|
||||
*/
|
||||
public static BlockFadeEvent callBlockFadeEvent(GeneratorAccess world, BlockPosition pos, IBlockData newBlock) {
|
||||
CraftBlockState state = CraftBlockState.getBlockState(world, pos);
|
||||
CraftBlockState state = CraftBlockStates.getBlockState(world, pos);
|
||||
state.setData(newBlock);
|
||||
|
||||
BlockFadeEvent event = new BlockFadeEvent(state.getBlock(), state);
|
||||
@@ -743,7 +744,7 @@ public class CraftEventFactory {
|
||||
}
|
||||
|
||||
public static boolean handleMoistureChangeEvent(World world, BlockPosition pos, IBlockData newBlock, int flag) {
|
||||
CraftBlockState state = CraftBlockState.getBlockState(world, pos, flag);
|
||||
CraftBlockState state = CraftBlockStates.getBlockState(world, pos, flag);
|
||||
state.setData(newBlock);
|
||||
|
||||
MoistureChangeEvent event = new MoistureChangeEvent(state.getBlock(), state);
|
||||
@@ -766,7 +767,7 @@ public class CraftEventFactory {
|
||||
return true;
|
||||
}
|
||||
|
||||
CraftBlockState state = CraftBlockState.getBlockState(world, target, flag);
|
||||
CraftBlockState state = CraftBlockStates.getBlockState(world, target, flag);
|
||||
state.setData(block);
|
||||
|
||||
BlockSpreadEvent event = new BlockSpreadEvent(state.getBlock(), CraftBlock.at(world, source), state);
|
||||
@@ -1532,7 +1533,7 @@ public class CraftEventFactory {
|
||||
}
|
||||
|
||||
public static boolean handleBlockFormEvent(World world, BlockPosition pos, IBlockData block, int flag, @Nullable Entity entity) {
|
||||
CraftBlockState blockState = CraftBlockState.getBlockState(world, pos, flag);
|
||||
CraftBlockState blockState = CraftBlockStates.getBlockState(world, pos, flag);
|
||||
blockState.setData(block);
|
||||
|
||||
BlockFormEvent event = (entity == null) ? new BlockFormEvent(blockState.getBlock(), blockState) : new EntityBlockFormEvent(entity.getBukkitEntity(), blockState.getBlock(), blockState);
|
||||
|
||||
Reference in New Issue
Block a user