LTCatt před 6 roky
rodič
revize
d0b2135c69

+ 8 - 9
src/main/java/com/hexdragon/enchrebirth/block/GrindstoneContainerRe.java

@@ -11,7 +11,6 @@ import net.minecraft.entity.player.PlayerInventory;
 import net.minecraft.inventory.IInventory;
 import net.minecraft.inventory.IInventory;
 import net.minecraft.inventory.Inventory;
 import net.minecraft.inventory.Inventory;
 import net.minecraft.inventory.container.Container;
 import net.minecraft.inventory.container.Container;
-import net.minecraft.inventory.container.RepairContainer;
 import net.minecraft.inventory.container.Slot;
 import net.minecraft.inventory.container.Slot;
 import net.minecraft.item.ItemStack;
 import net.minecraft.item.ItemStack;
 import net.minecraft.item.Items;
 import net.minecraft.item.Items;
@@ -32,28 +31,30 @@ public class GrindstoneContainerRe extends Container {
 
 
     // 构造页面槽位
     // 构造页面槽位
     private void Constuct(int windowIdIn, PlayerInventory playerInventoryIn, final IWorldPosCallable worldPosCallableIn) {
     private void Constuct(int windowIdIn, PlayerInventory playerInventoryIn, final IWorldPosCallable worldPosCallableIn) {
-        this.addSlot(new Slot(this.inputInventory, 0, 49, 19) {
+        this.addSlot(new Slot(this.inputInventory, 0, 62, 28) {
             // 检查物品是否能输入:没有没拿走的输出,且接受输入
             // 检查物品是否能输入:没有没拿走的输出,且接受输入
             public boolean isItemValid(ItemStack stack) {
             public boolean isItemValid(ItemStack stack) {
                 return !(inputInventory.isEmpty() && !outputInventory.isEmpty()) && stack.getCount() == 1 && stack.isDamageable();
                 return !(inputInventory.isEmpty() && !outputInventory.isEmpty()) && stack.getCount() == 1 && stack.isDamageable();
             }
             }
         });
         });
-        this.addSlot(new Slot(this.outputInventory, 0, 129, 34) {
+        this.addSlot(new Slot(this.outputInventory, 0, 120, 28) {
             // 禁止将物品放在输出格
             // 禁止将物品放在输出格
             public boolean isItemValid(ItemStack stack) {
             public boolean isItemValid(ItemStack stack) {
                 return false;
                 return false;
             }
             }
+
             // 从输出格拿走物品时清空输入格
             // 从输出格拿走物品时清空输入格
             public ItemStack onTake(PlayerEntity thePlayer, ItemStack stack) {
             public ItemStack onTake(PlayerEntity thePlayer, ItemStack stack) {
                 GrindstoneContainerRe.this.inputInventory.setInventorySlotContents(0, ItemStack.EMPTY);
                 GrindstoneContainerRe.this.inputInventory.setInventorySlotContents(0, ItemStack.EMPTY);
                 return stack;
                 return stack;
             }
             }
         });
         });
-        this.addSlot(new Slot(this.outputInventory, 1, 129 + 18, 34) {
+        this.addSlot(new Slot(this.outputInventory, 1, 120 + 18, 28) {
             // 禁止将物品放在输出格
             // 禁止将物品放在输出格
             public boolean isItemValid(ItemStack stack) {
             public boolean isItemValid(ItemStack stack) {
                 return false;
                 return false;
             }
             }
+
             // 从输出格拿走物品时清空输入格
             // 从输出格拿走物品时清空输入格
             public ItemStack onTake(PlayerEntity thePlayer, ItemStack stack) {
             public ItemStack onTake(PlayerEntity thePlayer, ItemStack stack) {
                 GrindstoneContainerRe.this.inputInventory.setInventorySlotContents(0, ItemStack.EMPTY);
                 GrindstoneContainerRe.this.inputInventory.setInventorySlotContents(0, ItemStack.EMPTY);
@@ -62,7 +63,7 @@ public class GrindstoneContainerRe extends Container {
         });
         });
 
 
         // 增加物品栏与快捷栏槽位
         // 增加物品栏与快捷栏槽位
-        int yPositionStart = 84;
+        int yPositionStart = 68;
         for (int i = 0; i < 3; ++i) {
         for (int i = 0; i < 3; ++i) {
             for (int j = 0; j < 9; ++j) {
             for (int j = 0; j < 9; ++j) {
                 this.addSlot(new Slot(playerInventoryIn, j + i * 9 + 9, 8 + j * 18, yPositionStart + i * 18));
                 this.addSlot(new Slot(playerInventoryIn, j + i * 9 + 9, 8 + j * 18, yPositionStart + i * 18));
@@ -107,6 +108,7 @@ public class GrindstoneContainerRe extends Container {
         this.detectAndSendChanges();
         this.detectAndSendChanges();
     }
     }
 
 
+    // TODO : 打开砂轮物品栏关闭游戏,会在重新上线后掉落全部物品
     // 对砂轮的单个物品进行预处理:例如移除非诅咒附魔、重置修复消耗等
     // 对砂轮的单个物品进行预处理:例如移除非诅咒附魔、重置修复消耗等
     private ItemStack prepareNewItem(ItemStack stack) {
     private ItemStack prepareNewItem(ItemStack stack) {
         ItemStack itemstack = stack.copy();
         ItemStack itemstack = stack.copy();
@@ -119,11 +121,8 @@ public class GrindstoneContainerRe extends Container {
         itemstack.removeChildTag("Enchantments");
         itemstack.removeChildTag("Enchantments");
         Map<Enchantment, Integer> map = EnchantmentHelperRe.getCurseEnchantments(stack);
         Map<Enchantment, Integer> map = EnchantmentHelperRe.getCurseEnchantments(stack);
         EnchantmentHelper.setEnchantments(map, itemstack);
         EnchantmentHelper.setEnchantments(map, itemstack);
-        // 根据附魔数重置修复消耗
+        // 重置修复消耗
         itemstack.setRepairCost(0);
         itemstack.setRepairCost(0);
-        for (int i = 0; i < map.size(); ++i) {
-            itemstack.setRepairCost(RepairContainer.getNewRepairCost(itemstack.getRepairCost()));
-        }
         return itemstack;
         return itemstack;
     }
     }
 
 

+ 4 - 2
src/main/java/com/hexdragon/enchrebirth/block/GrindstoneScreenRe.java

@@ -1,6 +1,7 @@
 package com.hexdragon.enchrebirth.block;
 package com.hexdragon.enchrebirth.block;
 
 
 import com.hexdragon.core.gui.ContainerScreenRe;
 import com.hexdragon.core.gui.ContainerScreenRe;
+import com.hexdragon.enchrebirth.EnchRebirth;
 import com.mojang.blaze3d.matrix.MatrixStack;
 import com.mojang.blaze3d.matrix.MatrixStack;
 import net.minecraft.entity.player.PlayerInventory;
 import net.minecraft.entity.player.PlayerInventory;
 import net.minecraft.util.ResourceLocation;
 import net.minecraft.util.ResourceLocation;
@@ -11,11 +12,12 @@ import org.lwjgl.opengl.GL11;
 
 
 @OnlyIn(Dist.CLIENT)
 @OnlyIn(Dist.CLIENT)
 public class GrindstoneScreenRe extends ContainerScreenRe<GrindstoneContainerRe> {
 public class GrindstoneScreenRe extends ContainerScreenRe<GrindstoneContainerRe> {
-    private static final ResourceLocation GRINDSTONE_GUI_TEXTURES = new ResourceLocation("textures/gui/container/grindstone.png");
+    private static final ResourceLocation GRINDSTONE_GUI_TEXTURES = new ResourceLocation(EnchRebirth.MODID, "textures/gui/container/grindstone.png");
 
 
     public GrindstoneScreenRe(GrindstoneContainerRe container, PlayerInventory playerInventory, ITextComponent textComponent) {
     public GrindstoneScreenRe(GrindstoneContainerRe container, PlayerInventory playerInventory, ITextComponent textComponent) {
         super(container, playerInventory, textComponent);
         super(container, playerInventory, textComponent);
         this.showPlayerInventoryTitle = false;
         this.showPlayerInventoryTitle = false;
+        this.titleX = 61; this.titleY = 12; this.ySize = 150;
     }
     }
 
 
     public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
     public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
@@ -33,7 +35,7 @@ public class GrindstoneScreenRe extends ContainerScreenRe<GrindstoneContainerRe>
         this.blit(matrixStack, i, j, 0, 0, this.xSize, this.ySize);
         this.blit(matrixStack, i, j, 0, 0, this.xSize, this.ySize);
         // 显示无法合成的红叉:输入、输出仅一方为空
         // 显示无法合成的红叉:输入、输出仅一方为空
         if (this.container.getSlot(0).getHasStack() ^ (this.container.getSlot(1).getHasStack() || this.container.getSlot(2).getHasStack())) {
         if (this.container.getSlot(0).getHasStack() ^ (this.container.getSlot(1).getHasStack() || this.container.getSlot(2).getHasStack())) {
-            this.blit(matrixStack, i + 92, j + 31, this.xSize, 0, 28, 21);
+            this.blit(matrixStack, i + 85, j + 26, this.xSize, 0, 28, 21);
         }
         }
     }
     }
 }
 }

binární
src/main/resources/assets/enchrebirth/textures/gui/container/grindstone.png