plentiful amounts of dosh

This commit is contained in:
Pheonix 2022-06-19 18:11:16 +01:00
parent e9f144bac9
commit fcfa5cee55
18 changed files with 3287 additions and 926 deletions

View File

@ -2,6 +2,7 @@ package com.hbm.crafting;
import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.OreDictManager;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.fluid.Fluids;
import static com.hbm.inventory.OreDictManager.*;
@ -149,6 +150,7 @@ public class WeaponRecipes {
//CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_darter, 1), new Object[] { "SST", " P", 'S', STEEL.plate(), 'T', ModItems.gas_empty, 'P', ANY_PLASTIC.ingot() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_fireext, 1), new Object[] { "HB", " T", 'H', ModItems.hull_small_steel, 'B', ModItems.bolt_tungsten, 'T', ModItems.tank_steel });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_spas12, 1), new Object[] { "TPS", "HHR", " L", 'T', ModItems.bolt_tungsten, 'P', STEEL.plate(), 'S', STEEL.ingot(), 'H', ModItems.hull_small_steel, 'R', ModItems.mechanism_rifle_1, 'L', ANY_PLASTIC.ingot()});
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_glass_cannon, 1), new Object[] { "GGC", "GTM", 'G', Item.getItemFromBlock(ModBlocks.glass_quartz), 'C', ModItems.battery_lithium_cell, 'T', ModItems.crt_display, 'M', ModItems.mechanism_special });
//Ammo assemblies
CraftingManager.addRecipeAuto(new ItemStack(ModItems.pellet_flechette, 1), new Object[] { " L ", " L ", "LLL", 'L', PB.nugget() });

File diff suppressed because it is too large Load Diff

View File

@ -229,6 +229,14 @@ public class BulletConfigSyncingUtil {
public static int DET_BOLT = i++;
public static int TURBINE = i++;
public static int GLASS_EMRADIO = i++;
public static int GLASS_EMMICRO = i++;
public static int GLASS_EMIR = i++;
public static int GLASS_EMVISIBLE = i++;
public static int GLASS_EMUV = i++;
public static int GLASS_EMXRAY = i++;
public static int GLASS_EMGAMMA = i++;
public static int CHL_LR22 = i++;
public static int CHL_LR22_FIRE = i++;
@ -472,6 +480,15 @@ public class BulletConfigSyncingUtil {
configSet.put(DET_BOLT, GunDetonatorFactory.getLaserConfig());
configSet.put(TURBINE, GunEnergyFactory.getTurbineConfig());
configSet.put(GLASS_EMRADIO, GunPoweredFactory.getEMRadioConfig());
configSet.put(GLASS_EMMICRO, GunPoweredFactory.getEMMicroConfig());
configSet.put(GLASS_EMIR, GunPoweredFactory.getEMInfraredConfig());
configSet.put(GLASS_EMVISIBLE, GunPoweredFactory.getEMVisibleConfig());
configSet.put(GLASS_EMUV, GunPoweredFactory.getEMUVConfig());
configSet.put(GLASS_EMXRAY, GunPoweredFactory.getEMXrayConfig());
configSet.put(GLASS_EMGAMMA, GunPoweredFactory.getEMGammaConfig());
configSet.put(CHL_LR22, Gun22LRFactory.get22LRConfig().setToHoming(ModItems.ammo_22lr_chlorophyte));
configSet.put(CHL_LR22_FIRE, Gun22LRFactory.get22LRConfig().setToFire(3).setToHoming(ModItems.ammo_22lr_chlorophyte));

View File

@ -1,198 +1,211 @@
package com.hbm.handler;
import java.util.List;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.handler.guncfg.BulletConfigFactory;
import com.hbm.interfaces.IBulletHitBehavior;
import com.hbm.interfaces.IBulletHurtBehavior;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.interfaces.IBulletRicochetBehavior;
import com.hbm.interfaces.IBulletUpdateBehavior;
import com.hbm.interfaces.Untested;
import com.hbm.lib.ModDamageSource;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSourceIndirect;
public class BulletConfiguration {
//what item this specific configuration consumes
public Item ammo;
//how many ammo units one item restores
public int ammoCount = 1;
//how fast the bullet is (in sanics per second, or sps)
public float velocity;
//spread of bullets in gaussian range
public float spread;
//weapon durability reduced (centered around 10)
public int wear;
//greatest amount of pellets created each shot
public int bulletsMin;
//least amount of pellets created each shot
public int bulletsMax;
//damage bounds
public float dmgMin;
public float dmgMax;
//acceleration torwards neg Y
public double gravity;
//max age in ticks before despawning
public int maxAge;
//whether the projectile should be able to bounce off of blocks
public boolean doesRicochet;
//the maximum angle at which the projectile should bounce
public double ricochetAngle;
//lower bound ricochet chance (below R angle)
public int LBRC;
//higher bound ricochet chance (above R angle)
public int HBRC;
//how much of the initial velocity is kept after bouncing
public double bounceMod;
//whether or not the bullet should penetrate mobs
public boolean doesPenetrate;
//whether or not the bullet should phase through blocks
public boolean isSpectral;
//whether or not the bullet should break glass
public boolean doesBreakGlass;
//whether the bullet should stay alive after colliding with a block
public boolean liveAfterImpact;
//creates a "muzzle flash" and a ton of smoke with every projectile spawned
public boolean blackPowder = false;
//bullet effects
public List<PotionEffect> effects;
public int incendiary;
public int emp;
public boolean blockDamage = true;
public float explosive;
public double jolt;
public int rainbow;
public int nuke;
public int shrapnel;
public int chlorine;
public int leadChance;
public int caustic;
public boolean destroysBlocks;
public boolean instakill;
public IBulletHurtBehavior bHurt;
public IBulletHitBehavior bHit;
public IBulletRicochetBehavior bRicochet;
public IBulletImpactBehavior bImpact;
public IBulletUpdateBehavior bUpdate;
//appearance
public int style;
//additional appearance data, i.e. particle effects
public int trail;
//ricochet sound type
public int plink;
//vanilla particle FX
public String vPFX = "";
public String damageType = ModDamageSource.s_bullet;
public boolean dmgProj = true;
public boolean dmgFire = false;
public boolean dmgExplosion = false;
public boolean dmgBypass = false;
public static final int STYLE_NONE = -1;
public static final int STYLE_NORMAL = 0;
public static final int STYLE_PISTOL = 1;
public static final int STYLE_FLECHETTE = 2;
public static final int STYLE_PELLET = 3;
public static final int STYLE_BOLT = 4;
public static final int STYLE_FOLLY = 5;
public static final int STYLE_ROCKET = 6;
public static final int STYLE_STINGER = 7;
public static final int STYLE_NUKE = 8;
public static final int STYLE_MIRV = 9;
public static final int STYLE_GRENADE = 10;
public static final int STYLE_BF = 11;
public static final int STYLE_ORB = 12;
public static final int STYLE_METEOR = 13;
public static final int STYLE_APDS = 14;
public static final int STYLE_BLADE = 15;
public static final int STYLE_BARREL = 16;
public static final int PLINK_NONE = 0;
public static final int PLINK_BULLET = 1;
public static final int PLINK_GRENADE = 2;
public static final int PLINK_ENERGY = 3;
public static final int PLINK_SING = 4;
public static final int BOLT_LACUNAE = 0;
public static final int BOLT_NIGHTMARE = 1;
public static final int BOLT_LASER = 2;
public static final int BOLT_ZOMG = 3;
public static final int BOLT_WORM = 4;
public BulletConfiguration setToBolt(int trail) {
this.style = STYLE_BOLT;
this.trail = trail;
return this;
}
public BulletConfiguration setToFire(int duration) {
this.incendiary = duration;
return this;
}
public BulletConfiguration setToGuided() {
this.bUpdate = BulletConfigFactory.getLaserSteering();
this.doesRicochet = false;
return this;
}
public BulletConfiguration setToHoming(Item ammo) {
this.ammo = ammo;
this.bUpdate = BulletConfigFactory.getHomingBehavior(200, 45);
this.dmgMin *= 1.5F;
this.dmgMax *= 1.5F;
this.wear *= 0.5;
this.doesRicochet = false;
this.doesPenetrate = false;
this.vPFX = "greendust";
return this;
}
public BulletConfiguration accuracyMod(float mod) {
this.spread *= mod;
return this;
}
@Untested
public DamageSource getDamage(EntityBulletBase bullet, EntityLivingBase shooter) {
DamageSource dmg;
String unloc = damageType;
if(unloc.equals(ModDamageSource.s_zomg_prefix))
unloc += (bullet.worldObj.rand.nextInt(5) + 1); //pain
if(shooter != null)
dmg = new EntityDamageSourceIndirect(unloc, bullet, shooter);
else
dmg = new DamageSource(unloc);
if(this.dmgProj) dmg.setProjectile();
if(this.dmgFire) dmg.setFireDamage();
if(this.dmgExplosion) dmg.setExplosion();
if(this.dmgBypass) dmg.setDamageBypassesArmor();
return dmg;
}
}
package com.hbm.handler;
import java.util.List;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.handler.guncfg.BulletConfigFactory;
import com.hbm.interfaces.IBulletHitBehavior;
import com.hbm.interfaces.IBulletHurtBehavior;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.interfaces.IBulletRicochetBehavior;
import com.hbm.interfaces.IBulletUpdateBehavior;
import com.hbm.interfaces.Untested;
import com.hbm.lib.ModDamageSource;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSourceIndirect;
import net.minecraft.util.EnumChatFormatting;
public class BulletConfiguration {
//what item this specific configuration consumes
public Item ammo;
//how many ammo units one item restores
public int ammoCount = 1;
//how fast the bullet is (in sanics per second, or sps)
public float velocity;
//spread of bullets in gaussian range
public float spread;
//weapon durability reduced (centered around 10)
public int wear;
//greatest amount of pellets created each shot
public int bulletsMin;
//least amount of pellets created each shot
public int bulletsMax;
//damage bounds
public float dmgMin;
public float dmgMax;
//acceleration torwards neg Y
public double gravity;
//max age in ticks before despawning
public int maxAge;
//whether the projectile should be able to bounce off of blocks
public boolean doesRicochet;
//the maximum angle at which the projectile should bounce
public double ricochetAngle;
//lower bound ricochet chance (below R angle)
public int LBRC;
//higher bound ricochet chance (above R angle)
public int HBRC;
//how much of the initial velocity is kept after bouncing
public double bounceMod;
//whether or not the bullet should penetrate mobs
public boolean doesPenetrate;
//whether or not the bullet should phase through blocks
public boolean isSpectral;
//whether or not the bullet should break glass
public boolean doesBreakGlass;
//whether the bullet should stay alive after colliding with a block
public boolean liveAfterImpact;
//creates a "muzzle flash" and a ton of smoke with every projectile spawned
public boolean blackPowder = false;
//bullet effects
public List<PotionEffect> effects;
public int incendiary;
public int emp;
public boolean blockDamage = true;
public float explosive;
public double jolt;
public int rainbow;
public int nuke;
public int shrapnel;
public int chlorine;
public int leadChance;
public int caustic;
public boolean destroysBlocks;
public boolean instakill;
public IBulletHurtBehavior bHurt;
public IBulletHitBehavior bHit;
public IBulletRicochetBehavior bRicochet;
public IBulletImpactBehavior bImpact;
public IBulletUpdateBehavior bUpdate;
//appearance
public int style;
//additional appearance data, i.e. particle effects
public int trail;
//ricochet sound type
public int plink;
//vanilla particle FX
public String vPFX = "";
//energy projectiles
//power consumed per shot
public int dischargePerShot;
//unlocalised firing mode name
public String modeName;
//firing mode text colour
public EnumChatFormatting chatColour = EnumChatFormatting.WHITE;
//firing rate
public int firingRate;
public String damageType = ModDamageSource.s_bullet;
public boolean dmgProj = true;
public boolean dmgFire = false;
public boolean dmgExplosion = false;
public boolean dmgBypass = false;
public static final int STYLE_NONE = -1;
public static final int STYLE_NORMAL = 0;
public static final int STYLE_PISTOL = 1;
public static final int STYLE_FLECHETTE = 2;
public static final int STYLE_PELLET = 3;
public static final int STYLE_BOLT = 4;
public static final int STYLE_FOLLY = 5;
public static final int STYLE_ROCKET = 6;
public static final int STYLE_STINGER = 7;
public static final int STYLE_NUKE = 8;
public static final int STYLE_MIRV = 9;
public static final int STYLE_GRENADE = 10;
public static final int STYLE_BF = 11;
public static final int STYLE_ORB = 12;
public static final int STYLE_METEOR = 13;
public static final int STYLE_APDS = 14;
public static final int STYLE_BLADE = 15;
public static final int STYLE_BARREL = 16;
public static final int PLINK_NONE = 0;
public static final int PLINK_BULLET = 1;
public static final int PLINK_GRENADE = 2;
public static final int PLINK_ENERGY = 3;
public static final int PLINK_SING = 4;
public static final int BOLT_LACUNAE = 0;
public static final int BOLT_NIGHTMARE = 1;
public static final int BOLT_LASER = 2;
public static final int BOLT_ZOMG = 3;
public static final int BOLT_WORM = 4;
public static final int BOLT_GLASS_CYAN = 5;
public static final int BOLT_GLASS_BLUE = 6;
public BulletConfiguration setToBolt(int trail) {
this.style = STYLE_BOLT;
this.trail = trail;
return this;
}
public BulletConfiguration setToFire(int duration) {
this.incendiary = duration;
return this;
}
public BulletConfiguration setToGuided() {
this.bUpdate = BulletConfigFactory.getLaserSteering();
this.doesRicochet = false;
return this;
}
public BulletConfiguration setToHoming(Item ammo) {
this.ammo = ammo;
this.bUpdate = BulletConfigFactory.getHomingBehavior(200, 45);
this.dmgMin *= 1.5F;
this.dmgMax *= 1.5F;
this.wear *= 0.5;
this.doesRicochet = false;
this.doesPenetrate = false;
this.vPFX = "greendust";
return this;
}
public BulletConfiguration accuracyMod(float mod) {
this.spread *= mod;
return this;
}
@Untested
public DamageSource getDamage(EntityBulletBase bullet, EntityLivingBase shooter) {
DamageSource dmg;
String unloc = damageType;
if(unloc.equals(ModDamageSource.s_zomg_prefix))
unloc += (bullet.worldObj.rand.nextInt(5) + 1); //pain
if(shooter != null)
dmg = new EntityDamageSourceIndirect(unloc, bullet, shooter);
else
dmg = new DamageSource(unloc);
if(this.dmgProj) dmg.setProjectile();
if(this.dmgFire) dmg.setFireDamage();
if(this.dmgExplosion) dmg.setExplosion();
if(this.dmgBypass) dmg.setDamageBypassesArmor();
return dmg;
}
}

View File

@ -1,93 +1,101 @@
package com.hbm.handler;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
public class GunConfiguration {
/**
* alt function restrictions:
* alt can not be reloaded (reload type of 0, ammo cap of 0)
* alt cooldown and main cooldown are shared (alt cooldown will almoast always be greater or equal)
* alt is always the lower priority, mouse2 will be canceled then mouse1 is activated at the same time
* restrictions must be applied in gun's logic, mechanism may be dysfunctional if these rules are ignored
*/
//amount of ticks between each bullet
public int rateOfFire;
//amount of bullets fired per delay passed
public int roundsPerCycle;
//0 = normal, 1 = release, 2 = both
public int gunMode;
//0 = manual, 1 = automatic
public int firingMode;
//weapon won't fire after weapon breaks (main only)
public int durability;
//animations!
public HashMap<AnimType, BusAnimation> animations = new HashMap();
//whether ot not to disable crosshais when sneaking
public boolean hasSights;
//how long the reload animation will play
//MUST BE GREATER THAN ZERO ! ! !
public int reloadDuration;
//duration of every animation cycle
public int firingDuration;
//sound path to the reload sound
public String reloadSound = "";
//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;
//0 does not allow direct reload, 1 is full clip, 2 is single bullet
public int reloadType;
//whether or not the infinity enchantment should work
public boolean allowsInfinity;
//whether the ammo count should be displayed
public boolean showAmmo = true;
public String name = "";
public String manufacturer = "";
public List<String> comment = new ArrayList();
//bullet configs for main and alt fire
public List<Integer> config = new ArrayList();
//crosshair
public Crosshair crosshair;
public static final int MODE_NORMAL = 0;
public static final int MODE_RELEASE = 1;
public static final int MODE_BOTH = 1;
public static final int FIRE_MANUAL = 0;
public static final int FIRE_AUTO = 1;
public static final int RELOAD_NONE = 0;
public static final int RELOAD_FULL = 1;
public static final int RELOAD_SINGLE = 2;
public static final String RSOUND_REVOLVER = "hbm:weapon.revolverReload";
public static final String RSOUND_RIFLE = "";
public static final String RSOUND_MAG = "hbm:weapon.magReload";
public static final String RSOUND_SHOTGUN = "hbm:weapon.shotgunReload";
public static final String RSOUND_LAUNCHER = "hbm:weapon.rpgReload";
public static final String RSOUND_GRENADE = "hbm:weapon.hkReload";
public static final String RSOUND_FATMAN = "hbm:weapon.fatmanReload";
public GunConfiguration silenced() {
this.firingSound = "hbm:weapon.silencerShoot";
return this;
}
}
package com.hbm.handler;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
public class GunConfiguration {
/**
* alt function restrictions:
* alt can not be reloaded (reload type of 0, ammo cap of 0)
* alt cooldown and main cooldown are shared (alt cooldown will almoast always be greater or equal)
* alt is always the lower priority, mouse2 will be canceled then mouse1 is activated at the same time
* restrictions must be applied in gun's logic, mechanism may be dysfunctional if these rules are ignored
*/
//amount of ticks between each bullet
public int rateOfFire;
//amount of bullets fired per delay passed
public int roundsPerCycle;
//0 = normal, 1 = release, 2 = both
public int gunMode;
//0 = manual, 1 = automatic
public int firingMode;
//weapon won't fire after weapon breaks (main only)
public int durability;
//animations!
public HashMap<AnimType, BusAnimation> animations = new HashMap();
//whether ot not to disable crosshais when sneaking
public boolean hasSights;
//how long the reload animation will play
//MUST BE GREATER THAN ZERO ! ! !
public int reloadDuration;
//duration of every animation cycle
public int firingDuration;
//sound path to the reload sound
public String reloadSound = "";
//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;
//0 does not allow direct reload, 1 is full clip, 2 is single bullet
public int reloadType;
//whether or not the infinity enchantment should work
public boolean allowsInfinity;
//whether the ammo count should be displayed
public boolean showAmmo = true;
//for electrically powered weapons:
//the Maximum capacity of the gun
public int maxCharge;
//the rate at which the gun is charged
public int chargeRate;
//how much energy is discharged per shot
public int dischargePerShot;
public String name = "";
public String manufacturer = "";
public List<String> comment = new ArrayList();
//bullet configs for main and alt fire
public List<Integer> config = new ArrayList();
//crosshair
public Crosshair crosshair;
public static final int MODE_NORMAL = 0;
public static final int MODE_RELEASE = 1;
public static final int MODE_BOTH = 1;
public static final int FIRE_MANUAL = 0;
public static final int FIRE_AUTO = 1;
public static final int RELOAD_NONE = 0;
public static final int RELOAD_FULL = 1;
public static final int RELOAD_SINGLE = 2;
public static final String RSOUND_REVOLVER = "hbm:weapon.revolverReload";
public static final String RSOUND_RIFLE = "";
public static final String RSOUND_MAG = "hbm:weapon.magReload";
public static final String RSOUND_SHOTGUN = "hbm:weapon.shotgunReload";
public static final String RSOUND_LAUNCHER = "hbm:weapon.rpgReload";
public static final String RSOUND_GRENADE = "hbm:weapon.hkReload";
public static final String RSOUND_FATMAN = "hbm:weapon.fatmanReload";
public GunConfiguration silenced() {
this.firingSound = "hbm:weapon.silencerShoot";
return this;
}
}

View File

@ -0,0 +1,282 @@
package com.hbm.handler.guncfg;
import java.util.ArrayList;
import com.hbm.blocks.ModBlocks;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.explosion.ExplosionNT;
import com.hbm.explosion.ExplosionNT.ExAttrib;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.items.ModItems;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
public class GunPoweredFactory {
public static GunConfiguration getGlassCannonConfig() {
GunConfiguration config = new GunConfiguration();
config.roundsPerCycle = 1;
config.gunMode = GunConfiguration.MODE_NORMAL;
config.firingMode = GunConfiguration.FIRE_AUTO;
config.firingDuration = 0;
config.durability = 2500;
config.allowsInfinity = false;
config.crosshair = Crosshair.BOX;
config.firingSound = "hbm:weapon.zomgShoot";
config.maxCharge = 1_000_000;
config.chargeRate = 2500;
config.name = "LIY2001 Anti-Material Electromagnetic Rifle Prototype";
config.manufacturer = "OxfordEM technologies";
config.config = new ArrayList<Integer>();
config.config.add(BulletConfigSyncingUtil.GLASS_EMRADIO);
config.config.add(BulletConfigSyncingUtil.GLASS_EMMICRO);
config.config.add(BulletConfigSyncingUtil.GLASS_EMIR);
config.config.add(BulletConfigSyncingUtil.GLASS_EMVISIBLE);
config.config.add(BulletConfigSyncingUtil.GLASS_EMUV);
config.config.add(BulletConfigSyncingUtil.GLASS_EMXRAY);
config.config.add(BulletConfigSyncingUtil.GLASS_EMGAMMA);
return config;
}
/*public static BulletConfiguration getGlassBoltConfig() {
BulletConfiguration bullet = new BulletConfiguration();
bullet.velocity = 2.0F;
bullet.spread = 0F;
bullet.dmgMin = 30;
bullet.dmgMax = 40;
bullet.bulletsMin = 1;
bullet.bulletsMax = 1;
bullet.gravity = 0D;
bullet.maxAge = 100;
bullet.doesRicochet = true;
bullet.ricochetAngle = 90;
bullet.HBRC = 2;
bullet.LBRC = 90;
bullet.bounceMod = 1;
bullet.doesPenetrate = true;
bullet.style = BulletConfiguration.STYLE_BOLT;
bullet.plink = BulletConfiguration.PLINK_ENERGY;
bullet.trail = BulletConfiguration.BOLT_LASER;
bullet.dischargePerShot = 1000;
bullet.firingRate = 5;
bullet.modeName = "testMode";
bullet.chatColour = EnumChatFormatting.RED;
return bullet;
}*/
public static BulletConfiguration getEMRadioConfig() {
BulletConfiguration bullet = new BulletConfiguration();
bullet.velocity = 4.0F;
bullet.spread = 0F;
bullet.dmgMin = 35;
bullet.dmgMax = 45;
bullet.bulletsMin = 1;
bullet.bulletsMax = 1;
bullet.gravity = 0D;
bullet.maxAge = 100;
bullet.doesRicochet = true;
bullet.ricochetAngle = 90;
bullet.HBRC = 2;
bullet.LBRC = 90;
bullet.bounceMod = 1;
bullet.doesPenetrate = true;
bullet.style = BulletConfiguration.STYLE_BOLT;
bullet.trail = BulletConfiguration.BOLT_LASER;
bullet.plink = BulletConfiguration.PLINK_ENERGY;
bullet.dischargePerShot = 25_000;
bullet.firingRate = 20;
bullet.modeName = "weapon.elecGun.glass_cannon.radio";
bullet.chatColour = EnumChatFormatting.DARK_RED;
return bullet;
}
public static BulletConfiguration getEMMicroConfig() {
BulletConfiguration bullet = new BulletConfiguration();
bullet.velocity = 3.0F;
bullet.spread = 0F;
bullet.dmgMin = 18;
bullet.dmgMax = 22;
bullet.bulletsMin = 1;
bullet.bulletsMax = 1;
bullet.gravity = 0D;
bullet.maxAge = 100;
bullet.doesRicochet = true;
bullet.ricochetAngle = 90;
bullet.HBRC = 2;
bullet.LBRC = 90;
bullet.bounceMod = 1;
bullet.doesPenetrate = true;
bullet.style = BulletConfiguration.STYLE_BOLT;
bullet.trail = BulletConfiguration.BOLT_LASER;
bullet.dischargePerShot = 12_500;
bullet.firingRate = 15;
bullet.modeName = "weapon.elecGun.glass_cannon.micro";
bullet.chatColour = EnumChatFormatting.RED;
return bullet;
}
public static BulletConfiguration getEMInfraredConfig() {
BulletConfiguration bullet = new BulletConfiguration();
bullet.velocity = 2.0F;
bullet.spread = 0F;
bullet.dmgMin = 9;
bullet.dmgMax = 11;
bullet.bulletsMin = 1;
bullet.bulletsMax = 1;
bullet.gravity = 0D;
bullet.maxAge = 100;
bullet.doesRicochet = true;
bullet.ricochetAngle = 90;
bullet.HBRC = 2;
bullet.LBRC = 90;
bullet.bounceMod = 1;
bullet.doesPenetrate = true;
bullet.style = BulletConfiguration.STYLE_BOLT;
bullet.trail = BulletConfiguration.BOLT_LASER;
bullet.dischargePerShot = 6_000;
bullet.firingRate = 10;
bullet.modeName = "weapon.elecGun.glass_cannon.ir";
bullet.chatColour = EnumChatFormatting.RED;
return bullet;
}
public static BulletConfiguration getEMVisibleConfig() {
BulletConfiguration bullet = new BulletConfiguration();
bullet.velocity = 2.0F;
bullet.spread = 0F;
bullet.dmgMin = 4;
bullet.dmgMax = 6;
bullet.bulletsMin = 1;
bullet.bulletsMax = 1;
bullet.gravity = 0D;
bullet.maxAge = 100;
bullet.doesRicochet = true;
bullet.ricochetAngle = 90;
bullet.HBRC = 2;
bullet.LBRC = 90;
bullet.bounceMod = 1;
bullet.doesPenetrate = true;
bullet.style = BulletConfiguration.STYLE_BOLT;
bullet.trail = BulletConfiguration.BOLT_WORM;
bullet.dischargePerShot = 2_500;
bullet.firingRate = 5;
bullet.modeName = "weapon.elecGun.glass_cannon.visible";
bullet.chatColour = EnumChatFormatting.GREEN;
return bullet;
}
public static BulletConfiguration getEMUVConfig() {
BulletConfiguration bullet = new BulletConfiguration();
bullet.velocity = 2.0F;
bullet.spread = 0F;
bullet.dmgMin = 3;
bullet.dmgMax = 3;
bullet.bulletsMin = 1;
bullet.bulletsMax = 1;
bullet.gravity = 0D;
bullet.maxAge = 100;
bullet.doesRicochet = true;
bullet.ricochetAngle = 90;
bullet.HBRC = 2;
bullet.LBRC = 90;
bullet.bounceMod = 1;
bullet.doesPenetrate = true;
bullet.style = BulletConfiguration.STYLE_BOLT;
bullet.trail = BulletConfiguration.BOLT_GLASS_CYAN;
bullet.dischargePerShot = 1_200;
bullet.firingRate = 3;
bullet.modeName = "weapon.elecGun.glass_cannon.uv";
bullet.chatColour = EnumChatFormatting.AQUA;
return bullet;
}
public static BulletConfiguration getEMXrayConfig() {
BulletConfiguration bullet = new BulletConfiguration();
bullet.velocity = 2.0F;
bullet.spread = 0F;
bullet.dmgMin = 2;
bullet.dmgMax = 2;
bullet.bulletsMin = 1;
bullet.bulletsMax = 1;
bullet.gravity = 0D;
bullet.maxAge = 100;
bullet.doesRicochet = true;
bullet.ricochetAngle = 90;
bullet.HBRC = 2;
bullet.LBRC = 90;
bullet.bounceMod = 1;
bullet.doesPenetrate = true;
bullet.style = BulletConfiguration.STYLE_BOLT;
bullet.trail = BulletConfiguration.BOLT_GLASS_BLUE;
bullet.dischargePerShot = 800;
bullet.firingRate = 2;
bullet.modeName = "weapon.elecGun.glass_cannon.xray";
bullet.chatColour = EnumChatFormatting.BLUE;
return bullet;
}
public static BulletConfiguration getEMGammaConfig() {
BulletConfiguration bullet = new BulletConfiguration();
bullet.velocity = 2.0F;
bullet.spread = 0F;
bullet.dmgMin = 1;
bullet.dmgMax = 1;
bullet.bulletsMin = 1;
bullet.bulletsMax = 1;
bullet.gravity = 0D;
bullet.maxAge = 100;
bullet.doesRicochet = true;
bullet.ricochetAngle = 90;
bullet.HBRC = 2;
bullet.LBRC = 90;
bullet.bounceMod = 1;
bullet.doesPenetrate = true;
bullet.style = BulletConfiguration.STYLE_BOLT;
bullet.trail = BulletConfiguration.BOLT_LACUNAE;
bullet.dischargePerShot = 400;
bullet.firingRate = 1;
bullet.modeName = "weapon.elecGun.glass_cannon.gamma";
bullet.chatColour = EnumChatFormatting.LIGHT_PURPLE;
return bullet;
}
}

View File

@ -28,6 +28,7 @@ import com.hbm.items.tool.*;
import com.hbm.items.tool.ItemToolAbility.EnumToolType;
import com.hbm.items.weapon.*;
import com.hbm.items.weapon.ItemMissile.*;
import com.hbm.items.weapon.gununified.ItemEnergyGunBase;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.potion.HbmPotion;
@ -1710,6 +1711,7 @@ public class ModItems {
public static Item gun_waluigi;
public static Item gun_darter;
public static Item gun_detonator;
public static Item gun_glass_cannon;
public static Item crucible;
@ -4439,6 +4441,7 @@ public class ModItems {
gun_dampfmaschine = new GunDampfmaschine().setUnlocalizedName("gun_dampfmaschine").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_dampfmaschine");
gun_darter = new ItemGunDart(GunDartFactory.getDarterConfig()).setFull3D().setUnlocalizedName("gun_darter").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_darter");
gun_detonator = new ItemGunDetonator(GunDetonatorFactory.getDetonatorConfig()).setFull3D().setUnlocalizedName("gun_detonator").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_darter");
gun_glass_cannon = new ItemEnergyGunBase(GunPoweredFactory.getGlassCannonConfig()).setFull3D().setUnlocalizedName("gun_glass_cannon").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_darter");
ToolMaterial matCrucible = EnumHelper.addToolMaterial("CRUCIBLE", 10, 3, 50.0F, 100.0F, 0);
crucible = new ItemCrucible(5000, 1F, matCrucible).setUnlocalizedName("crucible").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":crucible");
@ -7217,6 +7220,7 @@ public class ModItems {
GameRegistry.registerItem(gun_darter, gun_darter.getUnlocalizedName());
GameRegistry.registerItem(gun_detonator, gun_detonator.getUnlocalizedName());
GameRegistry.registerItem(crucible, crucible.getUnlocalizedName());
GameRegistry.registerItem(gun_glass_cannon, gun_glass_cannon.getUnlocalizedName());
//Ammo
GameRegistry.registerItem(gun_revolver_iron_ammo, gun_revolver_iron_ammo.getUnlocalizedName());

View File

@ -0,0 +1,331 @@
package com.hbm.items.weapon.gununified;
import java.util.List;
import org.lwjgl.input.Mouse;
import com.hbm.config.GeneralConfig;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.handler.HbmKeybinds;
import com.hbm.interfaces.IHoldableWeapon;
import com.hbm.items.machine.ItemBattery;
import com.hbm.items.weapon.ItemGunBase;
import com.hbm.main.MainRegistry;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.GunAnimationPacket;
import com.hbm.packet.GunButtonPacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.PlayerInformPacket;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.render.util.RenderScreenOverlay;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
import com.hbm.util.BobMathUtil;
import com.hbm.util.ChatBuilder;
import com.hbm.util.I18nUtil;
import api.hbm.energy.IBatteryItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
public class ItemEnergyGunBase extends ItemGunBase implements IBatteryItem {
public ItemEnergyGunBase(GunConfiguration config) {
super(config);
}
public ItemEnergyGunBase(GunConfiguration config, GunConfiguration alt) {
super(config, alt);
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
list.add("Energy Stored: " + BobMathUtil.getShortNumber(getCharge(stack)) + "/" + BobMathUtil.getShortNumber(mainConfig.maxCharge) + "HE");
list.add("Charge rate: " + BobMathUtil.getShortNumber(mainConfig.chargeRate) + "HE/t");
BulletConfiguration config = getConfig(stack);
list.add("");
list.add("Mode: " + I18nUtil.resolveKey(config.modeName));
list.add("Mode info:");
list.add("Average damage: " + ((float)(config.dmgMax + config.dmgMin) / 2F));
list.add("Firing Rate: " + BobMathUtil.roundDecimal((1F / (((float)config.firingRate) / 20F)), 2) + " rounds per second");
list.add("Power Consumption per Shot: " + BobMathUtil.getShortNumber(config.dischargePerShot) + "HE");
list.add("");
list.add("Name: " + mainConfig.name);
list.add("Manufacturer: " + mainConfig.manufacturer);
if(!mainConfig.comment.isEmpty()) {
list.add("");
for(String s : mainConfig.comment)
list.add(EnumChatFormatting.ITALIC + s);
}
}
@Override
@SideOnly(Side.CLIENT)
protected void updateClient(ItemStack stack, World world, EntityPlayer entity, int slot, boolean isCurrentItem) {
if(!world.isRemote)
return;
boolean clickLeft = Mouse.isButtonDown(0);
boolean clickRight = Mouse.isButtonDown(1);
boolean left = m1;
boolean right = m2;
if(isCurrentItem) {
if(left && right) {
PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(false, (byte) 0));
PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(false, (byte) 1));
m1 = false;
m2 = false;
}
if(left && !clickLeft) {
PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(false, (byte) 0));
m1 = false;
endActionClient(stack, world, entity, true);
}
if(right && !clickRight) {
PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(false, (byte) 1));
m2 = false;
endActionClient(stack, world, entity, false);
}
}
}
protected void updateServer(ItemStack stack, World world, EntityPlayer player, int slot, boolean isCurrentItem) {
if(getDelay(stack) > 0 && isCurrentItem)
setDelay(stack, getDelay(stack) - 1);
if(getIsMouseDown(stack) && !(player.getHeldItem() == stack)) {
setIsMouseDown(stack, false);
}
if(getIsAltDown(stack) && !isCurrentItem) {
setIsAltDown(stack, false);
}
if(GeneralConfig.enableGuns && mainConfig.firingMode == 1 && getIsMouseDown(stack) && tryShoot(stack, world, player, isCurrentItem)) {
fire(stack, world, player);
setDelay(stack, getConfig(stack).firingRate);
}
}
protected boolean tryShoot(ItemStack stack, World world, EntityPlayer player, boolean main) {
if(main && getDelay(stack) == 0) {
return getConfig(stack).dischargePerShot <= getCharge(stack);
}
return false;
}
protected void fire(ItemStack stack, World world, EntityPlayer player) {
BulletConfiguration config = getConfig(stack);
int bullets = config.bulletsMin;
for(int k = 0; k < mainConfig.roundsPerCycle; k++) {
if(config.bulletsMax > config.bulletsMin)
bullets += world.rand.nextInt(config.bulletsMax - config.bulletsMin);
for(int i = 0; i < bullets; i++) {
spawnProjectile(world, player, stack, BulletConfigSyncingUtil.getKey(config));
}
setCharge(stack, getCharge(stack) - config.dischargePerShot);;
}
world.playSoundAtEntity(player, mainConfig.firingSound, 1.0F, mainConfig.firingPitch);
if(player.getDisplayName().equals("Vic4Games")) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString("type", "justTilt");
nbt.setInteger("time", mainConfig.rateOfFire + 1);
PacketDispatcher.wrapper.sendTo(new AuxParticlePacketNT(nbt, player.posX, player.posY, player.posZ), (EntityPlayerMP) player);
}
}
protected void spawnProjectile(World world, EntityPlayer player, ItemStack stack, int config) {
EntityBulletBase bullet = new EntityBulletBase(world, config, player);
world.spawnEntityInWorld(bullet);
if(this.mainConfig.animations.containsKey(AnimType.CYCLE) && player instanceof EntityPlayerMP)
PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(AnimType.CYCLE.ordinal()), (EntityPlayerMP) player);
}
public void startAction(ItemStack stack, World world, EntityPlayer player, boolean main) {
if(mainConfig.firingMode == mainConfig.FIRE_MANUAL && main && tryShoot(stack, world, player, main)) {
fire(stack, world, player);
setDelay(stack, mainConfig.rateOfFire);
}
if(!main && stack.getItem() instanceof ItemEnergyGunBase) {
byte mode = stack.hasTagCompound() ? stack.getTagCompound().getByte("mode") : 0;
if(!stack.hasTagCompound())
stack.stackTagCompound = new NBTTagCompound();
mode++;
if(mode >= mainConfig.config.size()) {
mode = 0;
}
stack.getTagCompound().setByte("mode", mode);
if(!world.isRemote) {
BulletConfiguration config = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(mode));
//PacketDispatcher.wrapper.sendTo(new PlayerInformPacket("" + config.chatColour + config.modeName, MainRegistry.proxy.ID_GUN_MODE), (EntityPlayerMP)player);
player.addChatMessage(ChatBuilder.start("")
.nextTranslation("weapon.elecGun.modeChange").color(EnumChatFormatting.WHITE)
.nextTranslation(" ")
.nextTranslation(config.modeName).color(config.chatColour).flush());
}
}
}
// yummy boilerplate
public boolean showDurabilityBar(ItemStack stack) {
return true;
}
public double getDurabilityForDisplay(ItemStack stack) {
return 1D - (double) getCharge(stack) / (double) getMaxCharge();
}
@Override
public void chargeBattery(ItemStack stack, long i) {
if(stack.getItem() instanceof ItemEnergyGunBase) {
if(stack.hasTagCompound()) {
stack.stackTagCompound.setLong("charge", stack.stackTagCompound.getLong("charge") + i);
} else {
stack.stackTagCompound = new NBTTagCompound();
stack.stackTagCompound.setLong("charge", i);
}
}
}
@Override
public void setCharge(ItemStack stack, long i) {
if(stack.getItem() instanceof ItemEnergyGunBase) {
if(stack.hasTagCompound()) {
stack.stackTagCompound.setLong("charge", i);
} else {
stack.stackTagCompound = new NBTTagCompound();
stack.stackTagCompound.setLong("charge", i);
}
}
}
@Override
public void dischargeBattery(ItemStack stack, long i) {
if(stack.getItem() instanceof ItemEnergyGunBase) {
if(stack.hasTagCompound()) {
stack.stackTagCompound.setLong("charge", stack.stackTagCompound.getLong("charge") - i);
} else {
stack.stackTagCompound = new NBTTagCompound();
stack.stackTagCompound.setLong("charge", ((ItemEnergyGunBase)stack.getItem()).mainConfig.maxCharge - i);
}
}
}
@Override
public long getCharge(ItemStack stack) {
if(stack.getItem() instanceof ItemEnergyGunBase) {
if(stack.hasTagCompound()) {
return stack.stackTagCompound.getLong("charge");
} else {
stack.stackTagCompound = new NBTTagCompound();
stack.stackTagCompound.setLong("charge", ((ItemEnergyGunBase) stack.getItem()).mainConfig.maxCharge);
return stack.stackTagCompound.getLong("charge");
}
}
return 0;
}
@Override
public long getMaxCharge() {
return mainConfig.maxCharge;
}
@Override
public long getChargeRate() {
return mainConfig.chargeRate;
}
@Override
public long getDischargeRate() {
return 0;
}
public BulletConfiguration getConfig(ItemStack stack) {
byte mode = 0;
if(stack.hasTagCompound())
mode = stack.getTagCompound().getByte("mode");
return BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(mode));
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list) {
ItemStack stack = new ItemStack(item);
stack.stackTagCompound = new NBTTagCompound();
stack.stackTagCompound.setLong("charge", ((ItemEnergyGunBase) item).getMaxCharge());
list.add(stack);
}
@Override
@SideOnly(Side.CLIENT)
public void renderHUD(Pre event, ElementType type, EntityPlayer player, ItemStack stack) {
if(type == ElementType.CROSSHAIRS && GeneralConfig.enableCrosshairs) {
event.setCanceled(true);
if(!(mainConfig.hasSights && player.isSneaking()))
RenderScreenOverlay.renderCustomCrosshairs(event.resolution, Minecraft.getMinecraft().ingameGUI, ((IHoldableWeapon)player.getHeldItem().getItem()).getCrosshair());
else
RenderScreenOverlay.renderCustomCrosshairs(event.resolution, Minecraft.getMinecraft().ingameGUI, Crosshair.NONE);
}
}
}

