use of com.viaversion.viaversion.api.minecraft.Position in project ViaVersion by ViaVersion.
the class RedstoneConnectionHandler method connects.
private int connects(UserConnection user, Position position, BlockFace side) {
final Position relative = position.getRelative(side);
int blockState = getBlockData(user, relative);
if (connects(side, blockState)) {
// side
return 1;
}
int up = getBlockData(user, relative.getRelative(BlockFace.TOP));
if (redstone.contains(up) && !ConnectionData.occludingStates.contains(getBlockData(user, position.getRelative(BlockFace.TOP)))) {
// "up"
return 2;
}
int down = getBlockData(user, relative.getRelative(BlockFace.BOTTOM));
if (redstone.contains(down) && !ConnectionData.occludingStates.contains(getBlockData(user, relative))) {
// side
return 1;
}
// none
return 0;
}
use of com.viaversion.viaversion.api.minecraft.Position in project ViaVersion by ViaVersion.
the class BlockListener method placeBlock.
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void placeBlock(BlockPlaceEvent e) {
if (isOnPipe(e.getPlayer())) {
Block b = e.getBlockPlaced();
EntityTracker1_9 tracker = getUserConnection(e.getPlayer()).getEntityTracker(Protocol1_9To1_8.class);
tracker.addBlockInteraction(new Position(b.getX(), (short) b.getY(), b.getZ()));
}
}
Aggregations