Make loading RGB colors easier

This commit is contained in:
Sn0wStorm
2019-08-17 22:42:58 +02:00
parent c39b35d82a
commit 9567feed81
7 changed files with 34 additions and 12 deletions
+2 -3
View File
@@ -145,9 +145,8 @@ public class BRecipe {
P.p.errorLog("Invalid age time '" + age + "' in Recipe: " + getName(5));
return false;
}
try {
Brew.PotionColor.fromString(getColor());
} catch (IllegalArgumentException e) {
String c = getColor();
if (!c.equals("WATER") && Brew.PotionColor.fromString(c) == Brew.PotionColor.WATER) {
P.p.errorLog("Invalid Color '" + color + "' in Recipe: " + getName(5));
return false;
}
+6 -3
View File
@@ -766,10 +766,13 @@ public class Brew {
case "BRIGHT_GREY": return BRIGHT_GREY;
default:
try{
if (string.length() >= 7) {
string = string.substring(1);
}
return new PotionColor(Color.fromRGB(
Integer.parseInt(string.substring( 1, 3 ), 16 ),
Integer.parseInt(string.substring( 3, 5 ), 16 ),
Integer.parseInt(string.substring( 5, 7 ), 16 )
Integer.parseInt(string.substring( 0, 2 ), 16 ),
Integer.parseInt(string.substring( 2, 4 ), 16 ),
Integer.parseInt(string.substring( 4, 6 ), 16 )
));
} catch (Exception e) {
return WATER;
@@ -1137,11 +1137,19 @@ public class ConfigUpdater {
String[] lines = {"",
"# Wie viele Brewery Getränke in die Minecraft Fässer getan werden können [6]",
"maxBrewsInMCBarrels: 6"};
if (index == 0) {
if (index == -1) {
appendLines(lines);
} else {
addLines(index + 1, lines);
}
index = indexOfStart("# Benutzbare Farben");
if (index == -1) {
index = indexOfStart("# color:");
}
if (index != -1) {
addLines(index + 1, "# Oder RGB Farben (Hex: also zB '99FF33') (Ohne #) (mit '') (Einfach nach \"HTML color\" im Internet suchen)");
}
}
// Update en from 1.7 to 1.8
@@ -1164,11 +1172,19 @@ public class ConfigUpdater {
String[] lines = {"",
"# How many Brewery drinks can be put into the Minecraft barrels [6]",
"maxBrewsInMCBarrels: 6"};
if (index == 0) {
if (index == -1) {
appendLines(lines);
} else {
addLines(index + 1, lines);
}
index = indexOfStart("# Usable Colors");
if (index == -1) {
index = indexOfStart("# color:");
}
if (index != -1) {
addLines(index + 1, "# Or RGB colors (hex: for example '99FF33') (with '') (search for \"HTML color\" on the internet)");
}
}
// Update all Materials to Minecraft 1.13