本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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()));
}
}
示例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());
}
}
示例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;
}
示例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);
}
示例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;
}
示例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());
}
示例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());
}
示例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);
}