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

View File

@ -68,7 +68,7 @@ updateCheck: true
autosave: 3
# Config Version
version: '1.7'
version: '1.8'
# -- Rezepte für Getränke --
@ -87,6 +87,7 @@ version: '1.7'
# age: Zeit in Minecraft-Tagen, die das Getränk im Fass reifen muss 0= kein reifen
# color: Farbe des Getränks nach destillieren/reifen.
# Benutzbare Farben: DARK_RED, RED, BRIGHT_RED, ORANGE, PINK, BLUE, CYAN, WATER, GREEN, BLACK, GREY, BRIGHT_GREY
# Oder RGB Farben (Hex: also zB '99FF33') (Ohne #) (mit '') (Einfach nach "HTML color" im Internet suchen)
# difficulty: 1-10 Genauigkeit der Einhaltung der Vorgaben (1 = ungenau/einfach 10 = sehr genau/schwer)
# alcohol: Alkoholgehalt 0-100 in absoluter Menge bei perfektem Getränk (wird dem Spieler hinzugefügt, bei 100 = tot)
# effects: Auflistung Effekt/Level/Dauer Besonderere Trank-Effekte beim Trinken, Dauer in sek.

View File

@ -65,7 +65,7 @@ updateCheck: true
autosave: 3
# Config Version
version: '1.7'
version: '1.8'
# -- Recipes for Potions --
@ -84,6 +84,7 @@ version: '1.7'
# age: Time in Minecraft-days, the potion has to age in a barrel 0=no aging
# color: Color of the potion after distilling/aging.
# Usable Colors: DARK_RED, RED, BRIGHT_RED, ORANGE, PINK, BLUE, CYAN, WATER, GREEN, BLACK, GREY, BRIGHT_GREY
# Or RGB colors (hex: for example '99FF33') (with '') (search for "HTML color" on the internet)
# difficulty: 1-10 accuracy needed to get good quality (1 = unaccurate/easy, 10 = very precise/hard)
# alcohol: Absolute amount of alcohol 0-100 in a perfect potion (will be added directly to the player, where 100 means fainting)
# effects: List of effect/level/duration Special potion-effect when drinking, duration in sek.

View File

@ -65,7 +65,7 @@ updateCheck: true
autosave: 3
# Version de configuration
version: '1.7'
version: '1.8'
# -- Recette pour les boissons --
@ -85,6 +85,7 @@ version: '1.7'
# age: Temps en jours de Minecraft, la potion devra être âgée dans un baril. 0=Pas besoin d'âge
# color: Couleur de la potion après distillation/avoir laissé vieillir.
# Couleurs disponibles: DARK_RED, RED, BRIGHT_RED, ORANGE, PINK, BLUE, CYAN, WATER, GREEN, BLACK, GREY, BRIGHT_GREY (Dans l'ordre : Rouge foncé, Rouge, Rouge clair, Orange, Rose, Bleu, Cyan, Eau, Vert, Noir, Gris, Gris clair)
# Or RGB colors (hex: for example '99FF33') (with '') (search for "HTML color" on the internet)
# difficulty: 1-10 précision nécessaire pour obtenir une bonne qualité (1 = imprécis/facile, 10 = très précis/difficile)
# alcohol: Le montant d'alcool absolu dans une boisson parfaite (cela sera ajouté directement au joueur, où 100% entraînera l'évanouissement), un degré d'alcooléisme en fait
# effects: Liste des effets/durée en secondes lors de la consommation.

View File

@ -65,7 +65,7 @@ updateCheck: true
autosave: 3
# Versione del config
version: '1.7'
version: '1.8'
# -- Ricette per pozioni --
@ -84,6 +84,7 @@ version: '1.7'
# age: Tempo in giorni di Minecraft per cui la pozione deve essere invecchiata in un barile (0=nessun invecchiamento).
# color: Colore della pozione dopo essere stata distillata/invecchiata
# Colori utilizzabili: DARK_RED, RED, BRIGHT_RED, ORANGE, PINK, BLUE, CYAN, WATER, GREEN, BLACK, GREY, BRIGHT_GREY
# Or RGB colors (hex: for example '99FF33') (with '') (search for "HTML color" on the internet)
# difficoltà: Precisione richiesta per avere la migliore qualità da 1 a 10(1 = spreciso/più facile, 10 = molto preciso/più difficile)
# alcohol: Volume alcolico da 0 a 100 nella versione perfetta (sarà aggiunta direttamente al giocatore, dove 100 è la quantità massima di alcohol assorbibile.
# effects: Eventuali effetti come quelli delle pozioni nel formato di effetto/livello/durata.

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

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;

View File

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