Skip to content

Commit

Permalink
[1.6.0-pre2]兼容1.20.4,修复示例随机烧炼配方存在错误、不会释放铁砧配方示例的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
YufiriaMazenta committed Dec 8, 2023
1 parent 22bc7ac commit 427b068
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import java.text.SimpleDateFormat
version = "1.6.0-pre1"
version = "1.6.0-pre2"

plugins {
`java-library`
Expand Down Expand Up @@ -41,7 +41,7 @@ dependencies {
compileOnly("com.github.LoneDev6:API-ItemsAdder:3.5.0b")
compileOnly("com.github.oraxen:oraxen:1.160.0")
compileOnly("io.lumine:Mythic-Dist:5.3.5")
implementation("com.crypticlib:CrypticLib:0.5.9")
implementation("com.crypticlib:CrypticLib:0.5.10")
}

group = "com.github.yufiriamazenta"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,11 @@ private void openAnvilRecipeCreator(Player player, RecipeType recipeType, String
Languages.MENU_RECIPE_CREATOR_ICON_ANVIL_COPY_NBT_TOGGLE.value(),
event -> setIconGlowing(event.getSlot(), event)
);
toggleCopyNbt.display().addUnsafeEnchantment(Enchantment.MENDING, 1);
toggleCopyNbt.display().addItemFlags(ItemFlag.HIDE_ENCHANTS);
ItemStack display = toggleCopyNbt.display();
ItemMeta displayMeta = display.getItemMeta();
displayMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
display.setItemMeta(displayMeta);
display.addUnsafeEnchantment(Enchantment.MENDING, 1);
layoutMap.put('B', toggleCopyNbt);
layoutMap.put('A', new Icon(Material.ANVIL, Languages.MENU_RECIPE_CREATOR_ICON_CONFIRM.value(),
event -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public class AnvilHandler implements Listener {
public void onPrepareAnvil(PrepareAnvilEvent event) {
if (!PluginConfigs.ENABLE_ANVIL_RECIPE.value())
return;
ItemStack base = event.getInventory().getFirstItem();
ItemStack addition = event.getInventory().getSecondItem();
ItemStack base = event.getInventory().getItem(0);
ItemStack addition = event.getInventory().getItem(1);
if (ItemUtil.isAir(base) || ItemUtil.isAir(addition))
return;
AnvilRecipe anvilRecipe = RecipeManager.INSTANCE.matchAnvilRecipe(base, addition);
Expand All @@ -51,9 +51,9 @@ public void onClickAnvil(InventoryClickEvent event) {
AnvilInventory anvilInventory = (AnvilInventory) event.getInventory();
if (event.getSlot() != 2)
return;
ItemStack base = anvilInventory.getFirstItem();
ItemStack addition = anvilInventory.getSecondItem();
ItemStack result = anvilInventory.getResult();
ItemStack base = anvilInventory.getItem(0);
ItemStack addition = anvilInventory.getItem(1);
ItemStack result = anvilInventory.getItem(2);
if (ItemUtil.isAir(base) || ItemUtil.isAir(addition) || ItemUtil.isAir(result))
return;
AnvilRecipe anvilRecipe = RecipeManager.INSTANCE.matchAnvilRecipe(base, addition);
Expand Down Expand Up @@ -137,10 +137,10 @@ public void onClickAnvil(InventoryClickEvent event) {
//更新页面
AnvilRecipe afterClickRecipe = RecipeManager.INSTANCE.matchAnvilRecipe(base, addition);
if (afterClickRecipe == null) {
anvilInventory.setResult(null);
anvilInventory.setItem(2, null);
return;
}
anvilInventory.setResult(afterClickRecipe.getResult());
anvilInventory.setItem(2, afterClickRecipe.getResult());
anvilInventory.setRepairCost(anvilRecipe.costLevel());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,10 @@ private void saveDefConfigFile(List<File> allFiles) {
Craftorithm.instance().saveResource("recipes/example_potion.yml", false);
allFiles.add(new File(RECIPE_FILE_FOLDER, "example_potion.yml"));
}
if (PluginConfigs.ENABLE_ANVIL_RECIPE.value()) {
Craftorithm.instance().saveResource("recipes/example_anvil.yml", false);
allFiles.add(new File(RECIPE_FILE_FOLDER, "example_anvil.yml"));
}
}

}
2 changes: 1 addition & 1 deletion src/main/resources/recipes/example_random_cooking.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ multiple: true
source:
- block: furnace
item: bedrock
- block: smoking
- block: smoker
item: bedrock
- block: blast_furnace
item: bedrock
Expand Down

0 comments on commit 427b068

Please sign in to comment.