diff --git a/assets/hbm/lang/de_DE.lang b/assets/hbm/lang/de_DE.lang index 8e43c5506..d43af7e7f 100644 --- a/assets/hbm/lang/de_DE.lang +++ b/assets/hbm/lang/de_DE.lang @@ -1466,6 +1466,7 @@ item.ammo_50bmg_du.name=.50 BMG Patrone (DU) item.ammo_9mm.name=9mm Patrone item.ammo_9mm_ap.name=9mm Patrone (Panzerbrechend) item.ammo_9mm_du.name=9mm Patrone (DU) +item.ammo_9mm_rocket.name=9mm Rakete item.ammo_22lr.name=.22 LR Patrone item.ammo_22lr_ap.name=.22 LR Patrone (Panzerbrechend) item.ammo_folly_taint.name=Silbernes Geschoss (Original) @@ -1477,6 +1478,7 @@ item.ammo_44_ap.name=.44 Magnum Patrone (Panzerbrechend) item.ammo_44_du.name=.44 Magnum Patrone (DU) item.ammo_44_pip.name=.44 Magnum Patrone (Güterwagon) item.ammo_44_bj.name=.44 Magnum Patrone (Boot) +item.ammo_44_rocket.name=.44 Magnum Rakete item.ammo_rocket.name=84mm Rakete item.ammo_rocket_he.name=84mm Rakete (HE) item.ammo_rocket_incendiary.name=84mm Rakete (Brand) diff --git a/assets/hbm/lang/en_US.lang b/assets/hbm/lang/en_US.lang index 3d1fb033b..d49c40eb1 100644 --- a/assets/hbm/lang/en_US.lang +++ b/assets/hbm/lang/en_US.lang @@ -1466,6 +1466,7 @@ item.ammo_50bmg_du.name=.50 BMG Round (DU) item.ammo_9mm.name=9mm Round item.ammo_9mm_ap.name=9mm Round (Armor Piercing) item.ammo_9mm_du.name=9mm Round (DU) +item.ammo_9mm_rocket.name=9mm Rocket item.ammo_22lr.name=.22 LR Round item.ammo_22lr_ap.name=.22 LR Round (Armor Piercing) item.ammo_folly.name=Silver Bullet (Original) @@ -1477,6 +1478,7 @@ item.ammo_44_ap.name=.44 Magnum Bullet (Armor Piercing) item.ammo_44_du.name=.44 Magnum Bullet (DU) item.ammo_44_pip.name=.44 Magnum Bullet (Boxcar) item.ammo_44_bj.name=.44 Magnum Bullet (Boat) +item.ammo_44_rocket.name=.44 Magnum Rocket item.ammo_rocket.name=84mm Rocket item.ammo_rocket_he.name=84mm Rocket (HE) item.ammo_rocket_incendiary.name=84mm Rocket (Incendiary) diff --git a/assets/hbm/sounds.json b/assets/hbm/sounds.json index 5cceeb6b4..9908d4659 100644 --- a/assets/hbm/sounds.json +++ b/assets/hbm/sounds.json @@ -63,10 +63,12 @@ "weapon.osiprShoot": {"category": "player", "sounds": [{"name": "weapon/osiprShoot", "stream": false}]}, "weapon.osiprAltFire": {"category": "player", "sounds": [{"name": "weapon/osiprAltFire", "stream": false}]}, "weapon.osiprCharging": {"category": "player", "sounds": [{"name": "weapon/osiprCharging", "stream": false}]}, + "weapon.osiprReload": {"category": "player", "sounds": [{"name": "weapon/osiprReload", "stream": false}]}, "weapon.singFlyby": {"category": "player", "sounds": [{"name": "weapon/singFlyby", "stream": false}]}, "weapon.rifleShoot": {"category": "player", "sounds": [{"name": "weapon/rifleShoot", "stream": false}]}, "weapon.rpgShoot": {"category": "player", "sounds": [{"name": "weapon/rpgShoot", "stream": false}]}, "weapon.fatmanShoot": {"category": "player", "sounds": [{"name": "weapon/fatmanShoot", "stream": false}]}, + "weapon.fatmanReload": {"category": "player", "sounds": [{"name": "weapon/fatmanReload", "stream": false}]}, "weapon.zomgShoot": {"category": "player", "sounds": [{"name": "weapon/zomgShoot", "stream": false}]}, "weapon.flamethrowerIgnite": {"category": "player", "sounds": [{"name": "weapon/flamethrowerIgnite", "stream": false}]}, "weapon.flamethrowerShoot": {"category": "player", "sounds": [{"name": "weapon/flamethrowerShoot", "stream": false}]}, diff --git a/assets/hbm/sounds/weapon/fatmanReload.ogg b/assets/hbm/sounds/weapon/fatmanReload.ogg new file mode 100644 index 000000000..5ecf67ae0 Binary files /dev/null and b/assets/hbm/sounds/weapon/fatmanReload.ogg differ diff --git a/assets/hbm/sounds/weapon/magReload.ogg b/assets/hbm/sounds/weapon/magReload.ogg index e40f52d5e..fec4eedf8 100644 Binary files a/assets/hbm/sounds/weapon/magReload.ogg and b/assets/hbm/sounds/weapon/magReload.ogg differ diff --git a/assets/hbm/sounds/weapon/osiprReload.ogg b/assets/hbm/sounds/weapon/osiprReload.ogg new file mode 100644 index 000000000..a49fede16 Binary files /dev/null and b/assets/hbm/sounds/weapon/osiprReload.ogg differ diff --git a/assets/hbm/textures/gui/gui_launch_table.png b/assets/hbm/textures/gui/gui_launch_table.png index dd03ae32c..905ef3152 100644 Binary files a/assets/hbm/textures/gui/gui_launch_table.png and b/assets/hbm/textures/gui/gui_launch_table.png differ diff --git a/assets/hbm/textures/gui/gui_launch_table_small.png b/assets/hbm/textures/gui/gui_launch_table_small.png index 1d11f9e27..2a9736baf 100644 Binary files a/assets/hbm/textures/gui/gui_launch_table_small.png and b/assets/hbm/textures/gui/gui_launch_table_small.png differ diff --git a/assets/hbm/textures/gui/potions.png b/assets/hbm/textures/gui/potions.png index 46c14d1c6..87da40f5c 100644 Binary files a/assets/hbm/textures/gui/potions.png and b/assets/hbm/textures/gui/potions.png differ diff --git a/assets/hbm/textures/items/ammo_44_rocket.png b/assets/hbm/textures/items/ammo_44_rocket.png new file mode 100644 index 000000000..418125b2e Binary files /dev/null and b/assets/hbm/textures/items/ammo_44_rocket.png differ diff --git a/assets/hbm/textures/items/ammo_9mm_rocket.png b/assets/hbm/textures/items/ammo_9mm_rocket.png new file mode 100644 index 000000000..ad908fbe9 Binary files /dev/null and b/assets/hbm/textures/items/ammo_9mm_rocket.png differ diff --git a/assets/hbm/textures/items/wire_advanced_alloy_new.png b/assets/hbm/textures/items/wire_advanced_alloy_new.png new file mode 100644 index 000000000..48f8dfd97 Binary files /dev/null and b/assets/hbm/textures/items/wire_advanced_alloy_new.png differ diff --git a/assets/hbm/textures/items/wire_aluminium_new.png b/assets/hbm/textures/items/wire_aluminium_new.png new file mode 100644 index 000000000..3d2417498 Binary files /dev/null and b/assets/hbm/textures/items/wire_aluminium_new.png differ diff --git a/assets/hbm/textures/items/wire_blank.png b/assets/hbm/textures/items/wire_blank.png new file mode 100644 index 000000000..02d848f1f Binary files /dev/null and b/assets/hbm/textures/items/wire_blank.png differ diff --git a/assets/hbm/textures/items/wire_copper - Kopie.png b/assets/hbm/textures/items/wire_copper - Kopie.png deleted file mode 100644 index 1ec61204e..000000000 Binary files a/assets/hbm/textures/items/wire_copper - Kopie.png and /dev/null differ diff --git a/assets/hbm/textures/items/wire_copper_new.png b/assets/hbm/textures/items/wire_copper_new.png new file mode 100644 index 000000000..33dd16888 Binary files /dev/null and b/assets/hbm/textures/items/wire_copper_new.png differ diff --git a/assets/hbm/textures/items/wire_gold_new.png b/assets/hbm/textures/items/wire_gold_new.png new file mode 100644 index 000000000..de76cb172 Binary files /dev/null and b/assets/hbm/textures/items/wire_gold_new.png differ diff --git a/assets/hbm/textures/items/wire_magnetized_tungsten_new.png b/assets/hbm/textures/items/wire_magnetized_tungsten_new.png new file mode 100644 index 000000000..0b8c87d4e Binary files /dev/null and b/assets/hbm/textures/items/wire_magnetized_tungsten_new.png differ diff --git a/assets/hbm/textures/items/wire_red_copper_new.png b/assets/hbm/textures/items/wire_red_copper_new.png new file mode 100644 index 000000000..19eecd75e Binary files /dev/null and b/assets/hbm/textures/items/wire_red_copper_new.png differ diff --git a/assets/hbm/textures/items/wire_schrabidium_new.png b/assets/hbm/textures/items/wire_schrabidium_new.png new file mode 100644 index 000000000..15558c3c8 Binary files /dev/null and b/assets/hbm/textures/items/wire_schrabidium_new.png differ diff --git a/assets/hbm/textures/items/wire_tungsten_new.png b/assets/hbm/textures/items/wire_tungsten_new.png new file mode 100644 index 000000000..2c21fc45c Binary files /dev/null and b/assets/hbm/textures/items/wire_tungsten_new.png differ diff --git a/com/hbm/blocks/ModBlocks.java b/com/hbm/blocks/ModBlocks.java index 2f8a1a741..26cc18359 100644 --- a/com/hbm/blocks/ModBlocks.java +++ b/com/hbm/blocks/ModBlocks.java @@ -551,7 +551,7 @@ public class ModBlocks { public static final int guiID_launch_table = 84; public static Block soyuz_launcher; - public static final int guiID_soyuz_launcher = 85; + public static final int guiID_soyuz_launcher = 86; public static Block machine_radar; public static final int guiID_radar = 59; diff --git a/com/hbm/entity/projectile/EntityBulletBase.java b/com/hbm/entity/projectile/EntityBulletBase.java index c761f5432..0677caf8d 100644 --- a/com/hbm/entity/projectile/EntityBulletBase.java +++ b/com/hbm/entity/projectile/EntityBulletBase.java @@ -346,6 +346,12 @@ public class EntityBulletBase extends Entity implements IProjectile { if(this.ticksExisted > config.maxAge) this.setDead(); + + if(worldObj.isRemote && !config.vPFX.isEmpty()) { + for (i = 0; i < 8; ++i) { + this.worldObj.spawnParticle(config.vPFX, this.posX - this.motionX * i / 1.0D, this.posY - this.motionY * i / 1.0D, this.posZ - this.motionZ * i / 1.0D, 0, 0, 0); + } + } //this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; //this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; @@ -354,6 +360,9 @@ public class EntityBulletBase extends Entity implements IProjectile { //for when a bullet dies by hitting a block private void onBlockImpact(int bX, int bY, int bZ) { + if(config.bImpact != null) + config.bImpact.behaveBlockHit(this, bX, bY, bZ); + if(!worldObj.isRemote) this.setDead(); @@ -453,13 +462,8 @@ 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); - + if(config.bRicochet != null) + config.bRicochet.behaveBlockRicochet(this, bX, bY, bZ); } //for when a bullet dies by hitting an entity @@ -467,6 +471,9 @@ public class EntityBulletBase extends Entity implements IProjectile { onEntityHurt(e); onBlockImpact(-1, -1, -1); + if(config.bHit != null) + config.bHit.behaveEntityHit(this, e); + if(config.boxcar && !worldObj.isRemote) { EntityBoxcar pippo = new EntityBoxcar(worldObj); pippo.posX = e.posX; @@ -505,6 +512,9 @@ public class EntityBulletBase extends Entity implements IProjectile { //for when a bullet hurts an entity, not necessarily dying private void onEntityHurt(Entity e) { + if(config.bHurt != null) + config.bHurt.behaveEntityHurt(this, e); + if(config.incendiary > 0 && !worldObj.isRemote) { e.setFire(config.incendiary); } diff --git a/com/hbm/handler/BulletConfigSyncingUtil.java b/com/hbm/handler/BulletConfigSyncingUtil.java index d67a560eb..2e8f815c8 100644 --- a/com/hbm/handler/BulletConfigSyncingUtil.java +++ b/com/hbm/handler/BulletConfigSyncingUtil.java @@ -80,10 +80,12 @@ public class BulletConfigSyncingUtil { public static final int M44_DU = 0x62; public static final int M44_PIP = 0x63; public static final int M44_BJ = 0x64; + public static final int M44_ROCKET = 0x65; public static final int P9_NORMAL = 0x70; public static final int P9_AP = 0x71; public static final int P9_DU = 0x72; + public static final int P9_ROCKET = 0x73; public static final int BMG50_NORMAL = 0x80; public static final int BMG50_INCENDIARY = 0x81; @@ -100,6 +102,23 @@ public class BulletConfigSyncingUtil { public static final int AE50_NORMAL = 0xA0; public static final int AE50_AP = 0xA1; public static final int AE50_DU = 0xA2; + + public static final int SPECIAL_OSIPR = 0xB0; + public static final int SPECIAL_GAUSS = 0xB1; + public static final int SPECIAL_GAUSS_CHARGED = 0xB2; + + public static final int G20_NORMAL_FIRE = 0xC0; + public static final int G20_SLUG_FIRE = 0xC1; + public static final int G20_FLECHETTE_FIRE = 0xC2; + public static final int G20_EXPLOSIVE_FIRE = 0xC3; + public static final int G20_CAUSTIC_FIRE = 0xC4; + public static final int G20_SHOCK_FIRE = 0xC5; + public static final int G20_WITHER_FIRE = 0xC6; + + public static final int NUKE_NORMAL = 0xD0; + public static final int NUKE_MIRV = 0xD1; + public static final int NUKE_AMAT = 0xD2; + public static final int NUKE_PROTO = 0xD3; public static void loadConfigsForSync() { @@ -158,10 +177,12 @@ public class BulletConfigSyncingUtil { configSet.add(new ConfigKeyPair(Gun44MagnumFactory.getNoPipDUConfig(), M44_DU)); configSet.add(new ConfigKeyPair(Gun44MagnumFactory.getPipConfig(), M44_PIP)); configSet.add(new ConfigKeyPair(Gun44MagnumFactory.getBJConfig(), M44_BJ)); + configSet.add(new ConfigKeyPair(Gun44MagnumFactory.getRocketConfig(), M44_ROCKET)); configSet.add(new ConfigKeyPair(Gun9mmFactory.get9mmConfig(), P9_NORMAL)); configSet.add(new ConfigKeyPair(Gun9mmFactory.get9mmAPConfig(), P9_AP)); configSet.add(new ConfigKeyPair(Gun9mmFactory.get9mmDUConfig(), P9_DU)); + configSet.add(new ConfigKeyPair(Gun9mmFactory.get9mmRocketConfig(), P9_ROCKET)); configSet.add(new ConfigKeyPair(Gun50BMGFactory.get50BMGConfig(), BMG50_NORMAL)); configSet.add(new ConfigKeyPair(Gun50BMGFactory.get50BMGFireConfig(), BMG50_INCENDIARY)); @@ -178,6 +199,21 @@ public class BulletConfigSyncingUtil { configSet.add(new ConfigKeyPair(Gun50AEFactory.get50AEConfig(), AE50_NORMAL)); configSet.add(new ConfigKeyPair(Gun50AEFactory.get50APConfig(), AE50_AP)); configSet.add(new ConfigKeyPair(Gun50AEFactory.get50DUConfig(), AE50_DU)); + + configSet.add(new ConfigKeyPair(GunOSIPRFactory.getPulseConfig(), SPECIAL_OSIPR)); + configSet.add(new ConfigKeyPair(GunGaussFactory.getGaussConfig(), SPECIAL_GAUSS)); + configSet.add(new ConfigKeyPair(GunGaussFactory.getAltConfig(), SPECIAL_GAUSS_CHARGED)); + + configSet.add(new ConfigKeyPair(Gun20GaugeFactory.get20GaugeConfig().setToFire(3), G20_NORMAL_FIRE)); + configSet.add(new ConfigKeyPair(Gun20GaugeFactory.get20GaugeSlugConfig().setToFire(3), G20_SLUG_FIRE)); + configSet.add(new ConfigKeyPair(Gun20GaugeFactory.get20GaugeFlechetteConfig().setToFire(3), G20_FLECHETTE_FIRE)); + configSet.add(new ConfigKeyPair(Gun20GaugeFactory.get20GaugeExplosiveConfig().setToFire(3), G20_EXPLOSIVE_FIRE)); + configSet.add(new ConfigKeyPair(Gun20GaugeFactory.get20GaugeCausticConfig().setToFire(3), G20_CAUSTIC_FIRE)); + configSet.add(new ConfigKeyPair(Gun20GaugeFactory.get20GaugeShockConfig().setToFire(3), G20_SHOCK_FIRE)); + configSet.add(new ConfigKeyPair(Gun20GaugeFactory.get20GaugeWitherConfig().setToFire(3), G20_WITHER_FIRE)); + + configSet.add(new ConfigKeyPair(GunFatmanFactory.getNukeConfig(), NUKE_NORMAL)); + configSet.add(new ConfigKeyPair(GunFatmanFactory.getNukeProtoConfig(), NUKE_PROTO)); } public static BulletConfiguration pullConfig(int key) { diff --git a/com/hbm/handler/BulletConfiguration.java b/com/hbm/handler/BulletConfiguration.java index 4c583d3e6..b8aa24040 100644 --- a/com/hbm/handler/BulletConfiguration.java +++ b/com/hbm/handler/BulletConfiguration.java @@ -2,6 +2,11 @@ package com.hbm.handler; import java.util.List; +import com.hbm.interfaces.IBulletHitBehavior; +import com.hbm.interfaces.IBulletHurtBehavior; +import com.hbm.interfaces.IBulletImpactBehavior; +import com.hbm.interfaces.IBulletRicochetBehavior; + import net.minecraft.item.Item; import net.minecraft.potion.PotionEffect; @@ -62,9 +67,12 @@ public class BulletConfiguration { public int caustic; public boolean boxcar; public boolean boat; - public boolean destroysWood; public boolean destroysBlocks; public boolean instakill; + public IBulletHurtBehavior bHurt; + public IBulletHitBehavior bHit; + public IBulletRicochetBehavior bRicochet; + public IBulletImpactBehavior bImpact; //appearance public int style; @@ -72,6 +80,8 @@ public class BulletConfiguration { public int trail; //ricochet sound type public int plink; + //vanilla particle FX + public String vPFX = ""; public static final int STYLE_NORMAL = 0; public static final int STYLE_FLECHETTE = 1; @@ -83,6 +93,7 @@ public class BulletConfiguration { public static final int STYLE_NUKE = 7; public static final int STYLE_MIRV = 8; public static final int STYLE_GRENADE = 9; + public static final int STYLE_BF = 10; public static final int PLINK_NONE = 0; public static final int PLINK_BULLET = 1; diff --git a/com/hbm/handler/GUIHandler.java b/com/hbm/handler/GUIHandler.java index d971b7a92..86bd81bd6 100644 --- a/com/hbm/handler/GUIHandler.java +++ b/com/hbm/handler/GUIHandler.java @@ -769,6 +769,15 @@ public class GUIHandler implements IGuiHandler { } return null; } + + case ModBlocks.guiID_soyuz_launcher: + { + if(entity instanceof TileEntitySoyuzLauncher) + { + return new ContainerSoyuzLauncher(player.inventory, (TileEntitySoyuzLauncher) entity); + } + return null; + } } } else { //NON-TE CONTAINERS @@ -1536,6 +1545,15 @@ public class GUIHandler implements IGuiHandler { } return null; } + + case ModBlocks.guiID_soyuz_launcher: + { + if(entity instanceof TileEntitySoyuzLauncher) + { + return new GUISoyuzLauncher(player.inventory, (TileEntitySoyuzLauncher) entity); + } + return null; + } } } else { //CLIENTONLY GUIS diff --git a/com/hbm/handler/GunConfiguration.java b/com/hbm/handler/GunConfiguration.java index 436267874..0f96c4bb9 100644 --- a/com/hbm/handler/GunConfiguration.java +++ b/com/hbm/handler/GunConfiguration.java @@ -22,7 +22,7 @@ public class GunConfiguration { public int gunMode; //0 = manual, 1 = automatic public int firingMode; - //weapon won't fire after weapon breaks + //weapon won't fire after weapon breaks (main only) public int durability; //whether or not there is a reload delay animation @@ -46,6 +46,8 @@ public class GunConfiguration { //sound path to the shooting sound public String firingSound = ""; public float firingPitch = 1.0F; + //whether the reload sound should be played at the beginning or at the end of the reload + public boolean reloadSoundEnd = true; //how much ammo the clip can hold, 0 if drawn from inventory public int ammoCap; @@ -80,6 +82,7 @@ public class GunConfiguration { 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 static final String RSOUND_FATMAN = "hbm:weapon.fatmanReload"; public GunConfiguration silenced() { this.firingSound = "hbm:weapon.silencerShoot"; diff --git a/com/hbm/handler/guncfg/BulletConfigFactory.java b/com/hbm/handler/guncfg/BulletConfigFactory.java index 55a0c9362..dada1c63b 100644 --- a/com/hbm/handler/guncfg/BulletConfigFactory.java +++ b/com/hbm/handler/guncfg/BulletConfigFactory.java @@ -142,5 +142,32 @@ public class BulletConfigFactory { return bullet; } + + public static BulletConfiguration standardNukeConfig() { + + BulletConfiguration bullet = new BulletConfiguration(); + + bullet.velocity = 3.0F; + bullet.spread = 0.005F; + bullet.wear = 10; + bullet.bulletsMin = 1; + bullet.bulletsMax = 1; + bullet.dmgMin = 1000; + bullet.dmgMax = 1000; + bullet.gravity = 0.025D; + bullet.maxAge = 300; + bullet.doesRicochet = false; + bullet.ricochetAngle = 0; + bullet.HBRC = 0; + bullet.LBRC = 0; + bullet.bounceMod = 1.0; + bullet.doesPenetrate = false; + bullet.doesBreakGlass = false; + bullet.nuke = 35; + bullet.style = BulletConfiguration.STYLE_NUKE; + bullet.plink = BulletConfiguration.PLINK_GRENADE; + + return bullet; + } } diff --git a/com/hbm/handler/guncfg/Gun20GaugeFactory.java b/com/hbm/handler/guncfg/Gun20GaugeFactory.java index f4a54d459..caa4d0678 100644 --- a/com/hbm/handler/guncfg/Gun20GaugeFactory.java +++ b/com/hbm/handler/guncfg/Gun20GaugeFactory.java @@ -149,6 +149,32 @@ public class Gun20GaugeFactory { return config; } + public static GunConfiguration getBoltSaturniteConfig() { + + GunConfiguration config = getShotgunConfig(); + + config.ammoCap = 1; + config.durability = 4000; + config.reloadSound = GunConfiguration.RSOUND_SHOTGUN; + config.firingSound = "hbm:weapon.revolverShoot"; + config.firingPitch = 0.75F; + + config.name = "Winchester Model 20 D-25A"; + config.manufacturer = "Winchester Repeating Arms Company / Big MT"; + + config.config = new ArrayList(); + config.config.add(BulletConfigSyncingUtil.G20_SLUG_FIRE); + config.config.add(BulletConfigSyncingUtil.G20_NORMAL_FIRE); + config.config.add(BulletConfigSyncingUtil.G20_FLECHETTE_FIRE); + config.config.add(BulletConfigSyncingUtil.G20_FIRE); + config.config.add(BulletConfigSyncingUtil.G20_EXPLOSIVE_FIRE); + config.config.add(BulletConfigSyncingUtil.G20_CAUSTIC_FIRE); + config.config.add(BulletConfigSyncingUtil.G20_SHOCK_FIRE); + config.config.add(BulletConfigSyncingUtil.G20_WITHER_FIRE); + + return config; + } + public static BulletConfiguration get20GaugeConfig() { BulletConfiguration bullet = BulletConfigFactory.standardBuckshotConfig(); diff --git a/com/hbm/handler/guncfg/Gun22LRFactory.java b/com/hbm/handler/guncfg/Gun22LRFactory.java index 83210888e..139b97d27 100644 --- a/com/hbm/handler/guncfg/Gun22LRFactory.java +++ b/com/hbm/handler/guncfg/Gun22LRFactory.java @@ -31,6 +31,7 @@ public class Gun22LRFactory { config.durability = 3000; config.reloadSound = GunConfiguration.RSOUND_MAG; config.firingSound = "hbm:weapon.uziShoot"; + config.reloadSoundEnd = false; config.name = "IMI Uzi"; config.manufacturer = "Israel Military Industries"; diff --git a/com/hbm/handler/guncfg/Gun357MagnumFactory.java b/com/hbm/handler/guncfg/Gun357MagnumFactory.java index e268ead00..f7d48c57a 100644 --- a/com/hbm/handler/guncfg/Gun357MagnumFactory.java +++ b/com/hbm/handler/guncfg/Gun357MagnumFactory.java @@ -33,6 +33,7 @@ public class Gun357MagnumFactory { config.crosshair = Crosshair.L_CLASSIC; config.reloadSound = GunConfiguration.RSOUND_REVOLVER; config.firingSound = "hbm:weapon.revolverShoot"; + config.reloadSoundEnd = false; return config; } diff --git a/com/hbm/handler/guncfg/Gun44MagnumFactory.java b/com/hbm/handler/guncfg/Gun44MagnumFactory.java index 269659260..5d45a2ba7 100644 --- a/com/hbm/handler/guncfg/Gun44MagnumFactory.java +++ b/com/hbm/handler/guncfg/Gun44MagnumFactory.java @@ -30,6 +30,7 @@ public class Gun44MagnumFactory { config.crosshair = Crosshair.L_CLASSIC; config.reloadSound = GunConfiguration.RSOUND_REVOLVER; config.firingSound = "hbm:weapon.revolverShootAlt"; + config.reloadSoundEnd = false; return config; } @@ -47,6 +48,7 @@ public class Gun44MagnumFactory { config.config.add(BulletConfigSyncingUtil.M44_NORMAL); config.config.add(BulletConfigSyncingUtil.M44_AP); config.config.add(BulletConfigSyncingUtil.M44_DU); + config.config.add(BulletConfigSyncingUtil.M44_ROCKET); return config; } @@ -65,6 +67,7 @@ public class Gun44MagnumFactory { config.config.add(BulletConfigSyncingUtil.M44_NORMAL); config.config.add(BulletConfigSyncingUtil.M44_AP); config.config.add(BulletConfigSyncingUtil.M44_DU); + config.config.add(BulletConfigSyncingUtil.M44_ROCKET); return config; } @@ -84,6 +87,7 @@ public class Gun44MagnumFactory { config.config.add(BulletConfigSyncingUtil.M44_NORMAL); config.config.add(BulletConfigSyncingUtil.M44_AP); config.config.add(BulletConfigSyncingUtil.M44_DU); + config.config.add(BulletConfigSyncingUtil.M44_ROCKET); return config; } @@ -104,6 +108,7 @@ public class Gun44MagnumFactory { config.config.add(BulletConfigSyncingUtil.M44_DU); config.config.add(BulletConfigSyncingUtil.M44_PIP); config.config.add(BulletConfigSyncingUtil.M44_BJ); + config.config.add(BulletConfigSyncingUtil.M44_ROCKET); return config; } @@ -172,5 +177,17 @@ public class Gun44MagnumFactory { return bullet; } + + public static BulletConfiguration getRocketConfig() { + + BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig(); + + bullet.ammo = ModItems.ammo_44_rocket; + bullet.velocity = 5; + bullet.explosive = 15F; + bullet.trail = 1; + + return bullet; + } } diff --git a/com/hbm/handler/guncfg/Gun50AEFactory.java b/com/hbm/handler/guncfg/Gun50AEFactory.java index c54272684..12102faa4 100644 --- a/com/hbm/handler/guncfg/Gun50AEFactory.java +++ b/com/hbm/handler/guncfg/Gun50AEFactory.java @@ -30,6 +30,7 @@ public class Gun50AEFactory { config.crosshair = Crosshair.L_CLASSIC; config.reloadSound = GunConfiguration.RSOUND_REVOLVER; config.firingSound = "hbm:weapon.revolverShootAlt"; + config.reloadSoundEnd = false; return config; } @@ -41,7 +42,7 @@ public class Gun50AEFactory { config.durability = 2500; config.name = "IMI Desert Eagle"; - config.manufacturer = " Magnum Research / Israel Military Industries"; + config.manufacturer = "Magnum Research / Israel Military Industries"; config.config = new ArrayList(); config.config.add(BulletConfigSyncingUtil.AE50_NORMAL); diff --git a/com/hbm/handler/guncfg/Gun50BMGFactory.java b/com/hbm/handler/guncfg/Gun50BMGFactory.java index 53f1a56be..71746649a 100644 --- a/com/hbm/handler/guncfg/Gun50BMGFactory.java +++ b/com/hbm/handler/guncfg/Gun50BMGFactory.java @@ -31,6 +31,7 @@ public class Gun50BMGFactory { config.durability = 2000; config.reloadSound = GunConfiguration.RSOUND_MAG; config.firingSound = "hbm:weapon.calShoot"; + config.reloadSoundEnd = false; config.name = "Maxim gun"; config.manufacturer = "Hiram Maxim"; diff --git a/com/hbm/handler/guncfg/Gun9mmFactory.java b/com/hbm/handler/guncfg/Gun9mmFactory.java index ed1b68ded..f8ed6eedd 100644 --- a/com/hbm/handler/guncfg/Gun9mmFactory.java +++ b/com/hbm/handler/guncfg/Gun9mmFactory.java @@ -31,6 +31,7 @@ public class Gun9mmFactory { config.durability = 2500; config.reloadSound = GunConfiguration.RSOUND_MAG; config.firingSound = "hbm:weapon.rifleShoot"; + config.reloadSoundEnd = false; config.name = "Maschinenpistole 40"; config.manufacturer = "Erfurter Maschinenfabrik Geipel"; @@ -39,6 +40,7 @@ public class Gun9mmFactory { config.config.add(BulletConfigSyncingUtil.P9_NORMAL); config.config.add(BulletConfigSyncingUtil.P9_AP); config.config.add(BulletConfigSyncingUtil.P9_DU); + config.config.add(BulletConfigSyncingUtil.P9_ROCKET); return config; } @@ -83,5 +85,17 @@ public class Gun9mmFactory { return bullet; } + + public static BulletConfiguration get9mmRocketConfig() { + + BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig(); + + bullet.ammo = ModItems.ammo_9mm_rocket; + bullet.velocity = 5; + bullet.explosive = 7.5F; + bullet.trail = 5; + + return bullet; + } } diff --git a/com/hbm/handler/guncfg/GunFatmanFactory.java b/com/hbm/handler/guncfg/GunFatmanFactory.java new file mode 100644 index 000000000..1e3b7f8b0 --- /dev/null +++ b/com/hbm/handler/guncfg/GunFatmanFactory.java @@ -0,0 +1,114 @@ +package com.hbm.handler.guncfg; + +import java.util.ArrayList; + +import com.hbm.handler.BulletConfigSyncingUtil; +import com.hbm.handler.BulletConfiguration; +import com.hbm.handler.GunConfiguration; +import com.hbm.items.ModItems; +import com.hbm.render.misc.RenderScreenOverlay.Crosshair; + +public class GunFatmanFactory { + + public static GunConfiguration getFatmanConfig() { + + GunConfiguration config = new GunConfiguration(); + + config.rateOfFire = 20; + config.roundsPerCycle = 1; + config.gunMode = GunConfiguration.MODE_NORMAL; + config.firingMode = GunConfiguration.FIRE_MANUAL; + config.hasReloadAnim = false; + config.hasFiringAnim = false; + config.hasSpinup = false; + config.hasSpindown = false; + config.reloadDuration = 120; + config.firingDuration = 0; + config.ammoCap = 1; + config.reloadType = GunConfiguration.RELOAD_FULL; + config.allowsInfinity = true; + config.crosshair = Crosshair.L_CIRCUMFLEX; + config.firingSound = "hbm:weapon.fatmanShoot"; + config.reloadSound = GunConfiguration.RSOUND_FATMAN; + config.reloadSoundEnd = false; + + config.name = "M-42 Tactical Nuclear Catapult"; + config.manufacturer = "Fort Strong"; + + config.config = new ArrayList(); + config.config.add(BulletConfigSyncingUtil.NUKE_NORMAL); + config.durability = 1000; + + return config; + } + + public static GunConfiguration getProtoConfig() { + + GunConfiguration config = new GunConfiguration(); + + config.rateOfFire = 20; + config.roundsPerCycle = 8; + config.gunMode = GunConfiguration.MODE_NORMAL; + config.firingMode = GunConfiguration.FIRE_MANUAL; + config.hasReloadAnim = false; + config.hasFiringAnim = false; + config.hasSpinup = false; + config.hasSpindown = false; + config.reloadDuration = 120; + config.firingDuration = 0; + config.ammoCap = 8; + config.reloadType = GunConfiguration.RELOAD_FULL; + config.allowsInfinity = true; + config.crosshair = Crosshair.L_CIRCUMFLEX; + config.firingSound = "hbm:weapon.fatmanShoot"; + config.reloadSound = GunConfiguration.RSOUND_FATMAN; + config.reloadSoundEnd = false; + + config.name = "M-42 Tactical Nuclear Catapult"; + config.manufacturer = "Fort Strong"; + + config.config = new ArrayList(); + config.config.add(BulletConfigSyncingUtil.NUKE_PROTO); + config.durability = 1000; + + return config; + } + + public static BulletConfiguration getNukeConfig() { + + BulletConfiguration bullet = BulletConfigFactory.standardNukeConfig(); + + bullet.ammo = ModItems.gun_fatman_ammo; + + return bullet; + } + + public static BulletConfiguration getNukeProtoConfig() { + + BulletConfiguration bullet = BulletConfigFactory.standardNukeConfig(); + + bullet.spread = 0.1F; + bullet.ammo = ModItems.gun_fatman_ammo; + + return bullet; + } + + public static BulletConfiguration getMirvConfig() { + + BulletConfiguration bullet = BulletConfigFactory.standardNukeConfig(); + + bullet.ammo = ModItems.gun_mirv_ammo; + + return bullet; + } + + public static BulletConfiguration getBalefireConfig() { + + BulletConfiguration bullet = BulletConfigFactory.standardNukeConfig(); + + bullet.ammo = ModItems.gun_bf_ammo; + + return bullet; + } + +} diff --git a/com/hbm/handler/guncfg/GunGaussFactory.java b/com/hbm/handler/guncfg/GunGaussFactory.java new file mode 100644 index 000000000..f3a42a69b --- /dev/null +++ b/com/hbm/handler/guncfg/GunGaussFactory.java @@ -0,0 +1,84 @@ +package com.hbm.handler.guncfg; + +import java.util.ArrayList; + +import com.hbm.handler.BulletConfigSyncingUtil; +import com.hbm.handler.BulletConfiguration; +import com.hbm.handler.GunConfiguration; +import com.hbm.items.ModItems; +import com.hbm.render.misc.RenderScreenOverlay.Crosshair; + +public class GunGaussFactory { + + public static GunConfiguration getXVLConfig() { + + GunConfiguration config = new GunConfiguration(); + + config.rateOfFire = 4; + config.roundsPerCycle = 1; + config.gunMode = GunConfiguration.MODE_NORMAL; + config.firingMode = GunConfiguration.FIRE_AUTO; + config.hasReloadAnim = false; + config.hasFiringAnim = false; + config.hasSpinup = false; + config.hasSpindown = false; + config.reloadDuration = 20; + config.firingDuration = 0; + config.ammoCap = 0; + config.reloadType = GunConfiguration.RELOAD_NONE; + config.allowsInfinity = true; + config.crosshair = Crosshair.L_RAD; + config.durability = 6000; + config.firingSound = "hbm:weapon.tauShoot"; + + config.name = "XVL1456 Tau Cannon"; + config.manufacturer = "Black Mesa Research Facility"; + + config.config = new ArrayList(); + config.config.add(BulletConfigSyncingUtil.SPECIAL_GAUSS); + + return config; + } + + public static GunConfiguration getChargedConfig() { + + GunConfiguration config = new GunConfiguration(); + + config.rateOfFire = 10; + config.roundsPerCycle = 1; + config.gunMode = GunConfiguration.MODE_NORMAL; + config.firingMode = GunConfiguration.FIRE_AUTO; + config.reloadDuration = 20; + config.firingDuration = 0; + config.ammoCap = 30; + config.reloadType = GunConfiguration.RELOAD_FULL; + config.allowsInfinity = true; + config.crosshair = Crosshair.L_ARROWS; + + return config; + } + + public static BulletConfiguration getGaussConfig() { + + BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + + bullet.ammo = ModItems.gun_xvl1456_ammo; + bullet.dmgMin = 6; + bullet.dmgMax = 9; + bullet.trail = 1; + bullet.vPFX = "fireworksSpark"; + bullet.LBRC = 80; + bullet.HBRC = 5; + + return bullet; + } + + public static BulletConfiguration getAltConfig() { + + BulletConfiguration bullet = getGaussConfig(); + + bullet.vPFX = "reddust"; + + return bullet; + } +} diff --git a/com/hbm/handler/guncfg/GunGrenadeFactory.java b/com/hbm/handler/guncfg/GunGrenadeFactory.java index f8dceb46a..77391f9c2 100644 --- a/com/hbm/handler/guncfg/GunGrenadeFactory.java +++ b/com/hbm/handler/guncfg/GunGrenadeFactory.java @@ -31,6 +31,7 @@ public class GunGrenadeFactory { config.crosshair = Crosshair.L_CIRCUMFLEX; config.firingSound = "hbm:weapon.hkShoot"; config.reloadSound = GunConfiguration.RSOUND_GRENADE; + config.reloadSoundEnd = false; config.name = "Granatpistole HK69"; config.manufacturer = "Heckler & Koch"; diff --git a/com/hbm/handler/guncfg/GunOSIPRFactory.java b/com/hbm/handler/guncfg/GunOSIPRFactory.java new file mode 100644 index 000000000..d13053eb0 --- /dev/null +++ b/com/hbm/handler/guncfg/GunOSIPRFactory.java @@ -0,0 +1,80 @@ +package com.hbm.handler.guncfg; + +import java.util.ArrayList; + +import com.hbm.handler.BulletConfigSyncingUtil; +import com.hbm.handler.BulletConfiguration; +import com.hbm.handler.GunConfiguration; +import com.hbm.items.ModItems; +import com.hbm.render.misc.RenderScreenOverlay.Crosshair; + +public class GunOSIPRFactory { + + public static GunConfiguration getOSIPRConfig() { + + GunConfiguration config = new GunConfiguration(); + + config.rateOfFire = 2; + config.roundsPerCycle = 1; + config.gunMode = GunConfiguration.MODE_NORMAL; + config.firingMode = GunConfiguration.FIRE_AUTO; + config.hasReloadAnim = false; + config.hasFiringAnim = false; + config.hasSpinup = false; + config.hasSpindown = false; + config.reloadDuration = 20; + config.firingDuration = 0; + config.ammoCap = 30; + config.reloadType = GunConfiguration.RELOAD_FULL; + config.allowsInfinity = true; + config.crosshair = Crosshair.L_ARROWS; + config.durability = 10000; + config.reloadSound = "hbm:weapon.osiprReload"; + config.firingSound = "hbm:weapon.osiprShoot"; + config.reloadSoundEnd = false; + + config.name = "Overwatch Standard Issue Pulse Rifle"; + config.manufacturer = "The Universal Union"; + + config.config = new ArrayList(); + config.config.add(BulletConfigSyncingUtil.SPECIAL_OSIPR); + + return config; + } + + public static GunConfiguration getAltConfig() { + + GunConfiguration config = new GunConfiguration(); + + config.rateOfFire = 15; + config.roundsPerCycle = 1; + config.gunMode = GunConfiguration.MODE_NORMAL; + config.firingMode = GunConfiguration.FIRE_MANUAL; + config.hasReloadAnim = false; + config.hasFiringAnim = false; + config.hasSpinup = false; + config.hasSpindown = false; + config.reloadDuration = 20; + config.firingDuration = 0; + config.ammoCap = 1; + config.reloadType = GunConfiguration.RELOAD_NONE; + config.allowsInfinity = true; + config.firingSound = "hbm:weapon.singFlyby"; + + return config; + } + + static float inaccuracy = 5; + public static BulletConfiguration getPulseConfig() { + + BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + + bullet.ammo = ModItems.gun_osipr_ammo; + bullet.spread *= inaccuracy; + bullet.dmgMin = 3; + bullet.dmgMax = 5; + bullet.trail = 2; + + return bullet; + } +} diff --git a/com/hbm/handler/guncfg/GunRocketFactory.java b/com/hbm/handler/guncfg/GunRocketFactory.java index 4df2196a1..11a44c836 100644 --- a/com/hbm/handler/guncfg/GunRocketFactory.java +++ b/com/hbm/handler/guncfg/GunRocketFactory.java @@ -2,12 +2,19 @@ package com.hbm.handler.guncfg; import java.util.ArrayList; +import com.hbm.entity.projectile.EntityBulletBase; import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.handler.BulletConfiguration; import com.hbm.handler.GunConfiguration; +import com.hbm.interfaces.IBulletImpactBehavior; +import com.hbm.interfaces.IBulletRicochetBehavior; import com.hbm.items.ModItems; import com.hbm.render.misc.RenderScreenOverlay.Crosshair; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.world.World; + public class GunRocketFactory { public static GunConfiguration getGustavConfig() { @@ -30,6 +37,7 @@ public class GunRocketFactory { config.crosshair = Crosshair.L_CIRCUMFLEX; config.firingSound = "hbm:weapon.rpgShoot"; config.reloadSound = GunConfiguration.RSOUND_LAUNCHER; + config.reloadSoundEnd = false; config.name = "Carl Gustav Recoilless Rifle M1"; config.manufacturer = "Saab Bofors Dynamics"; @@ -235,9 +243,21 @@ public class GunRocketFactory { bullet.gravity = 0.000D; bullet.ricochetAngle = 90; bullet.LBRC = 100; - bullet.destroysWood = true; bullet.doesPenetrate = true; + bullet.bRicochet = new IBulletRicochetBehavior() { + + public void behaveBlockRicochet(EntityBulletBase bullet, int bX, int bY, int bZ) { + World worldObj = bullet.worldObj; + if(!worldObj.isRemote && + (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);} + + }; + return bullet; } diff --git a/com/hbm/interfaces/IBulletHitBehavior.java b/com/hbm/interfaces/IBulletHitBehavior.java new file mode 100644 index 000000000..b07aab829 --- /dev/null +++ b/com/hbm/interfaces/IBulletHitBehavior.java @@ -0,0 +1,12 @@ +package com.hbm.interfaces; + +import com.hbm.entity.projectile.EntityBulletBase; + +import net.minecraft.entity.Entity; + +public interface IBulletHitBehavior { + + //entity is hit, bullet dies + public void behaveEntityHit(EntityBulletBase bullet, Entity hit); + +} diff --git a/com/hbm/interfaces/IBulletHurtBehavior.java b/com/hbm/interfaces/IBulletHurtBehavior.java new file mode 100644 index 000000000..4aa57a5a2 --- /dev/null +++ b/com/hbm/interfaces/IBulletHurtBehavior.java @@ -0,0 +1,11 @@ +package com.hbm.interfaces; + +import com.hbm.entity.projectile.EntityBulletBase; + +import net.minecraft.entity.Entity; + +public interface IBulletHurtBehavior { + + //entity is hit + public void behaveEntityHurt(EntityBulletBase bullet, Entity hit); +} diff --git a/com/hbm/interfaces/IBulletImpactBehavior.java b/com/hbm/interfaces/IBulletImpactBehavior.java new file mode 100644 index 000000000..52f68c1fd --- /dev/null +++ b/com/hbm/interfaces/IBulletImpactBehavior.java @@ -0,0 +1,12 @@ +package com.hbm.interfaces; + +import com.hbm.entity.projectile.EntityBulletBase; + +import net.minecraft.entity.Entity; + +public interface IBulletImpactBehavior { + + //block is hit, bullet dies + public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z); + +} diff --git a/com/hbm/interfaces/IBulletRicochetBehavior.java b/com/hbm/interfaces/IBulletRicochetBehavior.java new file mode 100644 index 000000000..c55c03478 --- /dev/null +++ b/com/hbm/interfaces/IBulletRicochetBehavior.java @@ -0,0 +1,12 @@ +package com.hbm.interfaces; + +import com.hbm.entity.projectile.EntityBulletBase; + +import net.minecraft.entity.Entity; + +public interface IBulletRicochetBehavior { + + //block is hit, bullet ricochets + public void behaveBlockRicochet(EntityBulletBase bullet, int x, int y, int z); + +} diff --git a/com/hbm/inventory/MachineRecipes.java b/com/hbm/inventory/MachineRecipes.java index 98a9b6537..acdd1c4f6 100644 --- a/com/hbm/inventory/MachineRecipes.java +++ b/com/hbm/inventory/MachineRecipes.java @@ -659,6 +659,9 @@ public class MachineRecipes { if(input.getItem() == ModItems.assembly_nopip) return new ItemStack(ModItems.ammo_44); + + if(input.getItem() == ModItems.ammo_rocket) + return new ItemStack(ModItems.ammo_44_rocket); } if(stamp.getItem() == ModItems.stamp_9) { @@ -671,6 +674,9 @@ public class MachineRecipes { return new ItemStack(ModItems.gun_mp_ammo); if(input.getItem() == ModItems.assembly_lacunae) return new ItemStack(ModItems.ammo_5mm); + + if(input.getItem() == ModItems.ammo_rocket) + return new ItemStack(ModItems.ammo_9mm_rocket); } if(stamp.getItem() == ModItems.stamp_50) { @@ -752,11 +758,13 @@ public class MachineRecipes { recipes.put(new Object[] { i_stamps_44, new ItemStack(ModItems.assembly_nopip) }, getPressResultNN(i_stamps_44.get(0).getItem(), ModItems.assembly_nopip)); //recipes.put(new Object[] { i_stamps_44, new ItemStack(ModItems.assembly_pip) }, getPressResultNN(i_stamps_44.get(0).getItem(), ModItems.assembly_pip)); + recipes.put(new Object[] { i_stamps_44, new ItemStack(ModItems.ammo_rocket) }, getPressResultNN(i_stamps_44.get(0).getItem(), ModItems.ammo_rocket)); recipes.put(new Object[] { i_stamps_9, new ItemStack(ModItems.assembly_smg) }, getPressResultNN(i_stamps_9.get(0).getItem(), ModItems.assembly_smg)); recipes.put(new Object[] { i_stamps_9, new ItemStack(ModItems.assembly_uzi) }, getPressResultNN(i_stamps_9.get(0).getItem(), ModItems.assembly_uzi)); recipes.put(new Object[] { i_stamps_9, new ItemStack(ModItems.assembly_lacunae) }, getPressResultNN(i_stamps_9.get(0).getItem(), ModItems.assembly_lacunae)); recipes.put(new Object[] { i_stamps_9, new ItemStack(Items.gold_ingot) }, getPressResultNN(i_stamps_9.get(0).getItem(), Items.gold_ingot)); + recipes.put(new Object[] { i_stamps_9, new ItemStack(ModItems.ammo_rocket) }, getPressResultNN(i_stamps_9.get(0).getItem(), ModItems.ammo_rocket)); recipes.put(new Object[] { i_stamps_50, new ItemStack(ModItems.assembly_actionexpress) }, getPressResultNN(i_stamps_50.get(0).getItem(), ModItems.assembly_actionexpress)); recipes.put(new Object[] { i_stamps_50, new ItemStack(ModItems.assembly_calamity) }, getPressResultNN(i_stamps_50.get(0).getItem(), ModItems.assembly_calamity)); diff --git a/com/hbm/inventory/container/ContainerSoyuzLauncher.java b/com/hbm/inventory/container/ContainerSoyuzLauncher.java new file mode 100644 index 000000000..7399af085 --- /dev/null +++ b/com/hbm/inventory/container/ContainerSoyuzLauncher.java @@ -0,0 +1,98 @@ +package com.hbm.inventory.container; + +import com.hbm.tileentity.bomb.TileEntityLaunchTable; +import com.hbm.tileentity.machine.TileEntitySoyuzLauncher; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class ContainerSoyuzLauncher extends Container { + + private TileEntitySoyuzLauncher nukeBoy; + + public ContainerSoyuzLauncher(InventoryPlayer invPlayer, TileEntitySoyuzLauncher tedf) { + + nukeBoy = tedf; + + //Soyuz + this.addSlotToContainer(new Slot(tedf, 0, 62, 18)); + //Designator + this.addSlotToContainer(new Slot(tedf, 1, 62, 36)); + //Satellite + this.addSlotToContainer(new Slot(tedf, 2, 116, 18)); + //Landing module + this.addSlotToContainer(new Slot(tedf, 3, 116, 36)); + //Kerosene IN + this.addSlotToContainer(new Slot(tedf, 4, 8, 90)); + //Kerosene OUT + this.addSlotToContainer(new Slot(tedf, 5, 8, 108)); + //Peroxide IN + this.addSlotToContainer(new Slot(tedf, 6, 26, 90)); + //Peroxide OUT + this.addSlotToContainer(new Slot(tedf, 7, 26, 108)); + //Battery + this.addSlotToContainer(new Slot(tedf, 8, 44, 108)); + + for(int i = 0; i < 3; i++) + { + for(int j = 0; j < 6; j++) + { + this.addSlotToContainer(new Slot(tedf, j + i * 6 + 9, 62 + j * 18, 72 + i * 18)); + } + } + + 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 + 56)); + } + } + + for(int i = 0; i < 9; i++) + { + this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + 56)); + } + } + + @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 <= 1) { + if (!this.mergeItemStack(var5, 2, this.inventorySlots.size(), true)) + { + return null; + } + } + else 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 nukeBoy.isUseableByPlayer(player); + } +} diff --git a/com/hbm/inventory/gui/GUIMachineLaunchTable.java b/com/hbm/inventory/gui/GUIMachineLaunchTable.java index ab8552a4b..7d5321b62 100644 --- a/com/hbm/inventory/gui/GUIMachineLaunchTable.java +++ b/com/hbm/inventory/gui/GUIMachineLaunchTable.java @@ -47,7 +47,7 @@ public class GUIMachineLaunchTable extends GuiInfoContainer { this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 25, guiTop + 98, 18, 18, new String[] { "Size 15 & 15/20" }); this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 43, guiTop + 98, 18, 18, new String[] { "Size 20" }); - String[] text = new String[] { "Acepts custom missiles", "of all sizes, as long as the", "correct size setting is selected." }; + String[] text = new String[] { "Accepts custom missiles", "of all sizes, as long as the", "correct size setting is selected." }; this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text); String[] text1 = new String[] { "Detonator can only trigger center block." }; diff --git a/com/hbm/inventory/gui/GUISoyuzLauncher.java b/com/hbm/inventory/gui/GUISoyuzLauncher.java new file mode 100644 index 000000000..24e67ae7c --- /dev/null +++ b/com/hbm/inventory/gui/GUISoyuzLauncher.java @@ -0,0 +1,92 @@ +package com.hbm.inventory.gui; + +import org.lwjgl.opengl.GL11; + +import com.hbm.inventory.FluidTank; +import com.hbm.inventory.container.ContainerSoyuzLauncher; +import com.hbm.items.weapon.ItemCustomMissile; +import com.hbm.items.weapon.ItemMissile.PartSize; +import com.hbm.lib.RefStrings; +import com.hbm.packet.AuxButtonPacket; +import com.hbm.packet.PacketDispatcher; +import com.hbm.render.misc.MissileMultipart; +import com.hbm.render.misc.MissilePronter; +import com.hbm.tileentity.machine.TileEntitySoyuzLauncher; + +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.inventory.Container; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + +public class GUISoyuzLauncher extends GuiInfoContainer { + + private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_soyuz.png"); + private TileEntitySoyuzLauncher launcher; + + public GUISoyuzLauncher(InventoryPlayer invPlayer, TileEntitySoyuzLauncher tedf) { + super(new ContainerSoyuzLauncher(invPlayer, tedf)); + launcher = tedf; + + this.xSize = 176; + this.ySize = 222; + } + + @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); + this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 7, guiTop + 98, 18, 18, new String[] { "Size 10 & 10/15" }); + this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 25, guiTop + 98, 18, 18, new String[] { "Size 15 & 15/20" }); + this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 43, guiTop + 98, 18, 18, new String[] { "Size 20" }); + + String[] text = new String[] { "Acepts custom missiles", "of all sizes, as long as the", "correct size setting is selected." }; + this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text); + + String[] text1 = new String[] { "Detonator can only trigger center block." }; + this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 16, 16, 16, guiLeft - 8, guiTop + 36 + 16, text1);*/ + } + + protected void mouseClicked(int x, int y, int i) { + super.mouseClicked(x, y, i); + + /*if(guiLeft + 7 <= x && guiLeft + 7 + 18 > x && guiTop + 98 < y && guiTop + 98 + 18 >= y) { + + mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); + PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(launcher.xCoord, launcher.yCoord, launcher.zCoord, PartSize.SIZE_10.ordinal(), 0)); + } + + if(guiLeft + 25 <= x && guiLeft + 25 + 18 > x && guiTop + 98 < y && guiTop + 98 + 18 >= y) { + + mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); + PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(launcher.xCoord, launcher.yCoord, launcher.zCoord, PartSize.SIZE_15.ordinal(), 0)); + } + + if(guiLeft + 43 <= x && guiLeft + 43 + 18 > x && guiTop + 98 < y && guiTop + 98 + 18 >= y) { + + mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); + PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(launcher.xCoord, launcher.yCoord, launcher.zCoord, PartSize.SIZE_20.ordinal(), 0)); + }*/ + } + + @Override + protected void drawGuiContainerForegroundLayer( int i, int j) { + 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); + } + + @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); + } +} diff --git a/com/hbm/items/ModItems.java b/com/hbm/items/ModItems.java index e8354b14a..8c1b2bcf8 100644 --- a/com/hbm/items/ModItems.java +++ b/com/hbm/items/ModItems.java @@ -11,7 +11,10 @@ import com.hbm.handler.guncfg.Gun50AEFactory; import com.hbm.handler.guncfg.Gun50BMGFactory; import com.hbm.handler.guncfg.Gun5mmFactory; import com.hbm.handler.guncfg.Gun9mmFactory; +import com.hbm.handler.guncfg.GunFatmanFactory; +import com.hbm.handler.guncfg.GunGaussFactory; import com.hbm.handler.guncfg.GunGrenadeFactory; +import com.hbm.handler.guncfg.GunOSIPRFactory; import com.hbm.handler.guncfg.GunRocketFactory; import com.hbm.items.bomb.*; import com.hbm.items.food.*; @@ -1046,12 +1049,14 @@ public class ModItems { public static Item ammo_44_du; public static Item ammo_44_pip; public static Item ammo_44_bj; + public static Item ammo_44_rocket; public static Item ammo_5mm; public static Item ammo_5mm_explosive; public static Item ammo_5mm_du; public static Item ammo_9mm; public static Item ammo_9mm_ap; public static Item ammo_9mm_du; + public static Item ammo_9mm_rocket; public static Item ammo_22lr; public static Item ammo_22lr_ap; public static Item ammo_50ae; @@ -2729,6 +2734,7 @@ public class ModItems { ammo_9mm = new ItemAmmo().setUnlocalizedName("ammo_9mm").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_9mm"); ammo_9mm_ap = new ItemAmmo().setUnlocalizedName("ammo_9mm_ap").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_9mm_ap"); ammo_9mm_du = new ItemAmmo().setUnlocalizedName("ammo_9mm_du").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_9mm_du"); + ammo_9mm_rocket = new ItemAmmo().setUnlocalizedName("ammo_9mm_rocket").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_9mm_rocket"); ammo_50ae = new ItemAmmo().setUnlocalizedName("ammo_50ae").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_50ae"); ammo_50ae_ap = new ItemAmmo().setUnlocalizedName("ammo_50ae_ap").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_50ae_ap"); ammo_50ae_du = new ItemAmmo().setUnlocalizedName("ammo_50ae_du").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_50ae_du"); @@ -2742,6 +2748,7 @@ public class ModItems { ammo_44_du = new ItemAmmo().setUnlocalizedName("ammo_44_du").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_44_du"); ammo_44_pip = new ItemAmmo().setUnlocalizedName("ammo_44_pip").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_44_pip"); ammo_44_bj = new ItemAmmo().setUnlocalizedName("ammo_44_bj").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_44_bj"); + ammo_44_rocket = new ItemAmmo().setUnlocalizedName("ammo_44_rocket").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_44_rocket"); ammo_22lr = new ItemAmmo().setUnlocalizedName("ammo_22lr").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_22lr"); ammo_22lr_ap = new ItemAmmo().setUnlocalizedName("ammo_22lr_ap").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_22lr_ap"); ammo_folly = new ItemAmmo().setUnlocalizedName("ammo_folly").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ammo_folly"); @@ -2808,12 +2815,12 @@ public class ModItems { gun_lacunae = new ItemGunBase(Gun5mmFactory.getLacunaeConfig()).setUnlocalizedName("gun_lacunae").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_lacunae"); gun_folly = new GunFolly().setUnlocalizedName("gun_folly").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_folly"); gun_fatman_ammo = new Item().setUnlocalizedName("gun_fatman_ammo").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_fatman_ammo"); - gun_fatman = new GunFatman().setMaxDamage(2500).setUnlocalizedName("gun_fatman").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_fatman"); - gun_proto = new GunProtoMirv().setMaxDamage(2500).setUnlocalizedName("gun_proto").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_fatman"); + gun_fatman = new ItemGunBase(GunFatmanFactory.getFatmanConfig()).setUnlocalizedName("gun_fatman").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_fatman"); + gun_proto = new ItemGunBase(GunFatmanFactory.getProtoConfig()).setUnlocalizedName("gun_proto").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_fatman"); gun_mirv_ammo = new Item().setUnlocalizedName("gun_mirv_ammo").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_mirv_ammo"); - gun_mirv = new GunMIRV().setMaxDamage(2500).setUnlocalizedName("gun_mirv").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_mirv"); + gun_mirv = new ItemGunBase(GunFatmanFactory.getFatmanConfig()).setUnlocalizedName("gun_mirv").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_mirv"); gun_bf_ammo = new Item().setUnlocalizedName("gun_bf_ammo").setCreativeTab(null).setTextureName(RefStrings.MODID + ":gun_bf_ammo"); - gun_bf = new GunBaleFlare().setMaxDamage(2500).setUnlocalizedName("gun_bf").setCreativeTab(null).setTextureName(RefStrings.MODID + ":gun_bf"); + gun_bf = new ItemGunBase(GunFatmanFactory.getFatmanConfig()).setUnlocalizedName("gun_bf").setCreativeTab(null).setTextureName(RefStrings.MODID + ":gun_bf"); gun_mp40_ammo = new Item().setUnlocalizedName("gun_mp40_ammo").setCreativeTab(null).setTextureName(RefStrings.MODID + ":gun_mp40_ammo"); gun_mp40 = new ItemGunBase(Gun9mmFactory.getMP40Config()).setUnlocalizedName("gun_mp40").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_mp40"); gun_uzi_ammo = new Item().setUnlocalizedName("gun_uzi_ammo").setCreativeTab(null).setTextureName(RefStrings.MODID + ":gun_uzi_ammo"); @@ -2830,15 +2837,15 @@ public class ModItems { gun_bolt_action_ammo = new Item().setUnlocalizedName("gun_bolt_action_ammo").setCreativeTab(null).setTextureName(RefStrings.MODID + ":gun_bolt_action_ammo"); gun_bolt_action = new ItemGunBase(Gun20GaugeFactory.getBoltConfig()).setUnlocalizedName("gun_bolt_action").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_bolt_action"); gun_bolt_action_green = new ItemGunBase(Gun20GaugeFactory.getBoltGreenConfig()).setUnlocalizedName("gun_bolt_action_green").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_bolt_action_green"); - gun_bolt_action_saturnite = new GunBoltAction().setUnlocalizedName("gun_bolt_action_saturnite").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_bolt_action_saturnite"); + gun_bolt_action_saturnite = new ItemGunBase(Gun20GaugeFactory.getBoltSaturniteConfig()).setUnlocalizedName("gun_bolt_action_saturnite").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_bolt_action_saturnite"); gun_b92_ammo = new GunB92Cell().setUnlocalizedName("gun_b92_ammo").setMaxStackSize(1).setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_b92_ammo_alt"); gun_b92 = new GunB92().setUnlocalizedName("gun_b92").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_b92"); gun_b93 = new GunB93().setUnlocalizedName("gun_b93").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_b93"); gun_xvl1456_ammo = new Item().setUnlocalizedName("gun_xvl1456_ammo").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_xvl1456_ammo"); - gun_xvl1456 = new GunXVL1456().setUnlocalizedName("gun_xvl1456").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_xvl1456"); + gun_xvl1456 = new ItemGunGauss(GunGaussFactory.getXVLConfig(), GunGaussFactory.getChargedConfig()).setUnlocalizedName("gun_xvl1456").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_xvl1456"); gun_osipr_ammo = new Item().setUnlocalizedName("gun_osipr_ammo").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_osipr_ammo"); gun_osipr_ammo2 = new Item().setUnlocalizedName("gun_osipr_ammo2").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_osipr_ammo2"); - gun_osipr = new GunOSIPR().setUnlocalizedName("gun_osipr").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_osipr"); + gun_osipr = new ItemGunOSIPR(GunOSIPRFactory.getOSIPRConfig(), GunOSIPRFactory.getAltConfig()).setUnlocalizedName("gun_osipr").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_osipr"); gun_immolator_ammo = new Item().setUnlocalizedName("gun_immolator_ammo").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_immolator_ammo"); gun_immolator = new GunImmolator().setUnlocalizedName("gun_immolator").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_immolator"); gun_cryolator_ammo = new Item().setUnlocalizedName("gun_cryolator_ammo").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_cryolator_ammo"); @@ -4670,12 +4677,14 @@ public class ModItems { GameRegistry.registerItem(ammo_44_du, ammo_44_du.getUnlocalizedName()); GameRegistry.registerItem(ammo_44_pip, ammo_44_pip.getUnlocalizedName()); GameRegistry.registerItem(ammo_44_bj, ammo_44_bj.getUnlocalizedName()); + GameRegistry.registerItem(ammo_44_rocket, ammo_44_rocket.getUnlocalizedName()); GameRegistry.registerItem(ammo_5mm, ammo_5mm.getUnlocalizedName()); GameRegistry.registerItem(ammo_5mm_explosive, ammo_5mm_explosive.getUnlocalizedName()); GameRegistry.registerItem(ammo_5mm_du, ammo_5mm_du.getUnlocalizedName()); GameRegistry.registerItem(ammo_9mm, ammo_9mm.getUnlocalizedName()); GameRegistry.registerItem(ammo_9mm_ap, ammo_9mm_ap.getUnlocalizedName()); GameRegistry.registerItem(ammo_9mm_du, ammo_9mm_du.getUnlocalizedName()); + GameRegistry.registerItem(ammo_9mm_rocket, ammo_9mm_rocket.getUnlocalizedName()); GameRegistry.registerItem(ammo_22lr, ammo_22lr.getUnlocalizedName()); GameRegistry.registerItem(ammo_22lr_ap, ammo_22lr_ap.getUnlocalizedName()); GameRegistry.registerItem(ammo_50ae, ammo_50ae.getUnlocalizedName()); diff --git a/com/hbm/items/weapon/ItemAmmo.java b/com/hbm/items/weapon/ItemAmmo.java index 51f6656c2..64c64efb0 100644 --- a/com/hbm/items/weapon/ItemAmmo.java +++ b/com/hbm/items/weapon/ItemAmmo.java @@ -83,6 +83,10 @@ public class ItemAmmo extends Item { list.add(EnumChatFormatting.BLUE + "+ Boat"); list.add(EnumChatFormatting.RED + "- Highly decreased damage"); } + if(this == ModItems.ammo_44_rocket) { + list.add(EnumChatFormatting.BLUE + "+ Rocket"); + list.add(EnumChatFormatting.YELLOW + "* Uhhhh"); + } //5mm if(this == ModItems.ammo_5mm_explosive) { @@ -106,6 +110,10 @@ public class ItemAmmo extends Item { list.add(EnumChatFormatting.YELLOW + "* Heavy metal"); list.add(EnumChatFormatting.RED + "- Highly increased wear"); } + if(this == ModItems.ammo_9mm_rocket) { + list.add(EnumChatFormatting.BLUE + "+ Rocket"); + list.add(EnumChatFormatting.YELLOW + "* Uhhhh"); + } //.22LR if(this == ModItems.ammo_22lr_ap) { @@ -129,6 +137,17 @@ public class ItemAmmo extends Item { list.add(EnumChatFormatting.RED + "- Highly increased wear"); } + //.50 AE + if(this == ModItems.ammo_50ae_ap) { + list.add(EnumChatFormatting.BLUE + "+ Increased damage"); + list.add(EnumChatFormatting.RED + "- Increased wear"); + } + if(this == ModItems.ammo_50ae_du) { + list.add(EnumChatFormatting.BLUE + "+ Highly increased damage"); + list.add(EnumChatFormatting.YELLOW + "* Heavy metal"); + list.add(EnumChatFormatting.RED + "- Highly increased wear"); + } + //84mm ROCKETS if(this == ModItems.ammo_rocket_he) { list.add(EnumChatFormatting.BLUE + "+ Increased blast radius"); diff --git a/com/hbm/items/weapon/ItemGunBase.java b/com/hbm/items/weapon/ItemGunBase.java index fad7de87b..79e6800f9 100644 --- a/com/hbm/items/weapon/ItemGunBase.java +++ b/com/hbm/items/weapon/ItemGunBase.java @@ -61,6 +61,9 @@ public class ItemGunBase extends Item implements IHoldableWeapon { // return; if(entity instanceof EntityPlayer) { + + isCurrentItem = ((EntityPlayer)entity).getHeldItem() == stack; + if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT && world.isRemote) { updateClient(stack, world, (EntityPlayer)entity, slot, isCurrentItem); } else if(isCurrentItem) { @@ -71,7 +74,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon { } @SideOnly(Side.CLIENT) - private void updateClient(ItemStack stack, World world, EntityPlayer entity, int slot, boolean isCurrentItem) { + protected void updateClient(ItemStack stack, World world, EntityPlayer entity, int slot, boolean isCurrentItem) { boolean clickLeft = Mouse.isButtonDown(0); boolean clickRight = Mouse.isButtonDown(1); @@ -88,6 +91,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon { m2 = false; } + /// HANDLED IN MODEVENTHANDLERCLIENT.JAVA /// /*if(!left && !right) { if(clickLeft) { PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(true, (byte) 0)); @@ -104,12 +108,14 @@ public class ItemGunBase extends Item implements IHoldableWeapon { PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(false, (byte) 0)); //setIsMouseDown(stack, false); m1 = false; + endActionClient(stack, world, entity, true); } if(right && !clickRight) { PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(false, (byte) 1)); //setIsAltDown(stack, false); m2 = false; + endActionClient(stack, world, entity, false); } if(mainConfig.reloadType != mainConfig.RELOAD_NONE || (altConfig != null && altConfig.reloadType != 0)) { @@ -125,15 +131,17 @@ public class ItemGunBase extends Item implements IHoldableWeapon { if(left) { PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(false, (byte) 0)); m1 = false; + endActionClient(stack, world, entity, true); } if(right) { PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(false, (byte) 1)); m2 = false; + endActionClient(stack, world, entity, false); } } } - private void updateServer(ItemStack stack, World world, EntityPlayer player, int slot, boolean isCurrentItem) { + protected void updateServer(ItemStack stack, World world, EntityPlayer player, int slot, boolean isCurrentItem) { if(getDelay(stack) > 0 && isCurrentItem) setDelay(stack, getDelay(stack) - 1); @@ -147,14 +155,14 @@ public class ItemGunBase extends Item implements IHoldableWeapon { } if(getIsReloading(stack) && isCurrentItem) { - reload(stack, world, player); + reload2(stack, world, player); } } - //tries to shoot, bullet checks are done here - private boolean tryShoot(ItemStack stack, World world, EntityPlayer player, boolean main) { + //whether or not the gun can shoot in its current state + protected boolean tryShoot(ItemStack stack, World world, EntityPlayer player, boolean main) { - if(getDelay(stack) == 0 && !getIsReloading(stack) && getItemWear(stack) < mainConfig.durability) { + if(main && getDelay(stack) == 0 && !getIsReloading(stack) && getItemWear(stack) < mainConfig.durability) { if(mainConfig.reloadType == mainConfig.RELOAD_NONE) { return getBeltSize(player, getBeltType(player, stack)) > 0; @@ -164,11 +172,17 @@ public class ItemGunBase extends Item implements IHoldableWeapon { } } + if(!main && getDelay(stack) == 0 && !getIsReloading(stack) && getItemWear(stack) < mainConfig.durability) { + + //no extra conditions, alt fire has to be handled by every weapon individually in the altFire() method + return true; + } + return false; } - //called every time the gun shoots, overridden to change bullet entity/special additions - private void fire(ItemStack stack, World world, EntityPlayer player) { + //called every time the gun shoots successfully, calls spawnProjectile(), sets item wear + protected void fire(ItemStack stack, World world, EntityPlayer player) { BulletConfiguration config = null; @@ -191,34 +205,47 @@ public class ItemGunBase extends Item implements IHoldableWeapon { setItemWear(stack, getItemWear(stack) + config.wear); } world.playSoundAtEntity(player, mainConfig.firingSound, 1.0F, mainConfig.firingPitch); - - //player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_revolver_gold_ammo)); } - private void spawnProjectile(World world, EntityPlayer player, ItemStack stack, int config) { + //unlike fire(), being called does not automatically imply success, some things may still have to be handled before spawning the projectile + protected void altFire(ItemStack stack, World world, EntityPlayer player) { + + if(!altConfig.firingSound.isEmpty()) + world.playSoundAtEntity(player, altConfig.firingSound, 1.0F, altConfig.firingPitch); + } + + //spawns the actual projectile, can be overridden to change projectile entity + protected void spawnProjectile(World world, EntityPlayer player, ItemStack stack, int config) { EntityBulletBase bullet = new EntityBulletBase(world, config, player); world.spawnEntityInWorld(bullet); } - //called on click (server side, called by mouse packet) + //called on click (server side, called by mouse packet) for semi-automatics and specific events public void startAction(ItemStack stack, World world, EntityPlayer player, boolean main) { - if(mainConfig.firingMode == mainConfig.FIRE_MANUAL && getIsMouseDown(stack) && tryShoot(stack, world, player, main)) { + if(mainConfig.firingMode == mainConfig.FIRE_MANUAL && main && tryShoot(stack, world, player, main)) { fire(stack, world, player); setDelay(stack, mainConfig.rateOfFire); //setMag(stack, getMag(stack) - 1); useUpAmmo(player, stack); } + + if(!main && altConfig != null) + altFire(stack, world, player); } - //called on click release - public void endAction(ItemStack stack, World world, EntityPlayer player, boolean main) { - - } + //called on click (client side, called by update cylce) + public void startActionClient(ItemStack stack, World world, EntityPlayer player, boolean main) { } + + //called on click release (server side, called by mouse packet) for release actions like charged shots + public void endAction(ItemStack stack, World world, EntityPlayer player, boolean main) { } + + //called on click release (client side, called by update cylce) + public void endActionClient(ItemStack stack, World world, EntityPlayer player, boolean main) { } //reload action, if existent - private void reload(ItemStack stack, World world, EntityPlayer player) { + protected void reload(ItemStack stack, World world, EntityPlayer player) { if(getReloadCycle(stack) < 0 && stack == player.getHeldItem()) { @@ -227,6 +254,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon { Item ammo = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack))).ammo; + //how many bullets to load int count = 1; if(mainConfig.reloadType == 1) { @@ -275,7 +303,6 @@ public class ItemGunBase extends Item implements IHoldableWeapon { setMagType(stack, mainConfig.config.indexOf(config)); break; } - setIsReloading(stack, false); } //load new type if bullets are present @@ -322,6 +349,108 @@ public class ItemGunBase extends Item implements IHoldableWeapon { } } + //martin 2 reload algorithm + //now with less WET and more DRY + //compact, readable and most importantly, FUNCTIONAL + protected void reload2(ItemStack stack, World world, EntityPlayer player) { + + if(getReloadCycle(stack) < 0) { + + if(getMag(stack) == 0) + resetAmmoType(stack, world, player); + + + int count = 1; + + if(mainConfig.reloadType == mainConfig.RELOAD_FULL) { + + count = mainConfig.ammoCap - getMag(stack); + } + + boolean hasLoaded = false; + Item ammo = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack))).ammo; + + for(int i = 0; i < count; i++) { + + if(player.inventory.hasItem(ammo)) { + player.inventory.consumeInventoryItem(ammo); + setMag(stack, getMag(stack) + 1); + hasLoaded = true; + } else { + setIsReloading(stack, false); + break; + } + } + + if(getMag(stack) == mainConfig.ammoCap) { + setIsReloading(stack, false); + } else { + resetReloadCycle(stack); + } + + if(hasLoaded && mainConfig.reloadSoundEnd) + world.playSoundAtEntity(player, mainConfig.reloadSound, 1.0F, 1.0F); + + } else { + setReloadCycle(stack, getReloadCycle(stack) - 1); + } + + if(stack != player.getHeldItem()) { + setReloadCycle(stack, 0); + setIsReloading(stack, false); + } + } + + //initiates a reload + public void startReloadAction(ItemStack stack, World world, EntityPlayer player) { + + if(getIsReloading(stack)) + return; + + if(!mainConfig.reloadSoundEnd) + world.playSoundAtEntity(player, mainConfig.reloadSound, 1.0F, 1.0F); + + setIsReloading(stack, true); + resetReloadCycle(stack); + } + + public boolean canReload(ItemStack stack, World world, EntityPlayer player) { + + if(getMag(stack) == 0) { + + for(Integer config : mainConfig.config) { + + BulletConfiguration cfg = BulletConfigSyncingUtil.pullConfig(config); + + if(player.inventory.hasItem(cfg.ammo)) { + return true; + } + } + + } else { + + Item ammo = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack))).ammo; + if(player.inventory.hasItem(ammo)) + return true; + } + + return false; + } + + //searches the player's inv for next fitting ammo type and changes the gun's mag + protected void resetAmmoType(ItemStack stack, World world, EntityPlayer player) { + + for(Integer config : mainConfig.config) { + + BulletConfiguration cfg = BulletConfigSyncingUtil.pullConfig(config); + + if(player.inventory.hasItem(cfg.ammo)) { + setMagType(stack, mainConfig.config.indexOf(config)); + break; + } + } + } + //item mouseover text @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { @@ -357,6 +486,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon { } } + //returns ammo item of belt-weapons public static Item getBeltType(EntityPlayer player, ItemStack stack) { ItemGunBase gun = (ItemGunBase)stack.getItem(); @@ -375,6 +505,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon { return ammo; } + //returns BCFG of belt-weapons public static BulletConfiguration getBeltCfg(EntityPlayer player, ItemStack stack) { ItemGunBase gun = (ItemGunBase)stack.getItem(); @@ -391,7 +522,8 @@ public class ItemGunBase extends Item implements IHoldableWeapon { return BulletConfigSyncingUtil.pullConfig(gun.mainConfig.config.get(0)); } - + + //returns ammo capacity of belt-weapons for current ammo public static int getBeltSize(EntityPlayer player, Item ammo) { int amount = 0; @@ -404,6 +536,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon { return amount; } + //reduces ammo count for mag and belt-based weapons, should be called AFTER firing public void useUpAmmo(EntityPlayer player, ItemStack stack) { if(mainConfig.allowsInfinity && EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0) @@ -514,7 +647,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon { } /// NBT utility /// - private static void writeNBT(ItemStack stack, String key, int value) { + protected static void writeNBT(ItemStack stack, String key, int value) { if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound(); @@ -522,7 +655,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon { stack.stackTagCompound.setInteger(key, value); } - private static int readNBT(ItemStack stack, String key) { + protected static int readNBT(ItemStack stack, String key) { if(!stack.hasTagCompound()) return 0; diff --git a/com/hbm/items/weapon/ItemGunGauss.java b/com/hbm/items/weapon/ItemGunGauss.java new file mode 100644 index 000000000..b6e2e5d67 --- /dev/null +++ b/com/hbm/items/weapon/ItemGunGauss.java @@ -0,0 +1,124 @@ +package com.hbm.items.weapon; + +import java.util.List; + +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; + +import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityCombineBall; +import com.hbm.handler.BulletConfigSyncingUtil; +import com.hbm.handler.BulletConfiguration; +import com.hbm.handler.GunConfiguration; +import com.hbm.interfaces.IHoldableWeapon; +import com.hbm.items.ModItems; +import com.hbm.main.MainRegistry; +import com.hbm.packet.GunButtonPacket; +import com.hbm.packet.PacketDispatcher; +import com.hbm.render.misc.RenderScreenOverlay.Crosshair; +import com.hbm.sound.AudioWrapper; + +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityClientPlayerMP; +import net.minecraft.client.resources.I18n; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import net.minecraftforge.client.event.MouseEvent; + +public class ItemGunGauss extends ItemGunBase { + + private AudioWrapper chargeLoop; + + public ItemGunGauss(GunConfiguration config, GunConfiguration alt) { + super(config, alt); + } + + public void endAction(ItemStack stack, World world, EntityPlayer player, boolean main) { + + if(getHasShot(stack)) { + world.playSoundAtEntity(player, "hbm:weapon.sparkShoot", 1.0F, 1.0F); + setHasShot(stack, false); + } + } + + public void endActionClient(ItemStack stack, World world, EntityPlayer player, boolean main) { + + if(chargeLoop != null) { + chargeLoop.stopSound(); + chargeLoop = null; + } + //setCharge(stack, 0); + } + + @Override + public void startActionClient(ItemStack stack, World world, EntityPlayer player, boolean main) { + + if(!main) { + setCharge(stack, 1); + chargeLoop = MainRegistry.proxy.getLoopedSound("hbm:weapon.tauChargeLoop2", (float)player.posX, (float)player.posY, (float)player.posZ, 1.0F, 0.75F); + world.playSoundAtEntity(player, "hbm:weapon.tauChargeLoop2", 1.0F, 0.75F); + + if(chargeLoop != null) { + chargeLoop.startSound(); + } + } + } + + protected void updateClient(ItemStack stack, World world, EntityPlayer player, int slot, boolean isCurrentItem) { + super.updateClient(stack, world, player, slot, isCurrentItem); + + /*if(!isCurrentItem) { + setCharge(stack, 0); + if(chargeLoop != null) { + chargeLoop.stopSound(); + chargeLoop = null; + } + return; + }*/ + + int c = getCharge(stack); + + if(c > 0) { + setCharge(stack, c + 1); + System.out.println(c); + } + + if(chargeLoop != null) { + chargeLoop.updatePosition((float)player.posX, (float)player.posY, (float)player.posZ); + chargeLoop.updatePitch(1.0F); + } + } + + protected void spawnProjectile(World world, EntityPlayer player, ItemStack stack, int config) { + + super.spawnProjectile(world, player, stack, config); + setHasShot(stack, true); + } + + public static void setHasShot(ItemStack stack, boolean b) { + writeNBT(stack, "hasShot", b ? 1 : 0); + } + + public static boolean getHasShot(ItemStack stack) { + return readNBT(stack, "hasShot") == 1; + } + + /// gauss charge state /// + public static void setCharge(ItemStack stack, int i) { + writeNBT(stack, "gauss_charge", i); + } + + public static int getCharge(ItemStack stack) { + return readNBT(stack, "gauss_charge"); + } +} diff --git a/com/hbm/items/weapon/ItemGunOSIPR.java b/com/hbm/items/weapon/ItemGunOSIPR.java new file mode 100644 index 000000000..ecdfdbf08 --- /dev/null +++ b/com/hbm/items/weapon/ItemGunOSIPR.java @@ -0,0 +1,88 @@ +package com.hbm.items.weapon; + +import java.util.List; + +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; + +import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityCombineBall; +import com.hbm.handler.BulletConfigSyncingUtil; +import com.hbm.handler.BulletConfiguration; +import com.hbm.handler.GunConfiguration; +import com.hbm.interfaces.IHoldableWeapon; +import com.hbm.items.ModItems; +import com.hbm.main.MainRegistry; +import com.hbm.packet.GunButtonPacket; +import com.hbm.packet.PacketDispatcher; +import com.hbm.render.misc.RenderScreenOverlay.Crosshair; + +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityClientPlayerMP; +import net.minecraft.client.resources.I18n; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import net.minecraftforge.client.event.MouseEvent; + +public class ItemGunOSIPR extends ItemGunBase { + + public ItemGunOSIPR(GunConfiguration config, GunConfiguration alt) { + super(config, alt); + } + + @Override + protected void altFire(ItemStack stack, World world, EntityPlayer player) { + + if(player.inventory.hasItem(ModItems.gun_osipr_ammo2)) { + setCharge(stack, 1); + world.playSoundAtEntity(player, "hbm:weapon.osiprCharging", 1.0F, 1F); + } + } + + protected void updateServer(ItemStack stack, World world, EntityPlayer player, int slot, boolean isCurrentItem) { + super.updateServer(stack, world, player, slot, isCurrentItem); + + if(!isCurrentItem || !player.inventory.hasItem(ModItems.gun_osipr_ammo2)) { + setCharge(stack, 0); + return; + } + + int i = getCharge(stack); + + if(i >= 20) { + EntityCombineBall entityarrow = new EntityCombineBall(player.worldObj, player, 3.0F); + entityarrow.setDamage(1000); + world.spawnEntityInWorld(entityarrow); + world.playSoundAtEntity(player, altConfig.firingSound, 1.0F, 1F); + setCharge(stack, 0); + setDelay(stack, altConfig.rateOfFire); + player.inventory.consumeInventoryItem(ModItems.gun_osipr_ammo2); + + } else if(i > 0) + setCharge(stack, i + 1); + } + + protected boolean tryShoot(ItemStack stack, World world, EntityPlayer player, boolean main) { + + return super.tryShoot(stack, world, player, main) && getCharge(stack) == 0; + } + + /// CMB charge state /// + public static void setCharge(ItemStack stack, int i) { + writeNBT(stack, "cmb_charge", i); + } + + public static int getCharge(ItemStack stack) { + return readNBT(stack, "cmb_charge"); + } +} diff --git a/com/hbm/main/ClientProxy.java b/com/hbm/main/ClientProxy.java index cce9cee4c..f8ebae473 100644 --- a/com/hbm/main/ClientProxy.java +++ b/com/hbm/main/ClientProxy.java @@ -5,6 +5,7 @@ import net.minecraft.client.particle.EntityCloudFX; import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.item.Item; +import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.client.model.AdvancedModelLoader; @@ -32,6 +33,8 @@ import com.hbm.render.item.*; import com.hbm.render.misc.MissilePart; import com.hbm.render.tileentity.*; import com.hbm.render.util.HmfModelLoader; +import com.hbm.sound.AudioWrapper; +import com.hbm.sound.AudioWrapperClient; import com.hbm.tileentity.bomb.*; import com.hbm.tileentity.conductor.*; import com.hbm.tileentity.deco.*; @@ -524,5 +527,13 @@ public class ClientProxy extends ServerProxy Minecraft.getMinecraft().effectRenderer.addEffect(contrail); } } + + @Override + public AudioWrapper getLoopedSound(String sound, float x, float y, float z, float volume, float pitch) { + + AudioWrapperClient audio = new AudioWrapperClient(new ResourceLocation(sound)); + audio.updatePosition(x, y, z); + return audio; + } } diff --git a/com/hbm/main/ModEventHandlerClient.java b/com/hbm/main/ModEventHandlerClient.java index 6e62b8da2..c0f3cbca9 100644 --- a/com/hbm/main/ModEventHandlerClient.java +++ b/com/hbm/main/ModEventHandlerClient.java @@ -139,12 +139,12 @@ public class ModEventHandlerClient { if(event.button == 0 && !item.m1 && !item.m2) { item.m1 = true; PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(true, (byte) 0)); - //System.out.println("M1"); + item.startActionClient(player.getHeldItem(), player.worldObj, player, true); } else if(event.button == 1 && !item.m2 && !item.m1) { item.m2 = true; PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(true, (byte) 1)); - //System.out.println("M2"); + item.startActionClient(player.getHeldItem(), player.worldObj, player, false); } } diff --git a/com/hbm/main/ServerProxy.java b/com/hbm/main/ServerProxy.java index a680fb7dc..bbb749ba7 100644 --- a/com/hbm/main/ServerProxy.java +++ b/com/hbm/main/ServerProxy.java @@ -1,5 +1,7 @@ package com.hbm.main; +import com.hbm.sound.AudioWrapper; + public class ServerProxy { public void registerRenderInfo() @@ -14,4 +16,6 @@ public class ServerProxy public void spawnParticle(double x, double y, double z, String type, float[] args) { } public void registerMissileItems() { } + + public AudioWrapper getLoopedSound(String sound, float x, float y, float z, float volume, float pitch) { return null; } } \ No newline at end of file diff --git a/com/hbm/packet/GunButtonPacket.java b/com/hbm/packet/GunButtonPacket.java index e3ec0efb7..3c2f6f9a8 100644 --- a/com/hbm/packet/GunButtonPacket.java +++ b/com/hbm/packet/GunButtonPacket.java @@ -87,8 +87,10 @@ public class GunButtonPacket implements IMessage { item.endAction(p.getHeldItem(), p.worldObj, p, false); break; - case 2: ItemGunBase.setIsReloading(p.getHeldItem(), true); - ItemGunBase.resetReloadCycle(p.getHeldItem()); + case 2: + if(item.canReload(p.getHeldItem(), p.worldObj, p)) { + item.startReloadAction(p.getHeldItem(), p.worldObj, p); + } break; } } diff --git a/com/hbm/render/entity/RenderBullet.java b/com/hbm/render/entity/RenderBullet.java index ac74ef984..9f521b21a 100644 --- a/com/hbm/render/entity/RenderBullet.java +++ b/com/hbm/render/entity/RenderBullet.java @@ -8,9 +8,12 @@ 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.ModelBaleflare; import com.hbm.render.model.ModelBuckshot; import com.hbm.render.model.ModelBullet; import com.hbm.render.model.ModelGrenade; +import com.hbm.render.model.ModelMIRV; +import com.hbm.render.model.ModelMiniNuke; import com.hbm.render.model.ModelRocket; import net.minecraft.client.renderer.Tessellator; @@ -24,12 +27,18 @@ public class RenderBullet extends Render { private ModelBuckshot buckshot; private ModelRocket rocket; private ModelGrenade grenade; + private ModelMiniNuke nuke; + private ModelMIRV mirv; + private ModelBaleflare bf; public RenderBullet() { bullet = new ModelBullet(); buckshot = new ModelBuckshot(); rocket = new ModelRocket(); grenade = new ModelGrenade(); + nuke = new ModelMiniNuke(); + mirv = new ModelMIRV(); + bf = new ModelBaleflare(); } @Override @@ -56,6 +65,9 @@ public class RenderBullet extends Render { case BulletConfiguration.STYLE_PELLET: renderBuckshot(); break; case BulletConfiguration.STYLE_ROCKET: renderRocket(trail); break; case BulletConfiguration.STYLE_GRENADE: renderGrenade(trail); break; + case BulletConfiguration.STYLE_NUKE: renderNuke(0); break; + case BulletConfiguration.STYLE_MIRV: renderNuke(1); break; + case BulletConfiguration.STYLE_BF: renderNuke(2); break; default: renderBullet(trail); break; } @@ -135,6 +147,24 @@ public class RenderBullet extends Render { grenade.renderAll(0.0625F); } + private void renderNuke(int type) { + + GL11.glScalef(1.5F, 1.5F, 1.5F); + + switch(type) { + case 0: + bindTexture(new ResourceLocation(RefStrings.MODID + ":textures/models/MiniNuke.png")); + nuke.renderAll(0.0625F); break; + case 1: + bindTexture(new ResourceLocation(RefStrings.MODID + ":textures/models/Mirv.png")); + mirv.renderAll(0.0625F); break; + case 2: + bindTexture(new ResourceLocation(RefStrings.MODID + ":textures/models/BaleFlare.png")); + bf.renderAll(0.0625F); break; + } + + } + private void renderFlechette() { GL11.glPushMatrix(); GL11.glDisable(GL11.GL_TEXTURE_2D); diff --git a/com/hbm/render/item/ItemRenderBFLauncher.java b/com/hbm/render/item/ItemRenderBFLauncher.java index 05e376c94..81f7bb2bd 100644 --- a/com/hbm/render/item/ItemRenderBFLauncher.java +++ b/com/hbm/render/item/ItemRenderBFLauncher.java @@ -41,11 +41,11 @@ public class ItemRenderBFLauncher implements IItemRenderer { GL11.glPushMatrix(); GL11.glEnable(GL11.GL_CULL_FACE); Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(RefStrings.MODID +":textures/models/BFLauncher.png")); - GL11.glRotatef(-135.0F, 0.0F, 0.0F, 1.0F); - GL11.glTranslatef(-0.5F, 0.0F, -0.2F); + GL11.glRotatef(-150.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(-0.6F, -0.1F, -0.2F); //GL11.glScalef(2.0F, 2.0F, 2.0F); GL11.glScalef(0.5F, 0.5F, 0.5F); - swordModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); + swordModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, item); GL11.glPopMatrix(); break; case EQUIPPED: @@ -60,7 +60,7 @@ public class ItemRenderBFLauncher implements IItemRenderer { GL11.glRotatef(-5.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(0.5F, -0.2F, 0.0F); GL11.glScalef(1.5F, 1.5F, 1.5F); - swordModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); + swordModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, item); GL11.glPopMatrix(); default: break; } diff --git a/com/hbm/render/item/ItemRenderFatMan.java b/com/hbm/render/item/ItemRenderFatMan.java index 16eb88f03..844025f17 100644 --- a/com/hbm/render/item/ItemRenderFatMan.java +++ b/com/hbm/render/item/ItemRenderFatMan.java @@ -42,11 +42,11 @@ public class ItemRenderFatMan implements IItemRenderer { GL11.glPushMatrix(); GL11.glEnable(GL11.GL_CULL_FACE); Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(RefStrings.MODID +":textures/models/FatmanLauncher.png")); - GL11.glRotatef(-135.0F, 0.0F, 0.0F, 1.0F); - GL11.glTranslatef(-0.5F, 0.0F, -0.2F); + GL11.glRotatef(-150.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(-0.6F, -0.1F, -0.2F); //GL11.glScalef(2.0F, 2.0F, 2.0F); GL11.glScalef(0.5F, 0.5F, 0.5F); - swordModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); + swordModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, item); GL11.glPopMatrix(); break; case EQUIPPED: @@ -61,7 +61,7 @@ public class ItemRenderFatMan implements IItemRenderer { GL11.glRotatef(-5.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(0.5F, -0.2F, 0.0F); GL11.glScalef(1.5F, 1.5F, 1.5F); - swordModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); + swordModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, item); GL11.glPopMatrix(); default: break; } diff --git a/com/hbm/render/item/ItemRenderGunAnim.java b/com/hbm/render/item/ItemRenderGunAnim.java index b34e80403..06ce922c4 100644 --- a/com/hbm/render/item/ItemRenderGunAnim.java +++ b/com/hbm/render/item/ItemRenderGunAnim.java @@ -125,7 +125,8 @@ public class ItemRenderGunAnim implements IItemRenderer { } if(item.getItem() == ModItems.gun_bolt_action || item.getItem() == ModItems.gun_bolt_action_green || - item.getItem() == ModItems.gun_lever_action || item.getItem() == ModItems.gun_lever_action_dark) { + item.getItem() == ModItems.gun_lever_action || item.getItem() == ModItems.gun_lever_action_dark + || item.getItem() == ModItems.gun_bolt_action_saturnite) { GL11.glTranslatef(0.0F, -0.4F, 0.0F); GL11.glRotatef(-20.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(5.0F, 0.0F, 1.0F, 0.0F); diff --git a/com/hbm/render/item/ItemRenderMIRVLauncher.java b/com/hbm/render/item/ItemRenderMIRVLauncher.java index c7b6bd88d..fc65850d8 100644 --- a/com/hbm/render/item/ItemRenderMIRVLauncher.java +++ b/com/hbm/render/item/ItemRenderMIRVLauncher.java @@ -42,11 +42,11 @@ public class ItemRenderMIRVLauncher implements IItemRenderer { GL11.glPushMatrix(); GL11.glEnable(GL11.GL_CULL_FACE); Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(RefStrings.MODID +":textures/models/MIRVLauncher.png")); - GL11.glRotatef(-135.0F, 0.0F, 0.0F, 1.0F); - GL11.glTranslatef(-0.5F, 0.0F, -0.2F); + GL11.glRotatef(-150.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(-0.6F, -0.1F, -0.2F); //GL11.glScalef(2.0F, 2.0F, 2.0F); GL11.glScalef(0.5F, 0.5F, 0.5F); - swordModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); + swordModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, item); GL11.glPopMatrix(); break; case EQUIPPED: @@ -61,7 +61,7 @@ public class ItemRenderMIRVLauncher implements IItemRenderer { GL11.glRotatef(-5.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(0.5F, -0.2F, 0.0F); GL11.glScalef(1.5F, 1.5F, 1.5F); - swordModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); + swordModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, item); GL11.glPopMatrix(); default: break; } diff --git a/com/hbm/render/item/ItemRenderOSIPR.java b/com/hbm/render/item/ItemRenderOSIPR.java index 1e483928a..6e9d6a5c8 100644 --- a/com/hbm/render/item/ItemRenderOSIPR.java +++ b/com/hbm/render/item/ItemRenderOSIPR.java @@ -46,7 +46,8 @@ public class ItemRenderOSIPR implements IItemRenderer { GL11.glTranslatef(-0.5F, 0.0F, -0.2F); //GL11.glScalef(2.0F, 2.0F, 2.0F); GL11.glScalef(0.5F, 0.5F, 0.5F); - GL11.glTranslatef(-0.4F, -0.1F, -0.1F); + GL11.glTranslatef(-0.4F, -0.2F, -0.1F); + GL11.glRotatef(-15.0F, 0.0F, 0.0F, 1.0F); swordModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); break; diff --git a/com/hbm/render/item/ItemRenderXVL1456.java b/com/hbm/render/item/ItemRenderXVL1456.java index 35c8e6192..6bd0e8b05 100644 --- a/com/hbm/render/item/ItemRenderXVL1456.java +++ b/com/hbm/render/item/ItemRenderXVL1456.java @@ -48,8 +48,8 @@ public class ItemRenderXVL1456 implements IItemRenderer { GL11.glPushMatrix(); GL11.glEnable(GL11.GL_CULL_FACE); Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(RefStrings.MODID +":textures/models/ModelXVL1456.png")); - GL11.glRotatef(-135.0F, 0.0F, 0.0F, 1.0F); - GL11.glTranslatef(-0.9F, 0.0F, -0.2F); + GL11.glRotatef(-150.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(-0.9F, -0.1F, -0.1F); GL11.glScalef(0.3F, 0.3F, 0.3F); swordModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, f); GL11.glPopMatrix(); diff --git a/com/hbm/render/model/ModelBFLauncher.java b/com/hbm/render/model/ModelBFLauncher.java index 103f39f9c..dadb9847e 100644 --- a/com/hbm/render/model/ModelBFLauncher.java +++ b/com/hbm/render/model/ModelBFLauncher.java @@ -8,9 +8,12 @@ package com.hbm.render.model; import org.lwjgl.opengl.GL11; +import com.hbm.items.weapon.ItemGunBase; + import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; public class ModelBFLauncher extends ModelBase { // fields @@ -203,8 +206,7 @@ public class ModelBFLauncher extends ModelBase { setRotation(Shape20, 0F, 0F, 0F); } - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5, ItemStack item) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); Shape1.render(f5); @@ -231,14 +233,18 @@ public class ModelBFLauncher extends ModelBase { Shape31.render(f5); Shape32.render(f5); Shape33.render(f5); - Shape13.render(f5); - Shape14.render(f5); - Shape15.render(f5); - Shape16.render(f5); - Shape17.render(f5); - Shape18.render(f5); - Shape19.render(f5); - Shape20.render(f5); + + int ammo = ItemGunBase.getMag(item); + if(ammo > 0) { + Shape13.render(f5); + Shape14.render(f5); + Shape15.render(f5); + Shape16.render(f5); + Shape17.render(f5); + Shape18.render(f5); + Shape19.render(f5); + Shape20.render(f5); + } } private void setRotation(ModelRenderer model, float x, float y, float z) { diff --git a/com/hbm/render/model/ModelBoltAction.java b/com/hbm/render/model/ModelBoltAction.java index 82d6b7f5c..287421431 100644 --- a/com/hbm/render/model/ModelBoltAction.java +++ b/com/hbm/render/model/ModelBoltAction.java @@ -202,8 +202,6 @@ public class ModelBoltAction extends ModelBase { HandleBottom.render(f5); HandleGrip.render(f5); - - GL11.glPushMatrix(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); diff --git a/com/hbm/render/model/ModelFatman.java b/com/hbm/render/model/ModelFatman.java index 049216d94..fc65ff140 100644 --- a/com/hbm/render/model/ModelFatman.java +++ b/com/hbm/render/model/ModelFatman.java @@ -4,318 +4,315 @@ // Keep in mind that you still need to fill in some blanks // - ZeuX - - - - - package com.hbm.render.model; import org.lwjgl.opengl.GL11; +import com.hbm.items.weapon.ItemGunBase; + import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; -public class ModelFatman extends ModelBase -{ - //fields - ModelRenderer Shape1; - ModelRenderer Shape2; - ModelRenderer Shape3; - ModelRenderer Shape4; - ModelRenderer Shape5; - ModelRenderer Shape6; - ModelRenderer Shape7; - ModelRenderer Shape8; - ModelRenderer Shape9; - ModelRenderer Shape10; - ModelRenderer Shape11; - ModelRenderer Shape12; - ModelRenderer Shape13; - ModelRenderer Shape14; - ModelRenderer Shape15; - ModelRenderer Shape16; - ModelRenderer Shape17; - ModelRenderer Shape18; - ModelRenderer Shape19; - ModelRenderer Shape20; - ModelRenderer Shape21; - ModelRenderer Shape22; - ModelRenderer Shape23; - ModelRenderer Shape24; - ModelRenderer Shape25; - ModelRenderer Shape26; - ModelRenderer Shape27; - ModelRenderer Shape28; - ModelRenderer Shape29; - ModelRenderer Shape30; - ModelRenderer Shape31; - ModelRenderer Shape32; - ModelRenderer Shape33; - - public ModelFatman() - { - textureWidth = 128; - textureHeight = 64; - - Shape1 = new ModelRenderer(this, 0, 0); - Shape1.addBox(0F, 0F, 0F, 40, 2, 4); - Shape1.setRotationPoint(-20F, 0F, 0F); - Shape1.setTextureSize(128, 64); - Shape1.mirror = true; - setRotation(Shape1, 0F, 0F, 0F); - Shape2 = new ModelRenderer(this, 0, 6); - Shape2.addBox(0F, 0F, 0F, 6, 2, 2); - Shape2.setRotationPoint(-19F, 2F, 1F); - Shape2.setTextureSize(128, 64); - Shape2.mirror = true; - setRotation(Shape2, 0F, 0F, 0F); - Shape3 = new ModelRenderer(this, 0, 10); - Shape3.addBox(0F, 0F, 0F, 1, 4, 1); - Shape3.setRotationPoint(-12F, 2F, 1.5F); - Shape3.setTextureSize(128, 64); - Shape3.mirror = true; - setRotation(Shape3, 0F, 0F, 0F); - Shape4 = new ModelRenderer(this, 16, 6); - Shape4.addBox(0F, 0F, 0F, 6, 1, 4); - Shape4.setRotationPoint(-10F, 2F, 0F); - Shape4.setTextureSize(128, 64); - Shape4.mirror = true; - setRotation(Shape4, 0F, 0F, 0F); - Shape5 = new ModelRenderer(this, 0, 15); - Shape5.addBox(0F, 0F, 0F, 2, 3, 1); - Shape5.setRotationPoint(-7F, 3F, 1.5F); - Shape5.setTextureSize(128, 64); - Shape5.mirror = true; - setRotation(Shape5, 0F, 0F, 0F); - Shape6 = new ModelRenderer(this, 4, 10); - Shape6.addBox(0F, 0F, 0F, 3, 3, 1); - Shape6.setRotationPoint(-10F, 3F, 1.5F); - Shape6.setTextureSize(128, 64); - Shape6.mirror = true; - setRotation(Shape6, 0F, 0F, 0F); - Shape7 = new ModelRenderer(this, 12, 10); - Shape7.addBox(-1F, 0F, 0F, 1, 2, 1); - Shape7.setRotationPoint(-7F, 3F, 1.5F); - Shape7.setTextureSize(128, 64); - Shape7.mirror = true; - setRotation(Shape7, 0F, 0F, 0.5235988F); - Shape8 = new ModelRenderer(this, 36, 6); - Shape8.addBox(0F, 0F, 0F, 10, 1, 4); - Shape8.setRotationPoint(-3F, 2F, 0F); - Shape8.setTextureSize(128, 64); - Shape8.mirror = true; - setRotation(Shape8, 0F, 0F, 0F); - Shape9 = new ModelRenderer(this, 64, 6); - Shape9.addBox(0F, 0F, 0F, 2, 3, 2); - Shape9.setRotationPoint(7F, 2F, 1F); - Shape9.setTextureSize(128, 64); - Shape9.mirror = true; - setRotation(Shape9, 0F, 0F, 0F); - Shape10 = new ModelRenderer(this, 88, 0); - Shape10.addBox(0F, 0F, 0F, 3, 4, 4); - Shape10.setRotationPoint(17F, -4F, 0F); - Shape10.setTextureSize(128, 64); - Shape10.mirror = true; - setRotation(Shape10, 0F, 0F, 0F); - Shape11 = new ModelRenderer(this, 72, 6); - Shape11.addBox(0F, 0F, 0F, 2, 3, 1); - Shape11.setRotationPoint(18F, -7F, 0F); - Shape11.setTextureSize(128, 64); - Shape11.mirror = true; - setRotation(Shape11, 0F, 0F, 0F); - Shape12 = new ModelRenderer(this, 78, 6); - Shape12.addBox(0F, 0F, 0F, 2, 3, 1); - Shape12.setRotationPoint(18F, -7F, 3F); - Shape12.setTextureSize(128, 64); - Shape12.mirror = true; - setRotation(Shape12, 0F, 0F, 0F); - Shape13 = new ModelRenderer(this, 0, 19); - Shape13.addBox(0F, -4F, 0F, 22, 4, 0); - Shape13.setRotationPoint(-17F, 0F, 1F); - Shape13.setTextureSize(128, 64); - Shape13.mirror = true; - setRotation(Shape13, 0.4363323F, 0F, 0F); - Shape14 = new ModelRenderer(this, 16, 11); - Shape14.addBox(0F, 0F, 0F, 33, 1, 1); - Shape14.setRotationPoint(-17F, -4F, -1F); - Shape14.setTextureSize(128, 64); - Shape14.mirror = true; - setRotation(Shape14, 0F, 0F, 0F); - Shape15 = new ModelRenderer(this, 0, 23); - Shape15.addBox(0F, -4F, 0F, 22, 4, 0); - Shape15.setRotationPoint(-17F, 0F, 3F); - Shape15.setTextureSize(128, 64); - Shape15.mirror = true; - setRotation(Shape15, -0.4363323F, 0F, 0F); - Shape16 = new ModelRenderer(this, 16, 13); - Shape16.addBox(0F, 0F, 0F, 33, 1, 1); - Shape16.setRotationPoint(-17F, -4F, 4F); - Shape16.setTextureSize(128, 64); - Shape16.mirror = true; - setRotation(Shape16, 0F, 0F, 0F); - Shape17 = new ModelRenderer(this, 44, 25); - Shape17.addBox(0F, -4F, 0F, 8, 4, 0); - Shape17.setRotationPoint(8F, 0F, 1F); - Shape17.setTextureSize(128, 64); - Shape17.mirror = true; - setRotation(Shape17, 0.4363323F, 0F, 0F); - Shape18 = new ModelRenderer(this, 44, 21); - Shape18.addBox(0F, -4F, 0F, 8, 4, 0); - Shape18.setRotationPoint(8F, 0F, 3F); - Shape18.setTextureSize(128, 64); - Shape18.mirror = true; - setRotation(Shape18, -0.4363323F, 0F, 0F); - Shape19 = new ModelRenderer(this, 0, 37); - Shape19.addBox(0F, 0F, 0F, 5, 4, 2); - Shape19.setRotationPoint(5F, -6F, 1F); - Shape19.setTextureSize(128, 64); - Shape19.mirror = true; - setRotation(Shape19, 0F, 0F, 0F); - Shape20 = new ModelRenderer(this, 0, 31); - Shape20.addBox(0F, 0F, 0F, 5, 2, 4); - Shape20.setRotationPoint(5F, -5F, 0F); - Shape20.setTextureSize(128, 64); - Shape20.mirror = true; - setRotation(Shape20, 0F, 0F, 0F); - Shape21 = new ModelRenderer(this, 0, 27); - Shape21.addBox(0F, 0F, 0F, 1, 2, 2); - Shape21.setRotationPoint(4F, -5F, 1F); - Shape21.setTextureSize(128, 64); - Shape21.mirror = true; - setRotation(Shape21, 0F, 0F, 0F); - Shape22 = new ModelRenderer(this, 6, 27); - Shape22.addBox(0F, 0F, 0F, 1, 2, 2); - Shape22.setRotationPoint(10F, -5F, 1F); - Shape22.setTextureSize(128, 64); - Shape22.mirror = true; - setRotation(Shape22, 0F, 0F, 0F); - Shape23 = new ModelRenderer(this, 8, 43); - Shape23.addBox(0F, 0F, 0F, 2, 2, 1); - Shape23.setRotationPoint(11F, -5F, 0F); - Shape23.setTextureSize(128, 64); - Shape23.mirror = true; - setRotation(Shape23, 0F, 0F, 0F); - Shape24 = new ModelRenderer(this, 8, 46); - Shape24.addBox(0F, 0F, 0F, 2, 2, 1); - Shape24.setRotationPoint(11F, -5F, 3F); - Shape24.setTextureSize(128, 64); - Shape24.mirror = true; - setRotation(Shape24, 0F, 0F, 0F); - Shape25 = new ModelRenderer(this, 0, 43); - Shape25.addBox(0F, 0F, 0F, 2, 1, 2); - Shape25.setRotationPoint(11F, -6F, 1F); - Shape25.setTextureSize(128, 64); - Shape25.mirror = true; - setRotation(Shape25, 0F, 0F, 0F); - Shape26 = new ModelRenderer(this, 0, 46); - Shape26.addBox(0F, 0F, 0F, 2, 1, 2); - Shape26.setRotationPoint(11F, -3F, 1F); - Shape26.setTextureSize(128, 64); - Shape26.mirror = true; - setRotation(Shape26, 0F, 0F, 0F); - Shape27 = new ModelRenderer(this, 18, 27); - Shape27.addBox(0F, 0F, 0F, 2, 5, 1); - Shape27.setRotationPoint(13F, -5F, 1.5F); - Shape27.setTextureSize(128, 64); - Shape27.mirror = true; - setRotation(Shape27, 0F, 0F, 0F); - Shape28 = new ModelRenderer(this, 84, 6); - Shape28.addBox(0F, 0F, 0F, 1, 3, 1); - Shape28.setRotationPoint(16F, -3F, 1.5F); - Shape28.setTextureSize(128, 64); - Shape28.mirror = true; - setRotation(Shape28, 0F, 0F, 0F); - Shape29 = new ModelRenderer(this, 6, 15); - Shape29.addBox(0F, 0F, 0F, 10, 2, 2); - Shape29.setRotationPoint(3F, -2F, 1F); - Shape29.setTextureSize(128, 64); - Shape29.mirror = true; - setRotation(Shape29, 0F, 0F, 0F); - Shape30 = new ModelRenderer(this, 30, 15); - Shape30.addBox(0F, 0F, 0F, 12, 2, 2); - Shape30.setRotationPoint(-7F, -1F, 4F); - Shape30.setTextureSize(128, 64); - Shape30.mirror = true; - setRotation(Shape30, 0F, 0F, 0F); - Shape31 = new ModelRenderer(this, 44, 19); - Shape31.addBox(0F, 0F, 0F, 14, 1, 1); - Shape31.setRotationPoint(5F, -0.5F, 4.5F); - Shape31.setTextureSize(128, 64); - Shape31.mirror = true; - setRotation(Shape31, 0F, 0F, 0F); - Shape32 = new ModelRenderer(this, 12, 27); - Shape32.addBox(0F, 0F, 0F, 1, 1, 1); - Shape32.setRotationPoint(18F, -0.5F, 3.5F); - Shape32.setTextureSize(128, 64); - Shape32.mirror = true; - setRotation(Shape32, 0F, 0F, 0F); - Shape33 = new ModelRenderer(this, 24, 29); - Shape33.addBox(0F, 0F, 0F, 21, 1, 2); - Shape33.setRotationPoint(-18F, -1F, 1F); - Shape33.setTextureSize(128, 64); - Shape33.mirror = true; - setRotation(Shape33, 0F, 0F, 0F); - } - - @Override -public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - Shape1.render(f5); - GL11.glDisable(GL11.GL_CULL_FACE); - Shape2.render(f5); - GL11.glEnable(GL11.GL_CULL_FACE); - Shape3.render(f5); - Shape4.render(f5); - Shape5.render(f5); - GL11.glDisable(GL11.GL_CULL_FACE); - Shape6.render(f5); - GL11.glEnable(GL11.GL_CULL_FACE); - Shape7.render(f5); - Shape8.render(f5); - GL11.glDisable(GL11.GL_CULL_FACE); - Shape9.render(f5); - GL11.glEnable(GL11.GL_CULL_FACE); - Shape10.render(f5); - Shape11.render(f5); - Shape12.render(f5); - Shape13.render(f5); - Shape14.render(f5); - Shape15.render(f5); - Shape16.render(f5); - Shape17.render(f5); - Shape18.render(f5); - Shape19.render(f5); - Shape20.render(f5); - Shape21.render(f5); - Shape22.render(f5); - Shape23.render(f5); - Shape24.render(f5); - Shape25.render(f5); - Shape26.render(f5); - Shape27.render(f5); - Shape28.render(f5); - Shape29.render(f5); - Shape30.render(f5); - Shape31.render(f5); - Shape32.render(f5); - Shape33.render(f5); - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - - @Override -public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { - super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); - } +public class ModelFatman extends ModelBase { + // fields + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + ModelRenderer Shape5; + ModelRenderer Shape6; + ModelRenderer Shape7; + ModelRenderer Shape8; + ModelRenderer Shape9; + ModelRenderer Shape10; + ModelRenderer Shape11; + ModelRenderer Shape12; + ModelRenderer Shape13; + ModelRenderer Shape14; + ModelRenderer Shape15; + ModelRenderer Shape16; + ModelRenderer Shape17; + ModelRenderer Shape18; + ModelRenderer Shape19; + ModelRenderer Shape20; + ModelRenderer Shape21; + ModelRenderer Shape22; + ModelRenderer Shape23; + ModelRenderer Shape24; + ModelRenderer Shape25; + ModelRenderer Shape26; + ModelRenderer Shape27; + ModelRenderer Shape28; + ModelRenderer Shape29; + ModelRenderer Shape30; + ModelRenderer Shape31; + ModelRenderer Shape32; + ModelRenderer Shape33; + + public ModelFatman() { + textureWidth = 128; + textureHeight = 64; + + Shape1 = new ModelRenderer(this, 0, 0); + Shape1.addBox(0F, 0F, 0F, 40, 2, 4); + Shape1.setRotationPoint(-20F, 0F, 0F); + Shape1.setTextureSize(128, 64); + Shape1.mirror = true; + setRotation(Shape1, 0F, 0F, 0F); + Shape2 = new ModelRenderer(this, 0, 6); + Shape2.addBox(0F, 0F, 0F, 6, 2, 2); + Shape2.setRotationPoint(-19F, 2F, 1F); + Shape2.setTextureSize(128, 64); + Shape2.mirror = true; + setRotation(Shape2, 0F, 0F, 0F); + Shape3 = new ModelRenderer(this, 0, 10); + Shape3.addBox(0F, 0F, 0F, 1, 4, 1); + Shape3.setRotationPoint(-12F, 2F, 1.5F); + Shape3.setTextureSize(128, 64); + Shape3.mirror = true; + setRotation(Shape3, 0F, 0F, 0F); + Shape4 = new ModelRenderer(this, 16, 6); + Shape4.addBox(0F, 0F, 0F, 6, 1, 4); + Shape4.setRotationPoint(-10F, 2F, 0F); + Shape4.setTextureSize(128, 64); + Shape4.mirror = true; + setRotation(Shape4, 0F, 0F, 0F); + Shape5 = new ModelRenderer(this, 0, 15); + Shape5.addBox(0F, 0F, 0F, 2, 3, 1); + Shape5.setRotationPoint(-7F, 3F, 1.5F); + Shape5.setTextureSize(128, 64); + Shape5.mirror = true; + setRotation(Shape5, 0F, 0F, 0F); + Shape6 = new ModelRenderer(this, 4, 10); + Shape6.addBox(0F, 0F, 0F, 3, 3, 1); + Shape6.setRotationPoint(-10F, 3F, 1.5F); + Shape6.setTextureSize(128, 64); + Shape6.mirror = true; + setRotation(Shape6, 0F, 0F, 0F); + Shape7 = new ModelRenderer(this, 12, 10); + Shape7.addBox(-1F, 0F, 0F, 1, 2, 1); + Shape7.setRotationPoint(-7F, 3F, 1.5F); + Shape7.setTextureSize(128, 64); + Shape7.mirror = true; + setRotation(Shape7, 0F, 0F, 0.5235988F); + Shape8 = new ModelRenderer(this, 36, 6); + Shape8.addBox(0F, 0F, 0F, 10, 1, 4); + Shape8.setRotationPoint(-3F, 2F, 0F); + Shape8.setTextureSize(128, 64); + Shape8.mirror = true; + setRotation(Shape8, 0F, 0F, 0F); + Shape9 = new ModelRenderer(this, 64, 6); + Shape9.addBox(0F, 0F, 0F, 2, 3, 2); + Shape9.setRotationPoint(7F, 2F, 1F); + Shape9.setTextureSize(128, 64); + Shape9.mirror = true; + setRotation(Shape9, 0F, 0F, 0F); + Shape10 = new ModelRenderer(this, 88, 0); + Shape10.addBox(0F, 0F, 0F, 3, 4, 4); + Shape10.setRotationPoint(17F, -4F, 0F); + Shape10.setTextureSize(128, 64); + Shape10.mirror = true; + setRotation(Shape10, 0F, 0F, 0F); + Shape11 = new ModelRenderer(this, 72, 6); + Shape11.addBox(0F, 0F, 0F, 2, 3, 1); + Shape11.setRotationPoint(18F, -7F, 0F); + Shape11.setTextureSize(128, 64); + Shape11.mirror = true; + setRotation(Shape11, 0F, 0F, 0F); + Shape12 = new ModelRenderer(this, 78, 6); + Shape12.addBox(0F, 0F, 0F, 2, 3, 1); + Shape12.setRotationPoint(18F, -7F, 3F); + Shape12.setTextureSize(128, 64); + Shape12.mirror = true; + setRotation(Shape12, 0F, 0F, 0F); + Shape13 = new ModelRenderer(this, 0, 19); + Shape13.addBox(0F, -4F, 0F, 22, 4, 0); + Shape13.setRotationPoint(-17F, 0F, 1F); + Shape13.setTextureSize(128, 64); + Shape13.mirror = true; + setRotation(Shape13, 0.4363323F, 0F, 0F); + Shape14 = new ModelRenderer(this, 16, 11); + Shape14.addBox(0F, 0F, 0F, 33, 1, 1); + Shape14.setRotationPoint(-17F, -4F, -1F); + Shape14.setTextureSize(128, 64); + Shape14.mirror = true; + setRotation(Shape14, 0F, 0F, 0F); + Shape15 = new ModelRenderer(this, 0, 23); + Shape15.addBox(0F, -4F, 0F, 22, 4, 0); + Shape15.setRotationPoint(-17F, 0F, 3F); + Shape15.setTextureSize(128, 64); + Shape15.mirror = true; + setRotation(Shape15, -0.4363323F, 0F, 0F); + Shape16 = new ModelRenderer(this, 16, 13); + Shape16.addBox(0F, 0F, 0F, 33, 1, 1); + Shape16.setRotationPoint(-17F, -4F, 4F); + Shape16.setTextureSize(128, 64); + Shape16.mirror = true; + setRotation(Shape16, 0F, 0F, 0F); + Shape17 = new ModelRenderer(this, 44, 25); + Shape17.addBox(0F, -4F, 0F, 8, 4, 0); + Shape17.setRotationPoint(8F, 0F, 1F); + Shape17.setTextureSize(128, 64); + Shape17.mirror = true; + setRotation(Shape17, 0.4363323F, 0F, 0F); + Shape18 = new ModelRenderer(this, 44, 21); + Shape18.addBox(0F, -4F, 0F, 8, 4, 0); + Shape18.setRotationPoint(8F, 0F, 3F); + Shape18.setTextureSize(128, 64); + Shape18.mirror = true; + setRotation(Shape18, -0.4363323F, 0F, 0F); + Shape19 = new ModelRenderer(this, 0, 37); + Shape19.addBox(0F, 0F, 0F, 5, 4, 2); + Shape19.setRotationPoint(5F, -6F, 1F); + Shape19.setTextureSize(128, 64); + Shape19.mirror = true; + setRotation(Shape19, 0F, 0F, 0F); + Shape20 = new ModelRenderer(this, 0, 31); + Shape20.addBox(0F, 0F, 0F, 5, 2, 4); + Shape20.setRotationPoint(5F, -5F, 0F); + Shape20.setTextureSize(128, 64); + Shape20.mirror = true; + setRotation(Shape20, 0F, 0F, 0F); + Shape21 = new ModelRenderer(this, 0, 27); + Shape21.addBox(0F, 0F, 0F, 1, 2, 2); + Shape21.setRotationPoint(4F, -5F, 1F); + Shape21.setTextureSize(128, 64); + Shape21.mirror = true; + setRotation(Shape21, 0F, 0F, 0F); + Shape22 = new ModelRenderer(this, 6, 27); + Shape22.addBox(0F, 0F, 0F, 1, 2, 2); + Shape22.setRotationPoint(10F, -5F, 1F); + Shape22.setTextureSize(128, 64); + Shape22.mirror = true; + setRotation(Shape22, 0F, 0F, 0F); + Shape23 = new ModelRenderer(this, 8, 43); + Shape23.addBox(0F, 0F, 0F, 2, 2, 1); + Shape23.setRotationPoint(11F, -5F, 0F); + Shape23.setTextureSize(128, 64); + Shape23.mirror = true; + setRotation(Shape23, 0F, 0F, 0F); + Shape24 = new ModelRenderer(this, 8, 46); + Shape24.addBox(0F, 0F, 0F, 2, 2, 1); + Shape24.setRotationPoint(11F, -5F, 3F); + Shape24.setTextureSize(128, 64); + Shape24.mirror = true; + setRotation(Shape24, 0F, 0F, 0F); + Shape25 = new ModelRenderer(this, 0, 43); + Shape25.addBox(0F, 0F, 0F, 2, 1, 2); + Shape25.setRotationPoint(11F, -6F, 1F); + Shape25.setTextureSize(128, 64); + Shape25.mirror = true; + setRotation(Shape25, 0F, 0F, 0F); + Shape26 = new ModelRenderer(this, 0, 46); + Shape26.addBox(0F, 0F, 0F, 2, 1, 2); + Shape26.setRotationPoint(11F, -3F, 1F); + Shape26.setTextureSize(128, 64); + Shape26.mirror = true; + setRotation(Shape26, 0F, 0F, 0F); + Shape27 = new ModelRenderer(this, 18, 27); + Shape27.addBox(0F, 0F, 0F, 2, 5, 1); + Shape27.setRotationPoint(13F, -5F, 1.5F); + Shape27.setTextureSize(128, 64); + Shape27.mirror = true; + setRotation(Shape27, 0F, 0F, 0F); + Shape28 = new ModelRenderer(this, 84, 6); + Shape28.addBox(0F, 0F, 0F, 1, 3, 1); + Shape28.setRotationPoint(16F, -3F, 1.5F); + Shape28.setTextureSize(128, 64); + Shape28.mirror = true; + setRotation(Shape28, 0F, 0F, 0F); + Shape29 = new ModelRenderer(this, 6, 15); + Shape29.addBox(0F, 0F, 0F, 10, 2, 2); + Shape29.setRotationPoint(3F, -2F, 1F); + Shape29.setTextureSize(128, 64); + Shape29.mirror = true; + setRotation(Shape29, 0F, 0F, 0F); + Shape30 = new ModelRenderer(this, 30, 15); + Shape30.addBox(0F, 0F, 0F, 12, 2, 2); + Shape30.setRotationPoint(-7F, -1F, 4F); + Shape30.setTextureSize(128, 64); + Shape30.mirror = true; + setRotation(Shape30, 0F, 0F, 0F); + Shape31 = new ModelRenderer(this, 44, 19); + Shape31.addBox(0F, 0F, 0F, 14, 1, 1); + Shape31.setRotationPoint(5F, -0.5F, 4.5F); + Shape31.setTextureSize(128, 64); + Shape31.mirror = true; + setRotation(Shape31, 0F, 0F, 0F); + Shape32 = new ModelRenderer(this, 12, 27); + Shape32.addBox(0F, 0F, 0F, 1, 1, 1); + Shape32.setRotationPoint(18F, -0.5F, 3.5F); + Shape32.setTextureSize(128, 64); + Shape32.mirror = true; + setRotation(Shape32, 0F, 0F, 0F); + Shape33 = new ModelRenderer(this, 24, 29); + Shape33.addBox(0F, 0F, 0F, 21, 1, 2); + Shape33.setRotationPoint(-18F, -1F, 1F); + Shape33.setTextureSize(128, 64); + Shape33.mirror = true; + setRotation(Shape33, 0F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5, ItemStack item) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + Shape1.render(f5); + GL11.glDisable(GL11.GL_CULL_FACE); + Shape2.render(f5); + GL11.glEnable(GL11.GL_CULL_FACE); + Shape3.render(f5); + Shape4.render(f5); + Shape5.render(f5); + GL11.glDisable(GL11.GL_CULL_FACE); + Shape6.render(f5); + GL11.glEnable(GL11.GL_CULL_FACE); + Shape7.render(f5); + Shape8.render(f5); + GL11.glDisable(GL11.GL_CULL_FACE); + Shape9.render(f5); + GL11.glEnable(GL11.GL_CULL_FACE); + Shape10.render(f5); + Shape11.render(f5); + Shape12.render(f5); + Shape13.render(f5); + Shape14.render(f5); + Shape15.render(f5); + Shape16.render(f5); + Shape17.render(f5); + Shape18.render(f5); + + int ammo = ItemGunBase.getMag(item); + if(ammo > 0) { + Shape19.render(f5); + Shape20.render(f5); + Shape21.render(f5); + Shape22.render(f5); + Shape23.render(f5); + Shape24.render(f5); + Shape25.render(f5); + Shape26.render(f5); + } + + Shape27.render(f5); + Shape28.render(f5); + Shape29.render(f5); + Shape30.render(f5); + Shape31.render(f5); + Shape32.render(f5); + Shape33.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + @Override + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + } } diff --git a/com/hbm/render/model/ModelMIRVLauncher.java b/com/hbm/render/model/ModelMIRVLauncher.java index 6cdcdfa22..a6dad112d 100644 --- a/com/hbm/render/model/ModelMIRVLauncher.java +++ b/com/hbm/render/model/ModelMIRVLauncher.java @@ -4,288 +4,284 @@ // Keep in mind that you still need to fill in some blanks // - ZeuX - - - - - package com.hbm.render.model; import org.lwjgl.opengl.GL11; +import com.hbm.items.weapon.ItemGunBase; + import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; -public class ModelMIRVLauncher extends ModelBase -{ - //fields - ModelRenderer Shape1; - ModelRenderer Shape2; - ModelRenderer Shape3; - ModelRenderer Shape4; - ModelRenderer Shape5; - ModelRenderer Shape6; - ModelRenderer Shape7; - ModelRenderer Shape8; - ModelRenderer Shape9; - ModelRenderer Shape10; - ModelRenderer Shape11; - ModelRenderer Shape12; - ModelRenderer Shape13; - ModelRenderer Shape14; - ModelRenderer Shape15; - ModelRenderer Shape16; - ModelRenderer Shape17; - ModelRenderer Shape18; - ModelRenderer Shape27; - ModelRenderer Shape28; - ModelRenderer Shape29; - ModelRenderer Shape30; - ModelRenderer Shape31; - ModelRenderer Shape32; - ModelRenderer Shape33; - ModelRenderer Shape19; - ModelRenderer Shape20; - ModelRenderer Shape21; - ModelRenderer Shape22; - - public ModelMIRVLauncher() - { - textureWidth = 128; - textureHeight = 64; - - Shape1 = new ModelRenderer(this, 0, 0); - Shape1.addBox(0F, 0F, 0F, 40, 2, 4); - Shape1.setRotationPoint(-20F, 0F, 0F); - Shape1.setTextureSize(128, 64); - Shape1.mirror = true; - setRotation(Shape1, 0F, 0F, 0F); - Shape2 = new ModelRenderer(this, 0, 6); - Shape2.addBox(0F, 0F, 0F, 6, 2, 2); - Shape2.setRotationPoint(-19F, 2F, 1F); - Shape2.setTextureSize(128, 64); - Shape2.mirror = true; - setRotation(Shape2, 0F, 0F, 0F); - Shape3 = new ModelRenderer(this, 0, 10); - Shape3.addBox(0F, 0F, 0F, 1, 4, 1); - Shape3.setRotationPoint(-12F, 2F, 1.5F); - Shape3.setTextureSize(128, 64); - Shape3.mirror = true; - setRotation(Shape3, 0F, 0F, 0F); - Shape4 = new ModelRenderer(this, 16, 6); - Shape4.addBox(0F, 0F, 0F, 6, 1, 4); - Shape4.setRotationPoint(-10F, 2F, 0F); - Shape4.setTextureSize(128, 64); - Shape4.mirror = true; - setRotation(Shape4, 0F, 0F, 0F); - Shape5 = new ModelRenderer(this, 0, 15); - Shape5.addBox(0F, 0F, 0F, 2, 3, 1); - Shape5.setRotationPoint(-7F, 3F, 1.5F); - Shape5.setTextureSize(128, 64); - Shape5.mirror = true; - setRotation(Shape5, 0F, 0F, 0F); - Shape6 = new ModelRenderer(this, 4, 10); - Shape6.addBox(0F, 0F, 0F, 3, 3, 1); - Shape6.setRotationPoint(-10F, 3F, 1.5F); - Shape6.setTextureSize(128, 64); - Shape6.mirror = true; - setRotation(Shape6, 0F, 0F, 0F); - Shape7 = new ModelRenderer(this, 12, 10); - Shape7.addBox(-1F, 0F, 0F, 1, 2, 1); - Shape7.setRotationPoint(-7F, 3F, 1.5F); - Shape7.setTextureSize(128, 64); - Shape7.mirror = true; - setRotation(Shape7, 0F, 0F, 0.5235988F); - Shape8 = new ModelRenderer(this, 36, 6); - Shape8.addBox(0F, 0F, 0F, 10, 1, 4); - Shape8.setRotationPoint(-3F, 2F, 0F); - Shape8.setTextureSize(128, 64); - Shape8.mirror = true; - setRotation(Shape8, 0F, 0F, 0F); - Shape9 = new ModelRenderer(this, 64, 6); - Shape9.addBox(0F, 0F, 0F, 2, 3, 2); - Shape9.setRotationPoint(7F, 2F, 1F); - Shape9.setTextureSize(128, 64); - Shape9.mirror = true; - setRotation(Shape9, 0F, 0F, 0F); - Shape10 = new ModelRenderer(this, 88, 0); - Shape10.addBox(0F, 0F, 0F, 3, 4, 4); - Shape10.setRotationPoint(17F, -4F, 0F); - Shape10.setTextureSize(128, 64); - Shape10.mirror = true; - setRotation(Shape10, 0F, 0F, 0F); - Shape11 = new ModelRenderer(this, 72, 6); - Shape11.addBox(0F, 0F, 0F, 2, 3, 1); - Shape11.setRotationPoint(18F, -7F, 0F); - Shape11.setTextureSize(128, 64); - Shape11.mirror = true; - setRotation(Shape11, 0F, 0F, 0F); - Shape12 = new ModelRenderer(this, 78, 6); - Shape12.addBox(0F, 0F, 0F, 2, 3, 1); - Shape12.setRotationPoint(18F, -7F, 3F); - Shape12.setTextureSize(128, 64); - Shape12.mirror = true; - setRotation(Shape12, 0F, 0F, 0F); - Shape13 = new ModelRenderer(this, 0, 19); - Shape13.addBox(0F, -4F, 0F, 22, 4, 0); - Shape13.setRotationPoint(-17F, 0F, 1F); - Shape13.setTextureSize(128, 64); - Shape13.mirror = true; - setRotation(Shape13, 0.4363323F, 0F, 0F); - Shape14 = new ModelRenderer(this, 16, 11); - Shape14.addBox(0F, 0F, 0F, 33, 1, 1); - Shape14.setRotationPoint(-17F, -4F, -1F); - Shape14.setTextureSize(128, 64); - Shape14.mirror = true; - setRotation(Shape14, 0F, 0F, 0F); - Shape15 = new ModelRenderer(this, 0, 23); - Shape15.addBox(0F, -4F, 0F, 22, 4, 0); - Shape15.setRotationPoint(-17F, 0F, 3F); - Shape15.setTextureSize(128, 64); - Shape15.mirror = true; - setRotation(Shape15, -0.4363323F, 0F, 0F); - Shape16 = new ModelRenderer(this, 16, 13); - Shape16.addBox(0F, 0F, 0F, 33, 1, 1); - Shape16.setRotationPoint(-17F, -4F, 4F); - Shape16.setTextureSize(128, 64); - Shape16.mirror = true; - setRotation(Shape16, 0F, 0F, 0F); - Shape17 = new ModelRenderer(this, 44, 25); - Shape17.addBox(0F, -4F, 0F, 8, 4, 0); - Shape17.setRotationPoint(8F, 0F, 1F); - Shape17.setTextureSize(128, 64); - Shape17.mirror = true; - setRotation(Shape17, 0.4363323F, 0F, 0F); - Shape18 = new ModelRenderer(this, 44, 21); - Shape18.addBox(0F, -4F, 0F, 8, 4, 0); - Shape18.setRotationPoint(8F, 0F, 3F); - Shape18.setTextureSize(128, 64); - Shape18.mirror = true; - setRotation(Shape18, -0.4363323F, 0F, 0F); - Shape27 = new ModelRenderer(this, 18, 27); - Shape27.addBox(0F, 0F, 0F, 2, 5, 1); - Shape27.setRotationPoint(13F, -5F, 1.5F); - Shape27.setTextureSize(128, 64); - Shape27.mirror = true; - setRotation(Shape27, 0F, 0F, 0F); - Shape28 = new ModelRenderer(this, 84, 6); - Shape28.addBox(0F, 0F, 0F, 1, 3, 1); - Shape28.setRotationPoint(16F, -3F, 1.5F); - Shape28.setTextureSize(128, 64); - Shape28.mirror = true; - setRotation(Shape28, 0F, 0F, 0F); - Shape29 = new ModelRenderer(this, 6, 15); - Shape29.addBox(0F, 0F, 0F, 10, 2, 2); - Shape29.setRotationPoint(3F, -2F, 1F); - Shape29.setTextureSize(128, 64); - Shape29.mirror = true; - setRotation(Shape29, 0F, 0F, 0F); - Shape30 = new ModelRenderer(this, 30, 15); - Shape30.addBox(0F, 0F, 0F, 12, 2, 2); - Shape30.setRotationPoint(-7F, -1F, 4F); - Shape30.setTextureSize(128, 64); - Shape30.mirror = true; - setRotation(Shape30, 0F, 0F, 0F); - Shape31 = new ModelRenderer(this, 44, 19); - Shape31.addBox(0F, 0F, 0F, 14, 1, 1); - Shape31.setRotationPoint(5F, -0.5F, 4.5F); - Shape31.setTextureSize(128, 64); - Shape31.mirror = true; - setRotation(Shape31, 0F, 0F, 0F); - Shape32 = new ModelRenderer(this, 12, 27); - Shape32.addBox(0F, 0F, 0F, 1, 1, 1); - Shape32.setRotationPoint(18F, -0.5F, 3.5F); - Shape32.setTextureSize(128, 64); - Shape32.mirror = true; - setRotation(Shape32, 0F, 0F, 0F); - Shape33 = new ModelRenderer(this, 24, 29); - Shape33.addBox(0F, 0F, 0F, 21, 1, 2); - Shape33.setRotationPoint(-18F, -1F, 1F); - Shape33.setTextureSize(128, 64); - Shape33.mirror = true; - setRotation(Shape33, 0F, 0F, 0F); - Shape19 = new ModelRenderer(this, 0, 33); - Shape19.addBox(0F, 0F, 0F, 10, 4, 2); - Shape19.setRotationPoint(-9F, -5F, 1F); - Shape19.setTextureSize(128, 64); - Shape19.mirror = true; - setRotation(Shape19, 0F, 0F, 0F); - Shape20 = new ModelRenderer(this, 0, 39); - Shape20.addBox(0F, 0F, 0F, 10, 2, 4); - Shape20.setRotationPoint(-9F, -4F, 0F); - Shape20.setTextureSize(128, 64); - Shape20.mirror = true; - setRotation(Shape20, 0F, 0F, 0F); - Shape21 = new ModelRenderer(this, 0, 45); - Shape21.addBox(0F, 0F, 0F, 10, 3, 3); - Shape21.setRotationPoint(-9F, -4.5F, 0.5F); - Shape21.setTextureSize(128, 64); - Shape21.mirror = true; - setRotation(Shape21, 0F, 0F, 0F); - Shape22 = new ModelRenderer(this, 0, 51); - Shape22.addBox(0F, 0F, 0F, 4, 1, 1); - Shape22.setRotationPoint(-6F, -6F, 1F); - Shape22.setTextureSize(128, 64); - Shape22.mirror = true; - setRotation(Shape22, 0F, 0F, 0F); - } - - @Override -public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - Shape1.render(f5); - GL11.glDisable(GL11.GL_CULL_FACE); - Shape2.render(f5); - GL11.glEnable(GL11.GL_CULL_FACE); - Shape3.render(f5); - Shape4.render(f5); - Shape5.render(f5); - GL11.glDisable(GL11.GL_CULL_FACE); - Shape6.render(f5); - GL11.glEnable(GL11.GL_CULL_FACE); - Shape7.render(f5); - Shape8.render(f5); - GL11.glDisable(GL11.GL_CULL_FACE); - Shape9.render(f5); - GL11.glEnable(GL11.GL_CULL_FACE); - Shape10.render(f5); - Shape11.render(f5); - Shape12.render(f5); - Shape13.render(f5); - Shape14.render(f5); - Shape15.render(f5); - Shape16.render(f5); - Shape17.render(f5); - Shape18.render(f5); - Shape27.render(f5); - Shape28.render(f5); - Shape29.render(f5); - Shape30.render(f5); - Shape31.render(f5); - Shape32.render(f5); - Shape33.render(f5); - Shape19.render(f5); - Shape20.render(f5); - Shape21.render(f5); - GL11.glDisable(GL11.GL_CULL_FACE); - Shape22.render(f5); - GL11.glEnable(GL11.GL_CULL_FACE); - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - - @Override -public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { - super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); - } +public class ModelMIRVLauncher extends ModelBase { + // fields + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + ModelRenderer Shape5; + ModelRenderer Shape6; + ModelRenderer Shape7; + ModelRenderer Shape8; + ModelRenderer Shape9; + ModelRenderer Shape10; + ModelRenderer Shape11; + ModelRenderer Shape12; + ModelRenderer Shape13; + ModelRenderer Shape14; + ModelRenderer Shape15; + ModelRenderer Shape16; + ModelRenderer Shape17; + ModelRenderer Shape18; + ModelRenderer Shape27; + ModelRenderer Shape28; + ModelRenderer Shape29; + ModelRenderer Shape30; + ModelRenderer Shape31; + ModelRenderer Shape32; + ModelRenderer Shape33; + ModelRenderer Shape19; + ModelRenderer Shape20; + ModelRenderer Shape21; + ModelRenderer Shape22; + + public ModelMIRVLauncher() { + textureWidth = 128; + textureHeight = 64; + + Shape1 = new ModelRenderer(this, 0, 0); + Shape1.addBox(0F, 0F, 0F, 40, 2, 4); + Shape1.setRotationPoint(-20F, 0F, 0F); + Shape1.setTextureSize(128, 64); + Shape1.mirror = true; + setRotation(Shape1, 0F, 0F, 0F); + Shape2 = new ModelRenderer(this, 0, 6); + Shape2.addBox(0F, 0F, 0F, 6, 2, 2); + Shape2.setRotationPoint(-19F, 2F, 1F); + Shape2.setTextureSize(128, 64); + Shape2.mirror = true; + setRotation(Shape2, 0F, 0F, 0F); + Shape3 = new ModelRenderer(this, 0, 10); + Shape3.addBox(0F, 0F, 0F, 1, 4, 1); + Shape3.setRotationPoint(-12F, 2F, 1.5F); + Shape3.setTextureSize(128, 64); + Shape3.mirror = true; + setRotation(Shape3, 0F, 0F, 0F); + Shape4 = new ModelRenderer(this, 16, 6); + Shape4.addBox(0F, 0F, 0F, 6, 1, 4); + Shape4.setRotationPoint(-10F, 2F, 0F); + Shape4.setTextureSize(128, 64); + Shape4.mirror = true; + setRotation(Shape4, 0F, 0F, 0F); + Shape5 = new ModelRenderer(this, 0, 15); + Shape5.addBox(0F, 0F, 0F, 2, 3, 1); + Shape5.setRotationPoint(-7F, 3F, 1.5F); + Shape5.setTextureSize(128, 64); + Shape5.mirror = true; + setRotation(Shape5, 0F, 0F, 0F); + Shape6 = new ModelRenderer(this, 4, 10); + Shape6.addBox(0F, 0F, 0F, 3, 3, 1); + Shape6.setRotationPoint(-10F, 3F, 1.5F); + Shape6.setTextureSize(128, 64); + Shape6.mirror = true; + setRotation(Shape6, 0F, 0F, 0F); + Shape7 = new ModelRenderer(this, 12, 10); + Shape7.addBox(-1F, 0F, 0F, 1, 2, 1); + Shape7.setRotationPoint(-7F, 3F, 1.5F); + Shape7.setTextureSize(128, 64); + Shape7.mirror = true; + setRotation(Shape7, 0F, 0F, 0.5235988F); + Shape8 = new ModelRenderer(this, 36, 6); + Shape8.addBox(0F, 0F, 0F, 10, 1, 4); + Shape8.setRotationPoint(-3F, 2F, 0F); + Shape8.setTextureSize(128, 64); + Shape8.mirror = true; + setRotation(Shape8, 0F, 0F, 0F); + Shape9 = new ModelRenderer(this, 64, 6); + Shape9.addBox(0F, 0F, 0F, 2, 3, 2); + Shape9.setRotationPoint(7F, 2F, 1F); + Shape9.setTextureSize(128, 64); + Shape9.mirror = true; + setRotation(Shape9, 0F, 0F, 0F); + Shape10 = new ModelRenderer(this, 88, 0); + Shape10.addBox(0F, 0F, 0F, 3, 4, 4); + Shape10.setRotationPoint(17F, -4F, 0F); + Shape10.setTextureSize(128, 64); + Shape10.mirror = true; + setRotation(Shape10, 0F, 0F, 0F); + Shape11 = new ModelRenderer(this, 72, 6); + Shape11.addBox(0F, 0F, 0F, 2, 3, 1); + Shape11.setRotationPoint(18F, -7F, 0F); + Shape11.setTextureSize(128, 64); + Shape11.mirror = true; + setRotation(Shape11, 0F, 0F, 0F); + Shape12 = new ModelRenderer(this, 78, 6); + Shape12.addBox(0F, 0F, 0F, 2, 3, 1); + Shape12.setRotationPoint(18F, -7F, 3F); + Shape12.setTextureSize(128, 64); + Shape12.mirror = true; + setRotation(Shape12, 0F, 0F, 0F); + Shape13 = new ModelRenderer(this, 0, 19); + Shape13.addBox(0F, -4F, 0F, 22, 4, 0); + Shape13.setRotationPoint(-17F, 0F, 1F); + Shape13.setTextureSize(128, 64); + Shape13.mirror = true; + setRotation(Shape13, 0.4363323F, 0F, 0F); + Shape14 = new ModelRenderer(this, 16, 11); + Shape14.addBox(0F, 0F, 0F, 33, 1, 1); + Shape14.setRotationPoint(-17F, -4F, -1F); + Shape14.setTextureSize(128, 64); + Shape14.mirror = true; + setRotation(Shape14, 0F, 0F, 0F); + Shape15 = new ModelRenderer(this, 0, 23); + Shape15.addBox(0F, -4F, 0F, 22, 4, 0); + Shape15.setRotationPoint(-17F, 0F, 3F); + Shape15.setTextureSize(128, 64); + Shape15.mirror = true; + setRotation(Shape15, -0.4363323F, 0F, 0F); + Shape16 = new ModelRenderer(this, 16, 13); + Shape16.addBox(0F, 0F, 0F, 33, 1, 1); + Shape16.setRotationPoint(-17F, -4F, 4F); + Shape16.setTextureSize(128, 64); + Shape16.mirror = true; + setRotation(Shape16, 0F, 0F, 0F); + Shape17 = new ModelRenderer(this, 44, 25); + Shape17.addBox(0F, -4F, 0F, 8, 4, 0); + Shape17.setRotationPoint(8F, 0F, 1F); + Shape17.setTextureSize(128, 64); + Shape17.mirror = true; + setRotation(Shape17, 0.4363323F, 0F, 0F); + Shape18 = new ModelRenderer(this, 44, 21); + Shape18.addBox(0F, -4F, 0F, 8, 4, 0); + Shape18.setRotationPoint(8F, 0F, 3F); + Shape18.setTextureSize(128, 64); + Shape18.mirror = true; + setRotation(Shape18, -0.4363323F, 0F, 0F); + Shape27 = new ModelRenderer(this, 18, 27); + Shape27.addBox(0F, 0F, 0F, 2, 5, 1); + Shape27.setRotationPoint(13F, -5F, 1.5F); + Shape27.setTextureSize(128, 64); + Shape27.mirror = true; + setRotation(Shape27, 0F, 0F, 0F); + Shape28 = new ModelRenderer(this, 84, 6); + Shape28.addBox(0F, 0F, 0F, 1, 3, 1); + Shape28.setRotationPoint(16F, -3F, 1.5F); + Shape28.setTextureSize(128, 64); + Shape28.mirror = true; + setRotation(Shape28, 0F, 0F, 0F); + Shape29 = new ModelRenderer(this, 6, 15); + Shape29.addBox(0F, 0F, 0F, 10, 2, 2); + Shape29.setRotationPoint(3F, -2F, 1F); + Shape29.setTextureSize(128, 64); + Shape29.mirror = true; + setRotation(Shape29, 0F, 0F, 0F); + Shape30 = new ModelRenderer(this, 30, 15); + Shape30.addBox(0F, 0F, 0F, 12, 2, 2); + Shape30.setRotationPoint(-7F, -1F, 4F); + Shape30.setTextureSize(128, 64); + Shape30.mirror = true; + setRotation(Shape30, 0F, 0F, 0F); + Shape31 = new ModelRenderer(this, 44, 19); + Shape31.addBox(0F, 0F, 0F, 14, 1, 1); + Shape31.setRotationPoint(5F, -0.5F, 4.5F); + Shape31.setTextureSize(128, 64); + Shape31.mirror = true; + setRotation(Shape31, 0F, 0F, 0F); + Shape32 = new ModelRenderer(this, 12, 27); + Shape32.addBox(0F, 0F, 0F, 1, 1, 1); + Shape32.setRotationPoint(18F, -0.5F, 3.5F); + Shape32.setTextureSize(128, 64); + Shape32.mirror = true; + setRotation(Shape32, 0F, 0F, 0F); + Shape33 = new ModelRenderer(this, 24, 29); + Shape33.addBox(0F, 0F, 0F, 21, 1, 2); + Shape33.setRotationPoint(-18F, -1F, 1F); + Shape33.setTextureSize(128, 64); + Shape33.mirror = true; + setRotation(Shape33, 0F, 0F, 0F); + Shape19 = new ModelRenderer(this, 0, 33); + Shape19.addBox(0F, 0F, 0F, 10, 4, 2); + Shape19.setRotationPoint(-9F, -5F, 1F); + Shape19.setTextureSize(128, 64); + Shape19.mirror = true; + setRotation(Shape19, 0F, 0F, 0F); + Shape20 = new ModelRenderer(this, 0, 39); + Shape20.addBox(0F, 0F, 0F, 10, 2, 4); + Shape20.setRotationPoint(-9F, -4F, 0F); + Shape20.setTextureSize(128, 64); + Shape20.mirror = true; + setRotation(Shape20, 0F, 0F, 0F); + Shape21 = new ModelRenderer(this, 0, 45); + Shape21.addBox(0F, 0F, 0F, 10, 3, 3); + Shape21.setRotationPoint(-9F, -4.5F, 0.5F); + Shape21.setTextureSize(128, 64); + Shape21.mirror = true; + setRotation(Shape21, 0F, 0F, 0F); + Shape22 = new ModelRenderer(this, 0, 51); + Shape22.addBox(0F, 0F, 0F, 4, 1, 1); + Shape22.setRotationPoint(-6F, -6F, 1F); + Shape22.setTextureSize(128, 64); + Shape22.mirror = true; + setRotation(Shape22, 0F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5, ItemStack item) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + Shape1.render(f5); + GL11.glDisable(GL11.GL_CULL_FACE); + Shape2.render(f5); + GL11.glEnable(GL11.GL_CULL_FACE); + Shape3.render(f5); + Shape4.render(f5); + Shape5.render(f5); + GL11.glDisable(GL11.GL_CULL_FACE); + Shape6.render(f5); + GL11.glEnable(GL11.GL_CULL_FACE); + Shape7.render(f5); + Shape8.render(f5); + GL11.glDisable(GL11.GL_CULL_FACE); + Shape9.render(f5); + GL11.glEnable(GL11.GL_CULL_FACE); + Shape10.render(f5); + Shape11.render(f5); + Shape12.render(f5); + Shape13.render(f5); + Shape14.render(f5); + Shape15.render(f5); + Shape16.render(f5); + Shape17.render(f5); + Shape18.render(f5); + Shape27.render(f5); + Shape28.render(f5); + Shape29.render(f5); + Shape30.render(f5); + Shape31.render(f5); + Shape32.render(f5); + Shape33.render(f5); + + int ammo = ItemGunBase.getMag(item); + if(ammo > 0) { + Shape19.render(f5); + Shape20.render(f5); + Shape21.render(f5); + GL11.glDisable(GL11.GL_CULL_FACE); + Shape22.render(f5); + GL11.glEnable(GL11.GL_CULL_FACE); + } + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + @Override + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + } } diff --git a/com/hbm/render/model/ModelNightmare2.java b/com/hbm/render/model/ModelNightmare2.java index 565ec6997..143dfe549 100644 --- a/com/hbm/render/model/ModelNightmare2.java +++ b/com/hbm/render/model/ModelNightmare2.java @@ -12,6 +12,7 @@ import com.hbm.items.weapon.ItemGunBase; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.Tessellator; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; @@ -231,6 +232,23 @@ public class ModelNightmare2 extends ModelBase { Bullet5.render(f5); if(ammo > 5) Bullet6.render(f5); + + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_LIGHTING); + + Tessellator tessellator = Tessellator.instance; + int color = 0xFF0000; + + tessellator.startDrawing(3); + tessellator.setColorOpaque_I(color); + tessellator.addVertex(-19F / 16F, -3F / 16F, -1F / 16F); + tessellator.addVertex(-150, 0, 0); + tessellator.draw(); + + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glPopMatrix(); } private void setRotation(ModelRenderer model, float x, float y, float z) { diff --git a/com/hbm/sound/AudioDynamic.java b/com/hbm/sound/AudioDynamic.java new file mode 100644 index 000000000..fd1237c44 --- /dev/null +++ b/com/hbm/sound/AudioDynamic.java @@ -0,0 +1,43 @@ +package com.hbm.sound; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.MovingSound; +import net.minecraft.client.audio.PositionedSound; +import net.minecraft.util.ResourceLocation; + +@SideOnly(Side.CLIENT) +public class AudioDynamic extends MovingSound { + + protected AudioDynamic(ResourceLocation loc) { + super(loc); + this.repeat = true; + } + + public void setPosition(float x, float y, float z) { + this.xPosF = x; + this.yPosF = y; + this.zPosF = z; + } + + @Override + public void update() { } + + public void start() { + Minecraft.getMinecraft().getSoundHandler().playSound(this); + } + + public void stop() { + Minecraft.getMinecraft().getSoundHandler().stopSound(this); + } + + public void setVolume(float volume) { + this.volume = volume; + } + + public void setPitch(float pitch) { + this.field_147663_c = pitch; + } + +} diff --git a/com/hbm/sound/AudioWrapper.java b/com/hbm/sound/AudioWrapper.java new file mode 100644 index 000000000..db2a3205b --- /dev/null +++ b/com/hbm/sound/AudioWrapper.java @@ -0,0 +1,17 @@ +package com.hbm.sound; + +public class AudioWrapper { + + public void updatePosition(float x, float y, float z) { } + + public void updateVolume(float pitch) { } + + public void updatePitch(float pitch) { } + + public void setDoesRepeat(boolean repeats) { } + + public void startSound() { } + + public void stopSound() { } + +} diff --git a/com/hbm/sound/AudioWrapperClient.java b/com/hbm/sound/AudioWrapperClient.java new file mode 100644 index 000000000..d14476113 --- /dev/null +++ b/com/hbm/sound/AudioWrapperClient.java @@ -0,0 +1,37 @@ +package com.hbm.sound; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.audio.MovingSound; +import net.minecraft.util.ResourceLocation; + +@SideOnly(Side.CLIENT) +public class AudioWrapperClient extends AudioWrapper { + + AudioDynamic sound; + + public AudioWrapperClient(ResourceLocation source) { + sound = new AudioDynamic(source); + } + + public void updatePosition(float x, float y, float z) { + sound.setPosition(x, y, z); + } + + public void updateVolume(float volume) { + sound.setVolume(volume); + } + + public void updatePitch(float pitch) { + sound.setPitch(pitch); + } + + public void startSound() { + sound.start(); + } + + public void stopSound() { + sound.stop(); + } + +} diff --git a/com/hbm/tileentity/machine/TileEntitySoyuzLauncher.java b/com/hbm/tileentity/machine/TileEntitySoyuzLauncher.java index f6fefd0e3..aa20eebb2 100644 --- a/com/hbm/tileentity/machine/TileEntitySoyuzLauncher.java +++ b/com/hbm/tileentity/machine/TileEntitySoyuzLauncher.java @@ -1,12 +1,290 @@ package com.hbm.tileentity.machine; +import java.util.ArrayList; +import java.util.List; + +import com.hbm.entity.missile.EntityMissileCustom; +import com.hbm.handler.MissileStruct; +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.lib.Library; +import com.hbm.main.MainRegistry; +import com.hbm.packet.AuxElectricityPacket; +import com.hbm.packet.AuxGaugePacket; +import com.hbm.packet.PacketDispatcher; +import com.hbm.packet.TEMissileMultipartPacket; + 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.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; -public class TileEntitySoyuzLauncher extends TileEntity { +public class TileEntitySoyuzLauncher extends TileEntity implements ISidedInventory, IConsumer, IFluidContainer, IFluidAcceptor { + private ItemStack slots[]; + + public long power; + public static final long maxPower = 100000; + public FluidTank[] tanks; + + public MissileStruct load; + + private static final int[] access = new int[] { 0 }; + + private String customName; + + public TileEntitySoyuzLauncher() { + slots = new ItemStack[27]; + tanks = new FluidTank[2]; + tanks[0] = new FluidTank(FluidType.KEROSENE, 100000, 0); + tanks[1] = new FluidTank(FluidType.ACID, 100000, 1); + } + + @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.launchTable"; + } + + @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 stack) { + 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; + } + } + + public long getPowerScaled(long i) { + return (power * i) / maxPower; + } + + @Override + public void updateEntity() { + + if (!worldObj.isRemote) { + + 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); + + PacketDispatcher.wrapper.sendToAll(new AuxElectricityPacket(xCoord, yCoord, zCoord, power)); + + } else { + + List entities = worldObj.getEntitiesWithinAABBExcludingEntity(null, AxisAlignedBB.getBoundingBox(xCoord - 0.5, yCoord, zCoord - 0.5, xCoord + 1.5, yCoord + 10, zCoord + 1.5)); + + for(Entity e : entities) { + + if(e instanceof EntityMissileCustom) { + + for(int i = 0; i < 15; i++) + MainRegistry.proxy.spawnParticle(xCoord + 0.5, yCoord + 0.25, zCoord + 0.5, "largelaunchsmoke", null); + + 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"); + power = nbt.getLong("power"); + + 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); + + NBTTagList list = new NBTTagList(); + + tanks[0].writeToNBT(nbt, "fuel"); + tanks[1].writeToNBT(nbt, "oxidizer"); + nbt.setLong("power", power); + + 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 access; + } + + @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; + } + + @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 getTanks() { + List 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() { return TileEntity.INFINITE_EXTENT_AABB; @@ -18,4 +296,19 @@ public class TileEntitySoyuzLauncher extends TileEntity { { 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; + } }