Skip to content

Commit 40554ef

Browse files
authored
Add default implementation for DataPalette#replaceId (#4931)
1 parent 6ce2113 commit 40554ef

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

  • api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks

api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks/DataPalette.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,13 @@ default void replaceIds(IntUnaryOperator mapper) {
138138
* @param oldId old id
139139
* @param newId new id
140140
*/
141-
void replaceId(int oldId, int newId);
141+
default void replaceId(int oldId, int newId) {
142+
for (int i = 0; i < this.size(); i++) {
143+
if (this.idByIndex(i) == oldId) {
144+
this.setIdByIndex(i, newId);
145+
}
146+
}
147+
}
142148

143149
/**
144150
* Returns the size of the palette.

0 commit comments

Comments
 (0)