Simplify menu code a bit

This commit is contained in:
UnknownShadow200 2018-04-11 07:07:57 +10:00
parent c801e96123
commit 58585827fc
14 changed files with 116 additions and 105 deletions

View File

@ -72,11 +72,13 @@ namespace ClassicalSharp.Gui {
public Anchor HorizontalAnchor, VerticalAnchor; public Anchor HorizontalAnchor, VerticalAnchor;
public int XOffset, YOffset; public int XOffset, YOffset;
public Rectangle Bounds { get { return new Rectangle(X, Y, Width, Height); } }
public virtual void Reposition() { public virtual void Reposition() {
X = CalcPos(HorizontalAnchor, XOffset, Width, game.Width); X = CalcPos(HorizontalAnchor, XOffset, Width, game.Width);
Y = CalcPos(VerticalAnchor, YOffset, Height, game.Height); Y = CalcPos(VerticalAnchor, YOffset, Height, game.Height);
} }
public bool Contains(int x, int y) {
return GuiElement.Contains(X, Y, Width, Height, x, y);
}
} }
} }

View File

@ -400,8 +400,8 @@ namespace ClassicalSharp.Gui.Screens {
public override bool HandlesMouseDown(int mouseX, int mouseY, MouseButton button) { public override bool HandlesMouseDown(int mouseX, int mouseY, MouseButton button) {
if (!HandlesAllInput || game.HideGui) return false; if (!HandlesAllInput || game.HideGui) return false;
if (!normalChat.Bounds.Contains(mouseX, mouseY)) { if (!normalChat.Contains(mouseX, mouseY)) {
if (altText.Active && altText.Bounds.Contains(mouseX, mouseY)) { if (altText.Active && altText.Contains(mouseX, mouseY)) {
altText.HandlesMouseDown(mouseX, mouseY, button); altText.HandlesMouseDown(mouseX, mouseY, button);
UpdateAltTextY(); UpdateAltTextY();
return true; return true;

View File

@ -72,7 +72,7 @@ namespace ClassicalSharp.Gui.Screens {
public override bool HandlesMouseDown(int mouseX, int mouseY, MouseButton button) { public override bool HandlesMouseDown(int mouseX, int mouseY, MouseButton button) {
if (button != MouseButton.Left) return true; if (button != MouseButton.Left) return true;
if (!reconnect.Disabled && reconnect.Bounds.Contains(mouseX, mouseY)) { if (!reconnect.Disabled && reconnect.Contains(mouseX, mouseY)) {
string connect = "Connecting to " + game.IPAddress + ":" + game.Port + ".."; string connect = "Connecting to " + game.IPAddress + ":" + game.Port + "..";
for (int i = 0; i < game.Components.Count; i++) for (int i = 0; i < game.Components.Count; i++)
game.Components[i].Reset(game); game.Components[i].Reset(game);
@ -85,7 +85,7 @@ namespace ClassicalSharp.Gui.Screens {
} }
public override bool HandlesMouseMove(int mouseX, int mouseY) { public override bool HandlesMouseMove(int mouseX, int mouseY) {
reconnect.Active = !reconnect.Disabled && reconnect.Bounds.Contains(mouseX, mouseY); reconnect.Active = !reconnect.Disabled && reconnect.Contains(mouseX, mouseY);
return true; return true;
} }

View File

@ -20,18 +20,20 @@ namespace ClassicalSharp.Gui.Screens {
protected override void ContextRecreated() { protected override void ContextRecreated() {
bool multi = !game.Server.IsSinglePlayer, hacks = game.ClassicHacks; bool multi = !game.Server.IsSinglePlayer, hacks = game.ClassicHacks;
ClickHandler onClick = OnButtonClick; ClickHandler onEnum = OnEnumClick;
widgets = new Widget[] { ClickHandler onBool = OnBoolClick;
MakeOpt(-1, -150, "Music", onClick, GetMusic, SetMusic),
MakeOpt(-1, -100, "Invert mouse", onClick, GetInvert, SetInvert),
MakeOpt(-1, -50, "Render distance", onClick, GetViewDist, SetViewDist),
multi ? null : MakeOpt(-1, 0, "Block physics", onClick, GetPhysics, SetPhysics),
MakeOpt(1, -150, "Sound", onClick, GetSounds, SetSounds), widgets = new Widget[] {
MakeOpt(1, -100, "Show FPS", onClick, GetShowFPS, SetShowFPS), MakeOpt(-1, -150, "Music", onBool, GetMusic, SetMusic),
MakeOpt(1, -50, "View bobbing", onClick, GetViewBob, SetViewBob), MakeOpt(-1, -100, "Invert mouse", onBool, GetInvert, SetInvert),
MakeOpt(1, 0, "FPS mode", onClick, GetFPS, SetFPS), MakeOpt(-1, -50, "Render distance", onEnum, GetViewDist, SetViewDist),
!hacks ? null : MakeOpt(0, 60, "Hacks enabled", onClick, GetHacks, SetHacks), multi ? null : MakeOpt(-1, 0, "Block physics", onBool, GetPhysics, SetPhysics),
MakeOpt(1, -150, "Sound", onBool, GetSounds, SetSounds),
MakeOpt(1, -100, "Show FPS", onBool, GetShowFPS, SetShowFPS),
MakeOpt(1, -50, "View bobbing", onBool, GetViewBob, SetViewBob),
MakeOpt(1, 0, "FPS mode", onEnum, GetFPS, SetFPS),
!hacks ? null : MakeOpt(0, 60, "Hacks enabled", onBool, GetHacks, SetHacks),
ButtonWidget.Create(game, 400, "Controls...", titleFont, SwitchClassic) ButtonWidget.Create(game, 400, "Controls...", titleFont, SwitchClassic)
.SetLocation(Anchor.Centre, Anchor.Max, 0, 95), .SetLocation(Anchor.Centre, Anchor.Max, 0, 95),
@ -92,16 +94,16 @@ namespace ClassicalSharp.Gui.Screens {
void MakeValidators() { void MakeValidators() {
IServerConnection network = game.Server; IServerConnection network = game.Server;
validators = new MenuInputValidator[] { validators = new MenuInputValidator[] {
new BooleanValidator(), null,
new BooleanValidator(), null,
new EnumValidator(typeof(ViewDist)), new EnumValidator(typeof(ViewDist)),
network.IsSinglePlayer ? new BooleanValidator() : null, null,
new BooleanValidator(), null,
new BooleanValidator(), null,
new BooleanValidator(), null,
new EnumValidator(typeof(FpsLimitMethod)), new EnumValidator(typeof(FpsLimitMethod)),
game.ClassicHacks ? new BooleanValidator() : null, null,
}; };
} }
} }

View File

@ -24,7 +24,7 @@ namespace ClassicalSharp.Gui.Screens {
// iterate backwards (because last elements rendered are shown over others) // iterate backwards (because last elements rendered are shown over others)
for (int i = widgets.Length - 1; i >= 0; i--) { for (int i = widgets.Length - 1; i >= 0; i--) {
Widget widget = widgets[i]; Widget widget = widgets[i];
if (widget == null || !widget.Bounds.Contains(mouseX, mouseY)) continue; if (widget == null || !widget.Contains(mouseX, mouseY)) continue;
if (widget.Disabled) return i; if (widget.Disabled) return i;
if (widget.MenuClick != null && button == MouseButton.Left) { if (widget.MenuClick != null && button == MouseButton.Left) {
@ -45,7 +45,7 @@ namespace ClassicalSharp.Gui.Screens {
for (int i = widgets.Length - 1; i >= 0; i--) { for (int i = widgets.Length - 1; i >= 0; i--) {
Widget widget = widgets[i]; Widget widget = widgets[i];
if (widget == null || !widget.Bounds.Contains(mouseX, mouseY)) continue; if (widget == null || !widget.Contains(mouseX, mouseY)) continue;
widget.Active = true; widget.Active = true;
return i; return i;

View File

@ -24,6 +24,8 @@ namespace ClassicalSharp.Gui.Screens {
protected override void ContextRecreated() { protected override void ContextRecreated() {
ClickHandler onClick = OnButtonClick; ClickHandler onClick = OnButtonClick;
ClickHandler onEnum = OnEnumClick;
widgets = new Widget[] { widgets = new Widget[] {
MakeOpt(-1, -150, "Clouds col", onClick, GetCloudsCol, SetCloudsCol), MakeOpt(-1, -150, "Clouds col", onClick, GetCloudsCol, SetCloudsCol),
MakeOpt(-1, -100, "Sky col", onClick, GetSkyCol, SetSkyCol), MakeOpt(-1, -100, "Sky col", onClick, GetSkyCol, SetSkyCol),
@ -33,7 +35,7 @@ namespace ClassicalSharp.Gui.Screens {
MakeOpt(1, -150, "Sunlight col", onClick, GetSunCol, SetSunCol), MakeOpt(1, -150, "Sunlight col", onClick, GetSunCol, SetSunCol),
MakeOpt(1, -100, "Shadow col", onClick, GetShadowCol, SetShadowCol), MakeOpt(1, -100, "Shadow col", onClick, GetShadowCol, SetShadowCol),
MakeOpt(1, -50, "Weather", onClick, GetWeather, SetWeather), MakeOpt(1, -50, "Weather", onEnum, GetWeather, SetWeather),
MakeOpt(1, 0, "Rain/Snow speed", onClick, GetWeatherSpeed, SetWeatherSpeed), MakeOpt(1, 0, "Rain/Snow speed", onClick, GetWeatherSpeed, SetWeatherSpeed),
MakeOpt(1, 50, "Water level", onClick, GetEdgeHeight, SetEdgeHeight), MakeOpt(1, 50, "Water level", onClick, GetEdgeHeight, SetEdgeHeight),

View File

@ -20,14 +20,17 @@ namespace ClassicalSharp.Gui.Screens {
protected override void ContextRecreated() { protected override void ContextRecreated() {
ClickHandler onClick = OnButtonClick; ClickHandler onClick = OnButtonClick;
widgets = new Widget[] { ClickHandler onEnum = OnEnumClick;
MakeOpt(-1, -50, "FPS mode", onClick, GetFPS, SetFPS), ClickHandler onBool = OnBoolClick;
MakeOpt(-1, 0, "View distance", onClick, GetViewDist, SetViewDist),
MakeOpt(-1, 50, "Advanced lighting", onClick, GetSmooth, SetSmooth),
MakeOpt(1, -50, "Names", onClick, GetNames, SetNames), widgets = new Widget[] {
MakeOpt(1, 0, "Shadows", onClick, GetShadows, SetShadows), MakeOpt(-1, -50, "FPS mode", onEnum, GetFPS, SetFPS),
MakeOpt(1, 50, "Mipmaps", onClick, GetMipmaps, SetMipmaps), MakeOpt(-1, 0, "View distance", onClick, GetViewDist, SetViewDist),
MakeOpt(-1, 50, "Advanced lighting", onBool, GetSmooth, SetSmooth),
MakeOpt(1, -50, "Names", onEnum, GetNames, SetNames),
MakeOpt(1, 0, "Shadows", onEnum, GetShadows, SetShadows),
MakeOpt(1, 50, "Mipmaps", onBool, GetMipmaps, SetMipmaps),
MakeBack(false, titleFont, SwitchOptions), MakeBack(false, titleFont, SwitchOptions),
null, null, null, null,
@ -86,11 +89,11 @@ namespace ClassicalSharp.Gui.Screens {
validators = new MenuInputValidator[] { validators = new MenuInputValidator[] {
new EnumValidator(typeof(FpsLimitMethod)), new EnumValidator(typeof(FpsLimitMethod)),
new IntegerValidator(8, 4096), new IntegerValidator(8, 4096),
new BooleanValidator(), null,
new EnumValidator(typeof(NameMode)), new EnumValidator(typeof(NameMode)),
new EnumValidator(typeof(EntityShadow)), new EnumValidator(typeof(EntityShadow)),
new BooleanValidator(), null,
}; };
} }

View File

@ -16,18 +16,20 @@ namespace ClassicalSharp.Gui.Screens {
protected override void ContextRecreated() { protected override void ContextRecreated() {
ClickHandler onClick = OnButtonClick; ClickHandler onClick = OnButtonClick;
widgets = new Widget[] { ClickHandler onBool = OnBoolClick;
MakeOpt(-1, -150, "Black text shadows", onClick, GetShadows, SetShadows),
MakeOpt(-1, -100, "Show FPS", onClick, GetShowFPS, SetShowFPS),
MakeOpt(-1, -50, "Hotbar scale", onClick, GetHotbar, SetHotbar),
MakeOpt(-1, 0, "Inventory scale", onClick, GetInventory, SetInventory),
MakeOpt(-1, 50, "Tab auto-complete", onClick, GetTabAuto, SetTabAuto),
MakeOpt(1, -150, "Clickable chat", onClick, GetClickable, SetClickable), widgets = new Widget[] {
MakeOpt(-1, -150, "Black text shadows", onBool, GetShadows, SetShadows),
MakeOpt(-1, -100, "Show FPS", onBool, GetShowFPS, SetShowFPS),
MakeOpt(-1, -50, "Hotbar scale", onClick, GetHotbar, SetHotbar),
MakeOpt(-1, 0, "Inventory scale", onClick, GetInventory, SetInventory),
MakeOpt(-1, 50, "Tab auto-complete", onBool, GetTabAuto, SetTabAuto),
MakeOpt(1, -150, "Clickable chat", onBool, GetClickable, SetClickable),
MakeOpt(1, -100, "Chat scale", onClick, GetChatScale, SetChatScale), MakeOpt(1, -100, "Chat scale", onClick, GetChatScale, SetChatScale),
MakeOpt(1, -50, "Chat lines", onClick, GetChatlines, SetChatlines), MakeOpt(1, -50, "Chat lines", onClick, GetChatlines, SetChatlines),
MakeOpt(1, 0, "Use system font", onClick, GetUseFont, SetUseFont), MakeOpt(1, 0, "Use system font", onBool, GetUseFont, SetUseFont),
MakeOpt(1, 50, "Font", onClick, GetFont, SetFont), MakeOpt(1, 50, "Font", onClick, GetFont, SetFont),
MakeBack(false, titleFont, SwitchOptions), MakeBack(false, titleFont, SwitchOptions),
null, null, null, null,
@ -94,16 +96,16 @@ namespace ClassicalSharp.Gui.Screens {
void MakeValidators() { void MakeValidators() {
validators = new MenuInputValidator[] { validators = new MenuInputValidator[] {
new BooleanValidator(), null,
new BooleanValidator(), null,
new RealValidator(0.25f, 4f), new RealValidator(0.25f, 4f),
new RealValidator(0.25f, 4f), new RealValidator(0.25f, 4f),
new BooleanValidator(), null,
new BooleanValidator(), null,
new RealValidator(0.25f, 4f), new RealValidator(0.25f, 4f),
new IntegerValidator(0, 30), new IntegerValidator(0, 30),
new BooleanValidator(), null,
new StringValidator(), new StringValidator(),
}; };
} }

View File

@ -27,17 +27,19 @@ namespace ClassicalSharp.Gui.Screens {
protected override void ContextRecreated() { protected override void ContextRecreated() {
ClickHandler onClick = OnButtonClick; ClickHandler onClick = OnButtonClick;
widgets = new Widget[] { ClickHandler onBool = OnBoolClick;
MakeOpt(-1, -150, "Hacks enabled", onClick, GetHacks, SetHacks),
MakeOpt(-1, -100, "Speed multiplier", onClick, GetSpeed, SetSpeed),
MakeOpt(-1, -50, "Camera clipping", onClick, GetClipping, SetClipping),
MakeOpt(-1, 0, "Jump height", onClick, GetJump, SetJump),
MakeOpt(-1, 50, "WOM style hacks", onClick, GetWOMHacks, SetWOMHacks),
MakeOpt(1, -150, "Full block stepping", onClick, GetFullStep, SetFullStep), widgets = new Widget[] {
MakeOpt(1, -100, "Modifiable liquids", onClick, GetLiquids, SetLiquids), MakeOpt(-1, -150, "Hacks enabled", onBool, GetHacks, SetHacks),
MakeOpt(1, -50, "Pushback placing", onClick, GetPushback, SetPushback), MakeOpt(-1, -100, "Speed multiplier", onClick, GetSpeed, SetSpeed),
MakeOpt(1, 0, "Noclip slide", onClick, GetSlide, SetSlide), MakeOpt(-1, -50, "Camera clipping", onBool, GetClipping, SetClipping),
MakeOpt(-1, 0, "Jump height", onClick, GetJump, SetJump),
MakeOpt(-1, 50, "WOM style hacks", onBool, GetWOMHacks, SetWOMHacks),
MakeOpt(1, -150, "Full block stepping", onBool, GetFullStep, SetFullStep),
MakeOpt(1, -100, "Modifiable liquids", onBool, GetLiquids, SetLiquids),
MakeOpt(1, -50, "Pushback placing", onBool, GetPushback, SetPushback),
MakeOpt(1, 0, "Noclip slide", onBool, GetSlide, SetSlide),
MakeOpt(1, 50, "Field of view", onClick, GetFOV, SetFOV), MakeOpt(1, 50, "Field of view", onClick, GetFOV, SetFOV),
null, null,
@ -134,16 +136,16 @@ namespace ClassicalSharp.Gui.Screens {
void MakeValidators() { void MakeValidators() {
validators = new MenuInputValidator[] { validators = new MenuInputValidator[] {
new BooleanValidator(), null,
new RealValidator(0.1f, 50), new RealValidator(0.1f, 50),
new BooleanValidator(), null,
new RealValidator(0.1f, 2048f), new RealValidator(0.1f, 2048f),
new BooleanValidator(), null,
new BooleanValidator(), null,
new BooleanValidator(), null,
new BooleanValidator(), null,
new BooleanValidator(), null,
new IntegerValidator(1, 150), new IntegerValidator(1, 150),
}; };
} }

View File

@ -162,24 +162,31 @@ namespace ClassicalSharp.Gui.Screens {
ChangeSetting(); ChangeSetting();
} }
protected void OnButtonClick(Game game, Widget widget) { protected void OnBoolClick(Game game, Widget widget) {
ButtonWidget button = widget as ButtonWidget; ButtonWidget button = (ButtonWidget)widget;
if (button == null) return; DisposeExtendedHelp();
string value = button.GetValue(game);
SetButtonValue(button, value == "ON" ? "OFF" : "ON");
UpdateDescription(button);
}
protected void OnEnumClick(Game game, Widget widget) {
ButtonWidget button = (ButtonWidget)widget;
DisposeExtendedHelp(); DisposeExtendedHelp();
int index = IndexOfWidget(button); int index = IndexOfWidget(button);
MenuInputValidator validator = validators[index]; MenuInputValidator validator = validators[index];
if (validator is BooleanValidator) { Type type = ((EnumValidator)validator).EnumType;
string value = button.GetValue(game); HandleEnumOption(button, type);
SetButtonValue(button, value == "ON" ? "OFF" : "ON"); }
UpdateDescription(button);
return;
} else if (validator is EnumValidator) {
Type type = ((EnumValidator)validator).EnumType;
HandleEnumOption(button, type);
return;
}
protected void OnButtonClick(Game game, Widget widget) {
ButtonWidget button = (ButtonWidget)widget;
DisposeExtendedHelp();
int index = IndexOfWidget(button);
MenuInputValidator validator = validators[index];
activeButton = button; activeButton = button;
InputClosed(); InputClosed();

View File

@ -19,15 +19,17 @@ namespace ClassicalSharp.Gui.Screens {
protected override void ContextRecreated() { protected override void ContextRecreated() {
bool multi = !game.Server.IsSinglePlayer; bool multi = !game.Server.IsSinglePlayer;
ClickHandler onClick = OnButtonClick; ClickHandler onClick = OnButtonClick;
ClickHandler onBool = OnBoolClick;
widgets = new Widget[] { widgets = new Widget[] {
multi ? null : MakeOpt(-1, -100, "Reach distance", onClick, GetReach, SetReach), multi ? null : MakeOpt(-1, -100, "Reach distance", onClick, GetReach, SetReach),
MakeOpt(-1, -50, "Music volume", onClick, GetMusic, SetMusic), MakeOpt(-1, -50, "Music volume", onClick, GetMusic, SetMusic),
MakeOpt(-1, 0, "Sounds volume", onClick, GetSounds, SetSounds), MakeOpt(-1, 0, "Sounds volume", onClick, GetSounds, SetSounds),
MakeOpt(-1, 50, "View bobbing", onClick, GetViewBob, SetViewBob), MakeOpt(-1, 50, "View bobbing", onBool, GetViewBob, SetViewBob),
multi ? null : MakeOpt(1, -100, "Block physics", onClick, GetPhysics, SetPhysics), multi ? null : MakeOpt(1, -100, "Block physics", onBool, GetPhysics, SetPhysics),
MakeOpt(1, -50, "Auto close launcher", onClick, GetAutoClose, SetAutoClose), MakeOpt(1, -50, "Auto close launcher", onBool, GetAutoClose, SetAutoClose),
MakeOpt(1, 0, "Invert mouse", onClick, GetInvert, SetInvert), MakeOpt(1, 0, "Invert mouse", onBool, GetInvert, SetInvert),
MakeOpt(1, 50, "Mouse sensitivity", onClick, GetSensitivity, SetSensitivity), MakeOpt(1, 50, "Mouse sensitivity", onClick, GetSensitivity, SetSensitivity),
MakeBack(false, titleFont, SwitchOptions), MakeBack(false, titleFont, SwitchOptions),
@ -78,11 +80,11 @@ namespace ClassicalSharp.Gui.Screens {
network.IsSinglePlayer ? new RealValidator(1, 1024) : null, network.IsSinglePlayer ? new RealValidator(1, 1024) : null,
new IntegerValidator(0, 100), new IntegerValidator(0, 100),
new IntegerValidator(0, 100), new IntegerValidator(0, 100),
new BooleanValidator(), null,
network.IsSinglePlayer ? new BooleanValidator() : null, null,
new BooleanValidator(), null,
new BooleanValidator(), null,
new IntegerValidator(1, 200), new IntegerValidator(1, 200),
}; };
} }

View File

@ -13,32 +13,21 @@ namespace ClassicalSharp.Gui.Screens {
public override void Init() { public override void Init() {
base.Init(); base.Init();
ContextRecreated(); ContextRecreated();
validators = new MenuInputValidator[] {
new BooleanValidator(),
new BooleanValidator(),
new BooleanValidator(),
new BooleanValidator(),
new BooleanValidator(),
new BooleanValidator(),
new BooleanValidator(),
new BooleanValidator(),
};
} }
protected override void ContextRecreated() { protected override void ContextRecreated() {
ClickHandler onClick = OnButtonClick; ClickHandler onBool = OnBoolClick;
widgets = new Widget[] {
MakeOpt(-1, -150, "Classic hand model", onClick, GetHand, SetHand),
MakeOpt(-1, -100, "Classic walk anim", onClick, GetAnim, SetAnim),
MakeOpt(-1, -50, "Classic gui textures", onClick, GetGui, SetGui),
MakeOpt(-1, 0, "Classic player list", onClick, GetList, SetList),
MakeOpt(-1, 50, "Classic options", onClick, GetOpts, SetOpts),
MakeOpt(1, -150, "Allow custom blocks", onClick, GetCustom, SetCustom), widgets = new Widget[] {
MakeOpt(1, -100, "Use CPE", onClick, GetCPE, SetCPE), MakeOpt(-1, -150, "Classic hand model", onBool, GetHand, SetHand),
MakeOpt(1, -50, "Use server textures", onClick, GetTexs, SetTexs), MakeOpt(-1, -100, "Classic walk anim", onBool, GetAnim, SetAnim),
MakeOpt(-1, -50, "Classic gui textures", onBool, GetGui, SetGui),
MakeOpt(-1, 0, "Classic player list", onBool, GetList, SetList),
MakeOpt(-1, 50, "Classic options", onBool, GetOpts, SetOpts),
MakeOpt(1, -150, "Allow custom blocks", onBool, GetCustom, SetCustom),
MakeOpt(1, -100, "Use CPE", onBool, GetCPE, SetCPE),
MakeOpt(1, -50, "Use server textures", onBool, GetTexs, SetTexs),
TextWidget.Create(game, "&eButtons on the right require restarting game", textFont) TextWidget.Create(game, "&eButtons on the right require restarting game", textFont)
.SetLocation(Anchor.Centre, Anchor.Centre, 0, 100), .SetLocation(Anchor.Centre, Anchor.Centre, 0, 100),

View File

@ -122,7 +122,7 @@ namespace ClassicalSharp.Gui.Widgets {
} }
public override bool HandlesMouseDown(int mouseX, int mouseY, MouseButton button) { public override bool HandlesMouseDown(int mouseX, int mouseY, MouseButton button) {
if (button != MouseButton.Left || !Bounds.Contains(mouseX, mouseY)) if (button != MouseButton.Left || !Contains(mouseX, mouseY))
return false; return false;
InventoryScreen screen = game.Gui.ActiveScreen as InventoryScreen; InventoryScreen screen = game.Gui.ActiveScreen as InventoryScreen;
if (screen == null) return false; if (screen == null) return false;

View File

@ -283,7 +283,7 @@ namespace ClassicalSharp {
} }
index++; index++;
if (counts[index] == 0 || if (counts[index] == 0 || y == 0 ||
(hidden[tileIdx + chunk[cIndex - 324]] & (1 << Side.Bottom)) != 0) { (hidden[tileIdx + chunk[cIndex - 324]] & (1 << Side.Bottom)) != 0) {
counts[index] = 0; counts[index] = 0;
} else { } else {