3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-25 15:50:10 +01:00

fix fence connections to stairs, remove waterlogged blocks from stair data

Dieser Commit ist enthalten in:
Gerrygames 2019-01-17 12:22:36 +01:00
Ursprung b129ef04f3
Commit 605e63e1df
2 geänderte Dateien mit 10 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -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));

Datei anzeigen

@ -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;
}