Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5bdb77c0e | ||
|
|
b06b4e7156 | ||
|
|
05c131cbff | ||
|
|
e3b71c2141 | ||
|
|
7c52af372f |
No files matched your search
+2
-2
@@ -4,7 +4,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = 'com.artillexstudios.axsmithing'
|
||||
version = '1.5'
|
||||
version = '1.6'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -28,7 +28,7 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
implementation 'net.byteflux:libby-bukkit:1.2.0'
|
||||
implementation 'com.artillexstudios.axapi:axapi:1.4.10'
|
||||
implementation 'com.artillexstudios.axapi:axapi:1.4.39'
|
||||
implementation 'org.bstats:bstats-bukkit:3.0.2'
|
||||
compileOnly 'com.google.code.gson:gson:2.10.1'
|
||||
compileOnly 'org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT'
|
||||
|
||||
@@ -196,7 +196,7 @@ public class SmithingTable_V1_16 implements SmithingTable, InventoryHolder {
|
||||
addition = new ItemStack(Material.AIR);
|
||||
}
|
||||
|
||||
if (base == null || addition.getType().isAir()) {
|
||||
if (base == null || base.getType().isAir()) {
|
||||
base = new ItemStack(Material.AIR);
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ public class SmithingTable_V1_16 implements SmithingTable, InventoryHolder {
|
||||
boolean successful = checkRecipe(inv, finalBase, finalAddition);
|
||||
|
||||
if (!successful) {
|
||||
checkRecipe(inv, finalAddition, finalBase);
|
||||
successful = checkRecipe(inv, finalAddition, finalBase);
|
||||
}
|
||||
|
||||
return successful;
|
||||
|
||||
@@ -233,15 +233,21 @@ public class SmithingTable_V1_20 implements SmithingTable, InventoryHolder {
|
||||
addition = new ItemStack(Material.AIR);
|
||||
}
|
||||
|
||||
if (base == null || addition.getType().isAir()) {
|
||||
if (base == null || base.getType().isAir()) {
|
||||
base = new ItemStack(Material.AIR);
|
||||
}
|
||||
|
||||
if (template == null || addition.getType().isAir()) {
|
||||
if (!needNetheriteTemplate) {
|
||||
if (template == null || template.getType().isAir()) {
|
||||
template = new ItemStack(Material.AIR);
|
||||
}
|
||||
|
||||
if (!needNetheriteTemplate && !hasTemplate(addition, base, template)) {
|
||||
if (template.getType().isAir()) {
|
||||
template = new ItemStack(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE);
|
||||
} else {
|
||||
template = new ItemStack(Material.AIR);
|
||||
} else if (base.getType().isAir()) {
|
||||
base = new ItemStack(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE);
|
||||
} else if (addition.getType().isAir()) {
|
||||
addition = new ItemStack(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE);;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,12 +275,36 @@ public class SmithingTable_V1_20 implements SmithingTable, InventoryHolder {
|
||||
successful = checkRecipe(inv, finalAddition, finalBase, finalTemplate);
|
||||
}
|
||||
if (!successful) {
|
||||
checkRecipe(inv, finalAddition, finalTemplate, finalBase);
|
||||
successful = checkRecipe(inv, finalAddition, finalTemplate, finalBase);
|
||||
}
|
||||
|
||||
return successful;
|
||||
}
|
||||
|
||||
private boolean hasTemplate(ItemStack item1, ItemStack item2, ItemStack item3) {
|
||||
if (isTemplate(item1)) {
|
||||
return true;
|
||||
} else if (isTemplate(item2)) {
|
||||
return true;
|
||||
} else {
|
||||
return isTemplate(item3);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isTemplate(ItemStack item) {
|
||||
return switch (item.getType()) {
|
||||
case COAST_ARMOR_TRIM_SMITHING_TEMPLATE, SHAPER_ARMOR_TRIM_SMITHING_TEMPLATE,
|
||||
DUNE_ARMOR_TRIM_SMITHING_TEMPLATE, EYE_ARMOR_TRIM_SMITHING_TEMPLATE,
|
||||
SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE, HOST_ARMOR_TRIM_SMITHING_TEMPLATE,
|
||||
RAISER_ARMOR_TRIM_SMITHING_TEMPLATE, SILENCE_ARMOR_TRIM_SMITHING_TEMPLATE,
|
||||
RIB_ARMOR_TRIM_SMITHING_TEMPLATE, SNOUT_ARMOR_TRIM_SMITHING_TEMPLATE,
|
||||
SPIRE_ARMOR_TRIM_SMITHING_TEMPLATE, TIDE_ARMOR_TRIM_SMITHING_TEMPLATE,
|
||||
VEX_ARMOR_TRIM_SMITHING_TEMPLATE, WARD_ARMOR_TRIM_SMITHING_TEMPLATE,
|
||||
WAYFINDER_ARMOR_TRIM_SMITHING_TEMPLATE, NETHERITE_UPGRADE_SMITHING_TEMPLATE -> true;
|
||||
default -> false;
|
||||
};
|
||||
}
|
||||
|
||||
private boolean checkRecipe(Inventory inventory, ItemStack finalTemplate, ItemStack finalBase, ItemStack finalAddition) {
|
||||
Iterator<Recipe> recipeIterator = Bukkit.getServer().recipeIterator();
|
||||
while (recipeIterator.hasNext()) {
|
||||
|
||||
Reference in new issue
Block a user