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 {
|
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;
|
static int i = 0;
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ import net.minecraft.world.World;
|
|||||||
*/
|
*/
|
||||||
public class CasingEjector implements Cloneable {
|
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();
|
public static final Random rand = new Random();
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
|
|||||||
@ -81,6 +81,8 @@ public class Gun4GaugeFactory {
|
|||||||
config.firingSound = "hbm:weapon.revolverShootAlt";
|
config.firingSound = "hbm:weapon.revolverShootAlt";
|
||||||
config.firingPitch = 0.65F;
|
config.firingPitch = 0.65F;
|
||||||
|
|
||||||
|
config.ejector = EJECTOR_SHOTGUN.clone().setDelay(10);
|
||||||
|
|
||||||
config.name = "ks23";
|
config.name = "ks23";
|
||||||
config.manufacturer = EnumGunManufacturer.TULSKY;
|
config.manufacturer = EnumGunManufacturer.TULSKY;
|
||||||
|
|
||||||
|
|||||||
@ -115,7 +115,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
|||||||
endActionClient(stack, world, entity, false);
|
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))) {
|
if(GameSettings.isKeyDown(HbmKeybinds.reloadKey) && Minecraft.getMinecraft().currentScreen == null && (getMag(stack) < mainConfig.ammoCap || hasInfinity(stack, mainConfig))) {
|
||||||
PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(true, (byte) 2));
|
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) {
|
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
|
//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);
|
setReloadCycle(stack, 0);
|
||||||
setIsReloading(stack, false);
|
setIsReloading(stack, false);
|
||||||
}
|
}
|
||||||
@ -208,7 +208,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
|||||||
if(!main)
|
if(!main)
|
||||||
config = altConfig;
|
config = altConfig;
|
||||||
|
|
||||||
if(config.reloadType == mainConfig.RELOAD_NONE) {
|
if(config.reloadType == GunConfiguration.RELOAD_NONE) {
|
||||||
return getBeltSize(player, getBeltType(player, stack, main)) > 0;
|
return getBeltSize(player, getBeltType(player, stack, main)) > 0;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -222,7 +222,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
|||||||
|
|
||||||
BulletConfiguration config = null;
|
BulletConfiguration config = null;
|
||||||
|
|
||||||
if(mainConfig.reloadType == mainConfig.RELOAD_NONE) {
|
if(mainConfig.reloadType == GunConfiguration.RELOAD_NONE) {
|
||||||
config = getBeltCfg(player, stack, true);
|
config = getBeltCfg(player, stack, true);
|
||||||
} else {
|
} else {
|
||||||
config = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack)));
|
config = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack)));
|
||||||
@ -261,13 +261,13 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
|||||||
if(altConfig == null)
|
if(altConfig == null)
|
||||||
return;
|
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;
|
int bullets = config.bulletsMin;
|
||||||
|
|
||||||
for(int k = 0; k < altConfig.roundsPerCycle; k++) {
|
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;
|
break;
|
||||||
|
|
||||||
if(config.bulletsMax > config.bulletsMin)
|
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)));
|
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)));
|
BulletConfiguration cfg = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack)));
|
||||||
ComparableStack ammo = (ComparableStack) cfg.ammo.copy();
|
ComparableStack ammo = (ComparableStack) cfg.ammo.copy();
|
||||||
|
|
||||||
@ -403,6 +400,9 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
|||||||
|
|
||||||
//initiates a reload
|
//initiates a reload
|
||||||
public void startReloadAction(ItemStack stack, World world, EntityPlayer player) {
|
public void startReloadAction(ItemStack stack, World world, EntityPlayer player) {
|
||||||
|
|
||||||
|
if(getMag(stack) == 0)
|
||||||
|
resetAmmoType(stack, world, player);
|
||||||
|
|
||||||
if(player.isSneaking() && hasInfinity(stack, mainConfig)) {
|
if(player.isSneaking() && hasInfinity(stack, mainConfig)) {
|
||||||
|
|
||||||
@ -494,8 +494,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
|||||||
addAdditionalInformation(stack, list);
|
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)));
|
final BulletConfiguration bulletConfig = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack)));
|
||||||
list.add(I18nUtil.resolveKey(HbmCollection.gunDamage, bulletConfig.dmgMin, bulletConfig.dmgMax));
|
list.add(I18nUtil.resolveKey(HbmCollection.gunDamage, bulletConfig.dmgMin, bulletConfig.dmgMax));
|
||||||
if(bulletConfig.bulletsMax != 1)
|
if(bulletConfig.bulletsMax != 1)
|
||||||
|
|||||||
@ -4,8 +4,10 @@ import java.awt.Color;
|
|||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
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.main.ResourceManager;
|
||||||
import com.hbm.particle.SpentCasing;
|
|
||||||
import com.hbm.render.anim.HbmAnimations;
|
import com.hbm.render.anim.HbmAnimations;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
@ -83,12 +85,15 @@ public class ItemRenderWeaponKS23 implements IItemRenderer {
|
|||||||
|
|
||||||
HbmAnimations.applyRelevantTransformation("Shell");
|
HbmAnimations.applyRelevantTransformation("Shell");
|
||||||
|
|
||||||
// TODO: Fetch the correct colors to render on the shells
|
ItemGunBase gun = (ItemGunBase)item.getItem();
|
||||||
Color shellColor = new Color(SpentCasing.COLOR_CASE_4GA);
|
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);
|
GL11.glColor3f(shellColor.getRed() / 255F, shellColor.getGreen() / 255F, shellColor.getBlue() / 255F);
|
||||||
ResourceManager.ks23.renderPart("Shell");
|
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);
|
GL11.glColor3f(shellForeColor.getRed() / 255F, shellForeColor.getGreen() / 255F, shellForeColor.getBlue() / 255F);
|
||||||
ResourceManager.ks23.renderPart("ShellFore");
|
ResourceManager.ks23.renderPart("ShellFore");
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user