Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-25 15:50:10 +01:00
Merge pull request #1160 from Gerrygames/master
fix fence connections to stairs
Dieser Commit ist enthalten in:
Commit
5ba7c4ba2c
@ -15,15 +15,17 @@ public abstract class AbstractFenceConnectionHandler extends ConnectionHandler {
|
||||
@Getter
|
||||
private Set<Integer> blockStates = new HashSet<>();
|
||||
private Map<Byte, Integer> connectedBlockStates = new HashMap<>();
|
||||
private static final StairConnectionHandler STAIR_CONNECTION_HANDLER = new StairConnectionHandler();
|
||||
|
||||
public AbstractFenceConnectionHandler(String blockConnections, String key) {
|
||||
this.blockConnections = blockConnections;
|
||||
|
||||
for (Map.Entry<String, Integer> blockState : ConnectionData.keyToId.entrySet()) {
|
||||
if (key.equals(blockState.getKey().split("\\[")[0])) {
|
||||
WrappedBlockData blockData = WrappedBlockData.fromString(blockState.getKey());
|
||||
if (blockData.hasData("waterlogged") && blockData.getValue("waterlogged").equals("true")) continue;
|
||||
blockStates.add(blockState.getValue());
|
||||
ConnectionData.connectionHandlerMap.put(blockState.getValue(), this);
|
||||
WrappedBlockData blockData = WrappedBlockData.fromString(blockState.getKey());
|
||||
connectedBlockStates.put(getStates(blockData), blockState.getValue());
|
||||
}
|
||||
}
|
||||
@ -35,7 +37,6 @@ public abstract class AbstractFenceConnectionHandler extends ConnectionHandler {
|
||||
if (blockData.getValue("north").equals("true")) states |= 2;
|
||||
if (blockData.getValue("south").equals("true")) states |= 4;
|
||||
if (blockData.getValue("west").equals("true")) states |= 8;
|
||||
if (blockData.hasData("waterlogged") && blockData.getValue("waterlogged").equals("true")) states |= 16;
|
||||
return states;
|
||||
}
|
||||
|
||||
@ -48,6 +49,11 @@ public abstract class AbstractFenceConnectionHandler extends ConnectionHandler {
|
||||
return states;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockData(UserConnection user, Position position) {
|
||||
return STAIR_CONNECTION_HANDLER.connect(user, position, super.getBlockData(user, position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int connect(UserConnection user, Position position, int blockState) {
|
||||
final Integer newBlockState = connectedBlockStates.get(getStates(user, position, blockState));
|
||||
|
@ -21,13 +21,13 @@ public class WallConnectionHandler extends AbstractFenceConnectionHandler {
|
||||
@Override
|
||||
protected byte getStates(WrappedBlockData blockData) {
|
||||
byte states = super.getStates(blockData);
|
||||
if (blockData.getValue("up").equals("true")) states |= 32;
|
||||
if (blockData.getValue("up").equals("true")) states |= 16;
|
||||
return states;
|
||||
}
|
||||
|
||||
protected byte getStates(UserConnection user, Position position, int blockState) {
|
||||
byte states = super.getStates(user, position, blockState);
|
||||
if (up(user, position)) states |= 32;
|
||||
if (up(user, position)) states |= 16;
|
||||
return states;
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren