本文整理汇总了Java中org.bukkit.craftbukkit.block.CraftBlock类的典型用法代码示例。如果您正苦于以下问题:Java CraftBlock类的具体用法?Java CraftBlock怎么用?Java CraftBlock使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CraftBlock类属于org.bukkit.craftbukkit.block包,在下文中一共展示了CraftBlock类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setBiome
import org.bukkit.craftbukkit.block.CraftBlock; //导入依赖的package包/类
public void setBiome(int x, int z, Biome bio) {
net.minecraft.world.biome.BiomeGenBase bb = CraftBlock.biomeToBiomeBase(bio);
if (this.world.blockExists(x, 0, z)) {
net.minecraft.world.chunk.Chunk chunk = this.world.getChunkFromBlockCoords(x, z);
if (chunk != null) {
byte[] biomevals = chunk.getBiomeArray();
biomevals[((z & 0xF) << 4) | (x & 0xF)] = (byte)bb.biomeID;
}
}
}
示例2: getPlayerBucketEvent
import org.bukkit.craftbukkit.block.CraftBlock; //导入依赖的package包/类
private static PlayerEvent getPlayerBucketEvent(boolean isFilling, EntityHuman who, int clickedX, int clickedY, int clickedZ, int clickedFace, ItemStack itemstack, net.minecraft.server.Item item) {
Player player = (who == null) ? null : (Player) who.getBukkitEntity();
CraftItemStack itemInHand = CraftItemStack.asNewCraftStack(item);
Material bucket = CraftMagicNumbers.getMaterial(itemstack.getItem());
CraftWorld craftWorld = (CraftWorld) player.getWorld();
CraftServer craftServer = (CraftServer) player.getServer();
Block blockClicked = craftWorld.getBlockAt(clickedX, clickedY, clickedZ);
BlockFace blockFace = CraftBlock.notchToBlockFace(clickedFace);
PlayerEvent event = null;
if (isFilling) {
event = new PlayerBucketFillEvent(player, blockClicked, blockFace, bucket, itemInHand);
((PlayerBucketFillEvent) event).setCancelled(!canBuild(craftWorld, player, clickedX, clickedZ));
} else {
event = new PlayerBucketEmptyEvent(player, blockClicked, blockFace, bucket, itemInHand);
((PlayerBucketEmptyEvent) event).setCancelled(!canBuild(craftWorld, player, clickedX, clickedZ));
}
craftServer.getPluginManager().callEvent(event);
return event;
}
示例3: getPlayerBucketEvent
import org.bukkit.craftbukkit.block.CraftBlock; //导入依赖的package包/类
private static PlayerEvent getPlayerBucketEvent(boolean isFilling, EntityHuman who, int clickedX, int clickedY, int clickedZ, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.server.Item item) {
Player player = (who == null) ? null : (Player) who.getBukkitEntity();
CraftItemStack itemInHand = CraftItemStack.asNewCraftStack(item);
Material bucket = CraftMagicNumbers.getMaterial(itemstack.getItem());
CraftWorld craftWorld = (CraftWorld) player.getWorld();
CraftServer craftServer = (CraftServer) player.getServer();
Block blockClicked = craftWorld.getBlockAt(clickedX, clickedY, clickedZ);
BlockFace blockFace = CraftBlock.notchToBlockFace(clickedFace);
PlayerEvent event = null;
if (isFilling) {
event = new PlayerBucketFillEvent(player, blockClicked, blockFace, bucket, itemInHand);
((PlayerBucketFillEvent) event).setCancelled(!canBuild(craftWorld, player, clickedX, clickedZ));
} else {
event = new PlayerBucketEmptyEvent(player, blockClicked, blockFace, bucket, itemInHand);
((PlayerBucketEmptyEvent) event).setCancelled(!canBuild(craftWorld, player, clickedX, clickedZ));
}
craftServer.getPluginManager().callEvent(event);
return event;
}
示例4: getPlayerBucketEvent
import org.bukkit.craftbukkit.block.CraftBlock; //导入依赖的package包/类
private static PlayerEvent getPlayerBucketEvent(boolean isFilling, EntityHuman who, int clickedX, int clickedY, int clickedZ, int clickedFace, ItemStack itemstack, net.minecraft.server.Item item) {
Player player = (who == null) ? null : (Player) who.getBukkitEntity();
CraftItemStack itemInHand = CraftItemStack.asNewCraftStack(item);
Material bucket = Material.getMaterial(itemstack.id);
CraftWorld craftWorld = (CraftWorld) player.getWorld();
CraftServer craftServer = (CraftServer) player.getServer();
Block blockClicked = craftWorld.getBlockAt(clickedX, clickedY, clickedZ);
BlockFace blockFace = CraftBlock.notchToBlockFace(clickedFace);
PlayerEvent event = null;
if (isFilling) {
event = new PlayerBucketFillEvent(player, blockClicked, blockFace, bucket, itemInHand);
((PlayerBucketFillEvent) event).setCancelled(!canBuild(craftWorld, player, clickedX, clickedZ));
} else {
event = new PlayerBucketEmptyEvent(player, blockClicked, blockFace, bucket, itemInHand);
((PlayerBucketEmptyEvent) event).setCancelled(!canBuild(craftWorld, player, clickedX, clickedZ));
}
craftServer.getPluginManager().callEvent(event);
return event;
}
示例5: e
import org.bukkit.craftbukkit.block.CraftBlock; //导入依赖的package包/类
private void e(World world, BlockPosition blockposition, IBlockData iblockdata) {
EnumDirection enumdirection = (EnumDirection) iblockdata.get(BlockPiston.FACING);
boolean flag = this.a(world, blockposition, enumdirection);
if (flag && !((Boolean) iblockdata.get(BlockPiston.EXTENDED)).booleanValue()) {
if ((new PistonExtendsChecker(world, blockposition, enumdirection, true)).a()) {
world.playBlockAction(blockposition, this, 0, enumdirection.a());
}
} else if (!flag && ((Boolean) iblockdata.get(BlockPiston.EXTENDED)).booleanValue()) {
// CraftBukkit start
if (!this.sticky) {
org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
BlockPistonRetractEvent event = new BlockPistonRetractEvent(block, ImmutableList.<org.bukkit.block.Block>of(), CraftBlock.notchToBlockFace(enumdirection));
world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
}
// PAIL: checkME - what happened to setTypeAndData?
// CraftBukkit end
world.playBlockAction(blockposition, this, 1, enumdirection.a());
}
}
示例6: setBiome
import org.bukkit.craftbukkit.block.CraftBlock; //导入依赖的package包/类
public void setBiome(int x, int z, Biome bio) {
BiomeBase bb = CraftBlock.biomeToBiomeBase(bio);
if (this.world.isLoaded(x, 0, z)) {
net.minecraft.server.Chunk chunk = this.world.getChunkAtWorldCoords(x, z);
if (chunk != null) {
byte[] biomevals = chunk.m();
biomevals[((z & 0xF) << 4) | (x & 0xF)] = (byte)bb.id;
}
}
}
示例7: callPlayerInteractEvent
import org.bukkit.craftbukkit.block.CraftBlock; //导入依赖的package包/类
public static PlayerInteractEvent callPlayerInteractEvent(EntityHuman who, Action action, int clickedX, int clickedY, int clickedZ, int clickedFace, ItemStack itemstack) {
Player player = (who == null) ? null : (Player) who.getBukkitEntity();
CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack);
CraftWorld craftWorld = (CraftWorld) player.getWorld();
CraftServer craftServer = (CraftServer) player.getServer();
Block blockClicked = craftWorld.getBlockAt(clickedX, clickedY, clickedZ);
BlockFace blockFace = CraftBlock.notchToBlockFace(clickedFace);
if (clickedY > 255) {
blockClicked = null;
switch (action) {
case LEFT_CLICK_BLOCK:
action = Action.LEFT_CLICK_AIR;
break;
case RIGHT_CLICK_BLOCK:
action = Action.RIGHT_CLICK_AIR;
break;
}
}
if (itemInHand.getType() == Material.AIR || itemInHand.getAmount() == 0) {
itemInHand = null;
}
PlayerInteractEvent event = new PlayerInteractEvent(player, action, itemInHand, blockClicked, blockFace);
craftServer.getPluginManager().callEvent(event);
return event;
}
示例8: setBiome
import org.bukkit.craftbukkit.block.CraftBlock; //导入依赖的package包/类
public void setBiome(int x, int z, Biome bio) {
BiomeBase bb = CraftBlock.biomeToBiomeBase(bio);
if (this.world.isLoaded(new BlockPosition(x, 0, z))) {
net.minecraft.server.Chunk chunk = this.world.getChunkAtWorldCoords(new BlockPosition(x, 0, z));
if (chunk != null) {
byte[] biomevals = chunk.getBiomeIndex();
biomevals[((z & 0xF) << 4) | (x & 0xF)] = (byte)bb.id;
}
}
}
示例9: callPlayerInteractEvent
import org.bukkit.craftbukkit.block.CraftBlock; //导入依赖的package包/类
public static PlayerInteractEvent callPlayerInteractEvent(EntityHuman who, Action action, BlockPosition position, EnumDirection direction, ItemStack itemstack, boolean cancelledBlock) {
Player player = (who == null) ? null : (Player) who.getBukkitEntity();
CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack);
CraftWorld craftWorld = (CraftWorld) player.getWorld();
CraftServer craftServer = (CraftServer) player.getServer();
Block blockClicked = craftWorld.getBlockAt(position.getX(), position.getY(), position.getZ());
BlockFace blockFace = CraftBlock.notchToBlockFace(direction);
if (position.getY() > 255) {
blockClicked = null;
switch (action) {
case LEFT_CLICK_BLOCK:
action = Action.LEFT_CLICK_AIR;
break;
case RIGHT_CLICK_BLOCK:
action = Action.RIGHT_CLICK_AIR;
break;
}
}
if (itemInHand.getType() == Material.AIR || itemInHand.getAmount() == 0) {
itemInHand = null;
}
PlayerInteractEvent event = new PlayerInteractEvent(player, action, itemInHand, blockClicked, blockFace);
if (cancelledBlock) {
event.setUseInteractedBlock(Event.Result.DENY);
}
craftServer.getPluginManager().callEvent(event);
return event;
}
示例10: setBiome
import org.bukkit.craftbukkit.block.CraftBlock; //导入依赖的package包/类
public void setBiome(int x, int z, Biome bio) {
BiomeBase bb = CraftBlock.biomeToBiomeBase(bio);
if (this.world.isLoaded(new BlockPosition(x, 0, z))) {
net.minecraft.server.Chunk chunk = this.world.getChunkAtWorldCoords(new BlockPosition(x, 0, z));
if (chunk != null) {
byte[] biomevals = chunk.getBiomeIndex();
biomevals[((z & 0xF) << 4) | (x & 0xF)] = (byte) BiomeBase.REGISTRY_ID.a(bb);
}
}
}
示例11: callPlayerInteractEvent
import org.bukkit.craftbukkit.block.CraftBlock; //导入依赖的package包/类
public static PlayerInteractEvent callPlayerInteractEvent(EntityHuman who, Action action, BlockPosition position, EnumDirection direction, ItemStack itemstack, boolean cancelledBlock, EnumHand hand) {
Player player = (who == null) ? null : (Player) who.getBukkitEntity();
CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack);
CraftWorld craftWorld = (CraftWorld) player.getWorld();
CraftServer craftServer = (CraftServer) player.getServer();
Block blockClicked = craftWorld.getBlockAt(position.getX(), position.getY(), position.getZ());
BlockFace blockFace = CraftBlock.notchToBlockFace(direction);
if (position.getY() > 255) {
blockClicked = null;
switch (action) {
case LEFT_CLICK_BLOCK:
action = Action.LEFT_CLICK_AIR;
break;
case RIGHT_CLICK_BLOCK:
action = Action.RIGHT_CLICK_AIR;
break;
}
}
if (itemInHand.getType() == Material.AIR || itemInHand.getAmount() == 0) {
itemInHand = null;
}
PlayerInteractEvent event = new PlayerInteractEvent(player, action, itemInHand, blockClicked, blockFace, (hand == null) ? null : ((hand == EnumHand.OFF_HAND) ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND));
if (cancelledBlock) {
event.setUseInteractedBlock(Event.Result.DENY);
}
craftServer.getPluginManager().callEvent(event);
return event;
}
示例12: setBiome
import org.bukkit.craftbukkit.block.CraftBlock; //导入依赖的package包/类
public void setBiome(int x, int z, Biome bio) {
net.minecraft.world.biome.BiomeGenBase bb = CraftBlock.biomeToBiomeBase(bio);
if (this.world.func_72899_e(x, 0, z)) {
net.minecraft.world.chunk.Chunk chunk = this.world.func_72938_d(x, z);
if (chunk != null) {
byte[] biomevals = chunk.func_76605_m();
biomevals[((z & 0xF) << 4) | (x & 0xF)] = (byte)bb.field_76756_M;
}
}
}
示例13: getBiome
import org.bukkit.craftbukkit.block.CraftBlock; //导入依赖的package包/类
public Biome getBiome(int x, int z) {
return CraftBlock.biomeBaseToBiome(biome[(z << 4) | x]);
}
示例14: setBiome
import org.bukkit.craftbukkit.block.CraftBlock; //导入依赖的package包/类
public void setBiome(int x, int z, Biome bio) {
biome[(z << 4) | x] = CraftBlock.biomeToBiomeBase(bio);
}
示例15: getBiome
import org.bukkit.craftbukkit.block.CraftBlock; //导入依赖的package包/类
public Biome getBiome(int x, int z) {
return CraftBlock.biomeBaseToBiome(this.world.getBiomeGenForCoords(x, z));
}