@Override public PacketTracer a(BlockPosition pos) { value("BlockPosition", pos); try { mute = true; super.a(pos); } finally { mute = false; } return this; }
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; }
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; }
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; }
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; } }
@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; } }
@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; } }
@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())); } }
@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()); } }
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; }
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); }
@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; }
@Override public Location getBeamTarget() { BlockPosition pos = getHandle().getBeamTarget(); return pos == null ? null : new Location(getWorld(), pos.getX(), pos.getY(), pos.getZ()); }
@Override public Location getExitLocation() { BlockPosition pos = gateway.exitPortal; return pos == null ? null : new Location(world, pos.getX(), pos.getY(), pos.getZ()); }
public void setTypeUpdate(BlockPosition position, IBlockData data) { setTypeAndData(position.getX(), position.getY(), position.getZ(), data.getBlock(), data.getBlock().toLegacyData(data), 0); }