migrate to new buildscript

Class Registries are merged together into one. All subprojects are also merged into one. It's probably possible to split stuff into multiple source sets and not merging the registries, but I'm just too lazy for that.
This commit is contained in:
Glease committed 2022-03-05 03:02:05 +08:00
1 parent 7c4b38e853
commit 38c46d61d9
341 files changed
+1027 -11951

No files matched your search

@@ -0,0 +1,67 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package minetweaker.mc1710.formatting;
import java.util.Arrays;
import minetweaker.api.formatting.IFormattedText;
import net.minecraft.util.EnumChatFormatting;
/**
*
* @author Stan
*/
public class FormattedStringJoin implements IMCFormattedString {
private final IMCFormattedString[] values;
public FormattedStringJoin(IMCFormattedString first, IMCFormattedString second) {
values = new IMCFormattedString[] { first, second };
}
public FormattedStringJoin(IMCFormattedString[] values) {
this.values = values;
}
@Override
public String getTooltipString() {
StringBuilder result = new StringBuilder();
for (IMCFormattedString value : values) {
result.append(value.getTooltipString());
}
return result.toString();
}
@Override
public String getTooltipString(String context) {
boolean first = true;
StringBuilder result = new StringBuilder();
for (IMCFormattedString value : values) {
if (first) {
first = false;
} else {
result.append(context);
}
result.append(value.getTooltipString());
result.append(EnumChatFormatting.RESET);
}
return result.toString();
}
@Override
public IFormattedText add(IFormattedText other) {
return cat(other);
}
@Override
public IFormattedText cat(IFormattedText other) {
IMCFormattedString[] newValues = Arrays.copyOf(values, values.length + 1);
newValues[values.length] = (IMCFormattedString) other;
return new FormattedStringJoin(newValues);
}
}