diff --git a/changelog b/changelog index ca4dc65aa..6c42b934e 100644 --- a/changelog +++ b/changelog @@ -82,3 +82,4 @@ * Fixed issue where drones that are too fast may skip waypoints * Fixed the electrolyzer speed upgrades not increasing energy consumption as advertised * Fixed giblets rendering in fullbright even in the dark +* All NTM keybinds will reset when opening a GUI, meanig that jetpacks and guns should no longer get stuck operating when opening an inventory diff --git a/src/main/java/com/hbm/config/ClientConfig.java b/src/main/java/com/hbm/config/ClientConfig.java index ffe66aeb4..116b1ffb7 100644 --- a/src/main/java/com/hbm/config/ClientConfig.java +++ b/src/main/java/com/hbm/config/ClientConfig.java @@ -30,6 +30,7 @@ public class ClientConfig { public static ConfigWrapper INFO_OFFSET_VERTICAL = new ConfigWrapper(0); public static ConfigWrapper INFO_POSITION = new ConfigWrapper(0); public static ConfigWrapper GUN_ANIMS_LEGACY = new ConfigWrapper(false); + public static ConfigWrapper GUN_MODEL_FOV = new ConfigWrapper(false); public static ConfigWrapper ITEM_TOOLTIP_SHOW_OREDICT = new ConfigWrapper(true); public static ConfigWrapper ITEM_TOOLTIP_SHOW_CUSTOM_NUKE = new ConfigWrapper(true); public static ConfigWrapper MAIN_MENU_WACKY_SPLASHES = new ConfigWrapper(true); @@ -46,6 +47,7 @@ public class ClientConfig { configMap.put("INFO_OFFSET_VERTICAL", INFO_OFFSET_VERTICAL); configMap.put("INFO_POSITION", INFO_POSITION); configMap.put("GUN_ANIMS_LEGACY", GUN_ANIMS_LEGACY); + configMap.put("GUN_MODEL_FOV", GUN_MODEL_FOV); configMap.put("ITEM_TOOLTIP_SHOW_OREDICT", ITEM_TOOLTIP_SHOW_OREDICT); configMap.put("ITEM_TOOLTIP_SHOW_OREDICT", ITEM_TOOLTIP_SHOW_CUSTOM_NUKE); configMap.put("MAIN_MENU_WACKY_SPLASHES", MAIN_MENU_WACKY_SPLASHES); diff --git a/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java b/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java index 3134e4d8c..7da3649b4 100644 --- a/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java @@ -143,10 +143,12 @@ public class AnvilRecipes { constructionRecipes.add(new AnvilConstructionRecipe(new OreDictStack(PB.ingot()), new AnvilOutput(new ItemStack(ModItems.plate_lead))).setTier(3)); constructionRecipes.add(new AnvilConstructionRecipe(new OreDictStack(CU.ingot()), new AnvilOutput(new ItemStack(ModItems.plate_copper))).setTier(3)); constructionRecipes.add(new AnvilConstructionRecipe(new OreDictStack(ALLOY.ingot()), new AnvilOutput(new ItemStack(ModItems.plate_advanced_alloy))).setTier(3)); - constructionRecipes.add(new AnvilConstructionRecipe(new OreDictStack(SA326.ingot()), new AnvilOutput(new ItemStack(ModItems.plate_schrabidium))).setTier(3)); - constructionRecipes.add(new AnvilConstructionRecipe(new OreDictStack(CMB.ingot()), new AnvilOutput(new ItemStack(ModItems.plate_combine_steel))).setTier(3)); + constructionRecipes.add(new AnvilConstructionRecipe(new OreDictStack(GUNMETAL.ingot()), new AnvilOutput(new ItemStack(ModItems.plate_gunmetal))).setTier(3)); + constructionRecipes.add(new AnvilConstructionRecipe(new OreDictStack(WEAPONSTEEL.ingot()), new AnvilOutput(new ItemStack(ModItems.plate_weaponsteel))).setTier(3)); constructionRecipes.add(new AnvilConstructionRecipe(new OreDictStack(BIGMT.ingot()), new AnvilOutput(new ItemStack(ModItems.plate_saturnite))).setTier(3)); constructionRecipes.add(new AnvilConstructionRecipe(new OreDictStack(DURA.ingot()), new AnvilOutput(new ItemStack(ModItems.plate_dura_steel))).setTier(3)); + constructionRecipes.add(new AnvilConstructionRecipe(new OreDictStack(SA326.ingot()), new AnvilOutput(new ItemStack(ModItems.plate_schrabidium))).setTier(3)); + constructionRecipes.add(new AnvilConstructionRecipe(new OreDictStack(CMB.ingot()), new AnvilOutput(new ItemStack(ModItems.plate_combine_steel))).setTier(3)); for(NTMMaterial mat : Mats.orderedList) { if(mat.autogen.contains(MaterialShapes.WIRE) && OreDictionary.doesOreNameExist(MaterialShapes.INGOT.make(mat))) { diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index b513d8fd4..05a7a449a 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -3231,8 +3231,8 @@ public class ModItems { gas_mask_filter_rag = new ItemFilter().setUnlocalizedName("gas_mask_filter_rag").setTextureName(RefStrings.MODID + ":gas_mask_filter_rag"); gas_mask_filter_piss = new ItemFilter().setUnlocalizedName("gas_mask_filter_piss").setTextureName(RefStrings.MODID + ":gas_mask_filter_piss"); jetpack_tank = new ItemSyringe().setUnlocalizedName("jetpack_tank").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":jetpack_tank"); - gun_kit_1 = new ItemSyringe().setUnlocalizedName("gun_kit_1").setMaxStackSize(16).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":gun_kit_1"); - gun_kit_2 = new ItemSyringe().setUnlocalizedName("gun_kit_2").setMaxStackSize(16).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":gun_kit_2"); + gun_kit_1 = new ItemRepairKit(10).setUnlocalizedName("gun_kit_1").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":gun_kit_1"); + gun_kit_2 = new ItemRepairKit(100).setUnlocalizedName("gun_kit_2").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":gun_kit_2"); cbt_device = new ItemSyringe().setUnlocalizedName("cbt_device").setMaxStackSize(1).setCreativeTab(null).setTextureName(RefStrings.MODID + ":cbt_device"); cigarette = new ItemCigarette().setUnlocalizedName("cigarette").setFull3D().setMaxStackSize(16).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":cigarette"); crackpipe = new ItemCigarette().setUnlocalizedName("crackpipe").setFull3D().setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":crackpipe"); diff --git a/src/main/java/com/hbm/items/tool/ItemRepairKit.java b/src/main/java/com/hbm/items/tool/ItemRepairKit.java new file mode 100644 index 000000000..11bb57989 --- /dev/null +++ b/src/main/java/com/hbm/items/tool/ItemRepairKit.java @@ -0,0 +1,54 @@ +package com.hbm.items.tool; + +import com.hbm.items.ModItems; +import com.hbm.items.weapon.sedna.GunConfig; +import com.hbm.items.weapon.sedna.ItemGunBaseNT; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class ItemRepairKit extends Item { + + public ItemRepairKit(int dura) { + this.setMaxStackSize(1); + this.setMaxDamage(dura - 1); + } + + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { + if(world.isRemote) return stack; + + boolean didSomething = false; + + for(int i = 0; i < 9; i++) { + + ItemStack item = player.inventory.mainInventory[i]; + + if(item != null && item.getItem() instanceof ItemGunBaseNT) { + ItemGunBaseNT gun = (ItemGunBaseNT) item.getItem(); + int configs = gun.getConfigCount(); + + for(int j = 0; j < configs; j++) { + GunConfig cfg = gun.getConfig(item, j); + float maxDura = cfg.getDurability(item); + float wear = Math.min(gun.getWear(item, j), maxDura); + if(wear > 0) { + gun.setWear(item, j, Math.max(0F, gun.getWear(item, j) - maxDura * 0.25F)); + didSomething = true; + } + } + } + } + + if(didSomething) { + if(this == ModItems.gun_kit_1) world.playSoundAtEntity(player, "hbm:item.spray", 1.0F, 1.0F); + if(this == ModItems.gun_kit_2) world.playSoundAtEntity(player, "hbm:item.repair", 1.0F, 1.0F); + + stack.damageItem(1, player); + } + + return stack; + } +} diff --git a/src/main/java/com/hbm/items/weapon/sedna/ItemGunBaseNT.java b/src/main/java/com/hbm/items/weapon/sedna/ItemGunBaseNT.java index 7b1fdc58c..0e8ac381e 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/ItemGunBaseNT.java +++ b/src/main/java/com/hbm/items/weapon/sedna/ItemGunBaseNT.java @@ -83,6 +83,10 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei return WeaponUpgradeManager.eval(cfg, stack, O_GUNCONFIG + index, this); } + public int getConfigCount() { + return configs_DNA.length; + } + public ItemGunBaseNT(WeaponQuality quality, GunConfig... cfg) { this.setMaxStackSize(1); this.configs_DNA = cfg; @@ -167,7 +171,13 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei @Override public void onEquip(EntityPlayer player, ItemStack stack) { - for(int i = 0; i < this.configs_DNA.length; i++) playAnimation(player, stack, AnimType.EQUIP, i); + for(int i = 0; i < this.configs_DNA.length; i++) { + playAnimation(player, stack, AnimType.EQUIP, i); + this.setPrimary(stack, i, false); + this.setSecondary(stack, i, false); + this.setTertiary(stack, i, false); + this.setReloadKey(stack, i, false); + } } public static void playAnimation(EntityPlayer player, ItemStack stack, AnimType type, int index) { diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index 01f91ca5a..571710cab 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -585,8 +585,8 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModItems.wiring_red_copper, 1), new Object[] { "PPP", "PIP", "PPP", 'P', STEEL.plate(), 'I', STEEL.ingot() }); addRecipeAuto(new ItemStack(ModItems.jetpack_tank, 1), new Object[] { " S ", "BKB", " S ", 'S', STEEL.plate(), 'B', STEEL.bolt(), 'K', Fluids.KEROSENE.getDict(1000) }); - addRecipeAuto(new ItemStack(ModItems.gun_kit_1, 4), new Object[] { "I ", "LB", "P ", 'I', ANY_RUBBER.ingot(), 'L', Fluids.LUBRICANT.getDict(1000), 'B', STEEL.bolt(), 'P', IRON.plate() }); - addRecipeAuto(new ItemStack(ModItems.gun_kit_2, 1), new Object[] { "III", "GLG", "PPP", 'I', ANY_RUBBER.ingot(), 'L', ModItems.ducttape, 'G', ModItems.gun_kit_1, 'P', IRON.plate() }); + addShapelessAuto(new ItemStack(ModItems.gun_kit_1, 1), new Object[] { ANY_RUBBER.ingot(), Fluids.WOODOIL.getDict(1_000), IRON.ingot() }); + addShapelessAuto(new ItemStack(ModItems.gun_kit_2, 1), new Object[] { ModItems.gun_kit_1, ModItems.wrench, ModItems.ducttape, Fluids.LUBRICANT.getDict(1_000) }); addRecipeAuto(new ItemStack(ModItems.igniter, 1), new Object[] { " W", "SC", "CE", 'S', STEEL.plate(), 'W', SA326.wireFine(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'E', EUPH.ingot() }); addRecipeAuto(new ItemStack(ModItems.watch, 1), new Object[] { "LYL", "EWE", "LYL", 'E', EUPH.ingot(), 'L', KEY_BLUE, 'W', Items.clock, 'Y', ModItems.billet_yharonite }); diff --git a/src/main/java/com/hbm/main/ModEventHandlerClient.java b/src/main/java/com/hbm/main/ModEventHandlerClient.java index 1a15b4109..06b3ddf91 100644 --- a/src/main/java/com/hbm/main/ModEventHandlerClient.java +++ b/src/main/java/com/hbm/main/ModEventHandlerClient.java @@ -27,6 +27,7 @@ import com.hbm.handler.HTTPHandler; import com.hbm.handler.HazmatRegistry; import com.hbm.handler.HbmKeybinds; import com.hbm.handler.ImpactWorldHandler; +import com.hbm.handler.HbmKeybinds.EnumKeybind; import com.hbm.hazard.HazardSystem; import com.hbm.interfaces.IHoldableWeapon; import com.hbm.interfaces.IItemHUD; @@ -53,6 +54,7 @@ import com.hbm.lib.RefStrings; import com.hbm.packet.PacketDispatcher; import com.hbm.packet.toserver.AuxButtonPacket; import com.hbm.packet.toserver.GunButtonPacket; +import com.hbm.packet.toserver.KeybindPacket; import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations.Animation; import com.hbm.render.block.ct.CTStitchReceiver; @@ -1114,6 +1116,24 @@ public class ModEventHandlerClient { } } } + + if(event.phase == Phase.START) { + + Minecraft mc = Minecraft.getMinecraft(); + + if(mc.currentScreen != null && mc.currentScreen.allowUserInput) { + HbmPlayerProps props = HbmPlayerProps.getData(MainRegistry.proxy.me()); + + for(EnumKeybind key : EnumKeybind.values()) { + boolean last = props.getKeyPressed(key); + + if(last) { + PacketDispatcher.wrapper.sendToServer(new KeybindPacket(key, !last)); + props.setKeyPressed(key, !last); + } + } + } + } } @SideOnly(Side.CLIENT) diff --git a/src/main/java/com/hbm/particle/helper/CasingCreator.java b/src/main/java/com/hbm/particle/helper/CasingCreator.java index 161bcb8d7..967f6a381 100644 --- a/src/main/java/com/hbm/particle/helper/CasingCreator.java +++ b/src/main/java/com/hbm/particle/helper/CasingCreator.java @@ -42,6 +42,8 @@ public class CasingCreator implements IParticleCreator { double mY = player.motionY + motion.yCoord + player.getRNG().nextGaussian() * motionVariance; double mZ = player.motionZ + motion.zCoord + player.getRNG().nextGaussian() * motionVariance; + if(player instanceof EntityPlayer && ((EntityPlayer) player).capabilities.isFlying) mY -= 0.04D; + NBTTagCompound data = new NBTTagCompound(); data.setString("type", "casingNT"); data.setDouble("mX", mX); diff --git a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderWeaponBase.java b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderWeaponBase.java index bd4f3d2c1..d432c31d8 100644 --- a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderWeaponBase.java +++ b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderWeaponBase.java @@ -6,6 +6,7 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import org.lwjgl.util.glu.Project; +import com.hbm.config.ClientConfig; import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.ItemGunBaseNT.SmokeNode; import com.hbm.lib.RefStrings; @@ -75,7 +76,7 @@ public abstract class ItemRenderWeaponBase implements IItemRenderer { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); - Project.gluPerspective(this.getFOVModifier(interp, false), (float) mc.displayWidth / (float) mc.displayHeight, 0.05F, farPlaneDistance * 2.0F); + Project.gluPerspective(this.getFOVModifier(interp, ClientConfig.GUN_MODEL_FOV.get()), (float) mc.displayWidth / (float) mc.displayHeight, 0.05F, farPlaneDistance * 2.0F); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity();