4
4
import net .minecraft .client .renderer .RenderBlocks ;
5
5
import net .minecraft .util .IIcon ;
6
6
import net .minecraft .world .IBlockAccess ;
7
+ import lordfokas .stargatetech2 .ModuleTransport ;
8
+ import lordfokas .stargatetech2 .core .IconRegistry ;
7
9
import lordfokas .stargatetech2 .core .base .BaseISBRH ;
8
10
9
11
public class RenderBeacon extends BaseISBRH {
@@ -20,9 +22,13 @@ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b
20
22
boolean handled = true ;
21
23
beacon .setBlockBounds (0.25f , 0.25f , 0.25f , 0.75f , 0.75f , 0.75f );
22
24
if (meta == BlockBeacon .META_TRANSCEIVER ){
23
- renderWorldBase (beacon , renderer , x , y , z );
25
+ renderWorldTransceiver (beacon , renderer , x , y , z );
24
26
}else if (meta == BlockBeacon .META_ANTENNA ){
25
- renderWorldPole (beacon , renderer , x , y , z );
27
+ renderWorldAntenna (beacon , renderer , x , y , z );
28
+ }else if (meta == BlockBeacon .META_CONSOLE ){
29
+ renderWorldConsole (beacon , renderer , x , y , z );
30
+ }else if (meta == BlockBeacon .META_MATTERGRID ){
31
+ renderWorldMatterGrid (beacon , renderer , x , y , z , world );
26
32
}else handled = false ;
27
33
beacon .setBlockBounds (0 , 0 , 0 , 1 , 1 , 1 );
28
34
return handled ;
@@ -32,13 +38,13 @@ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b
32
38
public void renderInventoryBlock (Block block , int meta , int modelID , RenderBlocks renderer ){
33
39
BlockBeacon beacon = (BlockBeacon ) block ;
34
40
if (meta == BlockBeacon .META_TRANSCEIVER ){
35
- renderItemBase (renderer , beacon );
41
+ renderItemTransceiver (renderer , beacon );
36
42
}else if (meta == BlockBeacon .META_ANTENNA ){
37
- renderItemPole (renderer , beacon );
38
- };
43
+ renderItemAntenna (renderer , beacon );
44
+ }else super . renderInventoryBlock ( block , meta , modelID , renderer ) ;
39
45
}
40
46
41
- private void renderWorldBase (BlockBeacon beacon , RenderBlocks renderer , int x , int y , int z ){
47
+ private void renderWorldTransceiver (BlockBeacon beacon , RenderBlocks renderer , int x , int y , int z ){
42
48
IIcon base = beacon .getBaseIcon (0 , 0 );
43
49
IIcon top = beacon .getBaseIcon (1 , 0 );
44
50
IIcon side = beacon .getBaseIcon (2 , 0 );
@@ -53,7 +59,7 @@ private void renderWorldBase(BlockBeacon beacon, RenderBlocks renderer, int x, i
53
59
beacon .restoreTextures ();
54
60
}
55
61
56
- private void renderItemBase (RenderBlocks renderer , BlockBeacon beacon ){
62
+ private void renderItemTransceiver (RenderBlocks renderer , BlockBeacon beacon ){
57
63
IIcon base = beacon .getBaseIcon (0 , 0 );
58
64
IIcon top = beacon .getBaseIcon (1 , 0 );
59
65
IIcon side = beacon .getBaseIcon (2 , 0 );
@@ -72,14 +78,14 @@ private void renderItemBase(RenderBlocks renderer, BlockBeacon beacon){
72
78
beacon .restoreTextures ();
73
79
}
74
80
75
- private void renderWorldPole (BlockBeacon beacon , RenderBlocks renderer , int x , int y , int z ){
81
+ private void renderWorldAntenna (BlockBeacon beacon , RenderBlocks renderer , int x , int y , int z ){
76
82
renderWorldCuboidWithBounds (beacon , renderer , x , y , z , F03 , 0 , F03 , F06 , 1 , F06 );
77
83
renderWorldCuboidWithBounds (beacon , renderer , x , y , z , F10 , 0 , F03 , F13 , 1 , F06 );
78
84
renderWorldCuboidWithBounds (beacon , renderer , x , y , z , F03 , 0 , F10 , F06 , 1 , F13 );
79
85
renderWorldCuboidWithBounds (beacon , renderer , x , y , z , F10 , 0 , F10 , F13 , 1 , F13 );
80
86
}
81
87
82
- private void renderItemPole (RenderBlocks renderer , BlockBeacon beacon ){
88
+ private void renderItemAntenna (RenderBlocks renderer , BlockBeacon beacon ){
83
89
renderer .setRenderBounds (F03 , 0 , F03 , F06 , 1 , F06 );
84
90
renderInventoryCuboid (beacon , BlockBeacon .META_ANTENNA , renderer , false );
85
91
renderer .setRenderBounds (F10 , 0 , F03 , F13 , 1 , F06 );
@@ -89,4 +95,43 @@ private void renderItemPole(RenderBlocks renderer, BlockBeacon beacon){
89
95
renderer .setRenderBounds (F10 , 0 , F10 , F13 , 1 , F13 );
90
96
renderInventoryCuboid (beacon , BlockBeacon .META_ANTENNA , renderer , false );
91
97
}
98
+
99
+ private void renderWorldConsole (BlockBeacon beacon , RenderBlocks renderer , int x , int y , int z ){
100
+ renderWorldCuboidWithBounds (beacon , renderer , x , y , z , 0 , 0 , 0 , 1 , F02 , 1 );
101
+ renderWorldCuboidWithBounds (beacon , renderer , x , y , z , 0 , F14 , 0 , 1 , 1 , 1 );
102
+ renderWorldCuboidWithBounds (beacon , renderer , x , y , z , 0 , F02 , 0 , F02 , F14 , F02 );
103
+ renderWorldCuboidWithBounds (beacon , renderer , x , y , z , F14 , F02 , 0 , 1 , F14 , F02 );
104
+ renderWorldCuboidWithBounds (beacon , renderer , x , y , z , 0 , F02 , F14 , F02 , F14 , 1 );
105
+ renderWorldCuboidWithBounds (beacon , renderer , x , y , z , F14 , F02 , F14 , 1 , F14 , 1 );
106
+ renderWorldCuboidWithBounds (beacon , renderer , x , y , z , F01 , F01 , F01 , F15 , F15 , F15 );
107
+ }
108
+
109
+ private void renderWorldMatterGrid (BlockBeacon beacon , RenderBlocks renderer , int x , int y , int z , IBlockAccess world ){
110
+ boolean top , bottom , left , right , topleft , topright , bottomleft , bottomright ;
111
+ top = isMatterGrid (world , x , y , z +1 );
112
+ bottom = isMatterGrid (world , x , y , z -1 );
113
+ right = isMatterGrid (world , x +1 , y , z );
114
+ left = isMatterGrid (world , x -1 , y , z );
115
+ topright = isMatterGrid (world , x +1 , y , z +1 );
116
+ topleft = isMatterGrid (world , x -1 , y , z +1 );
117
+ bottomright = isMatterGrid (world , x +1 , y , z -1 );
118
+ bottomleft = isMatterGrid (world , x -1 , y , z -1 );
119
+
120
+ renderWorldCuboidWithBounds (beacon , renderer , x , y , z , 0 , 0 , 0 , 1 , F15 , 1 );
121
+
122
+ if (!top ) renderWorldCuboidWithBounds (beacon , renderer , x , y , z , F01 , F15 , F15 , F15 , 1 , 1 );
123
+ if (!bottom ) renderWorldCuboidWithBounds (beacon , renderer , x , y , z , F01 , F15 , 0 , F15 , 1 , F01 );
124
+ if (!right ) renderWorldCuboidWithBounds (beacon , renderer , x , y , z , F15 , F15 , F01 , 1 , 1 , F15 );
125
+ if (!left ) renderWorldCuboidWithBounds (beacon , renderer , x , y , z , 0 , F15 , F01 , F01 , 1 , F15 );
126
+ if (!(top && right && topright )) renderWorldCuboidWithBounds (beacon , renderer , x , y , z , F15 , F15 , F15 , 1 , 1 , 1 );
127
+ if (!(top && left && topleft )) renderWorldCuboidWithBounds (beacon , renderer , x , y , z , 0 , F15 , F15 , F01 , 1 , 1 );
128
+ if (!(bottom && right && bottomright )) renderWorldCuboidWithBounds (beacon , renderer , x , y , z , F15 , F15 , 0 , 1 , 1 , F01 );
129
+ if (!(bottom && left && bottomleft )) renderWorldCuboidWithBounds (beacon , renderer , x , y , z , 0 , F15 , 0 , F01 , 1 , F01 );
130
+ }
131
+
132
+ private boolean isMatterGrid (IBlockAccess world , int x , int y , int z ){
133
+ boolean beacon = world .getBlock (x , y , z ) == ModuleTransport .beacon ;
134
+ boolean meta = world .getBlockMetadata (x , y , z ) == BlockBeacon .META_MATTERGRID ;
135
+ return beacon && meta ;
136
+ }
92
137
}
0 commit comments