View File

@ -468,6 +468,7 @@ public class ClientProxy extends ServerProxy {
MinecraftForgeClient.registerItemRenderer(ModItems.gun_detonator, new ItemRenderDetonatorLaser());
MinecraftForgeClient.registerItemRenderer(ModItems.detonator_laser, new ItemRenderDetonatorLaser());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_spas12, new ItemRenderWeaponSpas12());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_glass_cannon, new ItemRenderWeaponGlass());
//multitool
MinecraftForgeClient.registerItemRenderer(ModItems.multitool_dig, new ItemRenderMultitool());
MinecraftForgeClient.registerItemRenderer(ModItems.multitool_silk, new ItemRenderMultitool());

View File

@ -657,6 +657,7 @@ public class ResourceManager {
public static final IModelCustom detonator_laser = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/detonator_laser.obj"));
public static final IModelCustom spas_12 = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/spas-12.obj"));
public static final IModelCustom nightmare_dark = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/nightmare_dark.obj"));
public static final IModelCustom glass_cannon = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/glass_cannon.obj"));
public static final IModelCustom lance = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/lance.obj"));
@ -732,6 +733,7 @@ public class ResourceManager {
public static final ResourceLocation rem700sat_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/ff/rem700sat.png");
public static final ResourceLocation detonator_laser_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/detonator_laser.png");
public static final ResourceLocation spas_12_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/spas-12.png");
public static final ResourceLocation glass_cannon_panel_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/glass_cannon_panel.png");
public static final ResourceLocation lance_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/lance.png");

View File

@ -12,7 +12,7 @@ import net.minecraft.world.World;
public class ServerProxy {
//sort by estimated time of display. longer lasting ones should be sortet at the top.
//sort by estimated time of display. longer lasting ones should be sorted at the top.
public static final int ID_DUCK = 0;
public static final int ID_FILTER = 1;
public static final int ID_COMPASS = 2;
@ -21,6 +21,7 @@ public class ServerProxy {
public static final int ID_HUD = 5;
public static final int ID_DETONATOR = 6;
public static final int ID_FLUID_ID = 7;
public static final int ID_GUN_MODE = 8;
public void registerRenderInfo() { }
public void registerTileEntitySpecialRenderer() { }

View File

@ -321,6 +321,8 @@ public class RenderBullet extends Render {
case BulletConfiguration.BOLT_NIGHTMARE: red = 1F; green = 1F; blue = 0F; break;
case BulletConfiguration.BOLT_LACUNAE: red = 0.25F; green = 0F; blue = 0.75F; break;
case BulletConfiguration.BOLT_WORM: red = 0F; green = 1F; blue = 0F; break;
case BulletConfiguration.BOLT_GLASS_CYAN: red = 0F; green = 1F; blue = 1F; break;
case BulletConfiguration.BOLT_GLASS_BLUE: red = 0F; green = 0F; blue = 1F; break;
case BulletConfiguration.BOLT_ZOMG:
Random rand = new Random(eID * eID);

View File

@ -0,0 +1,182 @@
package com.hbm.render.item.weapon;
import org.lwjgl.opengl.GL11;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.items.weapon.gununified.ItemEnergyGunBase;
import com.hbm.main.ResourceManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import net.minecraftforge.client.IItemRenderer.ItemRendererHelper;
public class ItemRenderWeaponGlass implements IItemRenderer {
public ItemRenderWeaponGlass() { }
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
switch(type) {
case EQUIPPED:
case EQUIPPED_FIRST_PERSON:
case ENTITY:
case INVENTORY:
return true;
default: return false;
}
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return type == ItemRenderType.ENTITY && (helper == ItemRendererHelper.ENTITY_ROTATION || helper == ItemRendererHelper.ENTITY_BOBBING);
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_CULL_FACE);
switch(type) {
case EQUIPPED_FIRST_PERSON:
double s0 = 0.5D;
GL11.glRotated(25, 0, 0, 1);
GL11.glTranslated(2.5, 0.15, 0.5);
GL11.glRotated(90, 0, -1, 0);
GL11.glRotatef(90, 0, 1, 0);
GL11.glScaled(s0, s0, s0);
break;
case EQUIPPED:
double scale = 0.25D;
GL11.glScaled(-scale, scale, scale);
GL11.glRotatef(20F, -3.0F, -0.75F, -1.0F);
GL11.glRotatef(-170, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-30F, 2.0F, -1F, -5.0F);
GL11.glTranslatef(5F, -0.35F, 0.25F);
break;
case ENTITY:
double s1 = 0.5D;
GL11.glScaled(s1, s1, s1);
break;
case INVENTORY:
double s = 1.65D;
GL11.glTranslatef(8F, 8F, 0F);
GL11.glRotated(90, 0, 0, 1);
GL11.glRotated(135, 0, 0, 1);
GL11.glScaled(s, s, s);
break;
default: break;
}
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_BLEND);
GL11.glAlphaFunc(GL11.GL_GREATER, 0);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glColor4f(0.9F, 1.0F, 1.0F, 0.5F);
GL11.glDepthMask(false);
ResourceManager.glass_cannon.renderPart("Gun");
GL11.glDepthMask(true);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_LIGHTING);
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.glass_cannon_panel_tex);
ResourceManager.glass_cannon.renderPart("Panel");
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_TEXTURE_2D);
int color = 0xFFFFFF;
double freq = 1;
if(item.getItem() instanceof ItemEnergyGunBase) {
BulletConfiguration config = ((ItemEnergyGunBase)item.getItem()).getConfig(item);
String name = config.modeName;
switch(name) {
case "weapon.elecGun.glass_cannon.radio": color = 0xaa2200; freq = 0.5; break;
case "weapon.elecGun.glass_cannon.micro": color = 0xdc221f; freq = 1; break;
case "weapon.elecGun.glass_cannon.ir": color = 0xfc3d3a; freq = 1.5; break;
case "weapon.elecGun.glass_cannon.visible": color = 0x8fe325; freq = 2; break;
case "weapon.elecGun.glass_cannon.uv": color = 0x37d5f3; freq = 2.5; break;
case "weapon.elecGun.glass_cannon.xray": color = 0x2542fd; freq = 3; break;
case "weapon.elecGun.glass_cannon.gamma": color = 0xdc20f3; freq = 3.5; break;
}
}
float px = 0.0625F;
GL11.glTranslatef(-2F, px * 18, -px * 14);
GL11.glRotatef(90, 0, 1, 0);
GL11.glTranslatef(-0.7F, -0.86F, -0.33F);
Tessellator tess = Tessellator.instance;
tess.startDrawing(GL11.GL_QUADS);
int sub = 32;
double width = px * 21.25;
double len = width / sub;
double time = System.currentTimeMillis() / -100D;
double amplitude = 0.075;
tess.setColorOpaque_I(color);
for(int i = 0; i < sub; i++) {
double h0 = Math.sin(freq * i * 0.5 + time) * amplitude;
double h1 = Math.sin(freq * (i + 1) * 0.5 + time) * amplitude;
tess.addVertex(0, -px * 0.25 + h1, len * (i + 1));
tess.addVertex(0, px * 0.25 + h1, len * (i + 1));
tess.addVertex(0, px * 0.25 + h0, len * i);
tess.addVertex(0, -px * 0.25 + h0, len * i);
}
tess.setColorOpaque_F(1F, 1F, 1F);
tess.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopAttrib();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();
}
}

