33import java .io .DataInputStream ;
44import java .io .IOException ;
55
6-
76import org .lwjgl .opengl .GL11 ;
87
98import mods .eln .client .FrameTime ;
@@ -22,100 +21,90 @@ public class AutoMinerRender extends TransparentNodeElementRender {
2221 float [] buttonsState ;
2322 boolean [] ledsAState ;
2423 boolean [] ledsPState ;
25-
26-
24+
2725 public AutoMinerRender (TransparentNodeEntity tileEntity ,
2826 TransparentNodeDescriptor descriptor ) {
2927 super (tileEntity , descriptor );
3028 this .descriptor = (AutoMinerDescriptor ) descriptor ;
31-
29+
3230 buttonsState = new float [this .descriptor .buttonsCount ];
33- for (int idx = 0 ;idx < this .descriptor .buttonsCount ;idx ++){
31+ for (int idx = 0 ; idx < this .descriptor .buttonsCount ; idx ++) {
3432 buttonsState [idx ] = (float ) Math .random ();
3533 }
36-
34+
3735 ledsAState = new boolean [this .descriptor .ledsACount ];
38- for (int idx = 0 ;idx < this .descriptor .ledsACount ;idx ++){
36+ for (int idx = 0 ; idx < this .descriptor .ledsACount ; idx ++) {
3937 ledsAState [idx ] = Math .random () > 0.5 ;
4038 }
4139
4240 ledsPState = new boolean [this .descriptor .ledsPCount ];
43- for (int idx = 0 ;idx < this .descriptor .ledsPCount ;idx ++){
41+ for (int idx = 0 ; idx < this .descriptor .ledsPCount ; idx ++) {
4442 ledsPState [idx ] = Math .random () > 0.5 ;
4543 }
4644 }
4745
48-
49-
5046 @ Override
5147 public void draw () {
52-
53- if (pipeLength != 0 ) {
48+
49+ if (pipeLength != 0 ) {
5450 GL11 .glPushMatrix ();
55- for (int idx = pipeLength ;idx != 0 ;idx --){
56- if (idx != 1 ){
51+ for (int idx = pipeLength ; idx != 0 ; idx --) {
52+ if (idx != 1 ) {
5753 descriptor .pipe .draw ();
5854 }
59- else {
55+ else {
6056 descriptor .head .draw ();
6157 }
6258 GL11 .glTranslatef (0 , -1f , 0 );
6359 }
6460 GL11 .glPopMatrix ();
65- /*GL11.glLineWidth(20f);
66- GL11.glDisable(GL11.GL_TEXTURE_2D);
67-
68- GL11.glBegin(GL11.GL_LINES);
69- GL11.glColor4f(1f, 0f, 0f, 1f);
70- GL11.glVertex3f(0f, -0.5f, 0f);
71- GL11.glVertex3f(0f, -0.5f - pipeLength, 0f);
72- GL11.glEnd();
73-
74- GL11.glEnable(GL11.GL_TEXTURE_2D);*/
61+
7562 }
76-
77- for (int idx = 0 ;idx < this .descriptor .buttonsCount ;idx ++){
63+
64+ for (int idx = 0 ; idx < this .descriptor .buttonsCount ; idx ++) {
7865 buttonsState [idx ] = idx == job .ordinal () ? 1 : 0 ;
7966 }
80-
81- for (int idx = 0 ;idx < this .descriptor .ledsACount ;idx ++){
82- if (Math .random () < 0.2 *FrameTime .get ())
83- ledsAState [idx ] = ! ledsAState [idx ];
67+
68+ front .glRotateXnRef ();
69+ descriptor .draw (false , buttonsState , ledsAState , ledsPState );
70+ }
71+
72+ public void refresh (float deltaT ) {
73+ for (int idx = 0 ; idx < this .descriptor .ledsACount ; idx ++) {
74+ if (Math .random () < 0.2 * deltaT )
75+ ledsAState [idx ] = !ledsAState [idx ];
8476 }
8577
86- for (int idx = 0 ;idx < this .descriptor .ledsPCount ;idx ++){
87- if (Math .random () < 0.2 * FrameTime . get () )
88- ledsPState [idx ] = ! ledsPState [idx ];
78+ for (int idx = 0 ; idx < this .descriptor .ledsPCount ; idx ++) {
79+ if (Math .random () < 0.2 * deltaT )
80+ ledsPState [idx ] = !ledsPState [idx ];
8981 }
90-
91-
92- front .glRotateXnRef ();
93- descriptor .draw (false ,buttonsState ,ledsAState ,ledsPState );
82+
9483 }
9584
9685 TransparentNodeElementInventory inventory = new TransparentNodeElementInventory (AutoMinerContainer .inventorySize , 64 , this );
97-
86+
9887 @ Override
9988 public GuiScreen newGuiDraw (Direction side , EntityPlayer player ) {
10089 return new AutoMinerGuiDraw (player , inventory , this );
10190 }
102-
91+
10392 short pipeLength = 0 ;
10493 AutoMinerSlowProcess .jobType job ;
105-
94+
10695 @ Override
10796 public void networkUnserialize (DataInputStream stream ) {
10897 super .networkUnserialize (stream );
10998 try {
11099 pipeLength = stream .readShort ();
111100 job = AutoMinerSlowProcess .jobType .values ()[stream .readByte ()];
112- // Utils.println(job + " " + pipeLength);
101+ // Utils.println(job + " " + pipeLength);
113102
114103 } catch (IOException e ) {
115104 e .printStackTrace ();
116105 }
117106 }
118-
107+
119108 @ Override
120109 public boolean cameraDrawOptimisation () {
121110 return false ;
0 commit comments