Hot Fix-ups

- Change to proper key handling for closing create screens
- Fixed inconsistent collection behaviour of in-world funnels
This commit is contained in:
simibubi 2021-04-03 18:59:10 +02:00
parent f528520a53
commit 83e7074f12
3 changed files with 18 additions and 5 deletions

View file

@ -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))

View file

@ -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<T extends Container> 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<T extends Container> extends C
if (widget.charTyped(character, code))
return true;
}
if (character == 'e')
onClose();
return super.charTyped(character, code);
}

View file

@ -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);
}