visibility fix

This commit is contained in:
Serghei Borovetchi authored and Jason Mitchell committed 2022-02-17 18:45:26 -08:00
1 parent db6e3d33ca
commit 1e93f719fe
4 files changed
+27 -14

No files matched your search

+3 -2
View File
@@ -12,6 +12,7 @@ import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.inventory.GuiContainerCreative;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
@@ -472,9 +473,9 @@ public class ItemPanel extends Widget
final FluidStack fluidStack = StackInfo.getFluid(draggedStack);
if (fluidStack != null) {
searchField.setText(SPECIAL_REGEX_CHARS.matcher(fluidStack.getLocalizedName()).replaceAll("\\\\$0"));
searchField.setText(SPECIAL_REGEX_CHARS.matcher(EnumChatFormatting.getTextWithoutFormattingCodes(fluidStack.getLocalizedName())).replaceAll("\\\\$0"));
} else {
searchField.setText(SPECIAL_REGEX_CHARS.matcher(draggedStack.getDisplayName()).replaceAll("\\\\$0"));
searchField.setText(SPECIAL_REGEX_CHARS.matcher(EnumChatFormatting.getTextWithoutFormattingCodes(draggedStack.getDisplayName())).replaceAll("\\\\$0"));
}
return true;
+6 -10
View File
@@ -91,18 +91,14 @@ public class ItemsGrid
public void setGridSize(int mleft, int mtop, int w, int h)
{
//I don't like this big condition
if (marginLeft != mleft || marginTop != mtop || width != w || height != h) {
marginLeft = mleft;
marginTop = mtop;
marginLeft = mleft;
marginTop = mtop;
width = Math.max(0, w);
height = Math.max(0, h);
width = Math.max(0, w);
height = Math.max(0, h);
columns = width / SLOT_SIZE;
rows = height / SLOT_SIZE;
}
columns = width / SLOT_SIZE;
rows = height / SLOT_SIZE;
}
@@ -316,6 +316,12 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
if (gui.height - gui.ySize <= 40)
visiblity.showSearchSection = false;
if (visiblity.showBookmarkPanel || gui.guiTop <= 20)
visiblity.showSubsetDropdown = false;
if (!visiblity.showBookmarkPanel || gui.guiTop <= 20)
visiblity.showPresetsDropdown = false;
if (gui.guiLeft - 4 < 76)
visiblity.showWidgets = false;
try {
@@ -690,7 +696,9 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
if (visiblity.showBookmarkPanel) {
addWidget(bookmarkPanel);
bookmarkPanel.setVisible();
}
if (visiblity.showPresetsDropdown) {
addWidget(presetsPanel);
}
@@ -717,7 +725,7 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
addWidget(delete);
}
if (!visiblity.showBookmarkPanel) {
if (visiblity.showSubsetDropdown) {
// Bookmarks or Subset/dropdown
addWidget(dropDown);
}
@@ -11,6 +11,14 @@ public class VisiblityData
* Bookmark panel and associated buttons
*/
public boolean showBookmarkPanel = true;
/**
* Subset dropdown
*/
public boolean showSubsetDropdown = true;
/**
* Presets dropdown
*/
public boolean showPresetsDropdown = true;
/**
* Item and search section
*/
@@ -40,6 +48,6 @@ public class VisiblityData
if(!showWidgets)
showItemSection = showUtilityButtons = false;
if(!showItemSection)
showBookmarkPanel = showSearchSection = showItemPanel = false;
showBookmarkPanel = showSubsetDropdown = showPresetsDropdown = showSearchSection = showItemPanel = false;
}
}