Java 类net.minecraft.server.BlockPosition 实例源码

项目:ProjectAres    文件:PacketTracer.java   
@Override
public PacketTracer a(BlockPosition pos) {
    value("BlockPosition", pos);
    try {
        mute = true;
        super.a(pos);
    } finally {
        mute = false;
    }
    return this;
}
项目:Craftbukkit    文件:CraftItemFrame.java   
private void update() {
    EntityItemFrame old = this.getHandle();

    WorldServer world = ((CraftWorld) getWorld()).getHandle();
    BlockPosition position = old.getBlockPosition();
    EnumDirection direction = old.getDirection();
    ItemStack item = old.getItem() != null ? old.getItem().cloneItemStack() : null;

    old.die();

    EntityItemFrame frame = new EntityItemFrame(world,position,direction);
    frame.setItem(item);
    world.addEntity(frame);
    this.entity = frame;
}
项目:Craftbukkit    文件:CraftFish.java   
public double getBiteChance() {
    EntityFishingHook hook = getHandle();

    if (this.biteChance == -1) {
        if (hook.world.isRainingAt(new BlockPosition(MathHelper.floor(hook.locX), MathHelper.floor(hook.locY) + 1, MathHelper.floor(hook.locZ)))) {
            return 1/300.0;
        }
        return 1/500.0;
    }
    return this.biteChance;
}
项目:Craftbukkit    文件:CraftBlockState.java   
public boolean update(boolean force, boolean applyPhysics) {
    requirePlaced();
    Block block = getBlock();

    if (block.getType() != getType()) {
        if (!force) {
            return false;
        }
    }

    block.setTypeIdAndData(getTypeId(), getRawData(), applyPhysics);
    world.getHandle().notify(new BlockPosition(x, y, z));

    return true;
}
项目:Craftbukkit    文件:CraftNoteBlock.java   
public boolean play() {
    Block block = getBlock();

    if (block.getType() == Material.NOTE_BLOCK) {
        note.play(world.getHandle(), new BlockPosition(getX(), getY(), getZ()));
        return true;
    } else {
        return false;
    }
}
项目:Craftbukkit    文件:CraftNoteBlock.java   
@Override
public boolean play(byte instrument, byte note) {
    Block block = getBlock();

    if (block.getType() == Material.NOTE_BLOCK) {
        world.getHandle().playBlockAction(new BlockPosition(getX(), getY(), getZ()), CraftMagicNumbers.getBlock(block), instrument, note);
        return true;
    } else {
        return false;
    }
}
项目:Craftbukkit    文件:CraftNoteBlock.java   
@Override
public boolean play(Instrument instrument, Note note) {
    Block block = getBlock();

    if (block.getType() == Material.NOTE_BLOCK) {
        world.getHandle().playBlockAction(new BlockPosition(getX(), getY(), getZ()), CraftMagicNumbers.getBlock(block), instrument.getType(), note.getId());
        return true;
    } else {
        return false;
    }
}
项目:SpigotSource    文件:CraftItemFrame.java   
private void update() {
    EntityItemFrame old = this.getHandle();

    WorldServer world = ((CraftWorld) getWorld()).getHandle();
    BlockPosition position = old.getBlockPosition();
    EnumDirection direction = old.getDirection();
    ItemStack item = old.getItem() != null ? old.getItem().cloneItemStack() : null;

    old.die();

    EntityItemFrame frame = new EntityItemFrame(world,position,direction);
    frame.setItem(item);
    world.addEntity(frame);
    this.entity = frame;
}
项目:SpigotSource    文件:CraftFish.java   
public double getBiteChance() {
    EntityFishingHook hook = getHandle();

    if (this.biteChance == -1) {
        if (hook.world.isRainingAt(new BlockPosition(MathHelper.floor(hook.locX), MathHelper.floor(hook.locY) + 1, MathHelper.floor(hook.locZ)))) {
            return 1/300.0;
        }
        return 1/500.0;
    }
    return this.biteChance;
}
项目:SpigotSource    文件:CraftEnderCrystal.java   
@Override
public void setBeamTarget(Location location) {
    if (location == null) {
        getHandle().setBeamTarget((BlockPosition) null);
    } else if (location.getWorld() != getWorld()) {
        throw new IllegalArgumentException("Cannot set beam target location to different world");
    } else {
        getHandle().setBeamTarget(new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()));
    }
}
项目:SpigotSource    文件:CraftEndGateway.java   
@Override
public void setExitLocation(Location location) {
    if (location == null) {
        gateway.exitPortal = null;
    } else if (location.getWorld() != world) {
        throw new IllegalArgumentException("Cannot set exit location to different world");
    } else {
        gateway.exitPortal = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
    }
}
项目:SpigotSource    文件:CraftBlockState.java   
public boolean update(boolean force, boolean applyPhysics) {
    requirePlaced();
    Block block = getBlock();

    if (block.getType() != getType()) {
        if (!force) {
            return false;
        }
    }

    BlockPosition pos = new BlockPosition(x, y, z);
    IBlockData newBlock = CraftMagicNumbers.getBlock(getType()).fromLegacyData(getRawData());
    block.setTypeIdAndData(getTypeId(), getRawData(), applyPhysics);
    world.getHandle().notify(
            pos,
            CraftMagicNumbers.getBlock(block).fromLegacyData(block.getData()),
            newBlock,
            3
    );

    // Update levers etc
    if (applyPhysics && getData() instanceof Attachable) {
        world.getHandle().applyPhysics(pos.shift(CraftBlock.blockFaceToNotch(((Attachable) getData()).getAttachedFace())), newBlock.getBlock());
    }

    return true;
}
项目:SpigotSource    文件:CraftNoteBlock.java   
public boolean play() {
    Block block = getBlock();

    if (block.getType() == Material.NOTE_BLOCK) {
        note.play(world.getHandle(), new BlockPosition(getX(), getY(), getZ()));
        return true;
    } else {
        return false;
    }
}
项目:SpigotSource    文件:CraftNoteBlock.java   
@Override
public boolean play(byte instrument, byte note) {
    Block block = getBlock();

    if (block.getType() == Material.NOTE_BLOCK) {
        world.getHandle().playBlockAction(new BlockPosition(getX(), getY(), getZ()), CraftMagicNumbers.getBlock(block), instrument, note);
        return true;
    } else {
        return false;
    }
}
项目:SpigotSource    文件:CraftNoteBlock.java   
@Override
public boolean play(Instrument instrument, Note note) {
    Block block = getBlock();

    if (block.getType() == Material.NOTE_BLOCK) {
        world.getHandle().playBlockAction(new BlockPosition(getX(), getY(), getZ()), CraftMagicNumbers.getBlock(block), instrument.getType(), note.getId());
        return true;
    } else {
        return false;
    }
}
项目:ProjectAres    文件:NMSHacks.java   
public static void playEffect(World bukkitWorld, Vector pos, int effectId, int data) {
    WorldServer world = ((CraftWorld) bukkitWorld).getHandle();
    world.triggerEffect(effectId, new BlockPosition(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()), data);
}
项目:Craftbukkit    文件:CraftTravelAgent.java   
@Override
public Location findPortal(Location location) {
    PortalTravelAgent pta = ((CraftWorld) location.getWorld()).getHandle().getTravelAgent();
    BlockPosition found = pta.findPortal(location.getX(), location.getY(), location.getZ(), this.getSearchRadius());
    return found != null ? new Location(location.getWorld(), found.getX(), found.getY(), found.getZ(), location.getYaw(), location.getPitch()) : null;
}
项目:SpigotSource    文件:CraftEnderCrystal.java   
@Override
public Location getBeamTarget() {
    BlockPosition pos = getHandle().getBeamTarget();
    return pos == null ? null : new Location(getWorld(), pos.getX(), pos.getY(), pos.getZ());
}
项目:SpigotSource    文件:CraftEndGateway.java   
@Override
public Location getExitLocation() {
    BlockPosition pos = gateway.exitPortal;
    return pos == null ? null : new Location(world, pos.getX(), pos.getY(), pos.getZ());
}
项目:SpigotSource    文件:CraftTravelAgent.java   
@Override
public Location findPortal(Location location) {
    PortalTravelAgent pta = ((CraftWorld) location.getWorld()).getHandle().getTravelAgent();
    BlockPosition found = pta.findPortal(location.getX(), location.getY(), location.getZ(), this.getSearchRadius());
    return found != null ? new Location(location.getWorld(), found.getX(), found.getY(), found.getZ(), location.getYaw(), location.getPitch()) : null;
}
项目:Craftbukkit    文件:BlockStateListPopulator.java   
public void setTypeUpdate(BlockPosition position, IBlockData data) { 
    setTypeAndData(position.getX(), position.getY(), position.getZ(), data.getBlock(), data.getBlock().toLegacyData(data), 0);

}
项目:SpigotSource    文件:BlockStateListPopulator.java   
public void setTypeUpdate(BlockPosition position, IBlockData data) { 
    setTypeAndData(position.getX(), position.getY(), position.getZ(), data.getBlock(), data.getBlock().toLegacyData(data), 0);

}