Skip to content

Commit dc37422

Browse files
authored
Merge branch 'master' into scheduled-reason-tooltip
2 parents a8328b1 + bbe6e21 commit dc37422

File tree

4 files changed

+26
-50
lines changed

4 files changed

+26
-50
lines changed

src/main/java/appeng/client/gui/implementations/GuiBusIO.java

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import net.minecraft.entity.player.InventoryPlayer;
55

66
import org.lwjgl.input.Mouse;
7-
import org.lwjgl.opengl.GL11;
87

98
import appeng.api.config.SchedulingMode;
109
import appeng.api.config.Settings;
@@ -95,47 +94,30 @@ public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
9594
super.drawBG(offsetX, offsetY, mouseX, mouseY);
9695

9796
final int capacity = this.cvb.getUpgradeable().getInstalledUpgrades(Upgrades.CAPACITY);
98-
if (capacity < 1) {
99-
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
100-
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.4F);
101-
GL11.glEnable(GL11.GL_BLEND);
102-
}
103-
104-
this.drawTexturedModalRect(offsetX + 61, offsetY + 39, 79, 39, 18, 18);
105-
this.drawTexturedModalRect(offsetX + 79, offsetY + 21, 79, 39, 18, 18);
106-
this.drawTexturedModalRect(offsetX + 97, offsetY + 39, 79, 39, 18, 18);
107-
this.drawTexturedModalRect(offsetX + 79, offsetY + 57, 79, 39, 18, 18);
108-
109-
if (capacity < 1) {
110-
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
111-
GL11.glPopAttrib();
112-
}
113-
114-
if (capacity < 2) {
115-
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
116-
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.4F);
117-
GL11.glEnable(GL11.GL_BLEND);
118-
}
97+
final boolean hasOreFilter = this.cvb.getUpgradeable().getInstalledUpgrades(Upgrades.ORE_FILTER) != 0;
98+
final boolean hasFirstTier = capacity > 0;
99+
final boolean hasSecondTier = capacity > 1;
119100

120-
this.drawTexturedModalRect(offsetX + 61, offsetY + 21, 79, 39, 18, 18);
121-
this.drawTexturedModalRect(offsetX + 61, offsetY + 57, 79, 39, 18, 18);
122-
this.drawTexturedModalRect(offsetX + 97, offsetY + 21, 79, 39, 18, 18);
123-
this.drawTexturedModalRect(offsetX + 97, offsetY + 57, 79, 39, 18, 18);
124-
125-
if (capacity < 2) {
126-
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
127-
GL11.glPopAttrib();
101+
for (int y = 0; y < 3; y++) {
102+
for (int x = 0; x < 3; x++) {
103+
final int slotTextureX = hasOreFilter // true == inactive
104+
|| (!hasSecondTier && slotSequence[x + y * 3] > 4)
105+
|| (!hasFirstTier && slotSequence[x + y * 3] != 0) ? 79 : 61;
106+
this.drawTexturedModalRect(offsetX + 61 + (18 * x), offsetY + 21 + (18 * y), slotTextureX, 21, 18, 18);
107+
}
128108
}
129-
130109
}
131110

132111
@Override
133112
protected void handleButtonVisibility() {
134113
super.handleButtonVisibility();
135114

136115
final int capacity = this.cvb.getUpgradeable().getInstalledUpgrades(Upgrades.CAPACITY);
137-
final boolean firstTier = capacity > 0;
138-
final boolean secondTier = capacity > 1;
116+
final boolean hasOreFilter = this.cvb.getUpgradeable().getInstalledUpgrades(Upgrades.ORE_FILTER) != 0;
117+
final boolean firstTier = capacity > 0 && !hasOreFilter;
118+
final boolean secondTier = capacity > 1 && !hasOreFilter;
119+
120+
this.virtualSlots[0].setHidden(hasOreFilter);
139121

140122
this.virtualSlots[1].setHidden(!firstTier);
141123
this.virtualSlots[2].setHidden(!firstTier);

src/main/java/appeng/client/gui/implementations/GuiCellWorkbench.java

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
import net.minecraft.client.gui.GuiButton;
1616
import net.minecraft.entity.player.InventoryPlayer;
17-
import net.minecraft.inventory.IInventory;
18-
import net.minecraft.item.ItemStack;
1917

2018
import org.lwjgl.input.Mouse;
2119

@@ -24,7 +22,6 @@
2422
import appeng.api.config.FuzzyMode;
2523
import appeng.api.config.Settings;
2624
import appeng.api.config.Upgrades;
27-
import appeng.api.implementations.items.IUpgradeModule;
2825
import appeng.api.implementations.tiles.ICellWorkbench;
2926
import appeng.api.storage.data.IAEStackType;
3027
import appeng.client.gui.slots.VirtualMEPhantomSlot;
@@ -98,6 +95,12 @@ public void drawBG(final int offsetX, final int offsetY, final int mouseX, final
9895

9996
this.bindTexture(this.getBackground());
10097
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, 211 - 34, this.ySize);
98+
99+
final int slotsTextureY = this.cvb.getUpgradeable().getInstalledUpgrades(Upgrades.ORE_FILTER) != 0 ? 46 : 28;
100+
101+
for (int i = 0; i < 7; i++)
102+
this.drawTexturedModalRect(offsetX + 7, offsetY + 28 + (18 * i), 7, slotsTextureY, 162, 18);
103+
101104
if (this.drawUpgrades()) {
102105
if (this.workbench.availableUpgrades() <= 8) {
103106
this.drawTexturedModalRect(
@@ -193,23 +196,14 @@ private void initVirtualSlots() {
193196
protected void handleButtonVisibility() {
194197
this.copyMode.setState(this.workbench.getCopyMode() == CopyMode.CLEAR_ON_REMOVE);
195198

196-
boolean hasFuzzy = false;
197-
boolean hasOreFilter = false;
198-
final IInventory inv = this.workbench.getCellUpgradeInventory();
199-
for (int x = 0; x < inv.getSizeInventory(); x++) {
200-
final ItemStack is = inv.getStackInSlot(x);
201-
if (is != null && is.getItem() instanceof IUpgradeModule) {
202-
if (((IUpgradeModule) is.getItem()).getType(is) == Upgrades.FUZZY) {
203-
hasFuzzy = true;
204-
}
205-
if (((IUpgradeModule) is.getItem()).getType(is) == Upgrades.ORE_FILTER) {
206-
hasOreFilter = true;
207-
}
208-
}
209-
}
199+
final boolean hasFuzzy = this.cvb.getUpgradeable().getInstalledUpgrades(Upgrades.FUZZY) != 0;
200+
final boolean hasOreFilter = this.cvb.getUpgradeable().getInstalledUpgrades(Upgrades.ORE_FILTER) != 0;
201+
210202
this.fuzzyMode.setVisibility(!hasOreFilter && hasFuzzy);
211203
this.oreFilter.setVisibility(hasOreFilter);
212204
this.cellRestriction.setVisibility(this.workbench.haveCellRestrictAble());
205+
206+
for (VirtualMEPhantomSlot configSlot : this.configSlots) configSlot.setHidden(hasOreFilter);
213207
}
214208

215209
@Override
-466 Bytes
Loading
-532 Bytes
Loading

0 commit comments

Comments
 (0)