Added more default recipes + small fixes

BStats shows that >75% of users don't add any recipes themselves. So even if I would have preferred not to, i've added more default recipes to make it easier for everyone
+Fixed Brew Create with space in name
+Changed look of Quality Stars (now with half-stars)
+Fixed Cauldron Recipe with Multiple Ingredients
This commit is contained in:
Sn0wStorm
2019-12-06 18:57:41 +01:00
parent bc79248db5
commit 214bb52939
16 changed files with 2018 additions and 119 deletions
+1
View File
@@ -183,6 +183,7 @@ public class BPlayer {
if (bPlayer.drunkeness > 100) {
bPlayer.drinkCap(player);
}
//player.sendMessage("Betrunkenheit: §8[§7⭑⭑⭑⭒§0⭑§8] §8[§6|||||||||||||||||§0|||||||||§8]");
return true;
}
+32 -3
View File
@@ -253,19 +253,48 @@ public class P extends JavaPlugin {
} else if (recipes < 11) {
return "7-10";
} else if (recipes == 11) {
// There are 11 default recipes, so show this as its own slice
// There were 11 default recipes, so show this as its own slice
return "11";
} else if (recipes <= 31) {
} else if (recipes == 20) {
// There are 20 default recipes, so show this as its own slice
return "20";
} else if (recipes <= 29) {
if (recipes % 2 == 0) {
return recipes + "-" + (recipes + 1);
} else {
return (recipes - 1) + "-" + recipes;
}
} else if (recipes < 35) {
return "30-34";
} else if (recipes < 40) {
return "35-39";
} else if (recipes < 45) {
return "40-44";
} else if (recipes <= 50) {
return "45-50";
} else {
return "More than 31";
return "More than 50";
}
}));
metrics.addCustomChart(new Metrics.SimplePie("wakeups", () -> {
if (!BConfig.enableHome) {
return "disabled";
}
int wakeups = Wakeup.wakeups.size();
if (wakeups == 0) {
return "0";
} else if (wakeups <= 5) {
return "1-5";
} else if (wakeups <= 10) {
return "6-10";
} else if (wakeups <= 20) {
return "11-20";
} else {
return "More than 20";
}
}));
metrics.addCustomChart(new Metrics.SimplePie("v2_mc_version", () -> {
String mcv = Bukkit.getBukkitVersion();
mcv = mcv.substring(0, mcv.indexOf('.', 2));
@@ -524,6 +524,7 @@ public class CommandListener implements CommandExecutor {
if (player == null) {
player = ((Player) sender);
pName = null;
}
int stringLength = args.length - 1;
if (pName != null) {
+14 -7
View File
@@ -225,16 +225,23 @@ public class BrewLore {
return;
}
if (!brew.isUnlabeled() && brew.getQuality() > 0 && (qualityColor || BConfig.alwaysShowQuality)) {
int stars = (brew.getQuality() + 1) / 2;
StringBuilder b = new StringBuilder(stars);
for (; stars > 0; stars--) {
b.append("");
}
int stars = (brew.getQuality()) / 2;
boolean half = (brew.getQuality()) % 2 > 0;
StringBuilder b = new StringBuilder(24);
String color;
if (qualityColor) {
color = getQualityColor(brew.getQuality());
} else {
color = brew.getQuality() >= 10 ? "§6" : "§8";
color = "§7";
}
for (; stars > 0; stars--) {
b.append("");
}
if (half) {
if (!qualityColor) {
b.append("§8");
}
b.append("");
}
addOrReplaceLore(Type.STARS, color, b.toString());
} else {
@@ -480,10 +487,10 @@ public class BrewLore {
* Type of Lore Line
*/
public enum Type {
STARS("§s"),
CUSTOM("§t"),
SPACE("§u"),
STARS("§s"),
INGR("§v"),
COOK("§w"),
DISTILL("§x"),
@@ -138,8 +138,20 @@ public class BCauldronRecipe {
/**
* Find how much these ingredients match the given ones from 0-10.
* <p>If any ingredient is missing, returns 0
* <br>If all Ingredients and their amounts are equal, returns 10
* <br>Returns something between 0 and 10 if all ingredients present, but differing amounts, depending on how much the amount differs.
* <br>Any included item that is not in the recipe, will drive the number down most heavily.
* <br>More Amount of any item, will logarithmically raise the number
* <br>Difference in Amount to what the recipe expects will make a tiny difference on the number
* <p>So apart from unexpected items, more amount of the correct item will make the number go up,
* with a little dip for difference in expected amount.
*
* <p>The thought behind this is, that a given list of ingredients matches this recipe most, when:
* <br>1. It is not missing ingredients,
* <br>2. It has no unexpected ingredients
* <br>3. It has a lot of the matching ingredients, so that for two recipes, both having the same
* amount of unexpected ingredients, the one matching the item with the highest amounts wins.
* <br> For Example | Recipe_1: (Wheat*1), Recipe_2: (Sugar*1) | Ingredients: (Wheat*10, Sugar*5), Recipe_1 should win,
* even though the difference in expected amount (1) is lower for Recipe_2
* <br>4. It has the least difference in expected ingredient amount.
*/
public float getIngredientMatch(List<Ingredient> items) {
if (items.size() < ingredients.size()) {
@@ -162,9 +174,6 @@ public class BCauldronRecipe {
P.p.debugLog("Mod for " + recipeIng + ": " + mod);
match *= mod;
continue search;
}
@@ -173,8 +182,9 @@ public class BCauldronRecipe {
}
if (items.size() > ingredients.size()) {
// If there are too many items in the List, multiply the match by 0.1 per Item thats too much
// So that even if every other ingredient is perfect, a recipe that expects all these items will fare better
float tooMuch = items.size() - ingredients.size();
float mod = 0.1f / tooMuch;
double mod = Math.pow(0.1, tooMuch);
match *= mod;
}
P.p.debugLog("Match for Cauldron Recipe " + name + ": " + match);
+6
View File
@@ -196,6 +196,12 @@ public class BRecipe {
matParts = ingredParts[0].split("\\.");
}
if (!P.use1_14 && matParts[0].equalsIgnoreCase("sweet_berries")) {
// Using this in default recipes, but will error on < 1.14
ingredients.add(new SimpleItem(Material.BEDROCK));
continue;
}
// Check if this is a Plugin Item
String[] pluginItem = matParts[0].split(":");
if (pluginItem.length > 1) {
+13 -1
View File
@@ -21,6 +21,12 @@ public class PotionColor {
public static final PotionColor WATER = new PotionColor(11, P.use1_9 ? PotionType.WATER_BREATHING : null, Color.BLUE);
public static final PotionColor DARK_RED = new PotionColor(12, PotionType.INSTANT_DAMAGE, Color.fromRGB(128,0,0));
public static final PotionColor BRIGHT_GREY = new PotionColor(14, PotionType.INVISIBILITY, Color.SILVER);
public static final PotionColor WHITE = new PotionColor(Color.WHITE);
public static final PotionColor LIME = new PotionColor(Color.LIME);
public static final PotionColor OLIVE = new PotionColor(Color.OLIVE);
public static final PotionColor PURPLE = new PotionColor(Color.PURPLE);
public static final PotionColor TEAL = new PotionColor(Color.TEAL);
public static final PotionColor YELLOW = new PotionColor(Color.YELLOW);
private final int colorId;
private final PotionType type;
@@ -33,7 +39,7 @@ public class PotionColor {
}
public PotionColor(Color color) {
colorId = -1;
colorId = WATER.colorId;
type = WATER.getType();
this.color = color;
}
@@ -86,6 +92,12 @@ public class PotionColor {
case "WATER": return WATER;
case "DARK_RED": return DARK_RED;
case "BRIGHT_GREY": return BRIGHT_GREY;
case "WHITE": return WHITE;
case "LIME": return LIME;
case "OLIVE": return OLIVE;
case "PURPLE": return PURPLE;
case "TEAL": return TEAL;
case "YELLOW": return YELLOW;
default:
try{
if (string.length() >= 7) {
@@ -251,6 +251,12 @@ public abstract class RecipeItem implements Cloneable {
}
Material mat = Material.matchMaterial(ingredParts[0]);
if (mat == null && !P.use1_14 && ingredParts[0].equalsIgnoreCase("cornflower")) {
// Using this in default custom-items, but will error on < 1.14
materials.add(Material.BEDROCK);
continue;
}
if (mat == null && BConfig.hasVault) {
try {
net.milkbowl.vault.item.ItemInfo vaultItem = net.milkbowl.vault.item.Items.itemByString(ingredParts[0]);