rocket propelled chainsaw, functional custom missile entity

This commit is contained in:
HbmMods 2019-05-13 23:29:27 +02:00
parent 2717b71173
commit b350446a28
48 changed files with 1234 additions and 180 deletions

View File

@ -86,6 +86,10 @@ hbmfluid.biofuel=Biodiesel
hbmfluid.sas3=Schrabidiumtrisulfat
hbmfluid.nitan=NITAN© 100 Oktan Supertreibstoff
hbmfluid.cryogel=Kryogel
hbmfluid.hydrogen=Flüssiger Wasserstoff
hbmfluid.oxygen=Flüssiger Sauerstoff
hbmfluid.xenon=Xenongas
hbmfluid.balefire=BF-Raketentreibstoff
chem.TEST=Test
chem.FP_HEAVYOIL=Schwerölverarbeitung
@ -1447,6 +1451,7 @@ item.ammo_rocket_emp.name=84mm Rakete (Impuls)
item.ammo_rocket_glare.name=84mm Rakete (Roter Schein)
item.ammo_rocket_sleek.name=84mm Rakete (IF-R&D)
item.ammo_rocket_nuclear.name=84mm Rakete (Привет)
item.ammo_rocket_rpc.name=84mm Raketengetriebene Kettensäge
item.ammo_grenade.name=40mm Granate
item.ammo_grenade_he.name=40mm Granate (HE)
item.ammo_grenade_incendiary.name=40mm Granate (Brand)

View File

@ -86,6 +86,10 @@ hbmfluid.biofuel=Biofuel
hbmfluid.sas3=Schrabidium Trisulfide
hbmfluid.nitan=NITAN© 100 Octane Super Fuel
hbmfluid.cryogel=Cryogel
hbmfluid.hydrogen=Liquid Hydrogen
hbmfluid.oxygen=Liquid Oxygen
hbmfluid.xenon=Xenon Gas
hbmfluid.balefire=BF Rocket Fuel
chem.TEST=Test
chem.FP_HEAVYOIL=Heavy Oil Processing
@ -1447,6 +1451,7 @@ item.ammo_rocket_emp.name=84mm Rocket (Pulse)
item.ammo_rocket_glare.name=84mm Rocket (Red Glare)
item.ammo_rocket_sleek.name=84mm Rocket (IF-R&D)
item.ammo_rocket_nuclear.name=84mm Rocket (Привет)
item.ammo_rocket_rpc.name=84mm Rocket Propelled Chainsaw
item.ammo_grenade.name=40mm Grenade
item.ammo_grenade_he.name=40mm Grenade (HE)
item.ammo_grenade_incendiary.name=40mm Grenade (Incendiary)

380
assets/hbm/models/rpc.obj Normal file
View File

