Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-19 17:30:08 +01:00
Minor adjustments
Dieser Commit ist enthalten in:
Ursprung
7bf6524a34
Commit
c1e4394cd6
@ -346,7 +346,7 @@ public abstract class PlacementStateProcessor extends AbstractDelegateExtent imp
|
||||
return BlockTypesCache.states[ordinal].getNbtData();
|
||||
}
|
||||
|
||||
private char getBlockOrdinal(final int blockX, final int blockY, final int blockZ, final BlockState state) {
|
||||
private char getBlockOrdinal(int blockX, int blockY, int blockZ, BlockState state) {
|
||||
EnumSet<Direction> dirs = Direction.getDirections(state);
|
||||
Direction clickedFaceDirection = null; // This should be always be set by the below.
|
||||
Set<String> states = state.getStates().keySet().stream().map(Property::getName).collect(Collectors.toSet());
|
||||
@ -358,7 +358,12 @@ public abstract class PlacementStateProcessor extends AbstractDelegateExtent imp
|
||||
boolean hadNesw = false;
|
||||
for (Direction dir : NESW) {
|
||||
if (dirs.contains(dir)) {
|
||||
clickedFaceDirection = dir.getLeft().getLeft(); // opposite
|
||||
clickedFaceDirection = dir.getLeft().getLeft();
|
||||
if (state.getBlockType() == BlockTypes.CHEST || state.getBlockType() == BlockTypes.TRAPPED_CHEST) {
|
||||
Direction tmp = clickedFaceDirection;
|
||||
clickedFaceDirection = dir;
|
||||
dir = tmp;
|
||||
}
|
||||
clickPos.setComponents(
|
||||
(double) blockX + 0.5 * (1 + dir.getBlockX()),
|
||||
(double) blockY + 0.2,
|
||||
|
@ -29,12 +29,10 @@ import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import java.util.OptionalInt;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A collection of cardinal, ordinal, and secondary-ordinal directions.
|
||||
@ -366,7 +364,7 @@ public enum Direction {
|
||||
* @since TODO
|
||||
*/
|
||||
public static EnumSet<Direction> getDirections(BlockState state) {
|
||||
Set<Direction> directions = new HashSet<>();
|
||||
EnumSet<Direction> directions = EnumSet.noneOf(Direction.class);
|
||||
for (Property<?> property : state.getBlockType().getProperties()) {
|
||||
if (property instanceof DirectionalProperty dirProp) {
|
||||
directions.add(state.getState(dirProp));
|
||||
@ -376,8 +374,7 @@ public enum Direction {
|
||||
if (!(value instanceof String str)) {
|
||||
if (value instanceof Integer i) {
|
||||
fromRotationIndex(i).ifPresent(directions::add);
|
||||
}
|
||||
if (value instanceof Boolean) {
|
||||
} else if (value instanceof Boolean b && b) {
|
||||
try {
|
||||
directions.add(Direction.valueOf(property.getName().toUpperCase(Locale.ROOT)));
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
@ -397,9 +394,8 @@ public enum Direction {
|
||||
case "shape" -> {} // Do nothing for now
|
||||
}
|
||||
}
|
||||
return EnumSet.copyOf(directions);
|
||||
return directions;
|
||||
}
|
||||
//FAWE end
|
||||
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren