Răsfoiți Sursa

下界合金会提供三倍的修复量

LTCatt 5 ani în urmă
părinte
comite
7820005ba4

+ 1 - 2
src/main/java/com/hexdragon/blacksmithre/block/anvil/AnvilContainerRe.java

@@ -117,7 +117,7 @@ public class AnvilContainerRe extends Container {
             worldPosCallable.consume((world, pos) -> radio[0] = new float[]{1f, 1f, 0.98f, 0.95f}[world.getDifficulty().getId()] * enchantmentRadio);
             worldPosCallable.consume((world, pos) -> radio[0] = new float[]{1f, 1f, 0.98f, 0.95f}[world.getDifficulty().getId()] * enchantmentRadio);
 
 
             // 获取每个材料修复的耐久度
             // 获取每个材料修复的耐久度
-            int mendingPerMaterial = (int) (outputItem.getMaxDamage() / ItemHelperRe.getDamageableItemMaterialCost(outputItem) * radio[0]);
+            int mendingPerMaterial = (int) (outputItem.getMaxDamage() / ItemHelperRe.getDamageableItemRepairCost(outputItem) * radio[0]);
             if (mendingPerMaterial <= 0) {
             if (mendingPerMaterial <= 0) {
                 this.outputInventory.setInventorySlotContents(0, ItemStack.EMPTY);
                 this.outputInventory.setInventorySlotContents(0, ItemStack.EMPTY);
                 return;
                 return;
@@ -201,7 +201,6 @@ public class AnvilContainerRe extends Container {
                     world.playEvent(1029, blockPos, 0);
                     world.playEvent(1029, blockPos, 0);
                 } else {
                 } else {
                     // TODO : <验证> 铁砧损坏等级增加时的物品处理是否在多人工作正常
                     // TODO : <验证> 铁砧损坏等级增加时的物品处理是否在多人工作正常
-                    // TODO : <验证> Mixin config mixins.blacksmithre.json "minVersion" 定为0.8是否合理
                     // 保存当前物品并清空物品栏,避免在更改方块时爆出
                     // 保存当前物品并清空物品栏,避免在更改方块时爆出
                     AnvilTileEntity tileEntity = (AnvilTileEntity) world.getTileEntity(blockPos);
                     AnvilTileEntity tileEntity = (AnvilTileEntity) world.getTileEntity(blockPos);
                     ItemStack itemStack0 = tileEntity.getItems().get(0).copy();
                     ItemStack itemStack0 = tileEntity.getItems().get(0).copy();

+ 0 - 1
src/main/java/com/hexdragon/blacksmithre/block/anvil/AnvilScreenRe.java

@@ -36,7 +36,6 @@ public class AnvilScreenRe extends ContainerScreen<AnvilContainerRe> {
         }
         }
         // TODO : 带有腐朽附魔的物品在满耐久的时候和原料一起放入铁砧允许修复,而不是打上红叉
         // TODO : 带有腐朽附魔的物品在满耐久的时候和原料一起放入铁砧允许修复,而不是打上红叉
         // TODO : <验证> 检查使用 Main 获取 TileEntity 的方式是否会在多人造成兼容性问题
         // TODO : <验证> 检查使用 Main 获取 TileEntity 的方式是否会在多人造成兼容性问题
-        // TODO : Timicasto 汇报的 Bug:按 Shift 转移物品容易崩溃?
         // 渲染当前的 TileEntity
         // 渲染当前的 TileEntity
         ItemRendererRe.renderItemModelIntoGUIScaled(itemRenderer, new ItemStack(Main.LastTileEntity.getBlockState().getBlock()), i + 23, j + 20, 40);
         ItemRendererRe.renderItemModelIntoGUIScaled(itemRenderer, new ItemStack(Main.LastTileEntity.getBlockState().getBlock()), i + 23, j + 20, 40);
     }
     }

+ 9 - 1
src/main/java/com/hexdragon/corere/item/ItemHelperRe.java

@@ -5,10 +5,18 @@ import net.minecraft.item.Item;
 import net.minecraft.item.ItemStack;
 import net.minecraft.item.ItemStack;
 import net.minecraft.item.Items;
 import net.minecraft.item.Items;
 import net.minecraftforge.common.ToolType;
 import net.minecraftforge.common.ToolType;
+import org.lwjgl.system.CallbackI;
 
 
 public class ItemHelperRe {
 public class ItemHelperRe {
 
 
-    // 合成某个可损坏的物品大致需要的最珍贵原料数,返回值并不准确,只适合用于估计
+    // 完全修复某个可损坏的物品大致需要的珍贵原料数,返回值并不准确,只适合用于估计
+    public static float getDamageableItemRepairCost(ItemStack itemStack) {
+        // 一个下界合金视作 3 个原材料
+        boolean isNetherite = itemStack.getItem().getIsRepairable(itemStack, new ItemStack(Items.NETHERITE_INGOT));
+        return getDamageableItemMaterialCost(itemStack) / (isNetherite ? 3f : 1f);
+    }
+
+    // 合成某个可损坏的物品大致需要的珍贵原料数(下界合金为其对应的钻石物品),返回值并不准确,只适合用于估计
     public static int getDamageableItemMaterialCost(ItemStack itemStack) {
     public static int getDamageableItemMaterialCost(ItemStack itemStack) {
         Item item = itemStack.getItem();
         Item item = itemStack.getItem();
         // 根据工具种类判断
         // 根据工具种类判断