View File

@ -50,8 +50,9 @@ public class RenderInfoSystem {
if(event.type != ElementType.CROSSHAIRS)
return;
if(this.messages.isEmpty())
if(this.messages.isEmpty()) {
return;
}
Minecraft mc = Minecraft.getMinecraft();
ScaledResolution resolution = event.resolution;

View File

@ -124,22 +124,22 @@ public class RenderScreenOverlay {
int pZ = resolution.getScaledHeight() - 21;
Minecraft.getMinecraft().renderEngine.bindTexture(misc);
gui.drawTexturedModalRect(pX, pZ + 16, 94, 0, 52, 3);
gui.drawTexturedModalRect(pX + 1, pZ + 16, 95, 3, 50 - dura, 3);
gui.drawTexturedModalRect(pX, pZ + 16, 94, 0, 52, 3);
gui.drawTexturedModalRect(pX + 1, pZ + 16, 95, 3, 50 - dura, 3);
String cap = max == -1 ? ("") : ("" + max);
if(renderCount)
Minecraft.getMinecraft().fontRenderer.drawString(count + " / " + cap, pX + 16, pZ + 6, 0xFFFFFF);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), new ItemStack(ammo), pX, pZ);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), new ItemStack(ammo), pX, pZ);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(Gui.icons);
}

