mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-22 13:09:47 +00:00
Improve/refactoring (#15)
* Improve the code * Code improve in binnie.core.utils package * Code improve in binnie.core.triggers package * Code improve in binnie.core.resource package * Code improve in binnie.core.proxy package * Code improve readability in binnie.core package * Add missed constructors * Some improve code readabilty * Expand import with * * Revert "Expand import with *" This reverts commit 3bb4a44f3b69a8559bd5753337e0f6793ad18dc4. * Fix using fully qualified names in imports * Fix missed unnessesary "this." * Removed binnie.craftgui package Optimised imports and removed unnessesary "this." * Some refactoring code in binnie.core.craftgui package * Merge from master1.7.10 * Improve code readability in binnie.core.craftgui.database package * Improve code readability in binnie.core.craftgui.events package * Improve code readability in binnie.core.craftgui.geometry package * Improve code readability in binnie.core.craftgui.* package
This commit is contained in:
1 parent
a3c2360ba6
commit
f402cb155f
428 files changed
+9515
-10103
No files matched your search
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.genetics.craftgui;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.Random;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.geometry.TextJustification;
|
||||
import binnie.core.craftgui.geometry.IArea;
|
||||
import binnie.core.craftgui.window.Panel;
|
||||
import binnie.core.craftgui.minecraft.MinecraftGUI;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.ControlText;
|
||||
import binnie.core.craftgui.minecraft.control.ControlProgressBase;
|
||||
|
||||
public class ControlSequencerProgress extends ControlProgressBase
|
||||
{
|
||||
ControlText textControl;
|
||||
|
||||
public ControlSequencerProgress(final IWidget parent, final int x, final int y) {
|
||||
super(parent, x, y, 100.0f, 52.0f);
|
||||
final Panel panel = new Panel(this, 0.0f, 0.0f, 100.0f, 52.0f, MinecraftGUI.PanelType.Gray);
|
||||
this.textControl = new ControlText(panel, new IArea(4.0f, 4.0f, 92.0f, 44.0f), "", TextJustification.MiddleCenter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateClient() {
|
||||
super.onUpdateClient();
|
||||
final ItemStack stack = Machine.getMachine(Window.get(this).getInventory()).getMachineUtil().getStack(5);
|
||||
if (stack == null) {
|
||||
this.textControl.setValue("");
|
||||
}
|
||||
else {
|
||||
final Random rand = new Random(stack.getDisplayName().length());
|
||||
String text = "";
|
||||
final String[] codes = { "A", "T", "G", "C" };
|
||||
final String[] colors = { "a", "d", "b", "c" };
|
||||
for (int i = 0; i < 65; ++i) {
|
||||
final int k = rand.nextInt(4);
|
||||
final String code = codes[k];
|
||||
if (rand.nextFloat() < this.progress) {
|
||||
final String col = "§" + colors[k];
|
||||
text = text + "§r" + col + "§l" + code;
|
||||
}
|
||||
else {
|
||||
text = text + "§r§7§k§l" + code;
|
||||
}
|
||||
}
|
||||
this.textControl.setValue(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user