diff --git a/assets/hbm/models/forcefield_top.obj b/assets/hbm/models/forcefield_top.obj new file mode 100644 index 000000000..ddffe1a43 --- /dev/null +++ b/assets/hbm/models/forcefield_top.obj @@ -0,0 +1,550 @@ +# Blender v2.76 (sub 0) OBJ File: 'forcefield_top.blend' +# www.blender.org +o Torus.001 +v 0.750000 0.750000 0.000000 +v 0.676777 0.926777 0.000000 +v 0.500000 1.000000 0.000000 +v 0.323223 0.926777 0.000000 +v 0.323223 0.573223 0.000000 +v 0.500000 0.500000 0.000000 +v 0.676777 0.573223 0.000000 +v 0.649519 0.750000 -0.375000 +v 0.586106 0.926777 -0.338388 +v 0.433013 1.000000 -0.250000 +v 0.279920 0.926777 -0.161612 +v 0.279920 0.573223 -0.161612 +v 0.433013 0.500000 -0.250000 +v 0.586106 0.573223 -0.338388 +v 0.375000 0.750000 -0.649519 +v 0.338388 0.926777 -0.586106 +v 0.250000 1.000000 -0.433013 +v 0.161612 0.926777 -0.279920 +v 0.161612 0.573223 -0.279920 +v 0.250000 0.500000 -0.433013 +v 0.338388 0.573223 -0.586106 +v 0.000000 0.750000 -0.750000 +v 0.000000 0.926777 -0.676777 +v 0.000000 1.000000 -0.500000 +v 0.000000 0.926777 -0.323223 +v 0.000000 0.573223 -0.323223 +v 0.000000 0.500000 -0.500000 +v 0.000000 0.573223 -0.676777 +v -0.375000 0.750000 -0.649519 +v -0.338388 0.926777 -0.586106 +v -0.250000 1.000000 -0.433013 +v -0.161612 0.926777 -0.279920 +v -0.161612 0.573223 -0.279920 +v -0.250000 0.500000 -0.433013 +v -0.338388 0.573223 -0.586106 +v -0.649519 0.750000 -0.375000 +v -0.586106 0.926777 -0.338389 +v -0.433013 1.000000 -0.250000 +v -0.279920 0.926777 -0.161612 +v -0.279920 0.573223 -0.161612 +v -0.433013 0.500000 -0.250000 +v -0.586106 0.573223 -0.338389 +v -0.750000 0.750000 -0.000000 +v -0.676777 0.926777 -0.000000 +v -0.500000 1.000000 -0.000000 +v -0.323223 0.926777 -0.000000 +v -0.323223 0.573223 -0.000000 +v -0.500000 0.500000 -0.000000 +v -0.676777 0.573223 -0.000000 +v -0.649519 0.750000 0.375000 +v -0.586106 0.926777 0.338388 +v -0.433013 1.000000 0.250000 +v -0.279920 0.926777 0.161612 +v -0.279920 0.573223 0.161612 +v -0.433013 0.500000 0.250000 +v -0.586106 0.573223 0.338388 +v -0.375000 0.750000 0.649519 +v -0.338388 0.926777 0.586106 +v -0.250000 1.000000 0.433013 +v -0.161612 0.926777 0.279920 +v -0.161612 0.573223 0.279920 +v -0.250000 0.500000 0.433013 +v -0.338388 0.573223 0.586106 +v 0.000000 0.750000 0.750000 +v 0.000000 0.926777 0.676777 +v 0.000000 1.000000 0.500000 +v 0.000000 0.926777 0.323223 +v 0.000000 0.573223 0.323223 +v 0.000000 0.500000 0.500000 +v 0.000000 0.573223 0.676777 +v 0.375000 0.750000 0.649519 +v 0.338388 0.926777 0.586106 +v 0.250000 1.000000 0.433013 +v 0.161612 0.926777 0.279920 +v 0.161612 0.573223 0.279920 +v 0.250000 0.500000 0.433013 +v 0.338388 0.573223 0.586106 +v 0.649519 0.750000 0.375000 +v 0.586106 0.926777 0.338388 +v 0.433013 1.000000 0.250000 +v 0.279920 0.926777 0.161612 +v 0.279920 0.573223 0.161612 +v 0.433013 0.500000 0.250000 +v 0.586106 0.573223 0.338388 +v 0.000000 0.500000 -0.400000 +v 0.000000 1.000000 -0.400000 +v 0.200000 0.500000 -0.346410 +v 0.200000 1.000000 -0.346410 +v 0.346410 0.500000 -0.200000 +v 0.346410 1.000000 -0.200000 +v 0.400000 0.500000 0.000000 +v 0.400000 1.000000 0.000000 +v 0.346410 0.500000 0.200000 +v 0.346410 1.000000 0.200000 +v 0.200000 0.500000 0.346410 +v 0.200000 1.000000 0.346410 +v 0.000000 0.500000 0.400000 +v 0.000000 1.000000 0.400000 +v -0.200000 0.500000 0.346410 +v -0.200000 1.000000 0.346410 +v -0.346410 0.500000 0.200000 +v -0.346410 1.000000 0.200000 +v -0.400000 0.500000 0.000000 +v -0.400000 1.000000 0.000000 +v -0.346410 0.500000 -0.200000 +v -0.346410 1.000000 -0.200000 +v -0.200000 0.500000 -0.346410 +v -0.200000 1.000000 -0.346410 +v 0.000000 0.000000 -0.150000 +v 0.000000 0.250000 -0.150000 +v 0.075000 0.000000 -0.129904 +v 0.075000 0.250000 -0.129904 +v 0.129904 0.000000 -0.075000 +v 0.129904 0.250000 -0.075000 +v 0.150000 0.000000 0.000000 +v 0.150000 0.250000 0.000000 +v 0.129904 0.000000 0.075000 +v 0.129904 0.250000 0.075000 +v 0.075000 0.000000 0.129904 +v 0.075000 0.250000 0.129904 +v 0.000000 0.000000 0.150000 +v 0.000000 0.250000 0.150000 +v -0.075000 0.000000 0.129904 +v -0.075000 0.250000 0.129904 +v -0.129904 0.000000 0.075000 +v -0.129904 0.250000 0.075000 +v -0.150000 0.000000 0.000000 +v -0.150000 0.250000 0.000000 +v -0.129904 0.000000 -0.075000 +v -0.129904 0.250000 -0.075000 +v -0.075000 0.000000 -0.129904 +v -0.075000 0.250000 -0.129904 +vt 0.982296 0.504931 +vt 0.975331 0.574904 +vt 0.846585 0.574904 +vt 0.958517 0.643183 +vt 0.863399 0.643183 +vt 0.941702 0.711463 +vt 0.941702 0.298399 +vt 0.958517 0.366678 +vt 0.863399 0.366678 +vt 0.975331 0.434957 +vt 0.846584 0.434957 +vt 0.880214 0.711463 +vt 0.880214 0.298399 +vt 0.839620 0.504931 +vt 0.982296 0.504955 +vt 0.941631 0.711473 +vt 0.880142 0.711452 +vt 0.941773 0.298409 +vt 0.958564 0.366695 +vt 0.975355 0.434980 +vt 0.846609 0.434935 +vt 0.248508 0.041427 +vt 0.324602 0.041427 +vt 0.324602 0.225179 +vt 0.400696 0.041427 +vt 0.400696 0.225179 +vt 0.476790 0.041427 +vt 0.476790 0.225179 +vt 0.552884 0.041427 +vt 0.552884 0.225179 +vt 0.628978 0.041427 +vt 0.628978 0.225179 +vt 0.705072 0.041427 +vt 0.705072 0.225179 +vt 0.781166 0.041427 +vt 0.781165 0.225179 +vt 0.857260 0.041427 +vt 0.857259 0.225179 +vt 0.933354 0.041427 +vt 0.933354 0.225179 +vt 0.020226 0.041426 +vt 0.096320 0.041426 +vt 0.096319 0.225179 +vt 0.418984 0.526312 +vt 0.599025 0.346272 +vt 0.664924 0.592211 +vt 0.172414 0.041427 +vt 0.248508 0.225179 +vt 0.172414 0.225179 +vt 0.308475 0.891594 +vt 0.279940 0.891594 +vt 0.279940 0.799717 +vt 0.251405 0.891594 +vt 0.251405 0.799717 +vt 0.222870 0.891594 +vt 0.222870 0.799717 +vt 0.194335 0.891594 +vt 0.194335 0.799717 +vt 0.925225 0.832706 +vt 0.949005 0.960445 +vt 0.872911 0.960445 +vt 0.165799 0.891594 +vt 0.165799 0.799717 +vt 0.137264 0.891594 +vt 0.137264 0.799717 +vt 0.896690 0.832706 +vt 0.108729 0.891594 +vt 0.108729 0.799717 +vt 0.080194 0.891594 +vt 0.080193 0.799717 +vt 0.051658 0.891594 +vt 0.051658 0.799717 +vt 0.394081 0.891594 +vt 0.365546 0.891594 +vt 0.365546 0.799717 +vt 0.513665 0.889725 +vt 0.591625 0.811765 +vt 0.605892 0.865012 +vt 0.337011 0.891594 +vt 0.308475 0.799717 +vt 0.337011 0.799717 +vt 0.880285 0.298388 +vt 0.020226 0.225179 +vt 0.599025 0.630258 +vt 0.522930 0.630258 +vt 0.457031 0.592211 +vt 0.418984 0.450218 +vt 0.457031 0.384319 +vt 0.522930 0.346272 +vt 0.664924 0.384319 +vt 0.702971 0.450218 +vt 0.702971 0.526312 +vt 0.394081 0.799717 +vt 0.591625 0.889725 +vt 0.566912 0.903992 +vt 0.538377 0.903992 +vt 0.499397 0.865012 +vt 0.499397 0.836477 +vt 0.513665 0.811765 +vt 0.538377 0.797497 +vt 0.566912 0.797497 +vt 0.605892 0.836477 +vn 0.896800 0.371500 -0.240300 +vn 0.380700 0.919100 -0.102000 +vn -0.380700 0.919100 0.102000 +vn -0.380700 -0.919100 0.102000 +vn 0.380700 -0.919100 -0.102000 +vn 0.896800 -0.371500 -0.240300 +vn 0.656500 0.371500 -0.656500 +vn 0.278700 0.919100 -0.278700 +vn -0.278700 0.919100 0.278700 +vn -0.278700 -0.919100 0.278700 +vn 0.278700 -0.919100 -0.278700 +vn 0.656500 -0.371500 -0.656500 +vn 0.240300 0.371500 -0.896800 +vn 0.102000 0.919100 -0.380700 +vn -0.102000 0.919100 0.380700 +vn -0.102000 -0.919100 0.380700 +vn 0.102000 -0.919100 -0.380700 +vn 0.240300 -0.371500 -0.896800 +vn -0.240300 0.371500 -0.896800 +vn -0.102000 0.919100 -0.380700 +vn 0.102000 0.919100 0.380700 +vn 0.102000 -0.919100 0.380700 +vn -0.102000 -0.919100 -0.380700 +vn -0.240300 -0.371500 -0.896800 +vn -0.656500 0.371500 -0.656500 +vn -0.278700 0.919100 -0.278700 +vn 0.278700 0.919100 0.278700 +vn 0.278700 -0.919100 0.278700 +vn -0.278700 -0.919100 -0.278700 +vn -0.656500 -0.371500 -0.656500 +vn -0.896800 0.371500 -0.240300 +vn -0.380700 0.919100 -0.102000 +vn 0.380700 0.919100 0.102000 +vn 0.380700 -0.919100 0.102000 +vn -0.380700 -0.919100 -0.102000 +vn -0.896800 -0.371500 -0.240300 +vn -0.896800 0.371500 0.240300 +vn -0.896800 -0.371500 0.240300 +vn -0.656500 0.371500 0.656500 +vn -0.656500 -0.371500 0.656500 +vn -0.240300 0.371500 0.896800 +vn -0.240300 -0.371500 0.896800 +vn 0.240300 0.371500 0.896800 +vn 0.240300 -0.371500 0.896800 +vn 0.656500 0.371500 0.656500 +vn 0.656500 -0.371500 0.656500 +vn 0.896800 0.371500 0.240300 +vn 0.896800 -0.371500 0.240300 +vn 0.258800 0.000000 -0.965900 +vn 0.707100 0.000000 -0.707100 +vn 0.965900 0.000000 -0.258800 +vn 0.965900 0.000000 0.258800 +vn 0.707100 0.000000 0.707100 +vn 0.258800 0.000000 0.965900 +vn -0.258800 0.000000 0.965900 +vn -0.707100 0.000000 0.707100 +vn -0.965900 0.000000 0.258800 +vn -0.965900 0.000000 -0.258800 +vn 0.000000 1.000000 -0.000000 +vn -0.258800 0.000000 -0.965900 +vn -0.707100 0.000000 -0.707100 +vn 0.000000 -1.000000 -0.000000 +vn -0.186200 -0.694700 -0.694700 +vn 0.508600 -0.694700 -0.508600 +vn 0.694700 -0.694700 0.186200 +vn 0.186200 -0.694700 0.694700 +vn -0.508600 -0.694700 0.508600 +vn -0.694700 -0.694700 -0.186200 +s off +f 8/1/1 9/2/1 2/3/1 +f 9/2/2 10/4/2 3/5/2 +f 3/5/3 10/4/3 11/6/3 +f 12/7/4 13/8/4 6/9/4 +f 13/8/5 14/10/5 7/11/5 +f 7/11/6 14/10/6 8/1/6 +f 15/1/7 16/2/7 9/3/7 +f 9/3/8 16/2/8 17/4/8 +f 17/4/9 18/6/9 11/12/9 +f 19/7/10 20/8/10 13/9/10 +f 20/8/11 21/10/11 14/11/11 +f 14/11/12 21/10/12 15/1/12 +f 22/1/13 23/2/13 16/3/13 +f 23/2/14 24/4/14 17/5/14 +f 17/5/15 24/4/15 25/6/15 +f 19/13/16 26/7/16 27/8/16 +f 20/9/17 27/8/17 28/10/17 +f 28/10/18 22/1/18 15/14/18 +f 29/1/19 30/2/19 23/3/19 +f 23/3/20 30/2/20 31/4/20 +f 31/4/21 32/6/21 25/12/21 +f 33/7/22 34/8/22 27/9/22 +f 34/8/23 35/10/23 28/11/23 +f 28/11/24 35/10/24 29/1/24 +f 29/14/25 36/1/25 37/2/25 +f 37/2/26 38/4/26 31/5/26 +f 38/4/27 39/6/27 32/12/27 +f 33/13/28 40/7/28 41/8/28 +f 41/8/29 42/10/29 35/11/29 +f 42/10/30 36/1/30 29/14/30 +f 36/14/31 43/1/31 44/2/31 +f 44/2/32 45/4/32 38/5/32 +f 45/4/33 46/6/33 39/12/33 +f 40/13/34 47/7/34 48/8/34 +f 41/9/35 48/8/35 49/10/35 +f 49/10/36 43/1/36 36/14/36 +f 50/1/37 51/2/37 44/3/37 +f 51/2/3 52/4/3 45/5/3 +f 52/4/2 53/6/2 46/12/2 +f 54/7/5 55/8/5 48/9/5 +f 55/8/4 56/10/4 49/11/4 +f 56/10/38 50/1/38 43/14/38 +f 57/15/39 58/2/39 51/3/39 +f 58/2/9 59/4/9 52/5/9 +f 59/4/8 60/16/8 53/17/8 +f 61/18/11 62/19/11 55/9/11 +f 62/19/10 63/20/10 56/21/10 +f 56/21/40 63/20/40 57/15/40 +f 57/14/41 64/1/41 65/2/41 +f 65/2/15 66/4/15 59/5/15 +f 66/4/14 67/6/14 60/12/14 +f 68/7/17 69/8/17 62/9/17 +f 69/8/16 70/10/16 63/11/16 +f 70/10/42 64/1/42 57/14/42 +f 71/1/43 72/2/43 65/3/43 +f 72/2/21 73/4/21 66/5/21 +f 73/4/20 74/6/20 67/12/20 +f 75/7/23 76/8/23 69/9/23 +f 76/8/22 77/10/22 70/11/22 +f 77/10/44 71/1/44 64/14/44 +f 78/1/45 79/2/45 72/3/45 +f 79/2/27 80/4/27 73/5/27 +f 80/4/26 81/6/26 74/12/26 +f 82/7/29 83/8/29 76/9/29 +f 83/8/28 84/10/28 77/11/28 +f 84/10/46 78/1/46 71/14/46 +f 1/1/47 2/2/47 79/3/47 +f 79/3/33 2/2/33 3/4/33 +f 80/5/32 3/4/32 4/6/32 +f 5/7/35 6/8/35 83/9/35 +f 6/8/34 7/10/34 84/11/34 +f 7/10/48 1/1/48 78/14/48 +f 86/22/49 88/23/49 87/24/49 +f 88/23/50 90/25/50 89/26/50 +f 90/25/51 92/27/51 91/28/51 +f 92/27/52 94/29/52 93/30/52 +f 94/29/53 96/31/53 95/32/53 +f 96/31/54 98/33/54 97/34/54 +f 98/33/55 100/35/55 99/36/55 +f 100/35/56 102/37/56 101/38/56 +f 102/37/57 104/39/57 103/40/57 +f 104/41/58 106/42/58 105/43/58 +f 106/44/59 98/45/59 90/46/59 +f 108/47/60 86/22/60 85/48/60 +f 106/42/61 108/47/61 107/49/61 +f 91/46/62 99/44/62 107/45/62 +f 110/50/49 112/51/49 111/52/49 +f 112/51/50 114/53/50 113/54/50 +f 114/53/51 116/55/51 115/56/51 +f 116/55/52 118/57/52 117/58/52 +f 132/59/63 107/60/63 85/61/63 +f 118/57/53 120/62/53 119/63/53 +f 112/59/64 87/60/64 89/61/64 +f 120/62/54 122/64/54 121/65/54 +f 91/60/65 93/61/65 118/66/65 +f 122/64/55 124/67/55 123/68/55 +f 97/61/66 122/66/66 120/59/66 +f 124/67/56 126/69/56 125/70/56 +f 124/59/67 99/60/67 101/61/67 +f 126/69/57 128/71/57 127/72/57 +f 128/59/68 103/60/68 105/61/68 +f 128/73/58 130/74/58 129/75/58 +f 130/76/59 118/77/59 114/78/59 +f 132/79/60 110/50/60 109/80/60 +f 130/74/61 132/79/61 131/81/61 +f 115/78/62 123/76/62 111/77/62 +f 1/14/1 8/1/1 2/3/1 +f 2/3/2 9/2/2 3/5/2 +f 4/12/3 3/5/3 11/6/3 +f 5/13/4 12/7/4 6/9/4 +f 6/9/5 13/8/5 7/11/5 +f 1/14/6 7/11/6 8/1/6 +f 8/14/7 15/1/7 9/3/7 +f 10/5/8 9/3/8 17/4/8 +f 10/5/9 17/4/9 11/12/9 +f 12/13/10 19/7/10 13/9/10 +f 13/9/11 20/8/11 14/11/11 +f 8/14/12 14/11/12 15/1/12 +f 15/14/13 22/1/13 16/3/13 +f 16/3/14 23/2/14 17/5/14 +f 18/12/15 17/5/15 25/6/15 +f 20/9/16 19/13/16 27/8/16 +f 21/11/17 20/9/17 28/10/17 +f 21/11/18 28/10/18 15/14/18 +f 22/14/19 29/1/19 23/3/19 +f 24/5/20 23/3/20 31/4/20 +f 24/5/21 31/4/21 25/12/21 +f 26/13/22 33/7/22 27/9/22 +f 27/9/23 34/8/23 28/11/23 +f 22/14/24 28/11/24 29/1/24 +f 30/3/25 29/14/25 37/2/25 +f 30/3/26 37/2/26 31/5/26 +f 31/5/27 38/4/27 32/12/27 +f 34/9/28 33/13/28 41/8/28 +f 34/9/29 41/8/29 35/11/29 +f 35/11/30 42/10/30 29/14/30 +f 37/3/31 36/14/31 44/2/31 +f 37/3/32 44/2/32 38/5/32 +f 38/5/33 45/4/33 39/12/33 +f 41/9/34 40/13/34 48/8/34 +f 42/11/35 41/9/35 49/10/35 +f 42/11/36 49/10/36 36/14/36 +f 43/14/37 50/1/37 44/3/37 +f 44/3/3 51/2/3 45/5/3 +f 45/5/2 52/4/2 46/12/2 +f 47/13/5 54/7/5 48/9/5 +f 48/9/4 55/8/4 49/11/4 +f 49/11/38 56/10/38 43/14/38 +f 50/14/39 57/15/39 51/3/39 +f 51/3/9 58/2/9 52/5/9 +f 52/5/8 59/4/8 53/17/8 +f 54/82/11 61/18/11 55/9/11 +f 55/9/10 62/19/10 56/21/10 +f 50/14/40 56/21/40 57/15/40 +f 58/3/41 57/14/41 65/2/41 +f 58/3/15 65/2/15 59/5/15 +f 59/5/14 66/4/14 60/12/14 +f 61/13/17 68/7/17 62/9/17 +f 62/9/16 69/8/16 63/11/16 +f 63/11/42 70/10/42 57/14/42 +f 64/14/43 71/1/43 65/3/43 +f 65/3/21 72/2/21 66/5/21 +f 66/5/20 73/4/20 67/12/20 +f 68/13/23 75/7/23 69/9/23 +f 69/9/22 76/8/22 70/11/22 +f 70/11/44 77/10/44 64/14/44 +f 71/14/45 78/1/45 72/3/45 +f 72/3/27 79/2/27 73/5/27 +f 73/5/26 80/4/26 74/12/26 +f 75/13/29 82/7/29 76/9/29 +f 76/9/28 83/8/28 77/11/28 +f 77/11/46 84/10/46 71/14/46 +f 78/14/47 1/1/47 79/3/47 +f 80/5/33 79/3/33 3/4/33 +f 81/12/32 80/5/32 4/6/32 +f 82/13/35 5/7/35 83/9/35 +f 83/9/34 6/8/34 84/11/34 +f 84/11/48 7/10/48 78/14/48 +f 85/48/49 86/22/49 87/24/49 +f 87/24/50 88/23/50 89/26/50 +f 89/26/51 90/25/51 91/28/51 +f 91/28/52 92/27/52 93/30/52 +f 93/30/53 94/29/53 95/32/53 +f 95/32/54 96/31/54 97/34/54 +f 97/34/55 98/33/55 99/36/55 +f 99/36/56 100/35/56 101/38/56 +f 101/38/57 102/37/57 103/40/57 +f 103/83/58 104/41/58 105/43/58 +f 90/46/59 88/84/59 106/44/59 +f 86/85/59 108/86/59 106/44/59 +f 106/44/59 104/87/59 102/88/59 +f 102/88/59 100/89/59 98/45/59 +f 98/45/59 96/90/59 94/91/59 +f 94/91/59 92/92/59 90/46/59 +f 88/84/59 86/85/59 106/44/59 +f 106/44/59 102/88/59 98/45/59 +f 98/45/59 94/91/59 90/46/59 +f 107/49/60 108/47/60 85/48/60 +f 105/43/61 106/42/61 107/49/61 +f 107/45/62 85/90/62 91/46/62 +f 87/91/62 89/92/62 91/46/62 +f 91/46/62 93/84/62 95/85/62 +f 95/85/62 97/86/62 91/46/62 +f 99/44/62 101/87/62 103/88/62 +f 103/88/62 105/89/62 107/45/62 +f 85/90/62 87/91/62 91/46/62 +f 91/46/62 97/86/62 99/44/62 +f 99/44/62 103/88/62 107/45/62 +f 109/80/49 110/50/49 111/52/49 +f 111/52/50 112/51/50 113/54/50 +f 113/54/51 114/53/51 115/56/51 +f 115/56/52 116/55/52 117/58/52 +f 110/66/63 132/59/63 85/61/63 +f 117/58/53 118/57/53 119/63/53 +f 114/66/64 112/59/64 89/61/64 +f 119/63/54 120/62/54 121/65/54 +f 116/59/65 91/60/65 118/66/65 +f 121/65/55 122/64/55 123/68/55 +f 95/60/66 97/61/66 120/59/66 +f 123/68/56 124/67/56 125/70/56 +f 126/66/67 124/59/67 101/61/67 +f 125/70/57 126/69/57 127/72/57 +f 130/66/68 128/59/68 105/61/68 +f 127/93/58 128/73/58 129/75/58 +f 114/78/59 112/94/59 130/76/59 +f 110/95/59 132/96/59 130/76/59 +f 130/76/59 128/97/59 126/98/59 +f 126/98/59 124/99/59 122/100/59 +f 122/100/59 120/101/59 118/77/59 +f 118/77/59 116/102/59 114/78/59 +f 112/94/59 110/95/59 130/76/59 +f 130/76/59 126/98/59 122/100/59 +f 122/100/59 118/77/59 130/76/59 +f 131/81/60 132/79/60 109/80/60 +f 129/75/61 130/74/61 131/81/61 +f 131/100/62 109/101/62 111/77/62 +f 111/77/62 113/102/62 115/78/62 +f 115/78/62 117/94/62 119/95/62 +f 119/95/62 121/96/62 115/78/62 +f 123/76/62 125/97/62 127/98/62 +f 127/98/62 129/99/62 123/76/62 +f 131/100/62 111/77/62 123/76/62 +f 115/78/62 121/96/62 123/76/62 +f 123/76/62 129/99/62 131/100/62 diff --git a/assets/hbm/textures/gui/gui_field.png b/assets/hbm/textures/gui/gui_field.png index bb9e0b0d8..24a0cc3d0 100644 Binary files a/assets/hbm/textures/gui/gui_field.png and b/assets/hbm/textures/gui/gui_field.png differ diff --git a/assets/hbm/textures/items/upgrade_health.png b/assets/hbm/textures/items/upgrade_health.png new file mode 100644 index 000000000..60da4f01e Binary files /dev/null and b/assets/hbm/textures/items/upgrade_health.png differ diff --git a/assets/hbm/textures/items/upgrade_radius.png b/assets/hbm/textures/items/upgrade_radius.png new file mode 100644 index 000000000..2036f8fea Binary files /dev/null and b/assets/hbm/textures/items/upgrade_radius.png differ diff --git a/com/hbm/blocks/ModBlocks.java b/com/hbm/blocks/ModBlocks.java index 67dd7fb55..4f509334a 100644 --- a/com/hbm/blocks/ModBlocks.java +++ b/com/hbm/blocks/ModBlocks.java @@ -511,6 +511,9 @@ public class ModBlocks { public static Block radiorec; public static final int guiID_radiorec = 69; + public static Block machine_forcefield; + public static final int guiID_forcefield = 75; + public static Block turret_light; public static Block turret_heavy; public static Block turret_rocket; @@ -981,6 +984,8 @@ public class ModBlocks { radiobox = new Radiobox(Material.iron).setBlockName("radiobox").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":radiobox"); radiorec = new RadioRec(Material.iron).setBlockName("radiorec").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":radiorec"); + + machine_forcefield = new MachineForceField(Material.iron).setBlockName("machine_forcefield").setHardness(5.0F).setResistance(100.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":machine_forcefield"); cheater_virus = new CheaterVirus(Material.iron).setBlockName("cheater_virus").setHardness(Float.POSITIVE_INFINITY).setResistance(Float.POSITIVE_INFINITY).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":cheater_virus"); cheater_virus_seed = new CheaterVirusSeed(Material.iron).setBlockName("cheater_virus_seed").setHardness(Float.POSITIVE_INFINITY).setResistance(Float.POSITIVE_INFINITY).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":cheater_virus_seed"); @@ -1365,6 +1370,7 @@ public class ModBlocks { GameRegistry.registerBlock(machine_satlinker, machine_satlinker.getUnlocalizedName()); GameRegistry.registerBlock(machine_telelinker, machine_telelinker.getUnlocalizedName()); GameRegistry.registerBlock(machine_keyforge, machine_keyforge.getUnlocalizedName()); + GameRegistry.registerBlock(machine_forcefield, machine_forcefield.getUnlocalizedName()); GameRegistry.registerBlock(radiorec, radiorec.getUnlocalizedName()); GameRegistry.registerBlock(radiobox, radiobox.getUnlocalizedName()); diff --git a/com/hbm/blocks/machine/MachineForceField.java b/com/hbm/blocks/machine/MachineForceField.java new file mode 100644 index 000000000..460eabd31 --- /dev/null +++ b/com/hbm/blocks/machine/MachineForceField.java @@ -0,0 +1,54 @@ +package com.hbm.blocks.machine; + +import com.hbm.blocks.ModBlocks; +import com.hbm.main.MainRegistry; +import com.hbm.tileentity.machine.TileEntityForceField; + +import cpw.mods.fml.common.network.internal.FMLNetworkHandler; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class MachineForceField extends BlockContainer { + + public MachineForceField(Material p_i45386_1_) { + super(p_i45386_1_); + } + + @Override + public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { + return new TileEntityForceField(); + } + + @Override + public int getRenderType(){ + return -1; + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + if(world.isRemote) + { + return true; + } else if(!player.isSneaking()) + { + FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_forcefield, world, x, y, z); + return true; + } else { + return true; + } + } + +} diff --git a/com/hbm/handler/GUIHandler.java b/com/hbm/handler/GUIHandler.java index 599a36c15..4cf5f8589 100644 --- a/com/hbm/handler/GUIHandler.java +++ b/com/hbm/handler/GUIHandler.java @@ -30,6 +30,7 @@ import com.hbm.tileentity.machine.TileEntityCrateIron; import com.hbm.tileentity.machine.TileEntityCrateSteel; import com.hbm.tileentity.machine.TileEntityDiFurnace; import com.hbm.tileentity.machine.TileEntityFWatzCore; +import com.hbm.tileentity.machine.TileEntityForceField; import com.hbm.tileentity.machine.TileEntityFusionMultiblock; import com.hbm.tileentity.machine.TileEntityMachineAssembler; import com.hbm.tileentity.machine.TileEntityMachineBattery; @@ -748,6 +749,15 @@ public class GUIHandler implements IGuiHandler { } return null; } + + case ModBlocks.guiID_forcefield: + { + if(entity instanceof TileEntityForceField) + { + return new ContainerForceField(player.inventory, (TileEntityForceField) entity); + } + return null; + } } return null; } @@ -1415,6 +1425,15 @@ public class GUIHandler implements IGuiHandler { } return null; } + + case ModBlocks.guiID_forcefield: + { + if(entity instanceof TileEntityForceField) + { + return new GUIForceField(player.inventory, (TileEntityForceField) entity); + } + return null; + } } } else { //CLIENTONLY GUIS diff --git a/com/hbm/inventory/container/ContainerForceField.java b/com/hbm/inventory/container/ContainerForceField.java new file mode 100644 index 000000000..f40195c32 --- /dev/null +++ b/com/hbm/inventory/container/ContainerForceField.java @@ -0,0 +1,88 @@ +package com.hbm.inventory.container; + +import com.hbm.inventory.SlotMachineOutput; +import com.hbm.tileentity.machine.TileEntityForceField; +import com.hbm.tileentity.machine.TileEntityMachineTurbine; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class ContainerForceField extends Container { + + private TileEntityForceField diFurnace; + + public ContainerForceField(InventoryPlayer invPlayer, TileEntityForceField tedf) { + + diFurnace = tedf; + + //Battery + this.addSlotToContainer(new Slot(tedf, 0, 26, 53)); + //Range up + this.addSlotToContainer(new Slot(tedf, 1, 89, 35)); + //Health up + this.addSlotToContainer(new Slot(tedf, 2, 107, 35)); + + for(int i = 0; i < 3; i++) + { + for(int j = 0; j < 9; j++) + { + this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + } + } + + for(int i = 0; i < 9; i++) + { + this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142)); + } + } + + @Override + public void addCraftingToCrafters(ICrafting crafting) { + super.addCraftingToCrafters(crafting); + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) + { + ItemStack var3 = null; + Slot var4 = (Slot) this.inventorySlots.get(par2); + + if (var4 != null && var4.getHasStack()) + { + ItemStack var5 = var4.getStack(); + var3 = var5.copy(); + + if (par2 <= 2) { + if (!this.mergeItemStack(var5, 3, this.inventorySlots.size(), true)) + { + return null; + } + } + else if (!this.mergeItemStack(var5, 1, 3, false)) + { + if (!this.mergeItemStack(var5, 0, 1, false)) + return null; + } + + if (var5.stackSize == 0) + { + var4.putStack((ItemStack) null); + } + else + { + var4.onSlotChanged(); + } + } + + return var3; + } + + @Override + public boolean canInteractWith(EntityPlayer player) { + return diFurnace.isUseableByPlayer(player); + } +} diff --git a/com/hbm/inventory/gui/GUIForceField.java b/com/hbm/inventory/gui/GUIForceField.java new file mode 100644 index 000000000..8171a71f9 --- /dev/null +++ b/com/hbm/inventory/gui/GUIForceField.java @@ -0,0 +1,75 @@ +package com.hbm.inventory.gui; + +import org.lwjgl.opengl.GL11; + +import com.hbm.handler.FluidTypeHandler.FluidType; +import com.hbm.inventory.FluidTank; +import com.hbm.inventory.container.ContainerForceField; +import com.hbm.inventory.container.ContainerMachineTurbine; +import com.hbm.lib.RefStrings; +import com.hbm.packet.AuxButtonPacket; +import com.hbm.packet.PacketDispatcher; +import com.hbm.tileentity.machine.TileEntityForceField; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; + +public class GUIForceField extends GuiInfoContainer { + + public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_field.png"); + private TileEntityForceField diFurnace; + + public GUIForceField(InventoryPlayer invPlayer, TileEntityForceField tedf) { + super(new ContainerForceField(invPlayer, tedf)); + diFurnace = tedf; + + this.xSize = 176; + this.ySize = 168; + } + + @Override + public void drawScreen(int mouseX, int mouseY, float f) { + super.drawScreen(mouseX, mouseY, f); + + this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 69 - 52, 16, 52, diFurnace.power, diFurnace.maxPower); + this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 62, guiTop + 69 - 52, 16, 52, mouseX, mouseY, new String[]{ diFurnace.health + " / " + diFurnace.maxHealth + "HP"} ); + } + + @Override + protected void drawGuiContainerForegroundLayer(int i, int j) { + String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName()); + + this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); + this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + } + + protected void mouseClicked(int x, int y, int i) { + super.mouseClicked(x, y, i); + + if(guiLeft + 142 <= x && guiLeft + 142 + 18 > x && guiTop + 34 < y && guiTop + 34 + 18 >= y) { + + mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); + PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord, 0, 0)); + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + Minecraft.getMinecraft().getTextureManager().bindTexture(texture); + drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); + + int i = (int)diFurnace.getPowerScaled(52); + drawTexturedModalRect(guiLeft + 8, guiTop + 69 - i, 176, 52 - i, 16, i); + + int j = diFurnace.getHealthScaled(52); + drawTexturedModalRect(guiLeft + 62, guiTop + 69 - j, 192, 52 - j, 16, j); + + if(diFurnace.isOn) { + drawTexturedModalRect(guiLeft + 142, guiTop + 34, 176, 52, 18, 18); + } + } +} diff --git a/com/hbm/items/ModItems.java b/com/hbm/items/ModItems.java index 44e852545..4a12ad1f5 100644 --- a/com/hbm/items/ModItems.java +++ b/com/hbm/items/ModItems.java @@ -1001,6 +1001,8 @@ public class ModItems { public static Item upgrade_afterburn_1; public static Item upgrade_afterburn_2; public static Item upgrade_afterburn_3; + public static Item upgrade_radius; + public static Item upgrade_health; public static Item ingot_euphemium; public static Item nugget_euphemium; @@ -2316,6 +2318,8 @@ public class ModItems { upgrade_afterburn_1 = new ItemCustomLore().setUnlocalizedName("upgrade_afterburn_1").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_afterburn_1"); upgrade_afterburn_2 = new ItemCustomLore().setUnlocalizedName("upgrade_afterburn_2").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_afterburn_2"); upgrade_afterburn_3 = new ItemCustomLore().setUnlocalizedName("upgrade_afterburn_3").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_afterburn_3"); + upgrade_radius = new ItemCustomLore().setUnlocalizedName("upgrade_radius").setMaxStackSize(16).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_radius"); + upgrade_health = new ItemCustomLore().setUnlocalizedName("upgrade_health").setMaxStackSize(16).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_health"); wand = new ItemWand().setUnlocalizedName("wand_k").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setFull3D().setTextureName(RefStrings.MODID + ":wand"); wand_s = new ItemWandS().setUnlocalizedName("wand_s").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setFull3D().setTextureName(RefStrings.MODID + ":wand_s"); @@ -3266,6 +3270,8 @@ public class ModItems { GameRegistry.registerItem(upgrade_afterburn_1, upgrade_afterburn_1.getUnlocalizedName()); GameRegistry.registerItem(upgrade_afterburn_2, upgrade_afterburn_2.getUnlocalizedName()); GameRegistry.registerItem(upgrade_afterburn_3, upgrade_afterburn_3.getUnlocalizedName()); + GameRegistry.registerItem(upgrade_radius, upgrade_radius.getUnlocalizedName()); + GameRegistry.registerItem(upgrade_health, upgrade_health.getUnlocalizedName()); //Machine Templates GameRegistry.registerItem(siren_track, siren_track.getUnlocalizedName()); diff --git a/com/hbm/items/special/ItemCustomLore.java b/com/hbm/items/special/ItemCustomLore.java index c92fd8a09..450b44ecd 100644 --- a/com/hbm/items/special/ItemCustomLore.java +++ b/com/hbm/items/special/ItemCustomLore.java @@ -578,6 +578,22 @@ public class ItemCustomLore extends ItemRadioactive { list.add("Production x4 / Consumption x7.5"); } + if(this == ModItems.upgrade_radius) + { + list.add("Forcefield Range Upgrade"); + list.add("Radius +16 / Consumption +500"); + list.add(""); + list.add("Stacks to 16"); + } + + if(this == ModItems.upgrade_health) + { + list.add("Forcefield Health Upgrade"); + list.add("Max. Health +50 / Consumption +250"); + list.add(""); + list.add("Stacks to 16"); + } + if(this == ModItems.entanglement_kit) { list.add("Teleporter crafting item."); diff --git a/com/hbm/main/ClientProxy.java b/com/hbm/main/ClientProxy.java index 575d24f3a..831907812 100644 --- a/com/hbm/main/ClientProxy.java +++ b/com/hbm/main/ClientProxy.java @@ -85,6 +85,8 @@ public class ClientProxy extends ServerProxy ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFF.class, new RenderForceField()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityForceField.class, new RenderMachineForceField()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineCentrifuge.class, new RenderCentrifuge()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineGasCent.class, new RenderCentrifuge()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineUF6Tank.class, new RenderUF6Tank()); diff --git a/com/hbm/main/MainRegistry.java b/com/hbm/main/MainRegistry.java index c443f9347..023fab68a 100644 --- a/com/hbm/main/MainRegistry.java +++ b/com/hbm/main/MainRegistry.java @@ -274,6 +274,7 @@ import com.hbm.tileentity.machine.TileEntityDiFurnace; import com.hbm.tileentity.machine.TileEntityDummy; import com.hbm.tileentity.machine.TileEntityFF; import com.hbm.tileentity.machine.TileEntityFWatzCore; +import com.hbm.tileentity.machine.TileEntityForceField; import com.hbm.tileentity.machine.TileEntityFusionMultiblock; import com.hbm.tileentity.machine.TileEntityHatch; import com.hbm.tileentity.machine.TileEntityMachineAssembler; @@ -739,6 +740,7 @@ public class MainRegistry GameRegistry.registerTileEntity(TileEntityMachineTurbine.class, "tileentity_turbine"); GameRegistry.registerTileEntity(TileEntityGeiger.class, "tileentity_geiger"); GameRegistry.registerTileEntity(TileEntityFF.class, "tileentity_forcefield"); + GameRegistry.registerTileEntity(TileEntityForceField.class, "tileentity_machine_field"); EntityRegistry.registerModEntity(EntityRocket.class, "entity_rocket", 0, this, 250, 1, true); EntityRegistry.registerModEntity(EntityNukeExplosion.class, "entity_nuke_explosion", 1, this, 250, 1, true); diff --git a/com/hbm/main/ResourceManager.java b/com/hbm/main/ResourceManager.java index ae847d534..1af71c52a 100644 --- a/com/hbm/main/ResourceManager.java +++ b/com/hbm/main/ResourceManager.java @@ -88,6 +88,9 @@ public class ResourceManager { public static final IModelCustom radar_body = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/radar_base.obj")); public static final IModelCustom radar_head = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/radar_head.obj")); + //Forcefield + public static final IModelCustom forcefield_top = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/forcefield_top.obj")); + //Bombs public static final IModelCustom bomb_solinium = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/ufp.obj")); public static final IModelCustom n2 = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/n2.obj")); diff --git a/com/hbm/packet/AuxButtonPacket.java b/com/hbm/packet/AuxButtonPacket.java index 9f46117b1..03eba1274 100644 --- a/com/hbm/packet/AuxButtonPacket.java +++ b/com/hbm/packet/AuxButtonPacket.java @@ -9,6 +9,7 @@ import com.hbm.tileentity.bomb.TileEntityTurretCheapo; import com.hbm.tileentity.machine.TileEntityAMSBase; import com.hbm.tileentity.machine.TileEntityAMSEmitter; import com.hbm.tileentity.machine.TileEntityAMSLimiter; +import com.hbm.tileentity.machine.TileEntityForceField; import com.hbm.tileentity.machine.TileEntityMachineDiesel; import com.hbm.tileentity.machine.TileEntityMachineReactorSmall; import com.hbm.tileentity.machine.TileEntityMachineSeleniumEngine; @@ -113,6 +114,12 @@ public class AuxButtonPacket implements IMessage { } } + if (te instanceof TileEntityForceField) { + TileEntityForceField field = (TileEntityForceField)te; + + field.isOn = !field.isOn; + } + //} catch (Exception x) { } return null; diff --git a/com/hbm/packet/PacketDispatcher.java b/com/hbm/packet/PacketDispatcher.java index f41ebea3d..03d986c84 100644 --- a/com/hbm/packet/PacketDispatcher.java +++ b/com/hbm/packet/PacketDispatcher.java @@ -75,6 +75,8 @@ public class PacketDispatcher { wrapper.registerMessage(RadSurveyPacket.Handler.class, RadSurveyPacket.class, i++, Side.CLIENT); //Entity sound packet that keeps client and server separated wrapper.registerMessage(LoopedEntitySoundPacket.Handler.class, LoopedEntitySoundPacket.class, i++, Side.CLIENT); + //Entity sound packet that keeps client and server separated + wrapper.registerMessage(TEFFPacket.Handler.class, TEFFPacket.class, i++, Side.CLIENT); } } diff --git a/com/hbm/packet/TEFFPacket.java b/com/hbm/packet/TEFFPacket.java new file mode 100644 index 000000000..7164805a6 --- /dev/null +++ b/com/hbm/packet/TEFFPacket.java @@ -0,0 +1,100 @@ +package com.hbm.packet; + +import com.hbm.tileentity.machine.TileEntityBlastDoor; +import com.hbm.tileentity.machine.TileEntityForceField; +import com.hbm.tileentity.machine.TileEntityVaultDoor; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; +import net.minecraft.client.Minecraft; +import net.minecraft.tileentity.TileEntity; + +public class TEFFPacket implements IMessage { + + int x; + int y; + int z; + float rad; + int health; + int maxHealth; + int power; + boolean isOn; + int color; + int cooldown; + + public TEFFPacket() { + + } + + public TEFFPacket(int x, int y, int z, float rad, int health, int maxHealth, int power, boolean isOn, int color, int cooldown) { + this.x = x; + this.y = y; + this.z = z; + this.rad = rad; + this.health = health; + this.maxHealth = maxHealth; + this.power = power; + this.isOn = isOn; + this.color = color; + this.cooldown = cooldown; + } + + @Override + public void fromBytes(ByteBuf buf) { + x = buf.readInt(); + y = buf.readInt(); + z = buf.readInt(); + rad = buf.readFloat(); + health = buf.readInt(); + maxHealth = buf.readInt(); + power = buf.readInt(); + isOn = buf.readBoolean(); + color = buf.readInt(); + cooldown = buf.readInt(); + } + + @Override + public void toBytes(ByteBuf buf) { + buf.writeInt(x); + buf.writeInt(y); + buf.writeInt(z); + buf.writeFloat(rad); + buf.writeInt(health); + buf.writeInt(maxHealth); + buf.writeInt(power); + buf.writeBoolean(isOn); + buf.writeInt(color); + buf.writeInt(cooldown); + } + + public static class Handler implements IMessageHandler { + + @Override + @SideOnly(Side.CLIENT) + public IMessage onMessage(TEFFPacket m, MessageContext ctx) { + TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(m.x, m.y, m.z); + + try { + + if(te instanceof TileEntityForceField) { + TileEntityForceField ff = (TileEntityForceField)te; + + ff.radius = m.rad; + ff.health = m.health; + ff.maxHealth = m.maxHealth; + ff.power = m.power; + ff.isOn = m.isOn; + ff.color = m.color; + ff.cooldown = m.cooldown; + } + + } catch (Exception x) { + } + return null; + } + } +} diff --git a/com/hbm/render/tileentity/RenderMachineForceField.java b/com/hbm/render/tileentity/RenderMachineForceField.java new file mode 100644 index 000000000..d5aedfd1f --- /dev/null +++ b/com/hbm/render/tileentity/RenderMachineForceField.java @@ -0,0 +1,128 @@ +package com.hbm.render.tileentity; + +import org.lwjgl.opengl.GL11; + +import com.hbm.main.ResourceManager; +import com.hbm.tileentity.machine.TileEntityForceField; + +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Vec3; + +public class RenderMachineForceField extends TileEntitySpecialRenderer { + + @Override + public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) { + + GL11.glPushMatrix(); + GL11.glTranslated(x + 0.5D, y, z + 0.5D); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_CULL_FACE); + GL11.glRotatef(180, 0F, 1F, 0F); + + bindTexture(ResourceManager.radar_body_tex); + + ResourceManager.radar_body.renderAll(); + + TileEntityForceField ff = (TileEntityForceField)te; + + GL11.glTranslated(0, 0.5D, 0); + + //double rot = (System.currentTimeMillis() / 10D) % 360; + + int segments = (int)(16 + ff.radius * 0.125); + + bindTexture(ResourceManager.universal); + + if(ff.isOn && ff.health > 0 && ff.power > 0 && ff.cooldown == 0) { + generateSphere(segments, segments * 2, ff.radius, ff.color); + + double rot = (System.currentTimeMillis() / 10D) % 360; + GL11.glRotated(-rot, 0F, 1F, 0F); + } + + GL11.glTranslated(0, 0.5, 0); + ResourceManager.forcefield_top.renderAll(); + GL11.glTranslated(0, -0.5, 0); + + GL11.glPopMatrix(); + } + + private void generateSphere(int l, int s, float rad, int hex) { + + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_LIGHTING); + + float sRot = 360F / s; + float lRot = (float)Math.PI / l; + + for(int k = 0; k < s; k++) { + + GL11.glRotatef(sRot, 0F, 1F, 0F); + + Vec3 vec = Vec3.createVectorHelper(0, rad, 0); + + for(int i = 0; i < l; i++) { + + Tessellator tessellator = Tessellator.instance; + + /*if((i < 2 || i > l - 2) && k % 10 == 0) { + tessellator.startDrawing(3); + tessellator.setColorRGBA_F(0F, 1F, 0F, 1.0F); + tessellator.addVertex(vec.xCoord, vec.yCoord, vec.zCoord); + tessellator.addVertex(0, 0, 0); + tessellator.draw(); + }*/ + + tessellator.startDrawing(3); + //tessellator.setColorRGBA_F(0F, 1F, 0F, 1.0F); + tessellator.setColorOpaque_I(hex); + tessellator.addVertex(vec.xCoord, vec.yCoord, vec.zCoord); + vec.rotateAroundX(lRot); + tessellator.addVertex(vec.xCoord, vec.yCoord, vec.zCoord); + tessellator.draw(); + } + } + + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glPopMatrix(); + + generateSphere2(l, s, rad, hex); + } + + private void generateSphere2(int l, int s, float rad, int hex) { + + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_LIGHTING); + + float sRot = (float)Math.PI * 2F / (float)(s); + float lRot = (float)Math.PI / l; + + Vec3 vec2 = Vec3.createVectorHelper(0, rad, 0); + + for(int k = 0; k < l; k++) { + + vec2.rotateAroundZ(lRot); + + for(int i = 0; i < s; i++) { + + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawing(3); + //tessellator.setColorRGBA_F(0F, 1F, 0F, 1.0F); + tessellator.setColorOpaque_I(hex); + tessellator.addVertex(vec2.xCoord, vec2.yCoord, vec2.zCoord); + vec2.rotateAroundY(sRot); + tessellator.addVertex(vec2.xCoord, vec2.yCoord, vec2.zCoord); + tessellator.draw(); + } + } + + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glPopMatrix(); + } +} diff --git a/com/hbm/tileentity/machine/TileEntityForceField.java b/com/hbm/tileentity/machine/TileEntityForceField.java new file mode 100644 index 000000000..4451970d0 --- /dev/null +++ b/com/hbm/tileentity/machine/TileEntityForceField.java @@ -0,0 +1,449 @@ +package com.hbm.tileentity.machine; + +import java.util.ArrayList; +import java.util.List; + +import com.hbm.blocks.machine.MachineElectricFurnace; +import com.hbm.interfaces.IConsumer; +import com.hbm.items.ModItems; +import com.hbm.items.special.ItemBattery; +import com.hbm.lib.Library; +import com.hbm.packet.AuxElectricityPacket; +import com.hbm.packet.AuxGaugePacket; +import com.hbm.packet.PacketDispatcher; +import com.hbm.packet.TEFFPacket; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.FurnaceRecipes; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.Vec3; + +public class TileEntityForceField extends TileEntity implements ISidedInventory, IConsumer { + + private ItemStack slots[]; + + public int health = 100; + public int maxHealth = 100; + public long power; + public int powerCons; + public int cooldown = 0; + public int blink = 0; + public float radius = 16; + public boolean isOn = false; + public int color = 0x0000FF; + public final int baseCon = 1000; + public final int radCon = 500; + public final int shCon = 250; + public static final long maxPower = 1000000; + + private static final int[] slots_top = new int[] {0}; + private static final int[] slots_bottom = new int[] {0}; + private static final int[] slots_side = new int[] {0}; + + private String customName; + + public TileEntityForceField() { + slots = new ItemStack[3]; + } + + @Override + public int getSizeInventory() { + return slots.length; + } + + @Override + public ItemStack getStackInSlot(int i) { + return slots[i]; + } + + @Override + public ItemStack getStackInSlotOnClosing(int i) { + if(slots[i] != null) + { + ItemStack itemStack = slots[i]; + slots[i] = null; + return itemStack; + } else { + return null; + } + } + + @Override + public void setInventorySlotContents(int i, ItemStack itemStack) { + slots[i] = itemStack; + if(itemStack != null && itemStack.stackSize > getInventoryStackLimit()) + { + itemStack.stackSize = getInventoryStackLimit(); + } + } + + @Override + public String getInventoryName() { + return this.hasCustomInventoryName() ? this.customName : "container.forceField"; + } + + @Override + public boolean hasCustomInventoryName() { + return this.customName != null && this.customName.length() > 0; + } + + public void setCustomName(String name) { + this.customName = name; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer player) { + if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) + { + return false; + }else{ + return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64; + } + } + + //You scrubs aren't needed for anything (right now) + @Override + public void openInventory() {} + @Override + public void closeInventory() {} + + @Override + public boolean isItemValidForSlot(int i, ItemStack itemStack) { + if(i == 0) + if(itemStack.getItem() instanceof ItemBattery) + return true; + + if(i == 1) + return true; + + return false; + } + + @Override + public ItemStack decrStackSize(int i, int j) { + if(slots[i] != null) + { + if(slots[i].stackSize <= j) + { + ItemStack itemStack = slots[i]; + slots[i] = null; + return itemStack; + } + ItemStack itemStack1 = slots[i].splitStack(j); + if (slots[i].stackSize == 0) + { + slots[i] = null; + } + + return itemStack1; + } else { + return null; + } + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + NBTTagList list = nbt.getTagList("items", 10); + + this.power = nbt.getLong("powerTime"); + this.health = nbt.getInteger("health"); + this.maxHealth = nbt.getInteger("maxHealth"); + this.cooldown = nbt.getInteger("cooldown"); + this.blink = nbt.getInteger("blink"); + this.radius = nbt.getFloat("radius"); + this.isOn = nbt.getBoolean("isOn"); + + slots = new ItemStack[getSizeInventory()]; + + for(int i = 0; i < list.tagCount(); i++) + { + NBTTagCompound nbt1 = list.getCompoundTagAt(i); + byte b0 = nbt1.getByte("slot"); + if(b0 >= 0 && b0 < slots.length) + { + slots[b0] = ItemStack.loadItemStackFromNBT(nbt1); + } + } + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setLong("powerTime", power); + nbt.setInteger("health", health); + nbt.setInteger("maxHealth", maxHealth); + nbt.setInteger("cooldown", cooldown); + nbt.setInteger("blink", blink); + nbt.setFloat("radius", radius); + nbt.setBoolean("isOn", isOn); + + NBTTagList list = new NBTTagList(); + + for(int i = 0; i < slots.length; i++) + { + if(slots[i] != null) + { + NBTTagCompound nbt1 = new NBTTagCompound(); + nbt1.setByte("slot", (byte)i); + slots[i].writeToNBT(nbt1); + list.appendTag(nbt1); + } + } + nbt.setTag("items", list); + } + + @Override + public int[] getAccessibleSlotsFromSide(int p_94128_1_) + { + return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side); + } + + @Override + public boolean canInsertItem(int i, ItemStack itemStack, int j) { + return this.isItemValidForSlot(i, itemStack); + } + + @Override + public boolean canExtractItem(int i, ItemStack itemStack, int j) { + return false; + } + + public int getHealthScaled(int i) { + return (health * i) / maxHealth; + } + + public long getPowerScaled(long i) { + return (power * i) / maxPower; + } + + @Override + public void updateEntity() { + + if(!worldObj.isRemote) { + + int rStack = 0; + int hStack = 0; + radius = 16; + maxHealth = 100; + + if(slots[1] != null && slots[1].getItem() == ModItems.upgrade_radius) { + rStack = slots[1].stackSize; + radius += rStack * 16; + } + + if(slots[2] != null && slots[2].getItem() == ModItems.upgrade_health) { + hStack = slots[2].stackSize; + maxHealth += hStack * 50; + } + + this.powerCons = this.baseCon + rStack * this.radCon + hStack * this.shCon; + + power = Library.chargeTEFromItems(slots, 0, power, maxPower); + + if(blink > 0) { + blink--; + color = 0xFF0000; + } else { + color = 0x00FF00; + } + } + + if(cooldown > 0) { + cooldown--; + } else { + if(health < maxHealth) + health += maxHealth / 100; + + if(health > maxHealth) + health = maxHealth; + } + + if(isOn && cooldown == 0 && health > 0 && power >= powerCons) { + doField(radius); + + if(!worldObj.isRemote) { + power -= powerCons; + } + } else { + this.outside.clear(); + this.inside.clear(); + } + + if(!worldObj.isRemote) { + if(power < powerCons) + power = 0; + } + + if(!worldObj.isRemote) { + PacketDispatcher.wrapper.sendToAll(new TEFFPacket(xCoord, yCoord, zCoord, radius, health, maxHealth, (int) power, isOn, color, cooldown)); + } + } + + private int impact(Entity e) { + Vec3 vector = Vec3.createVectorHelper(e.motionX, e.motionY, e.motionZ); + + double mass = Math.pow(e.height * e.width * e.width, 2); + double speed = vector.lengthVector(); + return (int)(mass * speed * 100); + } + + private void damage(int ouch) { + health -= ouch; + + if(ouch >= (this.maxHealth / 250)) + blink = 5; + + if(health <= 0) { + health = 0; + cooldown = (int) (100 + radius); + } + } + + List outside = new ArrayList(); + List inside = new ArrayList(); + + private void doField(float rad) { + + List oLegacy = new ArrayList(outside); + List iLegacy = new ArrayList(inside); + + outside.clear(); + inside.clear(); + + List list = worldObj.getEntitiesWithinAABBExcludingEntity(null, AxisAlignedBB.getBoundingBox(xCoord + 0.5 - (rad + 25), yCoord + 0.5 - (rad + 25), zCoord + 0.5 - (rad + 25), xCoord + 0.5 + (rad + 25), yCoord + 0.5 + (rad + 25), zCoord + 0.5 + (rad + 25))); + + for(Object o : list) { + + if(o instanceof Entity && !(o instanceof EntityPlayer)) { + Entity entity = (Entity)o; + + double dist = Math.sqrt(Math.pow(xCoord + 0.5 - entity.posX, 2) + Math.pow(yCoord + 0.5 - entity.posY, 2) + Math.pow(zCoord + 0.5 - entity.posZ, 2)); + + boolean out = dist > rad; + + //if the entity has not been registered yet + if(!oLegacy.contains(entity) && !iLegacy.contains(entity)) { + if(out) { + outside.add(entity); + } else { + inside.add(entity); + } + + //if the entity has been detected before + } else { + + //if the entity has crossed inwards + if(oLegacy.contains(entity) && !out) { + Vec3 vec = Vec3.createVectorHelper(xCoord + 0.5 - entity.posX, yCoord + 0.5 - entity.posY, zCoord + 0.5 - entity.posZ); + vec = vec.normalize(); + + double mx = -vec.xCoord * (rad + 1); + double my = -vec.yCoord * (rad + 1); + double mz = -vec.zCoord * (rad + 1); + + entity.setLocationAndAngles(xCoord + 0.5 + mx, yCoord + 0.5 + my, zCoord + 0.5 + mz, 0, 0); + + double mo = Math.sqrt(Math.pow(entity.motionX, 2) + Math.pow(entity.motionY, 2) + Math.pow(entity.motionZ, 2)); + + entity.motionX = vec.xCoord * -mo; + entity.motionY = vec.yCoord * -mo; + entity.motionZ = vec.zCoord * -mo; + + entity.posX -= entity.motionX; + entity.posY -= entity.motionY; + entity.posZ -= entity.motionZ; + + worldObj.playSoundAtEntity(entity, "hbm:weapon.sparkShoot", 2.5F, 1.0F); + outside.add(entity); + + if(!worldObj.isRemote) { + this.damage(this.impact(entity)); + } + + } else + + //if the entity has crossed outwards + if(iLegacy.contains(entity) && out) { + Vec3 vec = Vec3.createVectorHelper(xCoord + 0.5 - entity.posX, yCoord + 0.5 - entity.posY, zCoord + 0.5 - entity.posZ); + vec = vec.normalize(); + + double mx = -vec.xCoord * (rad - 1); + double my = -vec.yCoord * (rad - 1); + double mz = -vec.zCoord * (rad - 1); + + entity.setLocationAndAngles(xCoord + 0.5 + mx, yCoord + 0.5 + my, zCoord + 0.5 + mz, 0, 0); + + double mo = Math.sqrt(Math.pow(entity.motionX, 2) + Math.pow(entity.motionY, 2) + Math.pow(entity.motionZ, 2)); + + entity.motionX = vec.xCoord * mo; + entity.motionY = vec.yCoord * mo; + entity.motionZ = vec.zCoord * mo; + + entity.posX -= entity.motionX; + entity.posY -= entity.motionY; + entity.posZ -= entity.motionZ; + + worldObj.playSoundAtEntity(entity, "hbm:weapon.sparkShoot", 2.5F, 1.0F); + inside.add(entity); + + if(!worldObj.isRemote) { + this.damage(this.impact(entity)); + } + + } else { + + if(out) { + outside.add(entity); + } else { + inside.add(entity); + } + } + } + } + } + } + + + @Override + public void setPower(long i) { + power = i; + + } + + @Override + public long getPower() { + return power; + + } + + @Override + public long getMaxPower() { + return maxPower; + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return TileEntity.INFINITE_EXTENT_AABB; + } + + @Override + @SideOnly(Side.CLIENT) + public double getMaxRenderDistanceSquared() + { + return 65536.0D; + } +}