From 83e7074f12c42eaabca2bad8daa110e7493f76e5 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Sat, 3 Apr 2021 18:59:10 +0200 Subject: [PATCH] Hot Fix-ups - Change to proper key handling for closing create screens - Fixed inconsistent collection behaviour of in-world funnels --- .../content/logistics/block/funnel/FunnelBlock.java | 3 ++- .../foundation/gui/AbstractSimiContainerScreen.java | 10 ++++++++-- .../create/foundation/gui/AbstractSimiScreen.java | 10 ++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelBlock.java index c7cc47dab..ce48d0b05 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelBlock.java @@ -107,7 +107,8 @@ public abstract class FunnelBlock extends AbstractDirectionalFunnelBlock { Direction direction = getFunnelFacing(state); Vec3d diff = entityIn.getPositionVec() - .subtract(VecHelper.getCenterOf(pos)); + .subtract(VecHelper.getCenterOf(pos) + .add(new Vec3d(direction.getDirectionVec()).scale(-.325f))); double projectedDiff = direction.getAxis() .getCoordinate(diff.x, diff.y, diff.z); if (projectedDiff < 0 == (direction.getAxisDirection() == AxisDirection.POSITIVE)) diff --git a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java index 106379330..7cf5f1cff 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java +++ b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java @@ -18,6 +18,7 @@ import net.minecraft.client.renderer.Rectangle2d; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.util.InputMappings; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.container.Container; import net.minecraft.item.ItemStack; @@ -79,6 +80,13 @@ public abstract class AbstractSimiContainerScreen extends C if (widget.keyPressed(code, p_keyPressed_2_, p_keyPressed_3_)) return true; } + + InputMappings.Input mouseKey = InputMappings.getInputByCode(code, p_keyPressed_2_); + if (code == 256 || this.minecraft.gameSettings.keyBindInventory.isActiveAndMatches(mouseKey)) { + this.minecraft.player.closeScreen(); + return true; + } + return super.keyPressed(code, p_keyPressed_2_, p_keyPressed_3_); } @@ -88,8 +96,6 @@ public abstract class AbstractSimiContainerScreen extends C if (widget.charTyped(character, code)) return true; } - if (character == 'e') - onClose(); return super.charTyped(character, code); } diff --git a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java index a6cd30944..7842b8101 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java +++ b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java @@ -9,6 +9,7 @@ import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.Widget; +import net.minecraft.client.util.InputMappings; import net.minecraft.util.text.StringTextComponent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -69,6 +70,13 @@ public abstract class AbstractSimiScreen extends Screen { for (Widget widget : widgets) if (widget.keyPressed(code, p_keyPressed_2_, p_keyPressed_3_)) return true; + + InputMappings.Input mouseKey = InputMappings.getInputByCode(code, p_keyPressed_2_); + if (code == 256 || this.minecraft.gameSettings.keyBindInventory.isActiveAndMatches(mouseKey)) { + this.minecraft.player.closeScreen(); + return true; + } + return super.keyPressed(code, p_keyPressed_2_, p_keyPressed_3_); } @@ -78,8 +86,6 @@ public abstract class AbstractSimiScreen extends Screen { if (widget.charTyped(character, code)) return true; } - if (character == 'e') - onClose(); return super.charTyped(character, code); }