1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
|
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: GT_Client.java
package gregtech.common;
import codechicken.lib.vec.Rotation;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.network.FMLNetworkEvent;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Materials;
import gregtech.api.interfaces.IHasFluidDisplayItem;
import gregtech.api.interfaces.tileentity.ICoverable;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.interfaces.tileentity.ITurnable;
import gregtech.api.metatileentity.BaseMetaPipeEntity;
import gregtech.api.net.GT_Packet_ClientPreference;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.*;
import gregtech.common.entities.GT_Entity_Arrow;
import gregtech.common.entities.GT_Entity_Arrow_Potion;
import gregtech.common.net.MessageUpdateFluidDisplayItem;
import gregtech.common.render.*;
import ic2.api.tile.IWrenchable;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatFileWriter;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.World;
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.oredict.OreDictionary;
import org.lwjgl.opengl.GL11;
import java.net.URL;
import java.util.*;
// Referenced classes of package gregtech.common:
// GT_Proxy
public class GT_Client extends GT_Proxy
implements Runnable {
private static List ROTATABLE_VANILLA_BLOCKS;
static {
ROTATABLE_VANILLA_BLOCKS = Arrays.asList(new Block[]{
Blocks.piston, Blocks.sticky_piston, Blocks.furnace, Blocks.lit_furnace, Blocks.dropper, Blocks.dispenser, Blocks.chest, Blocks.trapped_chest, Blocks.ender_chest, Blocks.hopper,
Blocks.pumpkin, Blocks.lit_pumpkin
});
}
private final HashSet<String> mCapeList = new HashSet<>();
public static final GT_PollutionRenderer mPollutionRenderer = new GT_PollutionRenderer();
private final GT_CapeRenderer mCapeRenderer;
private final List mPosR;
private final List mPosG;
private final List mPosB;
private final List mPosA = Arrays.asList(new Object[0]);
private final List mNegR;
private final List mNegG;
private final List mNegB;
private final List mNegA = Arrays.asList(new Object[0]);
private final List mMoltenPosR;
private final List mMoltenPosG;
private final List mMoltenPosB;
private final List mMoltenPosA = Arrays.asList(new Object[0]);
private final List mMoltenNegR;
private final List mMoltenNegG;
private final List mMoltenNegB;
private final List mMoltenNegA = Arrays.asList(new Object[0]);
private long mAnimationTick;
/**This is the place to def the value used below**/
private long afterSomeTime;
private boolean mAnimationDirection;
private int mLastUpdatedBlockX;
private int mLastUpdatedBlockY;
private int mLastUpdatedBlockZ;
private boolean isFirstClientPlayerTick;
private String mMessage;
private GT_ClientPreference mPreference;
private boolean mFirstTick = false;
public GT_Client() {
mCapeRenderer = new GT_CapeRenderer(mCapeList);
mAnimationTick = 0L;
mAnimationDirection = false;
isFirstClientPlayerTick = true;
mMessage = "";
mPosR = Arrays.asList(new Materials[]{
/**Materials.ChargedCertusQuartz, **/Materials.Enderium, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.Force,
Materials.Pyrotheum, Materials.Sunnarium, Materials.Glowstone, Materials.Thaumium, Materials.InfusedVis, Materials.InfusedAir, Materials.InfusedFire, Materials.FierySteel, Materials.Firestone
});
mPosG = Arrays.asList(new Materials[]{
/**Materials.ChargedCertusQuartz, **/Materials.Enderium, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.Force,
Materials.Pyrotheum, Materials.Sunnarium, Materials.Glowstone, Materials.InfusedAir, Materials.InfusedEarth
});
mPosB = Arrays.asList(new Materials[]{
/**Materials.ChargedCertusQuartz, **/Materials.Enderium, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.InfusedVis,
Materials.InfusedWater, Materials.Thaumium
});
mNegR = Arrays.asList(new Materials[]{
Materials.InfusedEntropy, Materials.NetherStar
});
mNegG = Arrays.asList(new Materials[]{
Materials.InfusedEntropy, Materials.NetherStar
});
mNegB = Arrays.asList(new Materials[]{
Materials.InfusedEntropy, Materials.NetherStar
});
mMoltenPosR = Arrays.asList(new Materials[]{
Materials.Enderium, Materials.NetherStar, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.Force,
Materials.Pyrotheum, Materials.Sunnarium, Materials.Glowstone, Materials.Thaumium, Materials.InfusedVis, Materials.InfusedAir, Materials.InfusedFire, Materials.FierySteel, Materials.Firestone
});
mMoltenPosG = Arrays.asList(new Materials[]{
Materials.Enderium, Materials.NetherStar, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.Force,
Materials.Pyrotheum, Materials.Sunnarium, Materials.Glowstone, Materials.InfusedAir, Materials.InfusedEarth
});
mMoltenPosB = Arrays.asList(new Materials[]{
Materials.Enderium, Materials.NetherStar, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.InfusedVis,
Materials.InfusedWater, Materials.Thaumium
});
mMoltenNegR = Arrays.asList(new Materials[]{
Materials.InfusedEntropy
});
mMoltenNegG = Arrays.asList(new Materials[]{
Materials.InfusedEntropy
});
mMoltenNegB = Arrays.asList(new Materials[]{
Materials.InfusedEntropy
});
}
private static boolean checkedForChicken = false;
private static void drawGrid(DrawBlockHighlightEvent aEvent, boolean showCoverConnections) {
if (!checkedForChicken) {
try {
Class.forName("codechicken.lib.vec.Rotation");
} catch (Throwable e) {
if (GT_Values.D1) {
e.printStackTrace(GT_Log.err);
}
return;
}
checkedForChicken = true;
}
GL11.glPushMatrix();
GL11.glTranslated(-(aEvent.player.lastTickPosX + (aEvent.player.posX - aEvent.player.lastTickPosX) * (double) aEvent.partialTicks), -(aEvent.player.lastTickPosY + (aEvent.player.posY - aEvent.player.lastTickPosY) * (double) aEvent.partialTicks), -(aEvent.player.lastTickPosZ + (aEvent.player.posZ - aEvent.player.lastTickPosZ) * (double) aEvent.partialTicks));
GL11.glTranslated((float) aEvent.target.blockX + 0.5F, (float) aEvent.target.blockY + 0.5F, (float) aEvent.target.blockZ + 0.5F);
Rotation.sideRotations[aEvent.target.sideHit].glApply();
GL11.glTranslated(0.0D, -0.501D, 0.0D);
GL11.glLineWidth(2.0F);
GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.5F);
GL11.glBegin(1);
GL11.glVertex3d(+.50D, .0D, -.25D);
GL11.glVertex3d(-.50D, .0D, -.25D);
GL11.glVertex3d(+.50D, .0D, +.25D);
GL11.glVertex3d(-.50D, .0D, +.25D);
GL11.glVertex3d(+.25D, .0D, -.50D);
GL11.glVertex3d(+.25D, .0D, +.50D);
GL11.glVertex3d(-.25D, .0D, -.50D);
GL11.glVertex3d(-.25D, .0D, +.50D);
TileEntity tTile = aEvent.player.worldObj.getTileEntity(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ);
byte tConnections = 0;
if (tTile instanceof ICoverable){
if (showCoverConnections) {
for (byte i = 0; i < 6; i++) {
if ( ((ICoverable) tTile).getCoverIDAtSide(i) > 0)
tConnections = (byte)(tConnections + (1 << i));
}
}
else if (tTile instanceof BaseMetaPipeEntity)
tConnections = ((BaseMetaPipeEntity) tTile).mConnections;
}
if (tConnections>0) {
int[][] GridSwitchArr = new int[][]{
{0, 5, 3, 1, 2, 4},
{5, 0, 1, 3, 2, 4},
{1, 3, 0, 5, 2, 4},
{3, 1, 5, 0, 2, 4},
{4, 2, 3, 1, 0, 5},
{2, 4, 3, 1, 5, 0},
};
for (byte i = 0; i < 6; i++) {
if ((tConnections & (1 << i)) != 0) {
switch (GridSwitchArr[aEvent.target.sideHit][i]) {
case 0:
GL11.glVertex3d(+.25D, .0D, +.25D);
GL11.glVertex3d(-.25D, .0D, -.25D);
GL11.glVertex3d(-.25D, .0D, +.25D);
GL11.glVertex3d(+.25D, .0D, -.25D);
break;
case 1:
GL11.glVertex3d(-.25D, .0D, +.50D);
GL11.glVertex3d(+.25D, .0D, +.25D);
GL11.glVertex3d(-.25D, .0D, +.25D);
GL11.glVertex3d(+.25D, .0D, +.50D);
break;
case 2:
GL11.glVertex3d(-.50D, .0D, -.25D);
GL11.glVertex3d(-.25D, .0D, +.25D);
GL11.glVertex3d(-.50D, .0D, +.25D);
GL11.glVertex3d(-.25D, .0D, -.25D);
break;
case 3:
GL11.glVertex3d(-.25D, .0D, -.50D);
GL11.glVertex3d(+.25D, .0D, -.25D);
GL11.glVertex3d(-.25D, .0D, -.25D);
GL11.glVertex3d(+.25D, .0D, -.50D);
break;
case 4:
GL11.glVertex3d(+.50D, .0D, -.25D);
GL11.glVertex3d(+.25D, .0D, +.25D);
GL11.glVertex3d(+.50D, .0D, +.25D);
GL11.glVertex3d(+.25D, .0D, -.25D);
break;
case 5:
GL11.glVertex3d(+.50D, .0D, +.50D);
GL11.glVertex3d(+.25D, .0D, +.25D);
GL11.glVertex3d(+.50D, .0D, +.25D);
GL11.glVertex3d(+.25D, .0D, +.50D);
GL11.glVertex3d(+.50D, .0D, -.50D);
GL11.glVertex3d(+.25D, .0D, -.25D);
GL11.glVertex3d(+.50D, .0D, -.25D);
GL11.glVertex3d(+.25D, .0D, -.50D);
GL11.glVertex3d(-.50D, .0D, +.50D);
GL11.glVertex3d(-.25D, .0D, +.25D);
GL11.glVertex3d(-.50D, .0D, +.25D);
GL11.glVertex3d(-.25D, .0D, +.50D);
GL11.glVertex3d(-.50D, .0D, -.50D);
GL11.glVertex3d(-.25D, .0D, -.25D);
GL11.glVertex3d(-.50D, .0D, -.25D);
GL11.glVertex3d(-.25D, .0D, -.50D);
break;
}
}
}
}
GL11.glEnd();
GL11.glPopMatrix();
}
private static void drawGrid(DrawBlockHighlightEvent aEvent) {
drawGrid(aEvent, false);
}
@Override
public boolean isServerSide() {
return true;
}
@Override
public boolean isClientSide() {
return true;
}
@Override
public boolean isBukkitSide() {
return false;
}
@Override
public EntityPlayer getThePlayer() {
return Minecraft.getMinecraft().thePlayer;
}
@Override
public int addArmor(String aPrefix) {
return RenderingRegistry.addNewArmourRendererPrefix(aPrefix);
}
@Override
public void onPreLoad() {
super.onPreLoad();
String arr$[] = {
"renadi", "hanakocz", "MysteryDump", "Flaver4", "x_Fame", "Peluche321", "Goshen_Ithilien", "manf", "Bimgo", "leagris",
"IAmMinecrafter02", "Cerous", "Devilin_Pixy", "Bkarlsson87", "BadAlchemy", "CaballoCraft", "melanclock", "Resursator", "demanzke", "AndrewAmmerlaan",
"Deathlycraft", "Jirajha", "Axlegear", "kei_kouma", "Dracion", "dungi", "Dorfschwein", "Zero Tw0", "mattiagraz85", "sebastiank30",
"Plem", "invultri", "grillo126", "malcanteth", "Malevolence_", "Nicholas_Manuel", "Sirbab", "kehaan", "bpgames123", "semig0d",
"9000bowser", "Sovereignty89", "Kris1432", "xander_cage_", "samuraijp", "bsaa", "SpwnX", "tworf", "Kadah", "kanni",
"Stute", "Hegik", "Onlyme", "t3hero", "Hotchi", "jagoly", "Nullav", "BH5432", "Sibmer", "inceee",
"foxxx0", "Hartok", "TMSama", "Shlnen", "Carsso", "zessirb", "meep310", "Seldron", "yttr1um", "hohounk",
"freebug", "Sylphio", "jmarler", "Saberawr", "r00teniy", "Neonbeta", "yinscape", "voooon24", "Quintine", "peach774",
"lepthymo", "bildeman", "Kremnari", "Aerosalo", "OndraSter", "oscares91", "mr10movie", "Daxx367x2", "EGERTRONx", "aka13_404",
"Abouttabs", "Johnstaal", "djshiny99", "megatronp", "DZCreeper", "Kane_Hart", "Truculent", "vidplace7", "simon6689", "MomoNasty",
"UnknownXLV", "goreacraft", "Fluttermine", "Daddy_Cecil", "MrMaleficus", "TigersFangs", "cublikefoot", "chainman564", "NikitaBuker", "Misha999777",
"25FiveDetail", "AntiCivilBoy", "michaelbrady", "xXxIceFirexXx", "Speedynutty68", "GarretSidzaka", "HallowCharm977", "mastermind1919", "The_Hypersonic", "diamondguy2798",
"zF4ll3nPr3d4t0r", "CrafterOfMines57", "XxELIT3xSNIP3RxX", "SuterusuKusanagi", "xavier0014", "adamros", "alexbegt"
};
int len$ = arr$.length;
for (int i$ = 0; i$ < len$; i$++) {
String tName = arr$[i$];
mCapeList.add(tName.toLowerCase());
}
(new Thread(this)).start();
mPollutionRenderer.preLoad();
mPreference = new GT_ClientPreference(GregTech_API.sClientDataFile);
}
@Override
public void onLoad() {
super.onLoad();
new GT_Renderer_Block();
new GT_MetaGenerated_Item_Renderer();
new GT_MetaGenerated_Tool_Renderer();
new GT_Renderer_Entity_Arrow(GT_Entity_Arrow.class, "arrow");
new GT_Renderer_Entity_Arrow(GT_Entity_Arrow_Potion.class, "arrow_potions");
new GT_FlaskRenderer();
new GT_FluidDisplayStackRenderer();
}
@Override
public void onPostLoad() {
super.onPostLoad();
try {
label0:
for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++)
do {
if (i >= GregTech_API.METATILEENTITIES.length)
continue label0;
if (GregTech_API.METATILEENTITIES[i] != null) {
GregTech_API.METATILEENTITIES[i].getStackForm(1L).getTooltip(null, true);
GT_Log.out.println("META " + i + " " + GregTech_API.METATILEENTITIES[i].getMetaName());
}
i++;
} while (true);
} catch (Throwable e) {e.printStackTrace(GT_Log.err);}
// super.onPostLoad();
//
// for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) {
// try {
// for (; i < GregTech_API.METATILEENTITIES.length; i++) if (GregTech_API.METATILEENTITIES[i] != null) GregTech_API.METATILEENTITIES[i].getStackForm(1L).getTooltip(null, true);
// } catch (Throwable e) {
// e.printStackTrace(GT_Log.err);
// }
// }
}
@Override
public void run() {
try {
GT_Log.out.println("GT_Mod: Downloading Cape List.");
@SuppressWarnings("resource")
Scanner tScanner = new Scanner(new URL("http://gregtech.overminddl1.com/com/gregoriust/gregtech/supporterlist.txt").openStream());
while (tScanner.hasNextLine()) {
String tName = tScanner.nextLine();
if (!this.mCapeList.contains(tName.toLowerCase())) {
this.mCapeList.add(tName.toLowerCase());
}
}
} catch (Throwable e) {
}
try {
GT_Log.out.println("GT New Horizons: Downloading Cape List.");
@SuppressWarnings("resource")
Scanner tScanner = new Scanner(new URL("https://raw.githubusercontent.com/GTNewHorizons/CustomGTCapeHook-Cape-List/master/capes.txt").openStream());
while (tScanner.hasNextLine()) {
String tName = tScanner.nextLine();
if (tName.contains(":")) {
int splitLocation = tName.indexOf(":");
String username = tName.substring(0, splitLocation);
if (!this.mCapeList.contains(username.toLowerCase()) && !this.mCapeList.contains(tName.toLowerCase())) {
this.mCapeList.add(tName.toLowerCase());
}
} else {
if (!this.mCapeList.contains(tName.toLowerCase())) {
this.mCapeList.add(tName.toLowerCase());
}
}
}
} catch (Throwable e) {
}
/**try {
GT_Log.out.println("GT_Mod: Downloading News.");
@SuppressWarnings("resource")
Scanner tScanner = new Scanner(new URL("http://files.minecraftforge.net/maven/com/gregoriust/gregtech/message.txt").openStream());
while (tScanner.hasNextLine()) {
this.mMessage = (this.mMessage + tScanner.nextLine() + " ");
}
} catch (Throwable e) {
}**/
}
@Override
@SubscribeEvent
public void onClientConnectedToServerEvent(FMLNetworkEvent.ClientConnectedToServerEvent aEvent) {
mFirstTick = true;
}
@SubscribeEvent
public void receiveRenderSpecialsEvent(net.minecraftforge.client.event.RenderPlayerEvent.Specials.Pre aEvent) {
mCapeRenderer.receiveRenderSpecialsEvent(aEvent);
}
@SubscribeEvent
public void onPlayerTickEventClient(TickEvent.PlayerTickEvent aEvent) {
if ((aEvent.side.isClient()) && (aEvent.phase == TickEvent.Phase.END) && (!aEvent.player.isDead)) {
if (mFirstTick) {
mFirstTick = false;
GT_Values.NW.sendToServer(new GT_Packet_ClientPreference(mPreference));
}
afterSomeTime++;
if(afterSomeTime>=100L) {
afterSomeTime=0;
StatFileWriter sfw= Minecraft.getMinecraft().thePlayer.getStatFileWriter();
try {
for(GT_Recipe recipe:GT_Recipe.GT_Recipe_Map.sAssemblylineVisualRecipes.mRecipeList) {
recipe.mHidden=GT_Values.hideAssLineRecipes && !sfw.hasAchievementUnlocked(GT_Mod.achievements.getAchievement(recipe.getOutput(0).getUnlocalizedName()));
}
} catch (Exception ignored){}
}
ArrayList<GT_PlayedSound> tList = new ArrayList();
for (Map.Entry<GT_PlayedSound, Integer> tEntry : GT_Utility.sPlayedSoundMap.entrySet()) {
if (tEntry.getValue().intValue() < 0) {//Integer -> Integer -> int? >_<, fix
tList.add(tEntry.getKey());
} else {
tEntry.setValue(Integer.valueOf(tEntry.getValue().intValue() - 1));
}
}
GT_PlayedSound tKey;
for (Iterator i$ = tList.iterator(); i$.hasNext(); GT_Utility.sPlayedSoundMap.remove(tKey)) {
tKey = (GT_PlayedSound) i$.next();
}
if(!GregTech_API.mServerStarted) GregTech_API.mServerStarted = true;
if (GT_Values.updateFluidDisplayItems) {
MovingObjectPosition trace = Minecraft.getMinecraft().objectMouseOver;
if (trace != null && trace.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK &&
(mLastUpdatedBlockX != trace.blockX &&
mLastUpdatedBlockY != trace.blockY &&
mLastUpdatedBlockZ != trace.blockZ || afterSomeTime % 10 == 0)) {
mLastUpdatedBlockX = trace.blockX;
mLastUpdatedBlockY = trace.blockY;
mLastUpdatedBlockZ = trace.blockZ;
TileEntity tileEntity = aEvent.player.worldObj.getTileEntity(trace.blockX, trace.blockY, trace.blockZ);
if (tileEntity instanceof IGregTechTileEntity) {
IGregTechTileEntity gtTile = (IGregTechTileEntity) tileEntity;
if (gtTile.getMetaTileEntity() instanceof IHasFluidDisplayItem) {
GT_Values.NW.sendToServer(new MessageUpdateFluidDisplayItem(trace.blockX, trace.blockY, trace.blockZ, gtTile.getWorld().provider.dimensionId));
}
}
}
}
}
}
@SubscribeEvent
public void onDrawBlockHighlight(DrawBlockHighlightEvent aEvent) {
Block aBlock = aEvent.player.worldObj.getBlock(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ);
TileEntity aTileEntity = aEvent.player.worldObj.getTileEntity(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ);
if (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sWrenchList))
{
if (aTileEntity instanceof ITurnable || ROTATABLE_VANILLA_BLOCKS.contains(aBlock) || aTileEntity instanceof IWrenchable)
drawGrid(aEvent, false);
return;
}
if (!(aTileEntity instanceof ICoverable))
return;
if (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sWireCutterList) ||
GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sSolderingToolList) )
{
if (((ICoverable) aTileEntity).getCoverIDAtSide((byte) aEvent.target.sideHit) == 0)
drawGrid(aEvent, false);
return;
}
if ((aEvent.currentItem == null && aEvent.player.isSneaking()) ||
GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sCrowbarList) ||
GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sScrewdriverList))
{
if (((ICoverable) aTileEntity).getCoverIDAtSide((byte) aEvent.target.sideHit) == 0)
for (byte i = 0; i < 6; i++)
if (((ICoverable) aTileEntity).getCoverIDAtSide(i) > 0) {
drawGrid(aEvent, true);
return;
}
return;
}
if (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sCovers.keySet()))
{
if (((ICoverable) aTileEntity).getCoverIDAtSide((byte) aEvent.target.sideHit) == 0)
drawGrid(aEvent, true);
}
}
@SubscribeEvent
public void receiveRenderEvent(net.minecraftforge.client.event.RenderPlayerEvent.Pre aEvent) {
if (GT_Utility.getFullInvisibility(aEvent.entityPlayer)) {
aEvent.setCanceled(true);
return;
} else {
return;
}
}
@SubscribeEvent
public void onClientTickEvent(cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent aEvent) {
if (aEvent.phase == cpw.mods.fml.common.gameevent.TickEvent.Phase.END) {
if(changeDetected>0)changeDetected--;
int newHideValue=shouldHeldItemHideThings();
if(newHideValue!=hideValue){
hideValue=newHideValue;
changeDetected=5;
}
mAnimationTick++;
if (mAnimationTick % 50L == 0L)
{mAnimationDirection = !mAnimationDirection;}
int tDirection = mAnimationDirection ? 1 : -1;
for (Iterator i$ = mPosR.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
tMaterial.mRGBa[0] += tDirection;
}
for (Iterator i$ = mPosG.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
tMaterial.mRGBa[1] += tDirection;
}
for (Iterator i$ = mPosB.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
tMaterial.mRGBa[2] += tDirection;
}
for (Iterator i$ = mPosA.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
tMaterial.mRGBa[3] += tDirection;
}
for (Iterator i$ = mNegR.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
tMaterial.mRGBa[0] -= tDirection;
}
for (Iterator i$ = mNegG.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
tMaterial.mRGBa[1] -= tDirection;
}
for (Iterator i$ = mNegB.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
tMaterial.mRGBa[2] -= tDirection;
}
for (Iterator i$ = mNegA.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
tMaterial.mRGBa[3] -= tDirection;
}
for (Iterator i$ = mMoltenPosR.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
tMaterial.mMoltenRGBa[0] += tDirection;
}
for (Iterator i$ = mMoltenPosG.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
tMaterial.mMoltenRGBa[1] += tDirection;
}
for (Iterator i$ = mMoltenPosB.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
tMaterial.mMoltenRGBa[2] += tDirection;
}
for (Iterator i$ = mMoltenPosA.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
tMaterial.mMoltenRGBa[3] += tDirection;
}
for (Iterator i$ = mMoltenNegR.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
tMaterial.mMoltenRGBa[0] -= tDirection;
}
for (Iterator i$ = mMoltenNegG.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
tMaterial.mMoltenRGBa[1] -= tDirection;
}
for (Iterator i$ = mMoltenNegB.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
tMaterial.mMoltenRGBa[2] -= tDirection;
}
for (Iterator i$ = mMoltenNegA.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
tMaterial.mMoltenRGBa[3] -= tDirection;
}
}
}
@Override
public void doSonictronSound(ItemStack aStack, World aWorld, double aX, double aY, double aZ) {
if (GT_Utility.isStackInvalid(aStack))
return;
String tString = "note.harp";
int i = 0;
int j = mSoundItems.size();
do {
if (i >= j)
break;
if (GT_Utility.areStacksEqual((ItemStack) mSoundItems.get(i), aStack)) {
tString = (String) mSoundNames.get(i);
break;
}
i++;
} while (true);
if (tString.startsWith("random.explode"))
if (aStack.stackSize == 3)
tString = "random.fuse";
else if (aStack.stackSize == 2)
tString = "random.old_explode";
if (tString.startsWith("streaming."))
switch (aStack.stackSize) {
case 1: // '\001'
tString = (new StringBuilder()).append(tString).append("13").toString();
break;
case 2: // '\002'
tString = (new StringBuilder()).append(tString).append("cat").toString();
break;
case 3: // '\003'
tString = (new StringBuilder()).append(tString).append("blocks").toString();
break;
case 4: // '\004'
tString = (new StringBuilder()).append(tString).append("chirp").toString();
break;
case 5: // '\005'
tString = (new StringBuilder()).append(tString).append("far").toString();
break;
case 6: // '\006'
tString = (new StringBuilder()).append(tString).append("mall").toString();
break;
case 7: // '\007'
tString = (new StringBuilder()).append(tString).append("mellohi").toString();
break;
case 8: // '\b'
tString = (new StringBuilder()).append(tString).append("stal").toString();
break;
case 9: // '\t'
tString = (new StringBuilder()).append(tString).append("strad").toString();
break;
case 10: // '\n'
tString = (new StringBuilder()).append(tString).append("ward").toString();
break;
case 11: // '\013'
tString = (new StringBuilder()).append(tString).append("11").toString();
break;
case 12: // '\f'
tString = (new StringBuilder()).append(tString).append("wait").toString();
break;
default:
tString = (new StringBuilder()).append(tString).append("wherearewenow").toString();
break;
}
if (tString.startsWith("streaming.")){
new WorldSpawnedEventBuilder.RecordEffectEventBuilder()
.setIdentifier(tString.substring(10))
.setPosition(aX, aY, aZ)
.run();
}
else{
new WorldSpawnedEventBuilder.SoundEventBuilder()
.setVolume(3f)
.setPitch(tString.startsWith("note.") ? (float) Math.pow(2D, (double) (aStack.stackSize - 13) / 12D) : 1.0F)
.setIdentifier(tString)
.setPosition(aX, aY, aZ)
.run();
}
}
public static int hideValue=0;
/** <p>Client tick counter that is set to 5 on hiding pipes and covers.</p>
* <p>It triggers a texture update next client tick when reaching 4, with provision for 3 more update tasks,
* spreading client change detection related work and network traffic on different ticks, until it reaches 0.</p>
*/
public static int changeDetected=0;
private static int shouldHeldItemHideThings() {
try {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (player == null) return 0;
ItemStack tCurrentItem = player.getCurrentEquippedItem();
if (tCurrentItem == null) return 0;
int[] ids = OreDictionary.getOreIDs(tCurrentItem);
int hide = 0;
for (int i : ids) {
if (OreDictionary.getOreName(i).equals("craftingToolSolderingIron")) {
hide |= 0x1;
break;
}
}
if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)
|| GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList)
|| GT_Utility.isStackInList(tCurrentItem, GregTech_API.sHardHammerList)
|| GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSoftHammerList)
|| GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWireCutterList)
|| GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)
|| GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCrowbarList)
|| GregTech_API.sCovers.containsKey(new GT_ItemStack(tCurrentItem))) {
hide |= 0x2;
}
return hide;
}catch(Exception e){
return 0;
}
}
public static void recieveChunkPollutionPacket(ChunkCoordIntPair chunk, int pollution) {
mPollutionRenderer.processPacket(chunk, pollution);
}
}
|