@ -0,0 +1,380 @@
# Blender v2.76 (sub 0) OBJ File: 'rpc.blend'
# www.blender.org
o Cube_Cube.002
v -0.125000 0.500000 -0.375000
v -0.625000 0.000000 -0.375000
v 0.625000 0.500000 0.125000
v 0.375000 -0.500000 0.125000
v -0.375000 -0.500000 -0.375000
v -0.625000 -0.250000 -0.375000
v -0.375000 -0.500000 0.125000
v 0.625000 0.500000 -0.375000
v 0.625000 -0.250000 -0.375000
v 0.375000 -0.500000 -0.375000
v 0.625000 -0.250000 0.125000
v -0.125000 0.500000 0.125000
v -0.625000 0.000000 0.125000
v -0.625000 -0.250000 0.125000
v -0.250000 -0.500000 0.375000
v -0.250000 0.500000 0.375000
v -0.250000 -0.500000 0.125000
v -0.250000 0.500000 0.125000
v 0.625000 -0.500000 0.375000
v 0.625000 0.500000 0.375000
v 0.625000 -0.500000 0.125000
v 0.625000 0.500000 0.125000
v -3.187500 -0.437500 0.000000
v -0.187500 -0.437500 0.000000
v -3.187500 0.437500 -0.000000
v -0.187500 0.437500 -0.000000
v -3.437500 -0.187500 0.000000
v -3.437500 0.187500 -0.000000
v 1.750000 0.000000 -0.276250
v 1.750000 -0.239240 -0.138125
v 0.625000 -0.000000 -0.325000
v 1.625000 0.000000 -0.325000
v 0.625000 -0.281458 -0.162500
v 1.625000 -0.281458 -0.162500
v 0.625000 -0.281458 0.162500
v 1.625000 -0.281458 0.162500
v 0.625000 0.000000 0.325000
v 1.625000 0.000000 0.325000
v 0.625000 0.281458 0.162500
v 1.625000 0.281458 0.162500
v 0.625000 0.281458 -0.162500
v 1.625000 0.281458 -0.162500
v 1.750000 -0.239239 0.138125
v 1.750000 0.000000 0.276250
v 1.750000 0.239240 0.138125
v 1.750000 0.239240 -0.138125
v 2.250000 0.000000 -0.276250
v 2.250000 0.239240 -0.138125
v 2.250000 0.239240 0.138125
v 2.250000 0.000000 0.276250
v 2.250000 -0.239239 0.138125
v 2.250000 -0.239240 -0.138125
v 2.650000 0.000000 -0.345313
v 2.650000 0.299049 -0.172656
v 2.650000 0.299049 0.172656
v 2.650000 0.000000 0.345312
v 2.650000 -0.299049 0.172656
v 2.650000 -0.299049 -0.172656
v 2.062500 -0.500000 0.500000
v 2.062500 0.500000 0.500000
v 2.062500 -0.500000 -0.500000
v 2.062500 0.500000 -0.500000
v 2.437500 -0.500000 0.500000
v 2.437500 0.500000 0.500000
v 2.437500 -0.500000 -0.500000
v 2.437500 0.500000 -0.500000
v 1.812500 -0.125000 0.125000
v 1.812500 0.125000 0.125000
v 1.812500 -0.125000 -0.125000
v 1.812500 0.125000 -0.125000
v 2.187500 -0.125000 0.125000
v 2.187500 0.125000 0.125000
v 2.187500 -0.125000 -0.125000
v 2.187500 0.125000 -0.125000
v -0.125000 0.500000 -0.375000
v -0.125000 0.500000 0.125000
v -0.875000 1.000000 -0.375000
v -0.875000 1.000000 0.125000
v 2.250000 0.000000 -0.000000
v -3.187500 -0.437500 0.000000
v -0.187500 -0.437500 0.000000
v -3.187500 0.437500 -0.000000
v -0.187500 0.437500 -0.000000
v -3.437500 -0.187500 0.000000
v -3.437500 0.187500 -0.000000
v 2.250000 0.000000 -0.276250
v 2.250000 0.239240 -0.138125
v 2.250000 0.239240 0.138125
v 2.250000 0.000000 0.276250
v 2.250000 -0.239239 0.138125
v 2.250000 -0.239240 -0.138125
v 2.650000 0.000000 -0.345313
v 2.650000 0.299049 -0.172656
v 2.650000 0.299049 0.172656
v 2.650000 0.000000 0.345312
v 2.650000 -0.299049 0.172656
v 2.650000 -0.299049 -0.172656
v 2.062500 -0.500000 0.500000
v 2.062500 0.500000 0.500000
v 2.062500 -0.500000 -0.500000
v 2.062500 0.500000 -0.500000
v 2.437500 -0.500000 0.500000
v 2.437500 0.500000 0.500000
v 2.437500 -0.500000 -0.500000
v 2.437500 0.500000 -0.500000
v 1.812500 -0.125000 0.125000
v 1.812500 0.125000 0.125000
v 1.812500 -0.125000 -0.125000
v 1.812500 0.125000 -0.125000
v 2.187500 -0.125000 0.125000
v 2.187500 0.125000 0.125000
v 2.187500 -0.125000 -0.125000
v 2.187500 0.125000 -0.125000
v -0.125000 0.500000 -0.375000
v -0.125000 0.500000 0.125000
v -0.875000 1.000000 -0.375000
v -0.875000 1.000000 0.125000
vt 0.913043 0.173913
vt 0.913043 0.260870
vt 0.782609 0.260870
vt 0.565217 0.000000
vt 0.521739 0.173913
vt 0.434783 0.000000
vt 1.000000 0.173913
vt 0.913043 0.043478
vt 1.000000 0.043478
vt 0.913043 0.000000
vt 0.608696 0.043478
vt 0.695652 0.043478
vt 0.695652 0.086957
vt 0.782609 0.173913
vt 0.869565 -0.000000
vt 0.608696 0.000000
vt 0.695652 0.000000
vt 0.608696 0.086957
vt 0.695652 0.173913
vt 0.391304 0.260870
vt 0.391304 0.173913
vt 0.347826 0.173913
vt 0.347826 0.000000
vt 0.391304 0.000000
vt 0.195652 0.173913
vt 0.195652 0.000000
vt 0.152174 0.173913
vt 0.152174 -0.000000
vt 0.000000 0.173913
vt 0.000000 0.000000
vt 0.347826 0.217391
vt 0.152174 0.217391
vt 0.000000 0.217391
vt 0.565217 0.260870
vt 0.565217 0.413043
vt 0.043478 0.413043
vt -0.000000 0.369565
vt -0.000000 0.304348
vt 0.739130 0.391304
vt 0.760870 0.391304
vt 0.760870 0.456522
vt 0.739130 0.586957
vt 0.739130 0.652174
vt 0.565217 0.652174
vt 0.739130 0.326087
vt 0.760870 0.326087
vt 0.739130 0.260870
vt 0.565217 0.326087
vt 0.760870 0.586957
vt 0.760870 0.652174
vt 0.565217 0.391304
vt 0.760870 0.260870
vt 0.760870 0.478261
vt 0.847826 0.478261
vt 0.847826 0.521739
vt 0.739130 0.456522
vt 0.739130 0.521739
vt 0.760870 0.521739
vt 0.565217 0.586957
vt 0.565217 0.521739
vt 0.184783 0.586957
vt 0.097826 0.586957
vt 0.097826 0.413043
vt 0.847826 0.304348
vt 0.847826 0.260870
vt 0.934783 0.260870
vt 0.760870 0.434783
vt 0.847826 0.434783
vt 0.760870 0.347826
vt 0.847826 0.347826
vt 0.847826 0.391304
vt 0.760870 0.304348
vt 0.021739 0.456522
vt 0.000000 0.413043
vt 0.934783 0.347826
vt 0.934783 0.434783
vt 0.934783 0.478261
vt 0.934783 0.521739
vt 0.934783 0.304348
vt 0.934783 0.391304
vt 0.055813 0.418992
vt 0.097826 0.500000
vt 0.043478 0.500000
vt 0.391304 0.043478
vt 1.000000 0.000000
vt 0.739130 -0.000000
vt 0.608696 0.173913
vt 0.521739 0.260870
vt 0.195652 0.217391
vt 0.043478 0.260870
vt 0.565217 0.456522
vt 0.184783 0.413043
vn 0.000000 -1.000000 0.000000
vn 0.000000 0.000000 -1.000000
vn 1.000000 0.000000 0.000000
vn 0.707100 -0.707100 0.000000
vn -1.000000 0.000000 0.000000
vn 0.000000 0.000000 1.000000
vn -0.707100 -0.707100 0.000000
vn -0.707100 0.707100 0.000000
vn 0.000000 1.000000 0.000000
vn 0.320000 0.473700 0.820500
vn 0.000000 -0.500000 -0.866000
vn 0.320000 -0.473700 0.820500
vn 0.320000 -0.473700 -0.820500
vn 0.000000 -0.500000 0.866000
vn 0.320000 -0.947400 0.000000
vn -0.000000 0.500000 0.866000
vn 0.320000 0.473700 -0.820500
vn 0.000000 0.500000 -0.866000
vn 0.320000 0.947400 0.000000
vn 0.554700 0.832100 0.000000
vn -0.147900 -0.989000 0.000000
vn -0.147900 0.494500 0.856500
vn -0.147900 0.494500 -0.856500
vn -0.147900 -0.494500 -0.856500
vn -0.147900 -0.494500 0.856500
vn -0.147900 0.989000 0.000000
vn 0.000000 0.707100 -0.707100
vn 0.000000 0.707100 0.707100
vn -0.554700 -0.832100 0.000000
vn 0.147900 0.989000 -0.000000
vn 0.147900 -0.494500 -0.856500
vn 0.147900 -0.494500 0.856500
vn 0.147900 0.494500 0.856500
vn 0.147900 0.494500 -0.856500
vn 0.147900 -0.989000 0.000000
vn 0.000000 -0.707100 0.707100
vn 0.000000 -0.707100 -0.707100
s off
f 10/1/1 4/2/1 7/3/1
f 5/4/2 1/5/2 10/6/2
f 8/7/3 3/1/3 11/8/3
f 9/9/4 11/8/4 4/10/4
f 6/11/5 14/12/5 13/13/5
f 11/8/6 12/14/6 4/15/6
f 5/16/7 7/17/7 14/12/7
f 2/18/8 13/13/8 12/19/8
f 1/20/9 12/21/9 3/5/9
f 18/22/5 17/23/5 15/24/5
f 22/25/2 21/26/2 17/23/2
f 20/27/3 19/28/3 21/26/3
f 16/29/6 15/30/6 19/28/6
f 17/25/1 21/22/1 19/31/1
f 22/32/9 18/33/9 16/29/9
f 24/34/6 26/35/6 25/36/6
f 25/36/6 28/37/6 27/38/6
f 38/39/10 44/40/10 45/41/10
f 32/42/11 34/43/11 33/44/11
f 38/39/12 36/45/12 43/46/12
f 34/47/1 36/45/1 35/48/1
f 32/42/13 29/49/13 30/50/13
f 36/45/14 38/39/14 37/51/14
f 34/47/15 30/52/15 43/46/15
f 29/53/11 47/54/11 52/55/11
f 37/51/16 38/39/16 40/56/16
f 42/57/17 46/58/17 29/49/17
f 42/57/18 32/42/18 31/59/18
f 40/56/9 42/57/9 41/60/9
f 40/56/19 45/41/19 46/58/19
f 77/61/20 78/62/20 76/63/20
f 51/64/21 52/65/21 58/66/21
f 29/53/18 46/67/18 48/68/18
f 44/69/16 50/70/16 49/71/16
f 46/67/9 45/40/9 49/71/9
f 43/72/14 51/64/14 50/70/14
f 30/52/1 52/65/1 51/64/1
f 79/73/3 49/74/3 50/36/3
f 49/71/22 50/70/22 56/75/22
f 48/68/23 54/76/23 53/77/23
f 47/54/24 53/77/24 58/78/24
f 50/70/25 51/64/25 57/79/25
f 49/71/26 55/80/26 54/76/26
f 60/81/27 64/63/27 72/82/27
f 71/82/28 67/83/28 59/36/28
f 62/83/28 70/36/28 74/63/28
f 61/36/27 69/83/27 73/82/27
f 48/74/3 49/36/3 79/73/3
f 47/74/3 48/36/3 79/73/3
f 52/36/3 79/73/3 51/74/3
f 52/74/3 47/36/3 79/73/3
f 51/36/3 79/73/3 50/74/3
f 82/36/2 83/35/2 81/34/2
f 84/38/2 85/37/2 82/36/2
f 115/63/29 117/62/29 116/61/29
f 96/79/30 97/66/30 91/65/30
f 94/80/31 95/75/31 89/70/31
f 92/77/32 93/76/32 87/68/32
f 91/55/33 97/78/33 92/77/33
f 89/70/34 95/75/34 96/79/34
f 93/76/35 94/80/35 88/71/35
f 99/81/36 107/83/36 111/82/36
f 98/36/37 106/83/37 110/82/37
f 113/63/37 109/36/37 101/83/37
f 100/36/36 104/63/36 112/82/36
f 5/14/1 10/1/1 7/3/1
f 9/84/2 10/6/2 1/5/2
f 5/4/2 6/11/2 2/18/2
f 2/18/2 1/5/2 5/4/2
f 8/21/2 9/84/2 1/5/2
f 9/9/3 8/7/3 11/8/3
f 10/85/4 9/9/4 4/10/4
f 2/18/5 6/11/5 13/13/5
f 7/86/6 4/15/6 12/14/6
f 11/8/6 3/1/6 12/14/6
f 12/14/6 13/13/6 7/86/6
f 14/12/6 7/86/6 13/13/6
f 6/11/7 5/16/7 14/12/7
f 1/87/8 2/18/8 12/19/8
f 8/88/9 1/20/9 3/5/9
f 16/21/5 18/22/5 15/24/5
f 18/22/2 22/25/2 17/23/2
f 22/25/3 20/27/3 21/26/3
f 20/27/6 16/29/6 19/28/6
f 15/89/1 17/25/1 19/31/1
f 20/27/9 22/32/9 16/29/9
f 23/90/6 24/34/6 25/36/6
f 23/90/6 25/36/6 27/38/6
f 40/56/10 38/39/10 45/41/10
f 31/59/11 32/42/11 33/44/11
f 44/40/12 38/39/12 43/46/12
f 33/34/1 34/47/1 35/48/1
f 34/43/13 32/42/13 30/50/13
f 35/48/14 36/45/14 37/51/14
f 36/45/15 34/47/15 43/46/15
f 30/58/11 29/53/11 52/55/11
f 39/91/16 37/51/16 40/56/16
f 32/42/17 42/57/17 29/49/17
f 41/60/18 42/57/18 31/59/18
f 39/91/9 40/56/9 41/60/9
f 42/57/19 40/56/19 46/58/19
f 75/92/20 77/61/20 76/63/20
f 57/79/21 51/64/21 58/66/21
f 47/54/18 29/53/18 48/68/18
f 45/40/16 44/69/16 49/71/16
f 48/68/9 46/67/9 49/71/9
f 44/69/14 43/72/14 50/70/14
f 43/72/1 30/52/1 51/64/1
f 55/80/22 49/71/22 56/75/22
f 47/54/23 48/68/23 53/77/23
f 52/55/24 47/54/24 58/78/24
f 56/75/25 50/70/25 57/79/25
f 48/68/26 49/71/26 54/76/26
f 68/83/27 60/81/27 72/82/27
f 63/63/28 71/82/28 59/36/28
f 66/82/28 62/83/28 74/63/28
f 65/63/27 61/36/27 73/82/27
f 80/90/2 82/36/2 81/34/2
f 80/90/2 84/38/2 82/36/2
f 114/92/29 115/63/29 116/61/29
f 90/64/30 96/79/30 91/65/30
f 88/71/31 94/80/31 89/70/31
f 86/54/32 92/77/32 87/68/32
f 86/54/33 91/55/33 92/77/33
f 90/64/34 89/70/34 96/79/34
f 87/68/35 93/76/35 88/71/35
f 103/63/36 99/81/36 111/82/36
f 102/63/37 98/36/37 110/82/37
f 105/82/37 113/63/37 101/83/37
f 108/83/36 100/36/36 112/82/36

View File

