當前位置: 首頁>>代碼示例>>Java>>正文


Java BlockPosition類代碼示例

本文整理匯總了Java中net.minecraft.server.BlockPosition的典型用法代碼示例。如果您正苦於以下問題:Java BlockPosition類的具體用法?Java BlockPosition怎麽用?Java BlockPosition使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BlockPosition類屬於net.minecraft.server包,在下文中一共展示了BlockPosition類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: a

import net.minecraft.server.BlockPosition; //導入依賴的package包/類
@Override
public PacketTracer a(BlockPosition pos) {
    value("BlockPosition", pos);
    try {
        mute = true;
        super.a(pos);
    } finally {
        mute = false;
    }
    return this;
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:12,代碼來源:PacketTracer.java

示例2: update

import net.minecraft.server.BlockPosition; //導入依賴的package包/類
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;
}
 
開發者ID:tgnmc,項目名稱:Craftbukkit,代碼行數:16,代碼來源:CraftItemFrame.java

示例3: getBiteChance

import net.minecraft.server.BlockPosition; //導入依賴的package包/類
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;
}
 
開發者ID:tgnmc,項目名稱:Craftbukkit,代碼行數:12,代碼來源:CraftFish.java

示例4: update

import net.minecraft.server.BlockPosition; //導入依賴的package包/類
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;
}
 
開發者ID:tgnmc,項目名稱:Craftbukkit,代碼行數:16,代碼來源:CraftBlockState.java

示例5: play

import net.minecraft.server.BlockPosition; //導入依賴的package包/類
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;
    }
}
 
開發者ID:tgnmc,項目名稱:Craftbukkit,代碼行數:11,代碼來源:CraftNoteBlock.java

示例6: setBeamTarget

import net.minecraft.server.BlockPosition; //導入依賴的package包/類
@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()));
    }
}
 
開發者ID:bergerkiller,項目名稱:SpigotSource,代碼行數:11,代碼來源:CraftEnderCrystal.java

示例7: setExitLocation

import net.minecraft.server.BlockPosition; //導入依賴的package包/類
@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());
    }
}
 
開發者ID:bergerkiller,項目名稱:SpigotSource,代碼行數:11,代碼來源:CraftEndGateway.java

示例8: update

import net.minecraft.server.BlockPosition; //導入依賴的package包/類
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;
}
 
開發者ID:bergerkiller,項目名稱:SpigotSource,代碼行數:28,代碼來源:CraftBlockState.java

示例9: playEffect

import net.minecraft.server.BlockPosition; //導入依賴的package包/類
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);
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:5,代碼來源:NMSHacks.java

示例10: findPortal

import net.minecraft.server.BlockPosition; //導入依賴的package包/類
@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;
}
 
開發者ID:tgnmc,項目名稱:Craftbukkit,代碼行數:7,代碼來源:CraftTravelAgent.java

示例11: getBeamTarget

import net.minecraft.server.BlockPosition; //導入依賴的package包/類
@Override
public Location getBeamTarget() {
    BlockPosition pos = getHandle().getBeamTarget();
    return pos == null ? null : new Location(getWorld(), pos.getX(), pos.getY(), pos.getZ());
}
 
開發者ID:bergerkiller,項目名稱:SpigotSource,代碼行數:6,代碼來源:CraftEnderCrystal.java

示例12: getExitLocation

import net.minecraft.server.BlockPosition; //導入依賴的package包/類
@Override
public Location getExitLocation() {
    BlockPosition pos = gateway.exitPortal;
    return pos == null ? null : new Location(world, pos.getX(), pos.getY(), pos.getZ());
}
 
開發者ID:bergerkiller,項目名稱:SpigotSource,代碼行數:6,代碼來源:CraftEndGateway.java

示例13: setTypeUpdate

import net.minecraft.server.BlockPosition; //導入依賴的package包/類
public void setTypeUpdate(BlockPosition position, IBlockData data) { 
    setTypeAndData(position.getX(), position.getY(), position.getZ(), data.getBlock(), data.getBlock().toLegacyData(data), 0);
    
}
 
開發者ID:tgnmc,項目名稱:Craftbukkit,代碼行數:5,代碼來源:BlockStateListPopulator.java


注:本文中的net.minecraft.server.BlockPosition類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。