mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-20 04:10:07 +00:00
start 1.10.2
This commit is contained in:
1 parent
f969f63b66
commit
6a7c4bf67d
826 files changed
+60550
-63758
No files matched your search
@@ -1,106 +1,94 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.craftgui.minecraft.control;
|
||||
|
||||
import binnie.craftgui.minecraft.MinecraftTooltip;
|
||||
import binnie.craftgui.core.Tooltip;
|
||||
import binnie.craftgui.core.Attribute;
|
||||
import binnie.craftgui.minecraft.CustomSlot;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.CraftGUI;
|
||||
import binnie.craftgui.resource.minecraft.CraftGUITexture;
|
||||
import binnie.core.machines.power.ErrorState;
|
||||
import binnie.craftgui.core.ITooltip;
|
||||
import binnie.craftgui.controls.core.Control;
|
||||
import binnie.craftgui.core.*;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.minecraft.CustomSlot;
|
||||
import binnie.craftgui.minecraft.MinecraftTooltip;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
import binnie.craftgui.resource.minecraft.CraftGUITexture;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class ControlErrorState extends Control implements ITooltip
|
||||
{
|
||||
private ErrorState errorState;
|
||||
private int type;
|
||||
public class ControlErrorState extends Control implements ITooltip {
|
||||
private ErrorState errorState;
|
||||
private int type;
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
Object texture = CraftGUITexture.StateWarning;
|
||||
if (this.errorState == null) {
|
||||
texture = CraftGUITexture.StateNone;
|
||||
}
|
||||
else if (this.type == 0) {
|
||||
texture = CraftGUITexture.StateError;
|
||||
}
|
||||
CraftGUI.Render.texture(texture, IPoint.ZERO);
|
||||
super.onRenderBackground();
|
||||
}
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
Object texture = CraftGUITexture.StateWarning;
|
||||
if (this.errorState == null) {
|
||||
texture = CraftGUITexture.StateNone;
|
||||
} else if (this.type == 0) {
|
||||
texture = CraftGUITexture.StateError;
|
||||
}
|
||||
CraftGUI.Render.texture(texture, IPoint.ZERO);
|
||||
super.onRenderBackground();
|
||||
}
|
||||
|
||||
public ErrorState getError() {
|
||||
return Window.get(this).getContainer().getErrorState();
|
||||
}
|
||||
public ErrorState getError() {
|
||||
return Window.get(this).getContainer().getErrorState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onUpdateClient() {
|
||||
this.errorState = this.getError();
|
||||
this.type = Window.get(this).getContainer().getErrorType();
|
||||
ControlSlot.highlighting.get(EnumHighlighting.Error).clear();
|
||||
ControlSlot.highlighting.get(EnumHighlighting.Warning).clear();
|
||||
ControlLiquidTank.tankError.clear();
|
||||
ControlEnergyBar.isError = false;
|
||||
if (!this.isMouseOver() || this.errorState == null) {
|
||||
return;
|
||||
}
|
||||
ControlEnergyBar.isError = this.errorState.isPowerError();
|
||||
if (this.errorState.isItemError()) {
|
||||
for (final int slot : this.errorState.getData()) {
|
||||
int id = -1;
|
||||
for (final CustomSlot cslot : Window.get(this).getContainer().getCustomSlots()) {
|
||||
if (!(cslot.inventory instanceof InventoryPlayer) && cslot.getSlotIndex() == slot) {
|
||||
id = cslot.slotNumber;
|
||||
}
|
||||
}
|
||||
if (id >= 0) {
|
||||
if (this.type == 0) {
|
||||
ControlSlot.highlighting.get(EnumHighlighting.Error).add(id);
|
||||
}
|
||||
else {
|
||||
ControlSlot.highlighting.get(EnumHighlighting.Warning).add(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.errorState.isTankError()) {
|
||||
for (final int slot : this.errorState.getData()) {
|
||||
ControlLiquidTank.tankError.add(slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public final void onUpdateClient() {
|
||||
this.errorState = this.getError();
|
||||
this.type = Window.get(this).getContainer().getErrorType();
|
||||
ControlSlot.highlighting.get(EnumHighlighting.Error).clear();
|
||||
ControlSlot.highlighting.get(EnumHighlighting.Warning).clear();
|
||||
ControlLiquidTank.tankError.clear();
|
||||
ControlEnergyBar.isError = false;
|
||||
if (!this.isMouseOver() || this.errorState == null) {
|
||||
return;
|
||||
}
|
||||
ControlEnergyBar.isError = this.errorState.isPowerError();
|
||||
if (this.errorState.isItemError()) {
|
||||
for (final int slot : this.errorState.getData()) {
|
||||
int id = -1;
|
||||
for (final CustomSlot cslot : Window.get(this).getContainer().getCustomSlots()) {
|
||||
if (!(cslot.inventory instanceof InventoryPlayer) && cslot.getSlotIndex() == slot) {
|
||||
id = cslot.slotNumber;
|
||||
}
|
||||
}
|
||||
if (id >= 0) {
|
||||
if (this.type == 0) {
|
||||
ControlSlot.highlighting.get(EnumHighlighting.Error).add(id);
|
||||
} else {
|
||||
ControlSlot.highlighting.get(EnumHighlighting.Warning).add(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.errorState.isTankError()) {
|
||||
for (final int slot : this.errorState.getData()) {
|
||||
ControlLiquidTank.tankError.add(slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ControlErrorState(final IWidget parent, final float x, final float y) {
|
||||
super(parent, x, y, 16.0f, 16.0f);
|
||||
this.type = 0;
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
}
|
||||
public ControlErrorState(final IWidget parent, final float x, final float y) {
|
||||
super(parent, x, y, 16.0f, 16.0f);
|
||||
this.type = 0;
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(final Tooltip tooltipOrig) {
|
||||
final MinecraftTooltip tooltip = (MinecraftTooltip) tooltipOrig;
|
||||
if (this.errorState != null) {
|
||||
if (this.type == 0) {
|
||||
tooltip.setType(MinecraftTooltip.Type.Error);
|
||||
}
|
||||
else {
|
||||
tooltip.setType(MinecraftTooltip.Type.Warning);
|
||||
}
|
||||
tooltip.add(this.errorState.toString());
|
||||
if (this.errorState.getTooltip().length() > 0) {
|
||||
tooltip.add(this.errorState.getTooltip());
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void getTooltip(final Tooltip tooltipOrig) {
|
||||
final MinecraftTooltip tooltip = (MinecraftTooltip) tooltipOrig;
|
||||
if (this.errorState != null) {
|
||||
if (this.type == 0) {
|
||||
tooltip.setType(MinecraftTooltip.Type.Error);
|
||||
} else {
|
||||
tooltip.setType(MinecraftTooltip.Type.Warning);
|
||||
}
|
||||
tooltip.add(this.errorState.toString());
|
||||
if (this.errorState.getTooltip().length() > 0) {
|
||||
tooltip.add(this.errorState.getTooltip());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ErrorState getErrorState() {
|
||||
return this.errorState;
|
||||
}
|
||||
public ErrorState getErrorState() {
|
||||
return this.errorState;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user