Inspired by 2020's April Fools' 20w14infinite Snapshot, this mod brings endless randomly generated dimensions into Minecraft.

wait terminator escapes are actually important

authored by

Lera and committed by cassian.cc d3a53559 46b11422

+22 -4
+22 -4
common/src/main/java/net/lerariemann/infinity/util/core/SaferStringReader.java
··· 26 26 @Override 27 27 public String readStringUntil(char terminator) throws CommandSyntaxException { 28 28 StringBuilder result = new StringBuilder(); 29 + boolean escaped = false; 29 30 30 31 while(this.canRead()) { 31 32 char c = this.read(); 32 - if (c == terminator) { 33 - return result.toString(); 34 - } 33 + if (escaped) { 34 + if (c == terminator) { 35 + result.append(c); 36 + escaped = false; 37 + } 38 + else if (c == '\\') { 39 + result.append('\\'); 40 + } 41 + else { 42 + result.append('\\'); 43 + result.append(c); 44 + escaped = false; 45 + } 46 + } else if (c == '\\') { 47 + escaped = true; 48 + } else { 49 + if (c == terminator) { 50 + return result.toString(); 51 + } 35 52 36 - result.append(c); 53 + result.append(c); 54 + } 37 55 } 38 56 39 57 throw CommandSyntaxException.BUILT_IN_EXCEPTIONS.readerExpectedEndOfQuote().createWithContext(this);