View File

@ -1749,6 +1749,7 @@ item.gun_fireext.name=Fire Extinguisher
item.gun_flamer.name=Mister Topaz
item.gun_flechette.name=Flechette Rifle
item.gun_folly.name=Prototype Digamma "Folly"
item.gun_glass_cannon.name=The Glass Cannon
item.gun_hk69.name=Grenade Pistol
item.gun_hp.name=HPP Lazerjet
item.gun_hp_ammo.name=Ink Cartridge
@ -4205,4 +4206,12 @@ weapon.ability.fire=Flaming
weapon.ability.radiation=Radioactive Blade
weapon.ability.phosphorus=Phosphorus Tip
weapon.ability.stun=Stunning
weapon.ability.vampire=Vampire
weapon.ability.vampire=Vampire
weapon.elecGun.modeChange=Firing Mode Changed to:
weapon.elecGun.glass_cannon.radio=Radio Waves
weapon.elecGun.glass_cannon.micro=Microwaves
weapon.elecGun.glass_cannon.ir=Infrared
weapon.elecGun.glass_cannon.visible=Visible Light
weapon.elecGun.glass_cannon.uv=Ultraviolet Light
weapon.elecGun.glass_cannon.xray=X-rays
weapon.elecGun.glass_cannon.gamma=Gamma rays

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B