forked from unga22/MCPC-1.4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
forge_to_bukkit_patch.patch
17033 lines (15684 loc) · 597 KB
/
forge_to_bukkit_patch.patch
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
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Index: Block.java
===================================================================
--- Block.java (revision 3)
+++ Block.java (working copy)
@@ -1,10 +1,25 @@
package net.minecraft.server;
+import cpw.mods.fml.common.Side;
+import cpw.mods.fml.common.asm.SideOnly;
+import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import java.util.Random;
+import net.minecraft.server.Block$1;
+import net.minecraftforge.common.EnumPlantType;
+import net.minecraftforge.common.ForgeDirection;
+import net.minecraftforge.common.ForgeHooks;
+import net.minecraftforge.common.IPlantable;
+import net.minecraftforge.common.MinecraftForge;
public class Block
{
+ protected static int[] blockFireSpreadSpeed = new int[4096];
+ protected static int[] blockFlammability = new int[4096];
+ protected String currentTexture;
+ public boolean isDefaultTexture;
+
/**
* used as foreach item, if item.tab = current tab, display it on the screen
*/
@@ -267,8 +282,10 @@
public float frictionFactor;
private String name;
- protected Block(int var1, Material var2)
+ public Block(int var1, Material var2)
{
+ this.currentTexture = "/terrain.png";
+ this.isDefaultTexture = true;
this.cp = true;
this.cq = true;
this.stepSound = d;
@@ -288,6 +305,7 @@
q[var1] = this.c();
lightBlock[var1] = this.c() ? 255 : 0;
s[var1] = !var2.blocksLight();
+ this.isDefaultTexture = this.getTextureFile() != null && this.getTextureFile().equalsIgnoreCase("/terrain.png");
}
}
@@ -295,7 +313,7 @@
* Blocks with this attribute will not notify all near blocks when it's metadata change. The default behavior is
* always notify every neightbor block when anything changes.
*/
- protected Block r()
+ public Block r()
{
u[this.id] = true;
return this;
@@ -307,7 +325,7 @@
*/
protected void t_() {}
- protected Block(int var1, int var2, Material var3)
+ public Block(int var1, int var2, Material var3)
{
this(var1, var3);
this.textureId = var2;
@@ -316,7 +334,7 @@
/**
* Sets the footstep sound for the block. Returns the object for convenience in constructing.
*/
- protected Block a(StepSound var1)
+ public Block a(StepSound var1)
{
this.stepSound = var1;
return this;
@@ -325,7 +343,7 @@
/**
* Sets how much light is blocked going through this block. Returns the object for convenience in constructing.
*/
- protected Block h(int var1)
+ public Block h(int var1)
{
lightBlock[this.id] = var1;
return this;
@@ -335,7 +353,7 @@
* Sets the amount of light emitted by a block from 0.0f to 1.0f (converts internally to 0-15). Returns the object
* for convenience in constructing.
*/
- protected Block a(float var1)
+ public Block a(float var1)
{
lightEmission[this.id] = (int)(15.0F * var1);
return this;
@@ -344,7 +362,7 @@
/**
* Sets the the blocks resistance to explosions. Returns the object for convenience in constructing.
*/
- protected Block b(float var1)
+ public Block b(float var1)
{
this.durability = var1 * 3.0F;
return this;
@@ -380,7 +398,7 @@
/**
* Sets how many hits it takes to break a block.
*/
- protected Block c(float var1)
+ public Block c(float var1)
{
this.strength = var1;
@@ -395,7 +413,7 @@
/**
* This method will make the hardness of the block equals to -1, and the block is indestructible.
*/
- protected Block s()
+ public Block s()
{
this.c(-1.0F);
return this;
@@ -412,7 +430,7 @@
/**
* Sets whether this block type will receive random update ticks
*/
- protected Block b(boolean var1)
+ public Block b(boolean var1)
{
this.cr = var1;
return this;
@@ -427,15 +445,16 @@
return this.cr;
}
+ @Deprecated
public boolean u()
{
- return this.isTileEntity;
+ return this.hasTileEntity(0);
}
/**
* Sets the bounds of the block. minX, minY, minZ, maxX, maxY, maxZ
*/
- protected final void a(float var1, float var2, float var3, float var4, float var5, float var6)
+ public final void a(float var1, float var2, float var3, float var4, float var5, float var6)
{
this.minX = (double)var1;
this.minY = (double)var2;
@@ -445,6 +464,24 @@
this.maxZ = (double)var6;
}
+ @SideOnly(Side.CLIENT)
+ public float f(IBlockAccess var1, int var2, int var3, int var4)
+ {
+ return var1.j(var2, var3, var4, this.getLightValue(var1, var2, var3, var4));
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int e(IBlockAccess var1, int var2, int var3, int var4)
+ {
+ return var1.i(var2, var3, var4, this.getLightValue(var1, var2, var3, var4));
+ }
+
+ @SideOnly(Side.CLIENT)
+ public boolean a(IBlockAccess var1, int var2, int var3, int var4, int var5)
+ {
+ return var5 == 0 && this.minY > 0.0D ? true : (var5 == 1 && this.maxY < 1.0D ? true : (var5 == 2 && this.minZ > 0.0D ? true : (var5 == 3 && this.maxZ < 1.0D ? true : (var5 == 4 && this.minX > 0.0D ? true : (var5 == 5 && this.maxX < 1.0D ? true : !var1.r(var2, var3, var4))))));
+ }
+
/**
* Returns Returns true if the given side of this block type should be rendered (if it's solid or not), if the
* adjacent block is at the given coordinates. Args: blockAccess, x, y, z, side
@@ -454,6 +491,12 @@
return var1.getMaterial(var2, var3, var4).isBuildable();
}
+ @SideOnly(Side.CLIENT)
+ public int d(IBlockAccess var1, int var2, int var3, int var4, int var5)
+ {
+ return this.a(var5, var1.getData(var2, var3, var4));
+ }
+
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
@@ -483,6 +526,12 @@
}
}
+ @SideOnly(Side.CLIENT)
+ public AxisAlignedBB b_(World var1, int var2, int var3, int var4)
+ {
+ return AxisAlignedBB.a().a((double)var2 + this.minX, (double)var3 + this.minY, (double)var4 + this.minZ, (double)var2 + this.maxX, (double)var3 + this.maxY, (double)var4 + this.maxZ);
+ }
+
/**
* Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
* cleared to be reused)
@@ -522,6 +571,9 @@
*/
public void b(World var1, int var2, int var3, int var4, Random var5) {}
+ @SideOnly(Side.CLIENT)
+ public void a(World var1, int var2, int var3, int var4, Random var5) {}
+
/**
* Called right before the block is destroyed by a player. Args: world, x, y, z, metaData
*/
@@ -573,8 +625,7 @@
*/
public float getDamage(EntityHuman var1, World var2, int var3, int var4, int var5)
{
- float var6 = this.m(var2, var3, var4, var5);
- return var6 < 0.0F ? 0.0F : (!var1.b(this) ? 1.0F / var6 / 100.0F : var1.a(this) / var6 / 30.0F);
+ return ForgeHooks.blockStrength(this, var1, var2, var3, var4, var5);
}
/**
@@ -592,22 +643,20 @@
{
if (!var1.isStatic)
{
- int var8 = this.getDropCount(var7, var1.random);
+ ArrayList var8 = this.getBlockDropped(var1, var2, var3, var4, var5, var7);
+ Iterator var9 = var8.iterator();
- for (int var9 = 0; var9 < var8; ++var9)
+ while (var9.hasNext())
{
+ ItemStack var10 = (ItemStack)var9.next();
+
if (var1.random.nextFloat() <= var6)
{
- int var10 = this.getDropType(var5, var1.random, var7);
-
- if (var10 > 0)
- {
- this.a(var1, var2, var3, var4, new ItemStack(var10, 1, this.getDropData(var5)));
+ this.a(var1, var2, var3, var4, var10);
}
}
}
}
- }
/**
* Spawns EntityItem in the world for the given ItemStack if the world is not remote.
@@ -807,6 +856,12 @@
*/
public void wasExploded(World var1, int var2, int var3, int var4) {}
+ @SideOnly(Side.CLIENT)
+ public int n()
+ {
+ return 0;
+ }
+
/**
* checks to see if you can place this block can be placed on that side of a block: BlockLever overrides
*/
@@ -887,6 +942,24 @@
return this.maxZ;
}
+ @SideOnly(Side.CLIENT)
+ public int o()
+ {
+ return 16777215;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int g_(int var1)
+ {
+ return 16777215;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int b(IBlockAccess var1, int var2, int var3, int var4)
+ {
+ return 16777215;
+ }
+
/**
* Is this block powering the block on the specified side
*/
@@ -930,7 +1003,7 @@
var2.a(StatisticList.C[this.id], 1);
var2.j(0.025F);
- if (this.s_() && EnchantmentManager.hasSilkTouchEnchantment(var2))
+ if (this.canSilkHarvest(var1, var2, var3, var4, var5, var6) && EnchantmentManager.hasSilkTouchEnchantment(var2))
{
ItemStack var8 = this.f_(var6);
@@ -1046,16 +1119,34 @@
return this.material.getPushReaction();
}
+ @SideOnly(Side.CLIENT)
+ public float j(IBlockAccess var1, int var2, int var3, int var4)
+ {
+ return var1.s(var2, var3, var4) ? 0.2F : 1.0F;
+ }
+
/**
* Block's chance to react to an entity falling on it.
*/
public void a(World var1, int var2, int var3, int var4, Entity var5, float var6) {}
+ @SideOnly(Side.CLIENT)
+ public int a(World var1, int var2, int var3, int var4)
+ {
+ return this.id;
+ }
+
public int func_71873_h(World var1, int var2, int var3, int var4)
{
return this.getDropData(var1.getData(var2, var3, var4));
}
+ @SideOnly(Side.CLIENT)
+ public void a(int var1, CreativeModeTab var2, List var3)
+ {
+ var3.add(new ItemStack(var1, 1, 0));
+ }
+
/**
* sets the CreativeTab to display this block on
*/
@@ -1070,6 +1161,12 @@
*/
public void a(World var1, int var2, int var3, int var4, int var5, EntityHuman var6) {}
+ @SideOnly(Side.CLIENT)
+ public CreativeModeTab E()
+ {
+ return this.creativeTab;
+ }
+
/**
* Called when this block is set (with meta data).
*/
@@ -1080,11 +1177,340 @@
*/
public void f(World var1, int var2, int var3, int var4) {}
+ @SideOnly(Side.CLIENT)
+ public boolean u_()
+ {
+ return false;
+ }
+
public boolean func_82506_l()
{
return true;
}
+ public int getLightValue(IBlockAccess var1, int var2, int var3, int var4)
+ {
+ return lightEmission[this.id];
+ }
+
+ public boolean isLadder(World var1, int var2, int var3, int var4)
+ {
+ return false;
+ }
+
+ public boolean isBlockNormalCube(World var1, int var2, int var3, int var4)
+ {
+ return this.material.k() && this.b();
+ }
+
+ public boolean isBlockSolidOnSide(World var1, int var2, int var3, int var4, ForgeDirection var5)
+ {
+ int var6 = var1.getData(var2, var3, var4);
+
+ if (this instanceof BlockStepAbstract)
+ {
+ return (var6 & 8) == 8 && var5 == ForgeDirection.UP || this.c();
+ }
+ else if (this instanceof BlockSoil)
+ {
+ return var5 != ForgeDirection.DOWN && var5 != ForgeDirection.UP;
+ }
+ else if (this instanceof BlockStairs)
+ {
+ boolean var7 = (var6 & 4) != 0;
+ return (var6 & 3) + var5.ordinal() == 5 || var5 == ForgeDirection.UP && var7;
+ }
+ else
+ {
+ return this.isBlockNormalCube(var1, var2, var3, var4);
+ }
+ }
+
+ public boolean isBlockReplaceable(World var1, int var2, int var3, int var4)
+ {
+ return false;
+ }
+
+ public boolean isBlockBurning(World var1, int var2, int var3, int var4)
+ {
+ return false;
+ }
+
+ public boolean isAirBlock(World var1, int var2, int var3, int var4)
+ {
+ return false;
+ }
+
+ public boolean canHarvestBlock(EntityHuman var1, int var2)
+ {
+ return ForgeHooks.canHarvestBlock(this, var1, var2);
+ }
+
+ public boolean removeBlockByPlayer(World var1, EntityHuman var2, int var3, int var4, int var5)
+ {
+ return var1.setTypeId(var3, var4, var5, 0);
+ }
+
+ public void addCreativeItems(ArrayList var1) {}
+
+ public int getFlammability(IBlockAccess var1, int var2, int var3, int var4, int var5, ForgeDirection var6)
+ {
+ return blockFlammability[this.id];
+ }
+
+ public boolean isFlammable(IBlockAccess var1, int var2, int var3, int var4, int var5, ForgeDirection var6)
+ {
+ return this.getFlammability(var1, var2, var3, var4, var5, var6) > 0;
+ }
+
+ public int getFireSpreadSpeed(World var1, int var2, int var3, int var4, int var5, ForgeDirection var6)
+ {
+ return blockFireSpreadSpeed[this.id];
+ }
+
+ public boolean isFireSource(World var1, int var2, int var3, int var4, int var5, ForgeDirection var6)
+ {
+ return this.id == NETHERRACK.id && var6 == ForgeDirection.UP ? true : var1.worldProvider instanceof WorldProviderTheEnd && this.id == BEDROCK.id && var6 == ForgeDirection.UP;
+ }
+
+ public static void setBurnProperties(int var0, int var1, int var2)
+ {
+ blockFireSpreadSpeed[var0] = var1;
+ blockFlammability[var0] = var2;
+ }
+
+ public boolean hasTileEntity(int var1)
+ {
+ return this.isTileEntity;
+ }
+
+ public TileEntity createTileEntity(World var1, int var2)
+ {
+ return this instanceof BlockContainer ? ((BlockContainer)this).createNewTileEntity(var1, var2) : null;
+ }
+
+ public int quantityDropped(int var1, int var2, Random var3)
+ {
+ return this.getDropCount(var2, var3);
+ }
+
+ public ArrayList getBlockDropped(World var1, int var2, int var3, int var4, int var5, int var6)
+ {
+ ArrayList var7 = new ArrayList();
+ int var8 = this.quantityDropped(var5, var6, var1.random);
+
+ for (int var9 = 0; var9 < var8; ++var9)
+ {
+ int var10 = this.getDropType(var5, var1.random, 0);
+
+ if (var10 > 0)
+ {
+ var7.add(new ItemStack(var10, 1, this.getDropData(var5)));
+ }
+ }
+
+ return var7;
+ }
+
+ public boolean canSilkHarvest(World var1, EntityHuman var2, int var3, int var4, int var5, int var6)
+ {
+ return !(this instanceof BlockGlass) && !(this instanceof BlockEnderChest) ? this.b() && !this.hasTileEntity(var6) : true;
+ }
+
+ public boolean canCreatureSpawn(EnumCreatureType var1, World var2, int var3, int var4, int var5)
+ {
+ int var6 = var2.getData(var3, var4, var5);
+ return this instanceof BlockStep ? (!MinecraftForge.SPAWNER_ALLOW_ON_INVERTED ? i(this.id) : (var6 & 8) == 8 || this.c()) : (this instanceof BlockStairs ? (MinecraftForge.SPAWNER_ALLOW_ON_INVERTED ? (var6 & 4) != 0 : i(this.id)) : this.isBlockSolidOnSide(var2, var3, var4, var5, ForgeDirection.UP));
+ }
+
+ public boolean isBed(World var1, int var2, int var3, int var4, EntityLiving var5)
+ {
+ return this.id == BED.id;
+ }
+
+ public ChunkCoordinates getBedSpawnPosition(World var1, int var2, int var3, int var4, EntityHuman var5)
+ {
+ return BlockBed.b(var1, var2, var3, var4, 0);
+ }
+
+ public void setBedOccupied(World var1, int var2, int var3, int var4, EntityHuman var5, boolean var6)
+ {
+ BlockBed.a(var1, var2, var3, var4, var6);
+ }
+
+ public int getBedDirection(IBlockAccess var1, int var2, int var3, int var4)
+ {
+ return BlockBed.e(var1.getData(var2, var3, var4));
+ }
+
+ public boolean isBedFoot(IBlockAccess var1, int var2, int var3, int var4)
+ {
+ return BlockBed.b_(var1.getData(var2, var3, var4));
+ }
+
+ public void beginLeavesDecay(World var1, int var2, int var3, int var4) {}
+
+ public boolean canSustainLeaves(World var1, int var2, int var3, int var4)
+ {
+ return false;
+ }
+
+ public boolean isLeaves(World var1, int var2, int var3, int var4)
+ {
+ return false;
+ }
+
+ public boolean canBeReplacedByLeaves(World var1, int var2, int var3, int var4)
+ {
+ return !q[this.id];
+ }
+
+ public boolean isWood(World var1, int var2, int var3, int var4)
+ {
+ return false;
+ }
+
+ public boolean isGenMineableReplaceable(World var1, int var2, int var3, int var4)
+ {
+ return this.id == STONE.id;
+ }
+
+ public String getTextureFile()
+ {
+ return this.currentTexture;
+ }
+
+ public void setTextureFile(String var1)
+ {
+ this.currentTexture = var1;
+ this.isDefaultTexture = false;
+ }
+
+ public float getExplosionResistance(Entity var1, World var2, int var3, int var4, int var5, double var6, double var8, double var10)
+ {
+ return this.a(var1);
+ }
+
+ public boolean canConnectRedstone(IBlockAccess var1, int var2, int var3, int var4, int var5)
+ {
+ return byId[this.id].isPowerSource() && var5 != -1;
+ }
+
+ public boolean canPlaceTorchOnTop(World var1, int var2, int var3, int var4)
+ {
+ if (var1.t(var2, var3, var4))
+ {
+ return true;
+ }
+ else
+ {
+ int var5 = var1.getTypeId(var2, var3, var4);
+ return var5 == FENCE.id || var5 == NETHER_FENCE.id || var5 == GLASS.id || var5 == COBBLE_WALL.id;
+ }
+ }
+
+ public boolean canRenderInPass(int var1)
+ {
+ return var1 == this.n();
+ }
+
+ public ItemStack getPickBlock(MovingObjectPosition var1, World var2, int var3, int var4, int var5)
+ {
+ int var6 = this.a(var2, var3, var4, var5);
+
+ if (var6 == 0)
+ {
+ return null;
+ }
+ else
+ {
+ Item var7 = Item.byId[var6];
+ return var7 == null ? null : new ItemStack(var6, 1, this.func_71873_h(var2, var3, var4, var5));
+ }
+ }
+
+ public boolean isBlockFoliage(World var1, int var2, int var3, int var4)
+ {
+ return false;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public boolean addBlockHitEffects(World var1, MovingObjectPosition var2, axx var3)
+ {
+ return false;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public boolean addBlockDestroyEffects(World var1, int var2, int var3, int var4, int var5, axx var6)
+ {
+ return false;
+ }
+
+ public boolean canSustainPlant(World var1, int var2, int var3, int var4, ForgeDirection var5, IPlantable var6)
+ {
+ int var7 = var6.getPlantID(var1, var2, var3 + 1, var4);
+ EnumPlantType var8 = var6.getPlantType(var1, var2, var3 + 1, var4);
+
+ if (var7 == CACTUS.id && this.id == CACTUS.id)
+ {
+ return true;
+ }
+ else if (var7 == SUGAR_CANE_BLOCK.id && this.id == SUGAR_CANE_BLOCK.id)
+ {
+ return true;
+ }
+ else if (var6 instanceof BlockFlower && ((BlockFlower)var6).d_(this.id))
+ {
+ return true;
+ }
+ else
+ {
+ switch (Block$1.$SwitchMap$net$minecraftforge$common$EnumPlantType[var8.ordinal()])
+ {
+ case 1:
+ return this.id == SAND.id;
+
+ case 2:
+ return this.id == SOUL_SAND.id;
+
+ case 3:
+ return this.id == SOIL.id;
+
+ case 4:
+ return this.isBlockSolidOnSide(var1, var2, var3, var4, ForgeDirection.UP);
+
+ case 5:
+ return this.id == GRASS.id || this.id == DIRT.id;
+
+ case 6:
+ return var1.getMaterial(var2, var3, var4) == Material.WATER && var1.getData(var2, var3, var4) == 0;
+
+ case 7:
+ boolean var9 = this.id == GRASS.id || this.id == DIRT.id || this.id == SAND.id;
+ boolean var10 = var1.getMaterial(var2 - 1, var3 - 1, var4) == Material.WATER || var1.getMaterial(var2 + 1, var3 - 1, var4) == Material.WATER || var1.getMaterial(var2, var3 - 1, var4 - 1) == Material.WATER || var1.getMaterial(var2, var3 - 1, var4 + 1) == Material.WATER;
+ return var9 && var10;
+
+ default:
+ return false;
+ }
+ }
+ }
+
+ public boolean isFertile(World var1, int var2, int var3, int var4)
+ {
+ return this.id == SOIL.id ? var1.getData(var2, var3, var4) > 0 : false;
+ }
+
+ public int getLightOpacity(World var1, int var2, int var3, int var4)
+ {
+ return lightBlock[this.id];
+ }
+
+ public boolean canDragonDestroy(World var1, int var2, int var3, int var4)
+ {
+ return this.id != OBSIDIAN.id && this.id != WHITESTONE.id && this.id != BEDROCK.id;
+ }
+
static
{
Item.byId[WOOL.id] = (new ItemCloth(WOOL.id - 256)).b("cloth");
Index: BlockButton.java
===================================================================
--- BlockButton.java (revision 3)
+++ BlockButton.java (working copy)
@@ -2,6 +2,7 @@
import java.util.List;
import java.util.Random;
+import net.minecraftforge.common.ForgeDirection;
public class BlockButton extends Block
{
@@ -55,7 +56,8 @@
*/
public boolean canPlace(World var1, int var2, int var3, int var4, int var5)
{
- return var5 == 2 && var1.s(var2, var3, var4 + 1) ? true : (var5 == 3 && var1.s(var2, var3, var4 - 1) ? true : (var5 == 4 && var1.s(var2 + 1, var3, var4) ? true : var5 == 5 && var1.s(var2 - 1, var3, var4)));
+ ForgeDirection var6 = ForgeDirection.getOrientation(var5);
+ return var6 == ForgeDirection.NORTH && var1.isBlockSolidOnSide(var2, var3, var4 + 1, ForgeDirection.NORTH) || var6 == ForgeDirection.SOUTH && var1.isBlockSolidOnSide(var2, var3, var4 - 1, ForgeDirection.SOUTH) || var6 == ForgeDirection.WEST && var1.isBlockSolidOnSide(var2 + 1, var3, var4, ForgeDirection.WEST) || var6 == ForgeDirection.EAST && var1.isBlockSolidOnSide(var2 - 1, var3, var4, ForgeDirection.EAST);
}
/**
@@ -63,7 +65,7 @@
*/
public boolean canPlace(World var1, int var2, int var3, int var4)
{
- return var1.s(var2 - 1, var3, var4) ? true : (var1.s(var2 + 1, var3, var4) ? true : (var1.s(var2, var3, var4 - 1) ? true : var1.s(var2, var3, var4 + 1)));
+ return var1.isBlockSolidOnSide(var2 - 1, var3, var4, ForgeDirection.EAST) || var1.isBlockSolidOnSide(var2 + 1, var3, var4, ForgeDirection.WEST) || var1.isBlockSolidOnSide(var2, var3, var4 - 1, ForgeDirection.SOUTH) || var1.isBlockSolidOnSide(var2, var3, var4 + 1, ForgeDirection.NORTH);
}
/**
@@ -74,20 +76,21 @@
int var9 = var1.getData(var2, var3, var4);
int var10 = var9 & 8;
var9 &= 7;
+ ForgeDirection var11 = ForgeDirection.getOrientation(var5);
- if (var5 == 2 && var1.s(var2, var3, var4 + 1))
+ if (var11 == ForgeDirection.NORTH && var1.isBlockSolidOnSide(var2, var3, var4 + 1, ForgeDirection.NORTH))
{
var9 = 4;
}
- else if (var5 == 3 && var1.s(var2, var3, var4 - 1))
+ else if (var11 == ForgeDirection.SOUTH && var1.isBlockSolidOnSide(var2, var3, var4 - 1, ForgeDirection.SOUTH))
{
var9 = 3;
}
- else if (var5 == 4 && var1.s(var2 + 1, var3, var4))
+ else if (var11 == ForgeDirection.WEST && var1.isBlockSolidOnSide(var2 + 1, var3, var4, ForgeDirection.WEST))
{
var9 = 2;
}
- else if (var5 == 5 && var1.s(var2 - 1, var3, var4))
+ else if (var11 == ForgeDirection.EAST && var1.isBlockSolidOnSide(var2 - 1, var3, var4, ForgeDirection.EAST))
{
var9 = 1;
}
@@ -104,7 +107,7 @@
*/
private int l(World var1, int var2, int var3, int var4)
{
- return var1.s(var2 - 1, var3, var4) ? 1 : (var1.s(var2 + 1, var3, var4) ? 2 : (var1.s(var2, var3, var4 - 1) ? 3 : (var1.s(var2, var3, var4 + 1) ? 4 : 1)));
+ return var1.isBlockSolidOnSide(var2 - 1, var3, var4, ForgeDirection.EAST) ? 1 : (var1.isBlockSolidOnSide(var2 + 1, var3, var4, ForgeDirection.WEST) ? 2 : (var1.isBlockSolidOnSide(var2, var3, var4 - 1, ForgeDirection.SOUTH) ? 3 : (var1.isBlockSolidOnSide(var2, var3, var4 + 1, ForgeDirection.NORTH) ? 4 : 1)));
}
/**
@@ -118,22 +121,22 @@
int var6 = var1.getData(var2, var3, var4) & 7;
boolean var7 = false;
- if (!var1.s(var2 - 1, var3, var4) && var6 == 1)
+ if (!var1.isBlockSolidOnSide(var2 - 1, var3, var4, ForgeDirection.EAST) && var6 == 1)
{
var7 = true;
}
- if (!var1.s(var2 + 1, var3, var4) && var6 == 2)
+ if (!var1.isBlockSolidOnSide(var2 + 1, var3, var4, ForgeDirection.WEST) && var6 == 2)
{
var7 = true;
}
- if (!var1.s(var2, var3, var4 - 1) && var6 == 3)
+ if (!var1.isBlockSolidOnSide(var2, var3, var4 - 1, ForgeDirection.SOUTH) && var6 == 3)
{
var7 = true;
}
- if (!var1.s(var2, var3, var4 + 1) && var6 == 4)
+ if (!var1.isBlockSolidOnSide(var2, var3, var4 + 1, ForgeDirection.NORTH) && var6 == 4)
{
var7 = true;
}
@@ -324,17 +327,11 @@
*/
public void a(World var1, int var2, int var3, int var4, Entity var5)
{
- if (!var1.isStatic)
+ if (!var1.isStatic && this.a && (var1.getData(var2, var3, var4) & 8) == 0)
{
- if (this.a)
- {
- if ((var1.getData(var2, var3, var4) & 8) == 0)
- {
this.func_82535_o(var1, var2, var3, var4);
}
}
- }
- }
private void func_82535_o(World var1, int var2, int var3, int var4)
{
@@ -342,10 +339,10 @@
int var6 = var5 & 7;
boolean var7 = (var5 & 8) != 0;
this.func_82534_e(var5);
- List var9 = var1.a(EntityArrow.class, AxisAlignedBB.a().a((double)var2 + this.minX, (double)var3 + this.minY, (double)var4 + this.minZ, (double)var2 + this.maxX, (double)var3 + this.maxY, (double)var4 + this.maxZ));
- boolean var8 = !var9.isEmpty();
+ List var8 = var1.a(EntityArrow.class, AxisAlignedBB.a().a((double)var2 + this.minX, (double)var3 + this.minY, (double)var4 + this.minZ, (double)var2 + this.maxX, (double)var3 + this.maxY, (double)var4 + this.maxZ));
+ boolean var9 = !var8.isEmpty();
- if (var8 && !var7)
+ if (var9 && !var7)
{
var1.setData(var2, var3, var4, var6 | 8);
this.func_82536_d(var1, var2, var3, var4, var6);
@@ -353,7 +350,7 @@
var1.makeSound((double)var2 + 0.5D, (double)var3 + 0.5D, (double)var4 + 0.5D, "random.click", 0.3F, 0.6F);
}
- if (!var8 && var7)
+ if (!var9 && var7)
{
var1.setData(var2, var3, var4, var6);
this.func_82536_d(var1, var2, var3, var4, var6);
@@ -361,7 +358,7 @@
var1.makeSound((double)var2 + 0.5D, (double)var3 + 0.5D, (double)var4 + 0.5D, "random.click", 0.3F, 0.5F);
}
- if (var8)
+ if (var9)
{
var1.a(var2, var3, var4, this.id, this.r_());
}
Index: BlockCactus.java
===================================================================
--- BlockCactus.java (revision 3)
+++ BlockCactus.java (working copy)
@@ -1,8 +1,13 @@
package net.minecraft.server;
+import cpw.mods.fml.common.Side;
+import cpw.mods.fml.common.asm.SideOnly;
import java.util.Random;
+import net.minecraftforge.common.EnumPlantType;
+import net.minecraftforge.common.ForgeDirection;
+import net.minecraftforge.common.IPlantable;
-public class BlockCactus extends Block
+public class BlockCactus extends Block implements IPlantable
{
protected BlockCactus(int var1, int var2)
{
@@ -52,6 +57,13 @@
return AxisAlignedBB.a().a((double)((float)var2 + var5), (double)var3, (double)((float)var4 + var5), (double)((float)(var2 + 1) - var5), (double)((float)(var3 + 1) - var5), (double)((float)(var4 + 1) - var5));
}
+ @SideOnly(Side.CLIENT)
+ public AxisAlignedBB b_(World var1, int var2, int var3, int var4)
+ {
+ float var5 = 0.0625F;
+ return AxisAlignedBB.a().a((double)((float)var2 + var5), (double)var3, (double)((float)var4 + var5), (double)((float)(var2 + 1) - var5), (double)(var3 + 1), (double)((float)(var4 + 1) - var5));
+ }
+
/**
* Returns the block texture based on the side being looked at. Args: side
*/
@@ -130,7 +142,7 @@
else
{
int var5 = var1.getTypeId(var2, var3 - 1, var4);
- return var5 == Block.CACTUS.id || var5 == Block.SAND.id;
+ return byId[var5] != null && byId[var5].canSustainPlant(var1, var2, var3 - 1, var4, ForgeDirection.UP, this);
}
}
@@ -141,4 +153,19 @@
{
var5.damageEntity(DamageSource.CACTUS, 1);
}
+
+ public EnumPlantType getPlantType(World var1, int var2, int var3, int var4)
+ {
+ return EnumPlantType.Desert;
}
+
+ public int getPlantID(World var1, int var2, int var3, int var4)
+ {
+ return this.id;
+ }
+
+ public int getPlantMetadata(World var1, int var2, int var3, int var4)
+ {
+ return -1;
+ }
+}
Index: BlockCrops.java
===================================================================
--- BlockCrops.java (revision 3)
+++ BlockCrops.java (working copy)
@@ -1,6 +1,10 @@
package net.minecraft.server;
+import cpw.mods.fml.common.Side;
+import cpw.mods.fml.common.asm.SideOnly;
+import java.util.ArrayList;
import java.util.Random;
+import net.minecraftforge.common.ForgeDirection;
public class BlockCrops extends BlockFlower
{
@@ -86,11 +90,11 @@
int var19 = var1.getTypeId(var17, var3 - 1, var18);
float var20 = 0.0F;
- if (var19 == Block.SOIL.id)
+ if (byId[var19] != null && byId[var19].canSustainPlant(var1, var17, var3 - 1, var18, ForgeDirection.UP, this))
{
var20 = 1.0F;
- if (var1.getData(var17, var3 - 1, var18) > 0)
+ if (byId[var19].isFertile(var1, var17, var3 - 1, var18))
{
var20 = 3.0F;
}
@@ -156,24 +160,42 @@
public void dropNaturally(World var1, int var2, int var3, int var4, int var5, float var6, int var7)
{
super.dropNaturally(var1, var2, var3, var4, var5, var6, 0);
+ }
- if (!var1.isStatic)
+ public ArrayList getBlockDropped(World var1, int var2, int var3, int var4, int var5, int var6)
{
- if (var5 >= 7)
+ ArrayList var7 = new ArrayList();
+ int var8;
+
+ if (var5 == 7)
{
- int var8 = 3 + var7;
+ var8 = this.quantityDropped(var5, var6, var1.random);
for (int var9 = 0; var9 < var8; ++var9)
{
- if (var1.random.nextInt(15) <= var5)
+ int var10 = this.getDropType(var5, var1.random, 0);
+
+ if (var10 > 0)
{
- this.a(var1, var2, var3, var4, new ItemStack(this.h(), 1, 0));
+ var7.add(new ItemStack(var10, 1, this.getDropData(var5)));
}
}
}
+
+ if (var5 >= 7)
+ {
+ for (var8 = 0; var8 < 3 + var6; ++var8)
+ {
+ if (var1.random.nextInt(15) <= var5)
+ {
+ var7.add(new ItemStack(this.h(), 1, 0));
}
}
+ }
+ return var7;
+ }
+
/**
* Returns the ID of the items to drop on destruction.
*/
@@ -189,4 +211,10 @@
{
return 1;
}
+
+ @SideOnly(Side.CLIENT)
+ public int a(World var1, int var2, int var3, int var4)
+ {
+ return this.h();
}
+}
Index: BlockDispenser.java
===================================================================
--- BlockDispenser.java (revision 3)
+++ BlockDispenser.java (working copy)
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import cpw.mods.fml.common.Side;
+import cpw.mods.fml.common.asm.SideOnly;
import java.util.Random;
public class BlockDispenser extends BlockContainer
@@ -78,6 +80,24 @@
}
}
+ @SideOnly(Side.CLIENT)
+ public int d(IBlockAccess var1, int var2, int var3, int var4, int var5)
+ {
+ if (var5 == 1)