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();
|
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);
|
EnumSet<Direction> dirs = Direction.getDirections(state);
|
||||||
Direction clickedFaceDirection = null; // This should be always be set by the below.
|
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());
|
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;
|
boolean hadNesw = false;
|
||||||
for (Direction dir : NESW) {
|
for (Direction dir : NESW) {
|
||||||
if (dirs.contains(dir)) {
|
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(
|
clickPos.setComponents(
|
||||||
(double) blockX + 0.5 * (1 + dir.getBlockX()),
|
(double) blockX + 0.5 * (1 + dir.getBlockX()),
|
||||||
(double) blockY + 0.2,
|
(double) blockY + 0.2,
|
||||||
|
@ -29,12 +29,10 @@ import javax.annotation.Nullable;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.OptionalInt;
|
import java.util.OptionalInt;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A collection of cardinal, ordinal, and secondary-ordinal directions.
|
* A collection of cardinal, ordinal, and secondary-ordinal directions.
|
||||||
@ -366,7 +364,7 @@ public enum Direction {
|
|||||||
* @since TODO
|
* @since TODO
|
||||||
*/
|
*/
|
||||||
public static EnumSet<Direction> getDirections(BlockState state) {
|
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()) {
|
for (Property<?> property : state.getBlockType().getProperties()) {
|
||||||
if (property instanceof DirectionalProperty dirProp) {
|
if (property instanceof DirectionalProperty dirProp) {
|
||||||
directions.add(state.getState(dirProp));
|
directions.add(state.getState(dirProp));
|
||||||
@ -376,8 +374,7 @@ public enum Direction {
|
|||||||
if (!(value instanceof String str)) {
|
if (!(value instanceof String str)) {
|
||||||
if (value instanceof Integer i) {
|
if (value instanceof Integer i) {
|
||||||
fromRotationIndex(i).ifPresent(directions::add);
|
fromRotationIndex(i).ifPresent(directions::add);
|
||||||
}
|
} else if (value instanceof Boolean b && b) {
|
||||||
if (value instanceof Boolean) {
|
|
||||||
try {
|
try {
|
||||||
directions.add(Direction.valueOf(property.getName().toUpperCase(Locale.ROOT)));
|
directions.add(Direction.valueOf(property.getName().toUpperCase(Locale.ROOT)));
|
||||||
} catch (IllegalArgumentException ignored) {
|
} catch (IllegalArgumentException ignored) {
|
||||||
@ -397,9 +394,8 @@ public enum Direction {
|
|||||||
case "shape" -> {} // Do nothing for now
|
case "shape" -> {} // Do nothing for now
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return EnumSet.copyOf(directions);
|
return directions;
|
||||||
}
|
}
|
||||||
//FAWE end
|
//FAWE end
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren