Procházet zdrojové kódy

移除砂轮部分的警告和调试语句

LTCatt před 6 roky
rodič
revize
babb032df0

+ 6 - 10
src/main/java/com/hexdragon/enchrebirth/block/GrindstoneContainerRe.java

@@ -77,7 +77,7 @@ public class GrindstoneContainerRe extends Container {
                     while (l > 0) {
                         int i1 = ExperienceOrbEntity.getXPSplit(l);
                         l -= i1;
-                        p_216944_1_.addEntity(new ExperienceOrbEntity(p_216944_1_, (double) p_216944_2_.getX(), (double) p_216944_2_.getY() + 0.5D, (double) p_216944_2_.getZ() + 0.5D, i1));
+                        p_216944_1_.addEntity(new ExperienceOrbEntity(p_216944_1_, p_216944_2_.getX(), (double) p_216944_2_.getY() + 0.5D, (double) p_216944_2_.getZ() + 0.5D, i1));
                     }
 
                     p_216944_1_.playEvent(1042, p_216944_2_, 0);
@@ -129,7 +129,7 @@ public class GrindstoneContainerRe extends Container {
         }
 
         for (int k = 0; k < 9; ++k) {
-            this.addSlot(new Slot(playerInventoryIn, k, 8 + k * 18, 152)); // Modified
+            this.addSlot(new Slot(playerInventoryIn, k, 8 + k * 18, 142));
         }
 
     }
@@ -226,9 +226,7 @@ public class GrindstoneContainerRe extends Container {
         }
 
         itemstack.setCount(count);
-        Map<Enchantment, Integer> map = EnchantmentHelper.getEnchantments(stack).entrySet().stream().filter((p_217012_0_) -> {
-            return p_217012_0_.getKey().isCurse();
-        }).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
+        Map<Enchantment, Integer> map = EnchantmentHelper.getEnchantments(stack).entrySet().stream().filter((p_217012_0_) -> p_217012_0_.getKey().isCurse()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
         EnchantmentHelper.setEnchantments(map, itemstack);
         itemstack.setRepairCost(0);
         if (itemstack.getItem() == Items.ENCHANTED_BOOK && map.size() == 0) {
@@ -250,9 +248,7 @@ public class GrindstoneContainerRe extends Container {
      */
     public void onContainerClosed(PlayerEntity playerIn) {
         super.onContainerClosed(playerIn);
-        this.worldPosCallable.consume((p_217009_2_, p_217009_3_) -> {
-            this.clearContainer(playerIn, p_217009_2_, this.inputInventory);
-        });
+        this.worldPosCallable.consume((p_217009_2_, p_217009_3_) -> this.clearContainer(playerIn, p_217009_2_, this.inputInventory));
     }
 
     /**
@@ -282,11 +278,11 @@ public class GrindstoneContainerRe extends Container {
                 slot.onSlotChange(itemstack1, itemstack);
             } else if (index != 0 && index != 1) {
                 if (!itemstack2.isEmpty() && !itemstack3.isEmpty()) {
-                    if (index >= 3 && index < 30) {
+                    if (index < 30) {
                         if (!this.mergeItemStack(itemstack1, 30, 39, false)) {
                             return ItemStack.EMPTY;
                         }
-                    } else if (index >= 30 && index < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) {
+                    } else if (index < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) {
                         return ItemStack.EMPTY;
                     }
                 } else if (!this.mergeItemStack(itemstack1, 0, 2, false)) {

+ 3 - 6
src/main/java/com/hexdragon/enchrebirth/block/GrindstoneScreenRe.java

@@ -1,13 +1,13 @@
 package com.hexdragon.enchrebirth.block;
 
 import com.mojang.blaze3d.matrix.MatrixStack;
-import com.mojang.blaze3d.systems.RenderSystem;
 import net.minecraft.client.gui.screen.inventory.ContainerScreen;
 import net.minecraft.entity.player.PlayerInventory;
 import net.minecraft.util.ResourceLocation;
 import net.minecraft.util.text.ITextComponent;
 import net.minecraftforge.api.distmarker.Dist;
 import net.minecraftforge.api.distmarker.OnlyIn;
+import org.lwjgl.opengl.GL11;
 
 @OnlyIn(Dist.CLIENT)
 public class GrindstoneScreenRe extends ContainerScreen<GrindstoneContainerRe> {
@@ -25,14 +25,11 @@ public class GrindstoneScreenRe extends ContainerScreen<GrindstoneContainerRe> {
     }
 
     protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int x, int y) {
-        RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
+        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+        assert this.minecraft != null;
         this.minecraft.getTextureManager().bindTexture(GRINDSTONE_GUI_TEXTURES);
         int i = (this.width - this.xSize) / 2;
         int j = (this.height - this.ySize) / 2;
         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()) {
-            this.blit(matrixStack, i + 92, j + 31, this.xSize, 0, 28, 21);
-        }
-
     }
 }

+ 1 - 0
src/main/java/com/hexdragon/enchrebirth/mixin/GrindstoneBlockMixin.java

@@ -22,6 +22,7 @@ public abstract class GrindstoneBlockMixin extends HorizontalFaceBlock {
         super(builder);
     }
 
+    // 将砂轮的处理事件替换为 Mod 所提供的事件
     @Inject(method = "getContainer", at = @At(value = "HEAD"), cancellable = true, locals = LocalCapture.CAPTURE_FAILEXCEPTION)
     private void getContainer(BlockState state, World worldIn, BlockPos pos, CallbackInfoReturnable<INamedContainerProvider> cir) {
         cir.setReturnValue(new SimpleNamedContainerProvider(