本文整理汇总了Java中org.bukkit.craftbukkit.CraftWorld类的典型用法代码示例。如果您正苦于以下问题:Java CraftWorld类的具体用法?Java CraftWorld怎么用?Java CraftWorld使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CraftWorld类属于org.bukkit.craftbukkit包,在下文中一共展示了CraftWorld类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: teleport
import org.bukkit.craftbukkit.CraftWorld; //导入依赖的package包/类
public boolean teleport(Location location, TeleportCause cause) {
if (entity.ridingEntity != null || entity.riddenByEntity != null || entity.isDead) {
return false;
}
// Spigot start
net.minecraft.world.WorldServer newWorld = ((CraftWorld) location.getWorld()).getHandle();
if (newWorld != entity.worldObj) {
entity.teleportTo(location, cause.isPortal());
return true;
}
// Spigot
entity.setPositionAndRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
// entity.setLocation() throws no event, and so cannot be cancelled
return true;
}
示例2: CraftBlockState
import org.bukkit.craftbukkit.CraftWorld; //导入依赖的package包/类
public CraftBlockState(final Block block) {
this.world = (CraftWorld) block.getWorld();
this.x = block.getX();
this.y = block.getY();
this.z = block.getZ();
this.type = block.getTypeId();
this.light = block.getLightLevel();
this.chunk = (CraftChunk) block.getChunk();
this.flag = 3;
// Cauldron start - save TE data
TileEntity te = world.getHandle().getTileEntity(x, y, z);
if (te != null)
{
nbt = new NBTTagCompound();
te.writeToNBT(nbt);
}
else nbt = null;
// Cauldron end
createData(block.getData());
}
示例3: getListener
import org.bukkit.craftbukkit.CraftWorld; //导入依赖的package包/类
private static net.minecraft.command.ICommandSender getListener(CommandSender sender)
{
if ( sender instanceof CraftPlayer )
{
return new PlayerListener( ( (CraftPlayer) sender ).getHandle() );
}
if ( sender instanceof CraftBlockCommandSender )
{
CraftBlockCommandSender commandBlock = (CraftBlockCommandSender) sender;
Block block = commandBlock.getBlock();
return ( (net.minecraft.tileentity.TileEntityCommandBlock) ( (CraftWorld) block.getWorld() ).getTileEntityAt( block.getX(), block.getY(), block.getZ() ) ).func_145993_a();
}
if ( sender instanceof CraftMinecartCommand )
{
return ( (net.minecraft.entity.EntityMinecartCommandBlock) ( (CraftMinecartCommand) sender ).getHandle() ).func_145822_e();
}
return new ConsoleListener(sender); // Assume console/rcon
}
示例4: teleport
import org.bukkit.craftbukkit.CraftWorld; //导入依赖的package包/类
public boolean teleport(Location location, TeleportCause cause) {
if (entity.ridingEntity != null || entity.riddenByEntity != null || entity.isDead) {
return false;
}
// Spigot start
net.minecraft.world.WorldServer newWorld = ((CraftWorld) location.getWorld()).getHandle();
if (newWorld != entity.worldObj) {
entity.teleportTo(location, cause.isPortal());
return true;
}
// Spigot
entity.setPositionAndRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
// entity.setLocation() throws no event, and so cannot be cancelled
return true;
}
示例5: callBlockMultiPlaceEvent
import org.bukkit.craftbukkit.CraftWorld; //导入依赖的package包/类
/**
* Block place methods
*/
public static BlockMultiPlaceEvent callBlockMultiPlaceEvent(World world, EntityHuman who, List<BlockState> blockStates, int clickedX, int clickedY, int clickedZ) {
CraftWorld craftWorld = world.getWorld();
CraftServer craftServer = world.getServer();
Player player = (who == null) ? null : (Player) who.getBukkitEntity();
Block blockClicked = craftWorld.getBlockAt(clickedX, clickedY, clickedZ);
boolean canBuild = true;
for (int i = 0; i < blockStates.size(); i++) {
if (!canBuild(craftWorld, player, blockStates.get(i).getX(), blockStates.get(i).getZ())) {
canBuild = false;
break;
}
}
BlockMultiPlaceEvent event = new BlockMultiPlaceEvent(blockStates, blockClicked, player.getItemInHand(), player, canBuild);
craftServer.getPluginManager().callEvent(event);
return event;
}
示例6: callEntityDeathEvent
import org.bukkit.craftbukkit.CraftWorld; //导入依赖的package包/类
public static EntityDeathEvent callEntityDeathEvent(EntityLiving victim, List<org.bukkit.inventory.ItemStack> drops) {
CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity();
EntityDeathEvent event = new EntityDeathEvent(entity, drops, victim.getExpReward());
CraftWorld world = (CraftWorld) entity.getWorld();
Bukkit.getServer().getPluginManager().callEvent(event);
victim.expToDrop = event.getDroppedExp();
for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
if (stack == null || stack.getType() == Material.AIR || stack.getAmount() == 0) continue;
world.dropItemNaturally(entity.getLocation(), stack);
}
return event;
}
示例7: sendBlockChange
import org.bukkit.craftbukkit.CraftWorld; //导入依赖的package包/类
@Override
public void sendBlockChange(Location loc, int material, byte data) {
if (getHandle().playerNetServerHandler == null) return;
S23PacketBlockChange packet = new S23PacketBlockChange(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), ((CraftWorld) loc.getWorld()).getHandle());
packet.field_148883_d = CraftMagicNumbers.getBlock(material);
packet.field_148884_e = data;
getHandle().playerNetServerHandler.sendPacket(packet);
}
示例8: getBedSpawnLocation
import org.bukkit.craftbukkit.CraftWorld; //导入依赖的package包/类
public Location getBedSpawnLocation() {
World world = getServer().getWorld(getHandle().spawnWorld);
net.minecraft.util.ChunkCoordinates bed = getHandle().getBedLocation();
if (world != null && bed != null) {
bed = net.minecraft.entity.player.EntityPlayer.verifyRespawnCoordinates(((CraftWorld) world).getHandle(), bed, getHandle().isSpawnForced());
if (bed != null) {
return new Location(world, bed.posX, bed.posY, bed.posZ);
}
}
return null;
}
示例9: update
import org.bukkit.craftbukkit.CraftWorld; //导入依赖的package包/类
private void update() {
net.minecraft.world.WorldServer world = ((CraftWorld) getWorld()).getHandle();
net.minecraft.entity.item.EntityPainting painting = new net.minecraft.entity.item.EntityPainting(world);
painting.field_146063_b = getHandle().field_146063_b;
painting.field_146064_c = getHandle().field_146064_c;
painting.field_146062_d = getHandle().field_146062_d;
painting.art = getHandle().art;
painting.setDirection(getHandle().hangingDirection);
getHandle().setDead();
getHandle().velocityChanged = true; // because this occurs when the painting is broken, so it might be important
world.spawnEntityInWorld(painting);
this.entity = painting;
}
示例10: setFacingDirection
import org.bukkit.craftbukkit.CraftWorld; //导入依赖的package包/类
public boolean setFacingDirection(BlockFace face, boolean force) {
if (!super.setFacingDirection(face, force)) {
return false;
}
net.minecraft.world.WorldServer world = ((CraftWorld) this.getWorld()).getHandle();
world.getEntityTracker().removeEntityFromAllTrackingPlayers(this.getHandle());
world.getEntityTracker().addEntityToTracker(this.getHandle());
return true;
}
示例11: getWorld
import org.bukkit.craftbukkit.CraftWorld; //导入依赖的package包/类
public World getWorld() {
int dimension = worldMap.dimension; // Cauldron - byte -> int for Forge
for (World world : Bukkit.getServer().getWorlds()) {
if (((CraftWorld) world).getHandle().provider.dimensionId == dimension) {
return world;
}
}
return null;
}
示例12: isEmpty
import org.bukkit.craftbukkit.CraftWorld; //导入依赖的package包/类
public boolean isEmpty() {
// Cauldron start - support custom air blocks (Railcraft player aura tracking block)
//return getType() == Material.AIR;
if (getType() == Material.AIR) return true;
if (!(getWorld() instanceof CraftWorld)) return false;
return ((CraftWorld) getWorld()).getHandle().isAirBlock(getX(), getY(), getZ());
// Cauldron end
}
示例13: CraftCommandBlock
import org.bukkit.craftbukkit.CraftWorld; //导入依赖的package包/类
public CraftCommandBlock(Block block) {
super(block);
CraftWorld world = (CraftWorld) block.getWorld();
commandBlock = (TileEntityCommandBlock) world.getTileEntityAt(getX(), getY(), getZ());
command = commandBlock.func_145993_a().field_145763_e;
name = commandBlock.func_145993_a().getCommandSenderName();
}
示例14: CraftSign
import org.bukkit.craftbukkit.CraftWorld; //导入依赖的package包/类
public CraftSign(final Block block) {
super(block);
CraftWorld world = (CraftWorld) block.getWorld();
sign = (net.minecraft.tileentity.TileEntitySign) world.getTileEntityAt(getX(), getY(), getZ());
// Spigot start
if (sign == null) {
lines = new String[]{"", "", "", ""};
return;
}
// Spigot end
lines = new String[sign.signText.length];
System.arraycopy(sign.signText, 0, lines, 0, lines.length);
}
示例15: CraftSkull
import org.bukkit.craftbukkit.CraftWorld; //导入依赖的package包/类
public CraftSkull(final Block block) {
super(block);
CraftWorld world = (CraftWorld) block.getWorld();
skull = (TileEntitySkull) world.getTileEntityAt(getX(), getY(), getZ());
profile = skull.func_152108_a();
skullType = getSkullType(skull.func_145904_a());
rotation = (byte) skull.getRotation();
}