/** * Gets the direction of the axis along the given {@link AxisDirection}. * * @param axis The axis * @param direction The direction along the axis * @return The direction */ public static Direction getFromAxis(final Axis axis, final AxisDirection direction) { switch (direction) { case PLUS: return getFromAxis(axis); case ZERO: return NONE; case MINUS: return getFromAxis(axis).getOpposite(); default: throw new IllegalArgumentException(axis.name()); } }
@Override public List<Location<World>> findPotentialOutputs(Location<World> location, ItemStack itemStack, Direction inputSide) { return Lists.newArrayList(location.getRelative(inputSide.getOpposite())); } }
/** * @param sign treated as sign post if it is such, or else assumed to be a wall sign (i.e., * if you ask about a stone block, it's considered a wall * sign). * @return the blank side of the sign opposite the text. In the case of a wall sign, * the block in this direction is the block to which the sign is * attached. This is also the direction a player would be facing when reading the sign; see {@link #getFront(Location)}. */ public static Direction getBack(Location<World> sign) { Direction front = getFront(sign); if (front == null) return Direction.NONE; return front.getOpposite(); }
/** * Gets the direction of the axis along the given {@link AxisDirection}. * * @param axis The axis * @param direction The direction along the axis * @return The direction */ public static Direction getFromAxis(final Axis axis, final AxisDirection direction) { switch (direction) { case PLUS: return getFromAxis(axis); case ZERO: return NONE; case MINUS: return getFromAxis(axis).getOpposite(); default: throw new IllegalArgumentException(axis.name()); } }
signLocations.addAll(BlockUtil.getAdjacentExcept(location, event.getTargetSide())); } else { signLocations.add(location.getRelative(event.getTargetSide().getOpposite()));
Direction finalCurrentSmallest = currentSmallest; Sponge.getGame().getScheduler().createTaskBuilder().execute(() -> { disperseSnow(relative, finalCurrentSmallest.getOpposite()); if (isBlockBuried(location)) disperseSnow(location.getRelative(Direction.UP), Direction.NONE);
private void addChair(Player player, Location<World> location) { Entity entity = location.getExtent().createEntity(EntityTypes.ARMOR_STAND, location.getBlockPosition().toDouble().sub(-0.5, 1.2, -0.5)); entity.offer(Keys.INVISIBLE, true); entity.offer(Keys.HAS_GRAVITY, false); if (faceCorrectDirection.getValue() && location.supports(Keys.DIRECTION)) { Vector3d euler = LocationUtil.cartesianToEuler(location.get(Keys.DIRECTION).orElse(Direction.NONE).getOpposite().asOffset()); entity.setRotation(euler); player.setRotation(euler); } Sponge.getCauseStackManager().pushCause(player); location.getExtent().spawnEntity(entity); Sponge.getCauseStackManager().popCause(); Chair<?> chair = new Chair<>((ArmorStand) entity, location, player.getLocation()); entity.addPassenger(player); player.sendMessage(Text.of(TextColors.YELLOW, "You sit down!")); chairs.put(player.getUniqueId(), chair); }
Location<World> otherBase = otherSide.getRelative(back.getOpposite());