@ -109,6 +109,8 @@
"weapon.magReload": {"category": "player", "sounds": [{"name": "weapon/magReload", "stream": false}]},
"weapon.rpgReload": {"category": "player", "sounds": [{"name": "weapon/rpgReload", "stream": false}]},
"weapon.boat": {"category": "player", "sounds": [{"name": "weapon/boat", "stream": false}]},
"weapon.hkShoot": {"category": "player", "sounds": [{"name": "weapon/hkShoot", "stream": false}]},
"weapon.hkReload": {"category": "player", "sounds": [{"name": "weapon/hkReload", "stream": false}]},
"weapon.reloadTurret": {"category": "player", "sounds": [{"name": "weapon/reloadTurret", "stream": false}]},
"weapon.switchmode1": {"category": "player", "sounds": [{"name": "weapon/switchmode1", "stream": false}]},

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 344 B

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 741 B

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 B

After

Width:  |  Height:  |  Size: 130 B

View File

@ -6,9 +6,12 @@ import java.util.List;
import com.hbm.entity.logic.IChunkLoader;
import com.hbm.entity.particle.EntitySmokeFX;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.items.weapon.ItemMissile;
import com.hbm.items.weapon.ItemMissile.WarheadType;
import com.hbm.main.MainRegistry;
import com.hbm.packet.AuxParticlePacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.render.misc.MissileMultipart;
import com.hbm.tileentity.machine.TileEntityMachineRadar;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
@ -17,6 +20,7 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.DamageSource;
@ -34,12 +38,12 @@ public class EntityMissileCustom extends Entity implements IChunkLoader {
int startZ;
int targetX;
int targetZ;
public int velocity;
double velocity;
double decelY;
double accelXZ;
boolean isCluster = false;
private Ticket loaderTicket;
public int health = 50;
MissileMultipart template;
public EntityMissileCustom(World p_i1582_1_) {
super(p_i1582_1_);
@ -81,11 +85,9 @@ public class EntityMissileCustom extends Entity implements IChunkLoader {
private void killMissile() {
ExplosionLarge.explode(worldObj, posX, posY, posZ, 5, true, false, true);
ExplosionLarge.spawnShrapnelShower(worldObj, posX, posY, posZ, motionX, motionY, motionZ, 15, 0.075);
ExplosionLarge.spawnMissileDebris(worldObj, posX, posY, posZ, motionX, motionY, motionZ, 0.25, getDebris(), getDebrisRareDrop());
TileEntityMachineRadar.allMissiles.remove(this);
}
public EntityMissileCustom(World world, float x, float y, float z, int a, int b) {
public EntityMissileCustom(World world, float x, float y, float z, int a, int b, MissileMultipart template) {
super(world);
this.ignoreFrustumCheck = true;
/*this.posX = x;
@ -98,11 +100,21 @@ public class EntityMissileCustom extends Entity implements IChunkLoader {
targetZ = b;
this.motionY = 2;
this.template = template;
this.dataWatcher.updateObject(9, Item.getIdFromItem(template.warhead.part));
this.dataWatcher.updateObject(10, Item.getIdFromItem(template.fuselage.part));
if(template.fins != null)
this.dataWatcher.updateObject(11, Item.getIdFromItem(template.fins.part));
else
this.dataWatcher.addObject(11, Integer.valueOf(0));
this.dataWatcher.updateObject(12, Item.getIdFromItem(template.thruster.part));
Vec3 vector = Vec3.createVectorHelper(targetX - startX, 0, targetZ - startZ);
accelXZ = decelY = 1/vector.lengthVector();
decelY *= 2;
velocity = 1;
velocity = 0.0;
this.setSize(1.5F, 1.5F);
}
@ -111,6 +123,24 @@ public class EntityMissileCustom extends Entity implements IChunkLoader {
protected void entityInit() {
init(ForgeChunkManager.requestTicket(MainRegistry.instance, worldObj, Type.ENTITY));
this.dataWatcher.addObject(8, Integer.valueOf(this.health));
if(template != null) {
System.out.println("yeah");
this.dataWatcher.addObject(9, Integer.valueOf(Item.getIdFromItem(template.warhead.part)));
this.dataWatcher.addObject(10, Integer.valueOf(Item.getIdFromItem(template.fuselage.part)));
if(template.fins != null)
this.dataWatcher.addObject(11, Integer.valueOf(Item.getIdFromItem(template.fins.part)));
else
this.dataWatcher.addObject(11, Integer.valueOf(0));
this.dataWatcher.addObject(12, Integer.valueOf(Item.getIdFromItem(template.thruster.part)));
} else {
this.dataWatcher.addObject(9, Integer.valueOf(0));
this.dataWatcher.addObject(10, Integer.valueOf(0));
this.dataWatcher.addObject(11, Integer.valueOf(0));
this.dataWatcher.addObject(12, Integer.valueOf(0));
}
}
@Override
@ -128,6 +158,10 @@ public class EntityMissileCustom extends Entity implements IChunkLoader {
startX = nbt.getInteger("sX");
startZ = nbt.getInteger("sZ");
velocity = nbt.getInteger("veloc");
this.dataWatcher.updateObject(9, nbt.getInteger("warhead"));
this.dataWatcher.updateObject(10, nbt.getInteger("fuselage"));
this.dataWatcher.updateObject(11, nbt.getInteger("fins"));
this.dataWatcher.updateObject(12, nbt.getInteger("thruster"));
}
@Override
@ -144,7 +178,11 @@ public class EntityMissileCustom extends Entity implements IChunkLoader {
nbt.setInteger("tZ", targetZ);
nbt.setInteger("sX", startX);
nbt.setInteger("sZ", startZ);
nbt.setInteger("veloc", velocity);
nbt.setDouble("veloc", velocity);
nbt.setInteger("warhead", this.dataWatcher.getWatchableObjectInt(9));
nbt.setInteger("fuselage", this.dataWatcher.getWatchableObjectInt(10));
nbt.setInteger("fins", this.dataWatcher.getWatchableObjectInt(11));
nbt.setInteger("thruster", this.dataWatcher.getWatchableObjectInt(12));
}
protected void rotation() {
@ -175,108 +213,94 @@ public class EntityMissileCustom extends Entity implements IChunkLoader {
@Override
public void onUpdate()
{
//super.onUpdate();
//if(!worldObj.loadedEntityList.contains(this))
// worldObj.loadedEntityList.add(this);
//System.out.println(this.posX + " " + this.posY + " " + this.posZ);
if(velocity < 1)
velocity = 1;
if(this.ticksExisted > 40)
velocity = 3;
else if(this.ticksExisted > 20)
velocity = 2;
this.dataWatcher.updateObject(8, Integer.valueOf(this.health));
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
for(int i = 0; i < velocity; i++) {
//this.posX += this.motionX;
//this.posY += this.motionY;
//this.posZ += this.motionZ;
this.setLocationAndAngles(posX + this.motionX, posY + this.motionY, posZ + this.motionZ, 0, 0);
this.rotation();
this.motionY -= decelY;
Vec3 vector = Vec3.createVectorHelper(targetX - startX, 0, targetZ - startZ);
vector = vector.normalize();
vector.xCoord *= accelXZ;
vector.zCoord *= accelXZ;
if(motionY > 0) {
motionX += vector.xCoord;
motionZ += vector.zCoord;
}
if(motionY < 0) {
motionX -= vector.xCoord;
motionZ -= vector.zCoord;
}
if(!this.worldObj.isRemote)
//this.worldObj.spawnEntityInWorld(new EntitySmokeFX(this.worldObj, this.posX, this.posY, this.posZ, 0.0, 0.0, 0.0));
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacket(posX, posY, posZ, 2),
new TargetPoint(worldObj.provider.dimensionId, posX, posY, posZ, 300));
if(this.worldObj.getBlock((int)this.posX, (int)this.posY, (int)this.posZ) != Blocks.air &&
this.worldObj.getBlock((int)this.posX, (int)this.posY, (int)this.posZ) != Blocks.water &&
this.worldObj.getBlock((int)this.posX, (int)this.posY, (int)this.posZ) != Blocks.flowing_water) {
if(!this.worldObj.isRemote)
{
onImpact();
}
this.setDead();
return;
}
loadNeighboringChunks((int)(posX / 16), (int)(posZ / 16));
if(motionY < -1 && this.isCluster && !worldObj.isRemote) {
cluster();
this.setDead();
return;
}
this.setLocationAndAngles(posX + this.motionX * velocity, posY + this.motionY * velocity, posZ + this.motionZ * velocity, 0, 0);
this.rotation();
this.motionY -= decelY * velocity;
Vec3 vector = Vec3.createVectorHelper(targetX - startX, 0, targetZ - startZ);
vector = vector.normalize();
vector.xCoord *= accelXZ * velocity;
vector.zCoord *= accelXZ * velocity;
if (motionY > 0) {
motionX += vector.xCoord;
motionZ += vector.zCoord;
}
if (motionY < 0) {
motionX -= vector.xCoord;
motionZ -= vector.zCoord;
}
if (!this.worldObj.isRemote)
// this.worldObj.spawnEntityInWorld(new EntitySmokeFX(this.worldObj,
// this.posX, this.posY, this.posZ, 0.0, 0.0, 0.0));
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacket(posX, posY, posZ, 2),
new TargetPoint(worldObj.provider.dimensionId, posX, posY, posZ, 300));
if (this.worldObj.getBlock((int) this.posX, (int) this.posY, (int) this.posZ) != Blocks.air
&& this.worldObj.getBlock((int) this.posX, (int) this.posY, (int) this.posZ) != Blocks.water
&& this.worldObj.getBlock((int) this.posX, (int) this.posY, (int) this.posZ) != Blocks.flowing_water) {
if (!this.worldObj.isRemote) {
onImpact();
}
this.setDead();
return;
}
loadNeighboringChunks((int)(posX / 16), (int)(posZ / 16));
if(velocity < 5)
velocity += 0.01;
}
@Override
@SideOnly(Side.CLIENT)
public boolean isInRangeToRenderDist(double distance)
{
return distance < 500000;
return distance < 2500000;
}
public void onImpact() {
}
ItemMissile part = (ItemMissile) Item.getItemById(this.dataWatcher.getWatchableObjectInt(9));
public int getMissileType() {
WarheadType type = (WarheadType)part.attributes[0];
float strength = (Float)part.attributes[1];
return 0;
}
public List<ItemStack> getDebris() {
switch(type) {
case HE:
ExplosionLarge.explode(worldObj, posX, posY, posZ, strength, true, true, true);
break;
case INC:
break;
case CLUSTER:
break;
case BUSTER:
break;
case NUCLEAR:
break;
case TX:
break;
case BALEFIRE:
break;
case N2:
break;
default:
break;
return null;
}
}
public ItemStack getDebrisRareDrop() {
return null;
}
public void cluster() { }
public void init(Ticket ticket) {
if(!worldObj.isRemote) {

View File

@ -289,6 +289,8 @@ public class EntityBulletBase extends Entity implements IProjectile {
if(config.plink == 2)
worldObj.playSoundAtEntity(this, "hbm:weapon.gBounce", 1.0F, 1.0F);
onRicochet(movement.blockX, movement.blockY, movement.blockZ);
} else {
if(!worldObj.isRemote)
onBlockImpact(movement.blockX, movement.blockY, movement.blockZ);
@ -448,6 +450,18 @@ public class EntityBulletBase extends Entity implements IProjectile {
}
}
//for when a bullet dies by hitting a block
private void onRicochet(int bX, int bY, int bZ) {
if(!worldObj.isRemote && config.destroysWood &&
(worldObj.getBlock(bX, bY, bZ).getMaterial() == Material.wood ||
worldObj.getBlock(bX, bY, bZ).getMaterial() == Material.plants ||
worldObj.getBlock(bX, bY, bZ).getMaterial() == Material.glass ||
worldObj.getBlock(bX, bY, bZ).getMaterial() == Material.leaves))
worldObj.func_147480_a(bX, bY, bZ, false);
}
//for when a bullet dies by hitting an entity
private void onEntityImpact(Entity e) {
onEntityHurt(e);

View File

@ -55,6 +55,7 @@ public class BulletConfigSyncingUtil {
public static final int ROCKET_GLARE = 0x25;
public static final int ROCKET_SLEEK = 0x26;
public static final int ROCKET_NUKE = 0x27;
public static final int ROCKET_CHAINSAW = 0x28;
public static final int GRENADE_NORMAL = 0x30;
public static final int GRENADE_HE = 0x31;
@ -128,6 +129,7 @@ public class BulletConfigSyncingUtil {
configSet.add(new ConfigKeyPair(GunRocketFactory.getRocketGlareConfig(), ROCKET_GLARE));
configSet.add(new ConfigKeyPair(GunRocketFactory.getRocketSleekConfig(), ROCKET_SLEEK));
configSet.add(new ConfigKeyPair(GunRocketFactory.getRocketNukeConfig(), ROCKET_NUKE));
configSet.add(new ConfigKeyPair(GunRocketFactory.getRocketRPCConfig(), ROCKET_CHAINSAW));
configSet.add(new ConfigKeyPair(GunGrenadeFactory.getGrenadeConfig(), GRENADE_NORMAL));
configSet.add(new ConfigKeyPair(GunGrenadeFactory.getGrenadeHEConfig(), GRENADE_HE));

View File

@ -61,6 +61,7 @@ public class BulletConfiguration {
public int caustic;
public boolean boxcar;
public boolean boat;
public boolean destroysWood;
public boolean destroysBlocks;
public boolean instakill;

View File

@ -5,62 +5,65 @@ import java.util.Arrays;
public class FluidTypeHandler {
public enum FluidType {
NONE (0x888888, 8947848, 0, 1, 1, "hbmfluid.none"),
NONE (0x888888, 0, 1, 1, "hbmfluid.none"),
WATER (0x3333FF, 3355647, 1, 1, 1, "hbmfluid.water"),
STEAM (0xe5e5e5, 15066597, 9, 2, 1, "hbmfluid.steam"),
HOTSTEAM (0xE7D6D6, 0xE7D6D6, 1, 1, 2, "hbmfluid.hotsteam"),
SUPERHOTSTEAM (0xE7B7B7, 0xE7B7B7, 2, 1, 2, "hbmfluid.superhotsteam"),
COOLANT (0xd8fcff, 14220543, 2, 1, 1, "hbmfluid.coolant"),
WATER (0x3333FF, 1, 1, 1, "hbmfluid.water"),
STEAM (0xe5e5e5, 9, 2, 1, "hbmfluid.steam"),
HOTSTEAM (0xE7D6D6, 1, 1, 2, "hbmfluid.hotsteam"),
SUPERHOTSTEAM (0xE7B7B7, 2, 1, 2, "hbmfluid.superhotsteam"),
COOLANT (0xd8fcff, 2, 1, 1, "hbmfluid.coolant"),
LAVA (0xFF3300, 16724736, 3, 1, 1, "hbmfluid.lava"),
LAVA (0xFF3300, 3, 1, 1, "hbmfluid.lava"),
DEUTERIUM (0x0000FF, 255, 4, 1, 1, "hbmfluid.deuterium"),
TRITIUM (0x000099, 153, 5, 1, 1, "hbmfluid.tritium"),
DEUTERIUM (0x0000FF, 4, 1, 1, "hbmfluid.deuterium"),
TRITIUM (0x000099, 5, 1, 1, "hbmfluid.tritium"),
OIL (0x020202, 131586, 6, 1, 1, "hbmfluid.oil"),
HOTOIL (0x300900, 3148032, 8, 2, 1, "hbmfluid.hotoil"),
OIL (0x020202, 6, 1, 1, "hbmfluid.oil"),
HOTOIL (0x300900, 8, 2, 1, "hbmfluid.hotoil"),
HEAVYOIL (0x141312, 1315602, 2, 2, 1, "hbmfluid.heavyoil"),
BITUMEN (0x1f2426, 2040870, 3, 2, 1, "hbmfluid.bitumen"),
SMEAR (0x190f01, 1642241, 7, 1, 1, "hbmfluid.smear"),
HEATINGOIL (0x211806, 2168838, 4, 2, 1, "hbmfluid.heatingoil"),
HEAVYOIL (0x141312, 2, 2, 1, "hbmfluid.heavyoil"),
BITUMEN (0x1f2426, 3, 2, 1, "hbmfluid.bitumen"),
SMEAR (0x190f01, 7, 1, 1, "hbmfluid.smear"),
HEATINGOIL (0x211806, 4, 2, 1, "hbmfluid.heatingoil"),
RECLAIMED (0x332b22, 3353378, 8, 1, 1, "hbmfluid.reclaimed"),
PETROIL (0x44413d, 4473149, 9, 1, 1, "hbmfluid.petroil"),
RECLAIMED (0x332b22, 8, 1, 1, "hbmfluid.reclaimed"),
PETROIL (0x44413d, 9, 1, 1, "hbmfluid.petroil"),
LUBRICANT (0x606060, 6316128, 10, 1, 1, "hbmfluid.lubricant"),
LUBRICANT (0x606060, 10, 1, 1, "hbmfluid.lubricant"),
NAPHTHA (0x595744, 5855044, 5, 2, 1, "hbmfluid.naphtha"),
DIESEL (0xf2eed5, 15920853, 11, 1, 1, "hbmfluid.diesel"),
NAPHTHA (0x595744, 5, 2, 1, "hbmfluid.naphtha"),
DIESEL (0xf2eed5, 11, 1, 1, "hbmfluid.diesel"),
LIGHTOIL (0x8c7451, 9204817, 6, 2, 1, "hbmfluid.lightoil"),
KEROSENE (0xffa5d2, 16754130, 12, 1, 1, "hbmfluid.kerosene"),
LIGHTOIL (0x8c7451, 6, 2, 1, "hbmfluid.lightoil"),
KEROSENE (0xffa5d2, 12, 1, 1, "hbmfluid.kerosene"),
GAS (0xfffeed, 16776941, 13, 1, 1, "hbmfluid.gas"),
PETROLEUM (0x7cb7c9, 8173513, 7, 2, 1, "hbmfluid.petroleum"),
GAS (0xfffeed, 13, 1, 1, "hbmfluid.gas"),
PETROLEUM (0x7cb7c9, 7, 2, 1, "hbmfluid.petroleum"),
BIOGAS (0xbfd37c, 12571516, 12, 2, 1, "hbmfluid.biogas"),
BIOFUEL (0xeef274, 15659636, 13, 2, 1, "hbmfluid.biofuel"),
BIOGAS (0xbfd37c, 12, 2, 1, "hbmfluid.biogas"),
BIOFUEL (0xeef274, 13, 2, 1, "hbmfluid.biofuel"),
NITAN (0x8018ad, 8394925, 15, 2, 1, "hbmfluid.nitan"),
NITAN (0x8018ad, 15, 2, 1, "hbmfluid.nitan"),
UF6 (0xD1CEBE, 13749950, 14, 1, 1, "hbmfluid.uf6"),
PUF6 (0x4C4C4C, 5000268, 15, 1, 1, "hbmfluid.puf6"),
SAS3 (0x4ffffc, 5242876, 14, 2, 1, "hbmfluid.sas3"),
UF6 (0xD1CEBE, 14, 1, 1, "hbmfluid.uf6"),
PUF6 (0x4C4C4C, 15, 1, 1, "hbmfluid.puf6"),
SAS3 (0x4ffffc, 14, 2, 1, "hbmfluid.sas3"),
AMAT (0x010101, 65793, 0, 2, 1, "hbmfluid.amat"),
ASCHRAB (0xb50000, 11862016, 1, 2, 1, "hbmfluid.aschrab"),
AMAT (0x010101, 0, 2, 1, "hbmfluid.amat"),
ASCHRAB (0xb50000, 1, 2, 1, "hbmfluid.aschrab"),
ACID (0xfff7aa, 16775082, 10, 2, 1, "hbmfluid.acid"),
WATZ (0x86653E, 8807742, 11, 2, 1, "hbmfluid.watz"),
CRYOGEL (0x32ffff, 3342335, 0, 1, 2, "hbmfluid.cryogel");
ACID (0xfff7aa, 10, 2, 1, "hbmfluid.acid"),
WATZ (0x86653E, 11, 2, 1, "hbmfluid.watz"),
CRYOGEL (0x32ffff, 0, 1, 2, "hbmfluid.cryogel"),
HYDROGEN (0x4286f4, 3, 1, 2, "hbmfluid.hydrogen"),
OXYGEN (0x98bdf9, 4, 1, 2, "hbmfluid.oxygen"),
XENON (0xba45e8, 5, 1, 2, "hbmfluid.xenon"),
BALEFIRE (0x28e02e, 6, 1, 2, "hbmfluid.balefire");
//Approximate HEX Color of the fluid, used for pipe rendering
private int color;
//Converted MS Access color code, used for item rendering
private int msa;
//X position of the fluid on the sheet, the "row"
private int textureX;
//Y position of the fluid on the sheet, the "column"
@ -70,9 +73,8 @@ public class FluidTypeHandler {
//Unlocalized string ID of the fluid
private String name;
private FluidType(int color, int msa, int x, int y, int sheet, String name) {
private FluidType(int color, int x, int y, int sheet, String name) {
this.color = color;
this.msa = msa;
this.textureX = x;
this.textureY = y;
this.name = name;
@ -83,7 +85,7 @@ public class FluidTypeHandler {
return this.color;
}
public int getMSAColor() {
return this.msa;
return this.color;
}
public int textureX() {
return this.textureX;

View File

@ -77,6 +77,7 @@ public class GunConfiguration {
public static final String RSOUND_MAG = "hbm:weapon.magReload";
public static final String RSOUND_SHOTGUN = "hbm:weapon.shotgunReload";
public static final String RSOUND_LAUNCHER = "hbm:weapon.rpgReload";
public static final String RSOUND_GRENADE = "hbm:weapon.hkReload";
public GunConfiguration silenced() {
this.firingSound = "hbm:weapon.silencerShoot";

View File

@ -28,6 +28,8 @@ public class GunGrenadeFactory {
config.reloadType = GunConfiguration.RELOAD_SINGLE;
config.allowsInfinity = true;
config.crosshair = Crosshair.L_CIRCUMFLEX;
config.firingSound = "hbm:weapon.hkShoot";
config.reloadSound = GunConfiguration.RSOUND_GRENADE;
config.name = "Granatpistole HK69";
config.manufacturer = "Heckler & Koch";

View File

@ -43,6 +43,7 @@ public class GunRocketFactory {
config.config.add(BulletConfigSyncingUtil.ROCKET_GLARE);
config.config.add(BulletConfigSyncingUtil.ROCKET_SLEEK);
config.config.add(BulletConfigSyncingUtil.ROCKET_NUKE);
config.config.add(BulletConfigSyncingUtil.ROCKET_CHAINSAW);
config.durability = 140;
return config;
@ -62,6 +63,7 @@ public class GunRocketFactory {
config.config.add(BulletConfigSyncingUtil.ROCKET_EMP);
config.config.add(BulletConfigSyncingUtil.ROCKET_SLEEK);
config.config.add(BulletConfigSyncingUtil.ROCKET_NUKE);
config.config.add(BulletConfigSyncingUtil.ROCKET_CHAINSAW);
config.durability = 500;
return config;
@ -198,5 +200,26 @@ public class GunRocketFactory {
return bullet;
}
public static BulletConfiguration getRocketRPCConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig();
bullet.ammo = ModItems.ammo_rocket_rpc;
bullet.velocity = 3.0F;
bullet.dmgMin = 20;
bullet.dmgMax = 25;
bullet.wear = 15;
bullet.explosive = 0;
bullet.incendiary = 0;
bullet.trail = 8;
bullet.gravity = 0.000D;
bullet.ricochetAngle = 90;
bullet.LBRC = 100;
bullet.destroysWood = true;
bullet.doesPenetrate = true;
return bullet;
}
}

View File

@ -86,7 +86,7 @@ public class FluidTank {
if(slots[in] != null) {
inType = FluidContainerRegistry.getFluidType(slots[in]);
if(slots[in].getItem() == ModItems.fluid_barrel_infinite) {
if(slots[in].getItem() == ModItems.fluid_barrel_infinite && type != FluidType.NONE) {
this.fluid = this.maxFluid;
return;
}

View File

@ -2,6 +2,7 @@ package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.container.ContainerCompactLauncher;
import com.hbm.inventory.container.ContainerMachineMissileAssembly;
import com.hbm.items.weapon.ItemCustomMissile;
@ -25,11 +26,11 @@ import net.minecraft.util.ResourceLocation;
public class GUIMachineCompactLauncher extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_launch_table_small.png");
private TileEntityCompactLauncher assembler;
private TileEntityCompactLauncher launcher;
public GUIMachineCompactLauncher(InventoryPlayer invPlayer, TileEntityCompactLauncher tedf) {
super(new ContainerCompactLauncher(invPlayer, tedf));
assembler = tedf;
launcher = tedf;
this.xSize = 176;
this.ySize = 222;
@ -38,11 +39,16 @@ public class GUIMachineCompactLauncher extends GuiInfoContainer {
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
launcher.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 116, guiTop + 88 - 52, 16, 52);
launcher.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 88 - 52, 16, 52);
this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 88 - 52, 16, 52, new String[] { "Solid Fuel: " + launcher.solid + "l" });
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 113, 34, 6, launcher.power, launcher.maxPower);
}
@Override
protected void drawGuiContainerForegroundLayer( int i, int j) {
String name = this.assembler.hasCustomInventoryName() ? this.assembler.getInventoryName() : I18n.format(this.assembler.getInventoryName());
String name = this.launcher.hasCustomInventoryName() ? this.launcher.getInventoryName() : I18n.format(this.launcher.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);
@ -54,13 +60,46 @@ public class GUIMachineCompactLauncher extends GuiInfoContainer {
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int i = (int)launcher.getPowerScaled(34);
drawTexturedModalRect(guiLeft + 134, guiTop + 113, 176, 96, i, 6);
int j = (int)launcher.getSolidScaled(52);
drawTexturedModalRect(guiLeft + 152, guiTop + 88 - j, 176, 96 - j, 16, j);
if(launcher.isMissileValid())
drawTexturedModalRect(guiLeft + 25, guiTop + 35, 176, 26, 18, 18);
if(launcher.hasDesignator())
drawTexturedModalRect(guiLeft + 25, guiTop + 71, 176, 26, 18, 18);
if(launcher.liquidState() == 1)
drawTexturedModalRect(guiLeft + 121, guiTop + 23, 176, 0, 6, 8);
if(launcher.liquidState() == 0)
drawTexturedModalRect(guiLeft + 121, guiTop + 23, 182, 0, 6, 8);
if(launcher.oxidizerState() == 1)
drawTexturedModalRect(guiLeft + 139, guiTop + 23, 176, 0, 6, 8);
if(launcher.oxidizerState() == 0)
drawTexturedModalRect(guiLeft + 139, guiTop + 23, 182, 0, 6, 8);
if(launcher.solidState() == 1)
drawTexturedModalRect(guiLeft + 157, guiTop + 23, 176, 0, 6, 8);
if(launcher.solidState() == 0)
drawTexturedModalRect(guiLeft + 157, guiTop + 23, 182, 0, 6, 8);
Minecraft.getMinecraft().getTextureManager().bindTexture(launcher.tanks[0].getSheet());
launcher.tanks[0].renderTank(this, guiLeft + 116, guiTop + 88, launcher.tanks[0].getTankType().textureX() * FluidTank.x, launcher.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(launcher.tanks[1].getSheet());
launcher.tanks[1].renderTank(this, guiLeft + 134, guiTop + 88, launcher.tanks[1].getTankType().textureX() * FluidTank.x, launcher.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
/// DRAW MISSILE START
GL11.glPushMatrix();
MissileMultipart missile;
if(assembler.getStackInSlot(0) != null && assembler.getStackInSlot(0).getItem() instanceof ItemCustomMissile) {
ItemStack custom = assembler.getStackInSlot(0);
if(launcher.isMissileValid()) {
ItemStack custom = launcher.getStackInSlot(0);
missile = new MissileMultipart();

View File

@ -978,6 +978,7 @@ public class ModItems {
public static Item ammo_rocket_glare;
public static Item ammo_rocket_sleek;
public static Item ammo_rocket_nuclear;
public static Item ammo_rocket_rpc;
public static Item ammo_grenade;
public static Item ammo_grenade_he;
public static Item ammo_grenade_incendiary;
@ -2554,6 +2555,7 @@ public class ModItems {
ammo_rocket_glare = new ItemAmmo().setUnlocalizedName("ammo_rocket_glare").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_rocket_glare");
ammo_rocket_sleek = new ItemAmmo().setUnlocalizedName("ammo_rocket_sleek").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_rocket_sleek");
ammo_rocket_nuclear = new ItemAmmo().setUnlocalizedName("ammo_rocket_nuclear").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_rocket_nuclear");
ammo_rocket_rpc = new ItemAmmo().setUnlocalizedName("ammo_rocket_rpc").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_rocket_rpc");
ammo_grenade = new ItemAmmo().setUnlocalizedName("ammo_grenade").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_grenade");
ammo_grenade_he = new ItemAmmo().setUnlocalizedName("ammo_grenade_he").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_grenade_he");
ammo_grenade_incendiary = new ItemAmmo().setUnlocalizedName("ammo_grenade_incendiary").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_grenade_incendiary");
@ -4431,6 +4433,7 @@ public class ModItems {
GameRegistry.registerItem(ammo_rocket_glare, ammo_rocket_glare.getUnlocalizedName());
GameRegistry.registerItem(ammo_rocket_sleek, ammo_rocket_sleek.getUnlocalizedName());
GameRegistry.registerItem(ammo_rocket_nuclear, ammo_rocket_nuclear.getUnlocalizedName());
GameRegistry.registerItem(ammo_rocket_rpc, ammo_rocket_rpc.getUnlocalizedName());
GameRegistry.registerItem(ammo_grenade, ammo_grenade.getUnlocalizedName());
GameRegistry.registerItem(ammo_grenade_he, ammo_grenade_he.getUnlocalizedName());
GameRegistry.registerItem(ammo_grenade_incendiary, ammo_grenade_incendiary.getUnlocalizedName());

View File

@ -160,6 +160,13 @@ public class ItemAmmo extends Item {
list.add(EnumChatFormatting.RED + "- Very highly increased wear");
list.add(EnumChatFormatting.RED + "- Decreased projectile speed");
}
if(this == ModItems.ammo_rocket_rpc) {
list.add(EnumChatFormatting.BLUE + "+ Chainsaw");
list.add(EnumChatFormatting.BLUE + "+ Penetrating");
list.add(EnumChatFormatting.RED + "- Increased wear");
list.add(EnumChatFormatting.RED + "- Non-explosive");
list.add(EnumChatFormatting.YELLOW + "* Uhhhh");
}
//40mm GRENADES
if(this == ModItems.ammo_grenade_he) {

View File

@ -911,6 +911,11 @@ public class Library {
{
tileentity = worldObj.getTileEntity(((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetX, ((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetY, ((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetZ);
}
//Compact Launcher
if(block == ModBlocks.dummy_port_compact_launcher)
{
tileentity = worldObj.getTileEntity(((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetX, ((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetY, ((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetZ);
}
if(tileentity instanceof IConductor)
{
@ -1133,6 +1138,11 @@ public class Library {
{
tileentity = worldObj.getTileEntity(((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetX, ((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetY, ((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetZ);
}
//Compact Launcher
if(block == ModBlocks.dummy_port_compact_launcher)
{
tileentity = worldObj.getTileEntity(((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetX, ((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetY, ((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetZ);
}
if(tileentity == that)
tileentity = null;

View File

@ -24,6 +24,7 @@ import com.hbm.entity.mob.*;
import com.hbm.entity.particle.*;
import com.hbm.entity.projectile.*;
import com.hbm.items.ModItems;
import com.hbm.particle.ParticleContrail;
import com.hbm.render.block.*;
import com.hbm.render.entity.*;
import com.hbm.render.item.*;
@ -334,6 +335,8 @@ public class ClientProxy extends ServerProxy
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCoreReceiver.class, new RenderCoreComponent());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCoreInjector.class, new RenderCoreComponent());
RenderingRegistry.registerEntityRenderingHandler(EntityMissileCustom.class, new RenderMissileCustom());
RenderingRegistry.registerEntityRenderingHandler(EntityMissileGeneric.class, new RenderMissileGeneric());
RenderingRegistry.registerEntityRenderingHandler(EntityMissileAntiBallistic.class, new RenderMissileGeneric());
RenderingRegistry.registerEntityRenderingHandler(EntityMissileIncendiary.class, new RenderMissileGeneric());

View File

@ -669,6 +669,7 @@ public class MainRegistry
EntityRegistry.registerModEntity(EntityEMP.class, "entity_emp_logic", 136, this, 1000, 1, true);
EntityRegistry.registerModEntity(EntityWaterSplash.class, "entity_water_splash", 137, this, 1000, 1, true);
EntityRegistry.registerModEntity(EntityBobmazon.class, "entity_bobmazon_delivery", 138, this, 1000, 1, true);
EntityRegistry.registerModEntity(EntityMissileCustom.class, "entity_custom_missile", 139, this, 1000, 1, true);
EntityRegistry.registerGlobalEntityID(EntityNuclearCreeper.class, "entity_mob_nuclear_creeper", EntityRegistry.findGlobalUniqueEntityId(), 0x204131, 0x75CE00);
EntityRegistry.registerGlobalEntityID(EntityTaintedCreeper.class, "entity_mob_tainted_creeper", EntityRegistry.findGlobalUniqueEntityId(), 0x813b9b, 0xd71fdd);

View File

@ -297,6 +297,7 @@ public class ResourceManager {
//Boxcar
public static final IModelCustom boxcar = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/boxcar.obj"));
public static final IModelCustom duchessgambit = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/duchessgambit.obj"));
public static final IModelCustom rpc = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/rpc.obj"));
//Bomber
public static final IModelCustom dornier = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/dornier.obj"));
@ -363,6 +364,7 @@ public class ResourceManager {
//Boxcar
public static final ResourceLocation boxcar_tex = new ResourceLocation(RefStrings.MODID, "textures/models/boxcar.png");
public static final ResourceLocation duchessgambit_tex = new ResourceLocation(RefStrings.MODID, "textures/models/duchessgambit.png");
public static final ResourceLocation rpc_tex = new ResourceLocation(RefStrings.MODID, "textures/models/rpc.png");
//Bomber
public static final ResourceLocation dornier_0_tex = new ResourceLocation(RefStrings.MODID, "textures/models/dornier_0.png");

View File

@ -2,6 +2,7 @@ package com.hbm.packet;
import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.ISource;
import com.hbm.tileentity.bomb.TileEntityCompactLauncher;
import com.hbm.tileentity.bomb.TileEntityNukeCustom;
import com.hbm.tileentity.bomb.TileEntityNukeN45;
import com.hbm.tileentity.bomb.TileEntityTurretCIWS;
@ -236,6 +237,11 @@ public class AuxGaugePacket implements IMessage {
if(m.id == 6)
reactor.type = ReactorFuelType.getEnum(m.value);
}
if (te instanceof TileEntityCompactLauncher) {
TileEntityCompactLauncher launcher = (TileEntityCompactLauncher)te;
launcher.solid = m.value;
}
} catch (Exception x) {}
return null;

View File

@ -85,6 +85,8 @@ public class PacketDispatcher {
wrapper.registerMessage(AuxParticlePacket.Handler.class, AuxParticlePacket.class, i++, Side.CLIENT);
//Signals server to buy offer from bobmazon
wrapper.registerMessage(ItemBobmazonPacket.Handler.class, ItemBobmazonPacket.class, i++, Side.SERVER);
//Packet to send missile multipart information to TEs
wrapper.registerMessage(TEMissileMultipartPacket.Handler.class, TEMissileMultipartPacket.class, i++, Side.CLIENT);
}
}

View File

@ -0,0 +1,74 @@
package com.hbm.packet;
import com.hbm.main.MainRegistry;
import com.hbm.render.misc.MissileMultipart;
import com.hbm.tileentity.bomb.TileEntityCompactLauncher;
import com.hbm.tileentity.conductor.TileEntityFluidDuct;
import com.hbm.tileentity.machine.TileEntityMachineMissileAssembly;
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 io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
import net.minecraft.tileentity.TileEntity;
public class TEMissileMultipartPacket implements IMessage {
int x;
int y;
int z;
MissileMultipart missile;
public TEMissileMultipartPacket()
{
}
public TEMissileMultipartPacket(int x, int y, int z, MissileMultipart missile)
{
this.x = x;
this.y = y;
this.z = z;
this.missile = missile;
}
@Override
public void fromBytes(ByteBuf buf) {
x = buf.readInt();
y = buf.readInt();
z = buf.readInt();
missile = MissileMultipart.readFromByteBuffer(buf);
}
@Override
public void toBytes(ByteBuf buf) {
buf.writeInt(x);
buf.writeInt(y);
buf.writeInt(z);
missile.writeToByteBuffer(buf);
}
public static class Handler implements IMessageHandler<TEMissileMultipartPacket, IMessage> {
@Override
public IMessage onMessage(TEMissileMultipartPacket m, MessageContext ctx) {
TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(m.x, m.y, m.z);
if (te != null && te instanceof TileEntityCompactLauncher) {
TileEntityCompactLauncher launcher = (TileEntityCompactLauncher) te;
launcher.load = m.missile;
}
if (te != null && te instanceof TileEntityMachineMissileAssembly) {
TileEntityMachineMissileAssembly rack = (TileEntityMachineMissileAssembly) te;
rack.load = m.missile;
}
return null;
}
}
}

View File

@ -1,4 +1,4 @@
package com.hbm.entity.particle;
package com.hbm.particle;
import java.util.Random;
@ -65,7 +65,7 @@ public class ParticleContrail extends EntityFX {
p_70539_1_.startDrawingQuads();
this.particleRed = this.particleGreen = this.particleBlue = urandom.nextFloat() * 0.7F + 0.2F;
this.particleRed = this.particleGreen = this.particleBlue = urandom.nextFloat() * 0.1F + 0.2F;
p_70539_1_.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha);
p_70539_1_.setNormal(0.0F, 1.0F, 0.0F);

View File

@ -7,6 +7,7 @@ import org.lwjgl.opengl.GL11;
import com.hbm.entity.projectile.EntityBullet;
import com.hbm.handler.BulletConfiguration;
import com.hbm.lib.RefStrings;
import com.hbm.main.ResourceManager;
import com.hbm.render.model.ModelBuckshot;
import com.hbm.render.model.ModelBullet;
import com.hbm.render.model.ModelGrenade;
@ -42,7 +43,7 @@ public class RenderBullet extends Render {
0.0F, 0.0F, 1.0F);
GL11.glScalef(1.5F, 1.5F, 1.5F);
GL11.glRotatef(new Random(bullet.getEntityId()).nextInt(360), 1.0F, 0.0F, 0.0F);
GL11.glRotatef(new Random(bullet.getEntityId()).nextInt(90) - 45, 1.0F, 0.0F, 0.0F);
int style = bullet.getDataWatcher().getWatchableObjectByte(16);
int trail = bullet.getDataWatcher().getWatchableObjectByte(17);
@ -103,6 +104,14 @@ public class RenderBullet extends Render {
bindTexture(new ResourceLocation(RefStrings.MODID + ":textures/entity/ModelRocketNuclear.png")); break;
}
if(type == 8) {
bindTexture(ResourceManager.rpc_tex);
GL11.glScalef(0.25F, 0.25F, 0.25F);
GL11.glRotatef(180, 1, 0, 0);
ResourceManager.rpc.renderAll();
return;
}
rocket.renderAll(0.0625F);
}

View File

@ -0,0 +1,53 @@
package com.hbm.render.entity;
import org.lwjgl.opengl.GL11;
import com.hbm.entity.missile.EntityMissileAntiBallistic;
import com.hbm.entity.missile.EntityMissileBunkerBuster;
import com.hbm.entity.missile.EntityMissileCluster;
import com.hbm.entity.missile.EntityMissileGeneric;
import com.hbm.entity.missile.EntityMissileIncendiary;
import com.hbm.main.ResourceManager;
import com.hbm.render.misc.MissileMultipart;
import com.hbm.render.misc.MissilePart;
import com.hbm.render.misc.MissilePronter;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
public class RenderMissileCustom extends Render {
@Override
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_,
float p_76986_9_) {
GL11.glPushMatrix();
GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
GL11.glRotatef(p_76986_1_.prevRotationYaw + (p_76986_1_.rotationYaw - p_76986_1_.prevRotationYaw) * p_76986_9_ - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(p_76986_1_.prevRotationPitch + (p_76986_1_.rotationPitch - p_76986_1_.prevRotationPitch) * p_76986_9_, 0.0F, 0.0F, 1.0F);
int w = p_76986_1_.getDataWatcher().getWatchableObjectInt(9);
int f = p_76986_1_.getDataWatcher().getWatchableObjectInt(10);
int s = p_76986_1_.getDataWatcher().getWatchableObjectInt(11);
int t = p_76986_1_.getDataWatcher().getWatchableObjectInt(12);
MissileMultipart missile = new MissileMultipart();
missile.warhead = MissilePart.getPart(Item.getItemById(w));
missile.fuselage = MissilePart.getPart(Item.getItemById(f));
missile.fins = MissilePart.getPart(Item.getItemById(s));
missile.thruster = MissilePart.getPart(Item.getItemById(t));
MissilePronter.prontMissile(missile, Minecraft.getMinecraft().getTextureManager());
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
return ResourceManager.universal;
}
}

View File

@ -2,6 +2,9 @@ package com.hbm.render.misc;
import com.hbm.items.weapon.ItemMissile.PartType;
import io.netty.buffer.ByteBuf;
import net.minecraft.item.Item;
public class MissileMultipart {
public MissilePart warhead;
@ -22,4 +25,52 @@ public class MissileMultipart {
return height;
}
public void writeToByteBuffer(ByteBuf buf) {
if(warhead != null && warhead.type == PartType.WARHEAD)
buf.writeInt(Item.getIdFromItem(warhead.part));
else
buf.writeInt(0);
if(fuselage != null && fuselage.type == PartType.FUSELAGE)
buf.writeInt(Item.getIdFromItem(fuselage.part));
else
buf.writeInt(0);
if(fins != null && fins.type == PartType.FINS)
buf.writeInt(Item.getIdFromItem(fins.part));
else
buf.writeInt(0);
if(thruster != null && thruster.type == PartType.THRUSTER)
buf.writeInt(Item.getIdFromItem(thruster.part));
else
buf.writeInt(0);
}
public static MissileMultipart readFromByteBuffer(ByteBuf buf) {
MissileMultipart multipart = new MissileMultipart();
int w = buf.readInt();
int f = buf.readInt();
int s = buf.readInt();
int t = buf.readInt();
if(w != 0)
multipart.warhead = MissilePart.getPart(Item.getItemById(w));
if(f != 0)
multipart.fuselage = MissilePart.getPart(Item.getItemById(f));
if(s != 0)
multipart.fins = MissilePart.getPart(Item.getItemById(s));
if(t != 0)
multipart.thruster = MissilePart.getPart(Item.getItemById(t));
return multipart;
}
}

View File

@ -39,12 +39,13 @@ public class RenderCompactLauncher extends TileEntitySpecialRenderer {
MissileMultipart missile;
if(launcher.getStackInSlot(0) != null && launcher.getStackInSlot(0).getItem() instanceof ItemCustomMissile) {
ItemStack custom = launcher.getStackInSlot(0);
if(launcher.load != null) {
//ItemStack custom = launcher.getStackInSlot(0);
missile = ItemCustomMissile.getMultipart(custom);
//missile = ItemCustomMissile.getMultipart(custom);
MissilePronter.prontMissile(missile, Minecraft.getMinecraft().getTextureManager());
MissilePronter.prontMissile(launcher.load, Minecraft.getMinecraft().getTextureManager());
//
}
GL11.glPopMatrix();

View File

@ -46,49 +46,52 @@ public class RenderMissileAssembly extends TileEntitySpecialRenderer {
bindTexture(ResourceManager.missile_assembly_tex);
ResourceManager.missile_assembly.renderAll();
MissileMultipart missile = new MissileMultipart();
MissileMultipart missile = te.load;
if(te.getStackInSlot(1) != null)
missile.warhead = MissilePart.getPart(te.getStackInSlot(1).getItem());
if(missile != null) {
if(te.getStackInSlot(2) != null)
missile.fuselage = MissilePart.getPart(te.getStackInSlot(2).getItem());
if(te.getStackInSlot(3) != null)
missile.fins = MissilePart.getPart(te.getStackInSlot(3).getItem());
if(te.getStackInSlot(4) != null)
missile.thruster = MissilePart.getPart(te.getStackInSlot(4).getItem());
int range = (int) (missile.getHeight() / 2 - 1);
int step = 1;
if(range >= 2)
step = 2;
for(int i = -range; i <= range; i += step) {
if(i != 0) {
GL11.glTranslatef(i, 0F, 0F);
bindTexture(ResourceManager.strut_tex);
ResourceManager.strut.renderAll();
GL11.glTranslatef(-i, 0F, 0F);
if(te.getStackInSlot(1) != null)
missile.warhead = MissilePart.getPart(te.getStackInSlot(1).getItem());
if(te.getStackInSlot(2) != null)
missile.fuselage = MissilePart.getPart(te.getStackInSlot(2).getItem());
if(te.getStackInSlot(3) != null)
missile.fins = MissilePart.getPart(te.getStackInSlot(3).getItem());
if(te.getStackInSlot(4) != null)
missile.thruster = MissilePart.getPart(te.getStackInSlot(4).getItem());
int range = (int) (missile.getHeight() / 2 - 1);
int step = 1;
if(range >= 2)
step = 2;
for(int i = -range; i <= range; i += step) {
if(i != 0) {
GL11.glTranslatef(i, 0F, 0F);
bindTexture(ResourceManager.strut_tex);
ResourceManager.strut.renderAll();
GL11.glTranslatef(-i, 0F, 0F);
}
}
GL11.glTranslatef(0F, 1.5F, 0F);
GL11.glRotatef(180, 0F, 0F, 1F);
GL11.glTranslated(-missile.getHeight() / 2, 0, 0);
//GL11.glScaled(scale, scale, scale);
GL11.glRotatef(-90, 1, 0, 0);
GL11.glRotatef(-90, 0, 0, 1);
GL11.glScalef(1, 1, 1);
GL11.glEnable(GL11.GL_CULL_FACE);
MissilePronter.prontMissile(missile, Minecraft.getMinecraft().getTextureManager());
}
GL11.glTranslatef(0F, 1.5F, 0F);
GL11.glRotatef(180, 0F, 0F, 1F);
GL11.glTranslated(-missile.getHeight() / 2, 0, 0);
//GL11.glScaled(scale, scale, scale);
GL11.glRotatef(-90, 1, 0, 0);
GL11.glRotatef(-90, 0, 0, 1);
GL11.glScalef(1, 1, 1);
GL11.glEnable(GL11.GL_CULL_FACE);
MissilePronter.prontMissile(missile, Minecraft.getMinecraft().getTextureManager());
GL11.glPopMatrix();
}

View File

@ -1,9 +1,26 @@
package com.hbm.tileentity.bomb;
import java.util.ArrayList;
import java.util.List;
import com.hbm.entity.missile.EntityMissileCustom;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidContainer;
import com.hbm.inventory.FluidTank;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.ItemCustomMissile;
import com.hbm.items.weapon.ItemMissile;
import com.hbm.items.weapon.ItemMissile.FuelType;
import com.hbm.items.weapon.ItemMissile.PartSize;
import com.hbm.items.weapon.ItemMissile.PartType;
import com.hbm.lib.Library;
import com.hbm.packet.AuxElectricityPacket;
import com.hbm.packet.AuxGaugePacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.TEMissileMultipartPacket;
import com.hbm.render.misc.MissileMultipart;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -15,16 +32,27 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
public class TileEntityCompactLauncher extends TileEntity implements ISidedInventory {
public class TileEntityCompactLauncher extends TileEntity implements ISidedInventory, IConsumer, IFluidContainer, IFluidAcceptor {
private ItemStack slots[];
public long power;
public static final long maxPower = 100000;
public int solid;
public static final int maxSolid = 25000;
public FluidTank[] tanks;
public MissileMultipart load;
private static final int[] access = new int[] { 0 };
private String customName;
public TileEntityCompactLauncher() {
slots = new ItemStack[6];
tanks = new FluidTank[2];
tanks[0] = new FluidTank(FluidType.NONE, 25000, 0);
tanks[1] = new FluidTank(FluidType.NONE, 25000, 1);
}
@Override
@ -116,12 +144,215 @@ public class TileEntityCompactLauncher extends TileEntity implements ISidedInven
return null;
}
}
public long getPowerScaled(long i) {
return (power * i) / maxPower;
}
public int getSolidScaled(int i) {
return (solid * i) / maxSolid;
}
@Override
public void updateEntity() {
if (!worldObj.isRemote) {
updateTypes();
tanks[0].loadTank(2, 3, slots);
tanks[1].loadTank(2, 3, slots);
for (int i = 0; i < 2; i++)
tanks[i].updateTank(xCoord, yCoord, zCoord);
power = Library.chargeTEFromItems(slots, 5, power, maxPower);
if(slots[4] != null && slots[4].getItem() == ModItems.rocket_fuel && solid + 250 <= maxSolid) {
this.decrStackSize(4, 1);
solid += 250;
}
PacketDispatcher.wrapper.sendToAll(new AuxElectricityPacket(xCoord, yCoord, zCoord, power));
PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, solid, 0));
MissileMultipart multipart = getMultipart(slots[0]);
if(multipart != null)
PacketDispatcher.wrapper.sendToAll(new TEMissileMultipartPacket(xCoord, yCoord, zCoord, multipart));
else
PacketDispatcher.wrapper.sendToAll(new TEMissileMultipartPacket(xCoord, yCoord, zCoord, new MissileMultipart()));
if(power >= maxPower * 0.75 && isMissileValid() && hasDesignator() && hasFuel()) {
outer:
for(int x = -1; x <= 1; x++) {
for(int z = -1; z <= 1; z++) {
if(worldObj.isBlockIndirectlyGettingPowered(xCoord + x, yCoord, zCoord + z)) {
launch();
break outer;
}
}
}
}
}
}
private void launch() {
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:weapon.missileTakeOff", 10.0F, 1.0F);
int tX = slots[1].stackTagCompound.getInteger("xCoord");
int tZ = slots[1].stackTagCompound.getInteger("zCoord");
EntityMissileCustom missile = new EntityMissileCustom(worldObj, xCoord + 0.5F, yCoord + 2.5F, zCoord + 0.5F, tX, tZ, getMultipart(slots[0]));
worldObj.spawnEntityInWorld(missile);
slots[0] = null;
}
private boolean hasFuel() {
return solidState() != 0 && liquidState() != 0 && oxidizerState() != 0;
}
public static MissileMultipart getMultipart(ItemStack stack) {
return ItemCustomMissile.getMultipart(stack);
}
public boolean isMissileValid() {
MissileMultipart multipart = getMultipart(slots[0]);
if(multipart == null || multipart.fuselage == null)
return false;
ItemMissile fuselage = (ItemMissile)multipart.fuselage.part;
return fuselage.top == PartSize.SIZE_10;
}
public boolean hasDesignator() {
if(slots[1] != null) {
return (slots[1].getItem() == ModItems.designator || slots[1].getItem() == ModItems.designator_range || slots[1].getItem() == ModItems.designator_manual) && slots[1].hasTagCompound();
}
return false;
}
public int solidState() {
MissileMultipart multipart = getMultipart(slots[0]);
if(multipart == null || multipart.fuselage == null)
return -1;
ItemMissile fuselage = (ItemMissile)multipart.fuselage.part;
if((FuelType)fuselage.attributes[0] == FuelType.SOLID) {
if(solid >= (Float)fuselage.attributes[1])
return 1;
else
return 0;
}
return -1;
}
public int liquidState() {
MissileMultipart multipart = getMultipart(slots[0]);
if(multipart == null || multipart.fuselage == null)
return -1;
ItemMissile fuselage = (ItemMissile)multipart.fuselage.part;
switch((FuelType)fuselage.attributes[0]) {
case KEROSENE:
case HYDROGEN:
case XENON:
case BALEFIRE:
if(tanks[0].getFill() >= (Float)fuselage.attributes[1])
return 1;
else
return 0;
default: break;
}
return -1;
}
public int oxidizerState() {
MissileMultipart multipart = getMultipart(slots[0]);
if(multipart == null || multipart.fuselage == null)
return -1;
ItemMissile fuselage = (ItemMissile)multipart.fuselage.part;
switch((FuelType)fuselage.attributes[0]) {
case KEROSENE:
case HYDROGEN:
case BALEFIRE:
if(tanks[1].getFill() >= (Float)fuselage.attributes[1])
return 1;
else
return 0;
default: break;
}
return -1;
}
public void updateTypes() {
MissileMultipart multipart = getMultipart(slots[0]);
if(multipart == null || multipart.fuselage == null)
return;
ItemMissile fuselage = (ItemMissile)multipart.fuselage.part;
switch((FuelType)fuselage.attributes[0]) {
case KEROSENE:
tanks[0].setTankType(FluidType.KEROSENE);
tanks[1].setTankType(FluidType.ACID);
break;
case HYDROGEN:
tanks[0].setTankType(FluidType.HYDROGEN);
tanks[1].setTankType(FluidType.OXYGEN);
break;
case XENON:
tanks[0].setTankType(FluidType.XENON);
break;
case BALEFIRE:
tanks[0].setTankType(FluidType.BALEFIRE);
tanks[1].setTankType(FluidType.ACID);
break;
default: break;
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
NBTTagList list = nbt.getTagList("items", 10);
tanks[0].readFromNBT(nbt, "fuel");
tanks[1].readFromNBT(nbt, "oxidizer");
solid = nbt.getInteger("solidfuel");
power = nbt.getLong("power");
slots = new ItemStack[getSizeInventory()];
for (int i = 0; i < list.tagCount(); i++) {
@ -139,6 +370,11 @@ public class TileEntityCompactLauncher extends TileEntity implements ISidedInven
NBTTagList list = new NBTTagList();
tanks[0].writeToNBT(nbt, "fuel");
tanks[1].writeToNBT(nbt, "oxidizer");
nbt.setInteger("solidfuel", solid);
nbt.setLong("power", power);
for (int i = 0; i < slots.length; i++) {
if (slots[i] != null) {
NBTTagCompound nbt1 = new NBTTagCompound();
@ -164,6 +400,55 @@ public class TileEntityCompactLauncher extends TileEntity implements ISidedInven
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
return false;
}
@Override
public int getMaxFluidFill(FluidType type) {
if (type.name().equals(tanks[0].getTankType().name()))
return tanks[0].getMaxFill();
else if (type.name().equals(tanks[1].getTankType().name()))
return tanks[1].getMaxFill();
else
return 0;
}
@Override
public void setFillstate(int fill, int index) {
if (index < 2 && tanks[index] != null)
tanks[index].setFill(fill);
}
@Override
public void setFluidFill(int fill, FluidType type) {
if (type.name().equals(tanks[0].getTankType().name()))
tanks[0].setFill(fill);
else if (type.name().equals(tanks[1].getTankType().name()))
tanks[1].setFill(fill);
}
@Override
public void setType(FluidType type, int index) {
if (index < 2 && tanks[index] != null)
tanks[index].setTankType(type);
}
@Override
public List<FluidTank> getTanks() {
List<FluidTank> list = new ArrayList();
list.add(tanks[0]);
list.add(tanks[1]);
return list;
}
@Override
public int getFluidFill(FluidType type) {
if (type.name().equals(tanks[0].getTankType().name()))
return tanks[0].getFill();
else if (type.name().equals(tanks[1].getTankType().name()))
return tanks[1].getFill();
else
return 0;
}
@Override
public AxisAlignedBB getRenderBoundingBox() {
@ -176,4 +461,19 @@ public class TileEntityCompactLauncher extends TileEntity implements ISidedInven
{
return 65536.0D;
}
@Override
public void setPower(long i) {
this.power = i;
}
@Override
public long getPower() {
return this.power;
}
@Override
public long getMaxPower() {
return this.maxPower;
}
}

View File

@ -13,6 +13,10 @@ import com.hbm.items.weapon.ItemCustomMissile;
import com.hbm.items.weapon.ItemMissile;
import com.hbm.items.weapon.ItemMissile.FuelType;
import com.hbm.items.weapon.ItemMissile.PartType;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.TEMissileMultipartPacket;
import com.hbm.render.misc.MissileMultipart;
import com.hbm.render.misc.MissilePart;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -27,6 +31,8 @@ import net.minecraft.util.AxisAlignedBB;
public class TileEntityMachineMissileAssembly extends TileEntity implements ISidedInventory {
private ItemStack slots[];
public MissileMultipart load;
private static final int[] access = new int[] { 0 };
@ -174,6 +180,29 @@ public class TileEntityMachineMissileAssembly extends TileEntity implements ISid
return false;
}
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
MissileMultipart multipart = new MissileMultipart();
if(slots[1] != null)
multipart.warhead = MissilePart.getPart(slots[1].getItem());
if(slots[2] != null)
multipart.fuselage = MissilePart.getPart(slots[2].getItem());
if(slots[3] != null)
multipart.fins = MissilePart.getPart(slots[3].getItem());
if(slots[4] != null)
multipart.thruster = MissilePart.getPart(slots[4].getItem());
PacketDispatcher.wrapper.sendToAll(new TEMissileMultipartPacket(xCoord, yCoord, zCoord, multipart));
}
}
public int fuselageState() {
if(slots[2] != null && slots[2].getItem() instanceof ItemMissile) {