mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Add correct shell colouring to KS23
This commit is contained in:
parent
1b1682a9d6
commit
273018a5c7
@ -9,7 +9,7 @@ import com.hbm.items.ModItems;
|
||||
|
||||
public class BulletConfigSyncingUtil {
|
||||
|
||||
private static HashMap<Integer, BulletConfiguration> configSet = new HashMap();
|
||||
private static HashMap<Integer, BulletConfiguration> configSet = new HashMap<Integer, BulletConfiguration>();
|
||||
|
||||
static int i = 0;
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ import net.minecraft.world.World;
|
||||
*/
|
||||
public class CasingEjector implements Cloneable {
|
||||
|
||||
public static HashMap<Integer, CasingEjector> mappings = new HashMap();
|
||||
public static HashMap<Integer, CasingEjector> mappings = new HashMap<Integer, CasingEjector>();
|
||||
public static final Random rand = new Random();
|
||||
|
||||
private int id;
|
||||
|
||||
@ -81,6 +81,8 @@ public class Gun4GaugeFactory {
|
||||
config.firingSound = "hbm:weapon.revolverShootAlt";
|
||||
config.firingPitch = 0.65F;
|
||||
|
||||
config.ejector = EJECTOR_SHOTGUN.clone().setDelay(10);
|
||||
|
||||
config.name = "ks23";
|
||||
config.manufacturer = EnumGunManufacturer.TULSKY;
|
||||
|
||||
|
||||
@ -115,7 +115,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
endActionClient(stack, world, entity, false);
|
||||
}
|
||||
|
||||
if(mainConfig.reloadType != mainConfig.RELOAD_NONE || (altConfig != null && altConfig.reloadType != 0)) {
|
||||
if(mainConfig.reloadType != GunConfiguration.RELOAD_NONE || (altConfig != null && altConfig.reloadType != 0)) {
|
||||
|
||||
if(GameSettings.isKeyDown(HbmKeybinds.reloadKey) && Minecraft.getMinecraft().currentScreen == null && (getMag(stack) < mainConfig.ammoCap || hasInfinity(stack, mainConfig))) {
|
||||
PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(true, (byte) 2));
|
||||
@ -184,7 +184,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
protected boolean tryShoot(ItemStack stack, World world, EntityPlayer player, boolean main) {
|
||||
|
||||
//cancel reload when trying to shoot if it's a single reload weapon and at least one round is loaded
|
||||
if(getIsReloading(stack) && mainConfig.reloadType == mainConfig.RELOAD_SINGLE && this.getMag(stack) > 0) {
|
||||
if(getIsReloading(stack) && mainConfig.reloadType == GunConfiguration.RELOAD_SINGLE && getMag(stack) > 0) {
|
||||
setReloadCycle(stack, 0);
|
||||
setIsReloading(stack, false);
|
||||
}
|
||||
@ -208,7 +208,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
if(!main)
|
||||
config = altConfig;
|
||||
|
||||
if(config.reloadType == mainConfig.RELOAD_NONE) {
|
||||
if(config.reloadType == GunConfiguration.RELOAD_NONE) {
|
||||
return getBeltSize(player, getBeltType(player, stack, main)) > 0;
|
||||
|
||||
} else {
|
||||
@ -222,7 +222,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
|
||||
BulletConfiguration config = null;
|
||||
|
||||
if(mainConfig.reloadType == mainConfig.RELOAD_NONE) {
|
||||
if(mainConfig.reloadType == GunConfiguration.RELOAD_NONE) {
|
||||
config = getBeltCfg(player, stack, true);
|
||||
} else {
|
||||
config = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack)));
|
||||
@ -261,13 +261,13 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
if(altConfig == null)
|
||||
return;
|
||||
|
||||
BulletConfiguration config = altConfig.reloadType == altConfig.RELOAD_NONE ? getBeltCfg(player, stack, false) : BulletConfigSyncingUtil.pullConfig(altConfig.config.get(getMagType(stack)));
|
||||
BulletConfiguration config = altConfig.reloadType == GunConfiguration.RELOAD_NONE ? getBeltCfg(player, stack, false) : BulletConfigSyncingUtil.pullConfig(altConfig.config.get(getMagType(stack)));
|
||||
|
||||
int bullets = config.bulletsMin;
|
||||
|
||||
for(int k = 0; k < altConfig.roundsPerCycle; k++) {
|
||||
|
||||
if(altConfig.reloadType != altConfig.RELOAD_NONE && !hasAmmo(stack, player, true))
|
||||
if(altConfig.reloadType != GunConfiguration.RELOAD_NONE && !hasAmmo(stack, player, true))
|
||||
break;
|
||||
|
||||
if(config.bulletsMax > config.bulletsMin)
|
||||
@ -355,9 +355,6 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
|
||||
BulletConfiguration prevCfg = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack)));
|
||||
|
||||
if(getMag(stack) == 0)
|
||||
resetAmmoType(stack, world, player);
|
||||
|
||||
BulletConfiguration cfg = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack)));
|
||||
ComparableStack ammo = (ComparableStack) cfg.ammo.copy();
|
||||
|
||||
@ -403,6 +400,9 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
|
||||
//initiates a reload
|
||||
public void startReloadAction(ItemStack stack, World world, EntityPlayer player) {
|
||||
|
||||
if(getMag(stack) == 0)
|
||||
resetAmmoType(stack, world, player);
|
||||
|
||||
if(player.isSneaking() && hasInfinity(stack, mainConfig)) {
|
||||
|
||||
@ -494,8 +494,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
addAdditionalInformation(stack, list);
|
||||
}
|
||||
|
||||
protected void addAdditionalInformation(ItemStack stack, List<String> list)
|
||||
{
|
||||
protected void addAdditionalInformation(ItemStack stack, List<String> list) {
|
||||
final BulletConfiguration bulletConfig = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack)));
|
||||
list.add(I18nUtil.resolveKey(HbmCollection.gunDamage, bulletConfig.dmgMin, bulletConfig.dmgMax));
|
||||
if(bulletConfig.bulletsMax != 1)
|
||||
|
||||
@ -4,8 +4,10 @@ import java.awt.Color;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.handler.BulletConfigSyncingUtil;
|
||||
import com.hbm.handler.BulletConfiguration;
|
||||
import com.hbm.items.weapon.ItemGunBase;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.particle.SpentCasing;
|
||||
import com.hbm.render.anim.HbmAnimations;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@ -83,12 +85,15 @@ public class ItemRenderWeaponKS23 implements IItemRenderer {
|
||||
|
||||
HbmAnimations.applyRelevantTransformation("Shell");
|
||||
|
||||
// TODO: Fetch the correct colors to render on the shells
|
||||
Color shellColor = new Color(SpentCasing.COLOR_CASE_4GA);
|
||||
ItemGunBase gun = (ItemGunBase)item.getItem();
|
||||
BulletConfiguration bullet = BulletConfigSyncingUtil.pullConfig(gun.mainConfig.config.get(ItemGunBase.getMagType(item)));
|
||||
int[] colors = bullet.spentCasing.getColors();
|
||||
|
||||
Color shellColor = new Color(colors[1]);
|
||||
GL11.glColor3f(shellColor.getRed() / 255F, shellColor.getGreen() / 255F, shellColor.getBlue() / 255F);
|
||||
ResourceManager.ks23.renderPart("Shell");
|
||||
|
||||
Color shellForeColor = new Color(0xFFD800);
|
||||
Color shellForeColor = new Color(colors[0]);
|
||||
GL11.glColor3f(shellForeColor.getRed() / 255F, shellForeColor.getGreen() / 255F, shellForeColor.getBlue() / 255F);
|
||||
ResourceManager.ks23.renderPart("ShellFore");
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user