it's like mopping up 5 gallons of vomit

This commit is contained in:
Boblet 2025-05-26 10:05:03 +02:00
parent ce99e65b0b
commit e347aa4346
24 changed files with 54 additions and 1416 deletions

View File

@ -9,16 +9,19 @@
## Changed ## Changed
* The RBMK console's grid can now be rotated using a screwdriver * The RBMK console's grid can now be rotated using a screwdriver
* Tool abilities have changed * Tool abilities have changed
* Righ-clicking while holding ALT now opens a configuration window * Right-clicking while holding ALT now opens a configuration window
* The configuration window allows creation of tool presets * The configuration window allows creation of tool presets
* Area and block abilities can now be toggled independently from each other. For example, the vein miner ability can be combined with silk touch * Area and block abilities can now be toggled independently from each other. For example, the vein miner ability can be combined with silk touch
* Clicking on the same ability allows switching between levels * Clicking on the same ability allows switching between levels
* Updated textures for the armor and gun modification tables * Updated textures for the armor and gun modification tables
* Ported the fire extinguisher to the SEDNA gun system, eliminating the final remaining ItemGunBase gun * Ported the fire extinguisher to the SEDNA gun system, eliminating the final remaining ItemGunBase gun
* Water extinguishers can now wash away foam blocks * Water extinguishers can now wash away foam blocks
* Obliterated Fabsol's vodka
* Tier 4 heart piece is now called "heart of darkness"
## Fixed ## Fixed
* Conveyor ejectors should now correctly place items onto the back of splitters instead of on the output belts * Conveyor ejectors should now correctly place items onto the back of splitters instead of on the output belts
* Fixed strand caster fluid gauges going out of bounds * Fixed strand caster fluid gauges going out of bounds
* Fixed arc welder and soldering station not changing buffer size based on upgrade, preventing use of higher overdrive tiers * Fixed arc welder and soldering station not changing buffer size based on upgrade, preventing use of higher overdrive tiers
* Fixed non-standard template folder recipes not using the correct icon * Fixed non-standard template folder recipes not using the correct icon
* Fixed jetpack flight time not resetting when equipped like armor, causing kicks on servers that don't have flying cheats allowed

View File

@ -78,7 +78,6 @@ public class ConsumableRecipes {
//Canteens //Canteens
CraftingManager.addRecipeAuto(new ItemStack(ModItems.canteen_vodka, 1), new Object[] { "O", "P", 'O', Items.potato, 'P', STEEL.plate() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.canteen_vodka, 1), new Object[] { "O", "P", 'O', Items.potato, 'P', STEEL.plate() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.canteen_fab, 1), new Object[] { "VMV", "MVM", "VMV", 'V', ModItems.canteen_vodka, 'M', ModItems.powder_magic });
//Soda //Soda
CraftingManager.addRecipeAuto(new ItemStack(ModItems.bottle_empty, 6), new Object[] { " G ", "G G", "GGG", 'G', KEY_ANYPANE }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.bottle_empty, 6), new Object[] { " G ", "G G", "GGG", 'G', KEY_ANYPANE });
@ -119,7 +118,7 @@ public class ConsumableRecipes {
CraftingManager.addRecipeAuto(new ItemStack(ModItems.plan_c, 1), new Object[] { "PFP", 'P', ModItems.powder_poison, 'F', F.dust() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.plan_c, 1), new Object[] { "PFP", 'P', ModItems.powder_poison, 'F', F.dust() });
CraftingManager.addShapelessAuto(new ItemStack(ModItems.radx, 1), new Object[] { COAL.dust(), COAL.dust(), F.dust() }); CraftingManager.addShapelessAuto(new ItemStack(ModItems.radx, 1), new Object[] { COAL.dust(), COAL.dust(), F.dust() });
CraftingManager.addShapelessAuto(new ItemStack(ModItems.fmn, 1), new Object[] { COAL.dust(), PO210.dust(), ST.dust() }); CraftingManager.addShapelessAuto(new ItemStack(ModItems.fmn, 1), new Object[] { COAL.dust(), PO210.dust(), ST.dust() });
CraftingManager.addShapelessAuto(new ItemStack(ModItems.five_htp, 1), new Object[] { COAL.dust(), EUPH.dust(), ModItems.canteen_fab }); CraftingManager.addShapelessAuto(new ItemStack(ModItems.five_htp, 1), new Object[] { COAL.dust(), EUPH.dust(), ModItems.canteen_vodka });
CraftingManager.addShapelessAuto(new ItemStack(ModItems.cigarette, 16), new Object[] { ASBESTOS.ingot(), ANY_TAR.any(), PO210.nugget(), DictFrame.fromOne(ModItems.plant_item, ItemEnums.EnumPlantType.TOBACCO) }); CraftingManager.addShapelessAuto(new ItemStack(ModItems.cigarette, 16), new Object[] { ASBESTOS.ingot(), ANY_TAR.any(), PO210.nugget(), DictFrame.fromOne(ModItems.plant_item, ItemEnums.EnumPlantType.TOBACCO) });
CraftingManager.addShapelessAuto(new ItemStack(ModItems.crackpipe, 1), new Object[] { ModItems.catalytic_converter }); CraftingManager.addShapelessAuto(new ItemStack(ModItems.crackpipe, 1), new Object[] { ModItems.catalytic_converter });
@ -193,7 +192,7 @@ public class ConsumableRecipes {
CraftingManager.addRecipeAuto(new ItemStack(ModItems.industrial_magnet, 1), new Object[] { "SMS", " B ", "SMS", 'S', STEEL.ingot(), 'M', ModItems.horseshoe_magnet, 'B', ModBlocks.fusion_conductor }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.industrial_magnet, 1), new Object[] { "SMS", " B ", "SMS", 'S', STEEL.ingot(), 'M', ModItems.horseshoe_magnet, 'B', ModBlocks.fusion_conductor });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.heart_container, 1), new Object[] { "HAH", "ACA", "HAH", 'H', ModItems.heart_piece, 'A', AL.ingot(), 'C', ModItems.coin_creeper }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.heart_container, 1), new Object[] { "HAH", "ACA", "HAH", 'H', ModItems.heart_piece, 'A', AL.ingot(), 'C', ModItems.coin_creeper });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.heart_booster, 1), new Object[] { "GHG", "MCM", "GHG", 'G', GOLD.ingot(), 'H', ModItems.heart_container, 'M', ModItems.morning_glory, 'C', ModItems.coin_maskman }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.heart_booster, 1), new Object[] { "GHG", "MCM", "GHG", 'G', GOLD.ingot(), 'H', ModItems.heart_container, 'M', ModItems.morning_glory, 'C', ModItems.coin_maskman });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.heart_fab, 1), new Object[] { "GHG", "MCM", "GHG", 'G', PO210.billet(), 'H', ModItems.heart_booster, 'M', ModItems.canteen_fab, 'C', ModItems.coin_worm }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.heart_fab, 1), new Object[] { "GHG", "MCM", "GHG", 'G', PO210.billet(), 'H', ModItems.heart_booster, 'M', ANY_COKE.gem(), 'C', ModItems.coin_worm });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ink, 1), new Object[] { "FPF", "PIP", "FPF", 'F', new ItemStack(Blocks.red_flower, 1, OreDictionary.WILDCARD_VALUE), 'P', ModItems.armor_polish, 'I', KEY_BLACK }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.ink, 1), new Object[] { "FPF", "PIP", "FPF", 'F', new ItemStack(Blocks.red_flower, 1, OreDictionary.WILDCARD_VALUE), 'P', ModItems.armor_polish, 'I', KEY_BLACK });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.bathwater_mk2, 1), new Object[] { "MWM", "WBW", "MWM", 'M', ModItems.bottle_mercury, 'W', ModItems.nuclear_waste, 'B', ModItems.bathwater }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.bathwater_mk2, 1), new Object[] { "MWM", "WBW", "MWM", 'M', ModItems.bottle_mercury, 'W', ModItems.nuclear_waste, 'B', ModItems.bathwater });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.back_tesla, 1), new Object[] { "DGD", "GTG", "DGD", 'D', ModItems.ducttape, 'G', GOLD.wireFine(), 'T', ModBlocks.tesla }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.back_tesla, 1), new Object[] { "DGD", "GTG", "DGD", 'D', ModItems.ducttape, 'G', GOLD.wireFine(), 'T', ModBlocks.tesla });

View File

@ -21,9 +21,7 @@ import com.hbm.explosion.vanillant.standard.ExplosionEffectStandard;
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard; import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration; import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.handler.threading.PacketThreading; import com.hbm.handler.threading.PacketThreading;
import com.hbm.items.weapon.ItemGunBase;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.packet.toclient.AuxParticlePacketNT; import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.potion.HbmPotion; import com.hbm.potion.HbmPotion;
@ -38,7 +36,6 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
@ -109,25 +106,9 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
this.dataWatcher.updateObject(17, (byte)this.config.trail); this.dataWatcher.updateObject(17, (byte)this.config.trail);
thrower = entity; thrower = entity;
ItemStack gun = entity.getHeldItem();
boolean offsetShot = true; boolean offsetShot = true;
boolean accuracyBoost = false; boolean accuracyBoost = false;
if(gun != null && gun.getItem() instanceof ItemGunBase) {
GunConfiguration cfg = ((ItemGunBase) gun.getItem()).mainConfig;
if(cfg != null) {
if(cfg.hasSights && entity.isSneaking()) {
offsetShot = false;
accuracyBoost = true;
}
if(cfg.isCentered){
offsetShot = false;
}
}
}
this.setLocationAndAngles(entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ, entity.rotationYaw, entity.rotationPitch); this.setLocationAndAngles(entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ, entity.rotationYaw, entity.rotationPitch);
if(offsetShot) { if(offsetShot) {

View File

@ -1599,7 +1599,6 @@ public class ModItems {
public static Item med_schizophrenia; public static Item med_schizophrenia;
public static Item canteen_vodka; public static Item canteen_vodka;
public static Item canteen_fab;
public static Item defuser; public static Item defuser;
public static Item reacher; public static Item reacher;
@ -2052,7 +2051,6 @@ public class ModItems {
public static Item wd40; public static Item wd40;
public static Item scrumpy; public static Item scrumpy;
public static Item wild_p; public static Item wild_p;
public static Item fabsols_vodka;
public static Item shackles; public static Item shackles;
public static Item injector_5htp; public static Item injector_5htp;
public static Item injector_knife; public static Item injector_knife;
@ -3087,7 +3085,6 @@ public class ModItems {
wd40 = new ItemModWD40().setUnlocalizedName("wd40").setTextureName(RefStrings.MODID + ":wd40"); wd40 = new ItemModWD40().setUnlocalizedName("wd40").setTextureName(RefStrings.MODID + ":wd40");
scrumpy = new ItemModRevive(1).setUnlocalizedName("scrumpy").setTextureName(RefStrings.MODID + ":scrumpy"); scrumpy = new ItemModRevive(1).setUnlocalizedName("scrumpy").setTextureName(RefStrings.MODID + ":scrumpy");
wild_p = new ItemModRevive(3).setUnlocalizedName("wild_p").setTextureName(RefStrings.MODID + ":wild_p"); wild_p = new ItemModRevive(3).setUnlocalizedName("wild_p").setTextureName(RefStrings.MODID + ":wild_p");
fabsols_vodka = new ItemModRevive(9999).setUnlocalizedName("fabsols_vodka").setTextureName(RefStrings.MODID + ":fabsols_vodka");
shackles = new ItemModShackles().setUnlocalizedName("shackles").setTextureName(RefStrings.MODID + ":shackles"); shackles = new ItemModShackles().setUnlocalizedName("shackles").setTextureName(RefStrings.MODID + ":shackles");
injector_5htp = new ItemModAuto().setUnlocalizedName("injector_5htp").setTextureName(RefStrings.MODID + ":injector_5htp"); injector_5htp = new ItemModAuto().setUnlocalizedName("injector_5htp").setTextureName(RefStrings.MODID + ":injector_5htp");
injector_knife = new ItemModKnife().setUnlocalizedName("injector_knife").setTextureName(RefStrings.MODID + ":injector_knife"); injector_knife = new ItemModKnife().setUnlocalizedName("injector_knife").setTextureName(RefStrings.MODID + ":injector_knife");
@ -3870,7 +3867,6 @@ public class ModItems {
static_sandwich = new ItemLemon(6, 1F, false).setUnlocalizedName("static_sandwich").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":static_sandwich"); static_sandwich = new ItemLemon(6, 1F, false).setUnlocalizedName("static_sandwich").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":static_sandwich");
pudding = new ItemLemon(6, 1F, false).setUnlocalizedName("pudding").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":pudding"); pudding = new ItemLemon(6, 1F, false).setUnlocalizedName("pudding").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":pudding");
canteen_vodka = new ItemCanteen(3 * 60).setUnlocalizedName("canteen_vodka").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":canteen_vodka"); canteen_vodka = new ItemCanteen(3 * 60).setUnlocalizedName("canteen_vodka").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":canteen_vodka");
canteen_fab = new ItemCanteen(2 * 60).setUnlocalizedName("canteen_fab").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":canteen_fab");
pancake = new ItemPancake(20, 20, false).setUnlocalizedName("pancake").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":pancake"); pancake = new ItemPancake(20, 20, false).setUnlocalizedName("pancake").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":pancake");
nugget = new ItemLemon(200, 1F, false).setUnlocalizedName("nugget").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":nugget"); nugget = new ItemLemon(200, 1F, false).setUnlocalizedName("nugget").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":nugget");
peas = new ItemPeas().setUnlocalizedName("peas").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":peas"); peas = new ItemPeas().setUnlocalizedName("peas").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":peas");
@ -6709,7 +6705,6 @@ public class ModItems {
GameRegistry.registerItem(med_ipecac, med_ipecac.getUnlocalizedName()); GameRegistry.registerItem(med_ipecac, med_ipecac.getUnlocalizedName());
GameRegistry.registerItem(med_ptsd, med_ptsd.getUnlocalizedName()); GameRegistry.registerItem(med_ptsd, med_ptsd.getUnlocalizedName());
GameRegistry.registerItem(canteen_vodka, canteen_vodka.getUnlocalizedName()); GameRegistry.registerItem(canteen_vodka, canteen_vodka.getUnlocalizedName());
GameRegistry.registerItem(canteen_fab, canteen_fab.getUnlocalizedName());
GameRegistry.registerItem(mucho_mango, mucho_mango.getUnlocalizedName()); GameRegistry.registerItem(mucho_mango, mucho_mango.getUnlocalizedName());
GameRegistry.registerItem(chocolate, chocolate.getUnlocalizedName()); GameRegistry.registerItem(chocolate, chocolate.getUnlocalizedName());
@ -6833,7 +6828,6 @@ public class ModItems {
GameRegistry.registerItem(wd40, wd40.getUnlocalizedName()); GameRegistry.registerItem(wd40, wd40.getUnlocalizedName());
GameRegistry.registerItem(scrumpy, scrumpy.getUnlocalizedName()); GameRegistry.registerItem(scrumpy, scrumpy.getUnlocalizedName());
GameRegistry.registerItem(wild_p, wild_p.getUnlocalizedName()); GameRegistry.registerItem(wild_p, wild_p.getUnlocalizedName());
GameRegistry.registerItem(fabsols_vodka, fabsols_vodka.getUnlocalizedName());
GameRegistry.registerItem(shackles, shackles.getUnlocalizedName()); GameRegistry.registerItem(shackles, shackles.getUnlocalizedName());
GameRegistry.registerItem(injector_5htp, injector_5htp.getUnlocalizedName()); GameRegistry.registerItem(injector_5htp, injector_5htp.getUnlocalizedName());
GameRegistry.registerItem(injector_knife, injector_knife.getUnlocalizedName()); GameRegistry.registerItem(injector_knife, injector_knife.getUnlocalizedName());

View File

@ -26,14 +26,13 @@ public class ItemModRevive extends ItemArmorMod {
if(this == ModItems.wild_p) { if(this == ModItems.wild_p) {
list.add(EnumChatFormatting.DARK_GRAY + "Explosive " + EnumChatFormatting.RED + "Reactive " + EnumChatFormatting.DARK_GRAY + "Plot " + EnumChatFormatting.RED + "Armor"); list.add(EnumChatFormatting.DARK_GRAY + "Explosive " + EnumChatFormatting.RED + "Reactive " + EnumChatFormatting.DARK_GRAY + "Plot " + EnumChatFormatting.RED + "Armor");
} }
if(this == ModItems.fabsols_vodka) {
list.add(EnumChatFormatting.ITALIC + "In the news:"); /*list.add(EnumChatFormatting.ITALIC + "In the news:");
list.add(EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + "Man literally too angry to die."); list.add(EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + "Man literally too angry to die.");
list.add(""); list.add("");
list.add(EnumChatFormatting.ITALIC + "\"I ain't got time to die\" says local"); list.add(EnumChatFormatting.ITALIC + "\"I ain't got time to die\" says local");
list.add(EnumChatFormatting.ITALIC + "man after ripping the physical manifestation"); list.add(EnumChatFormatting.ITALIC + "man after ripping the physical manifestation");
list.add(EnumChatFormatting.ITALIC + "of disaster itself in half."); list.add(EnumChatFormatting.ITALIC + "of disaster itself in half.");*/
}
list.add(""); list.add("");
list.add(EnumChatFormatting.GOLD + "" + (stack.getMaxDamage() - stack.getItemDamage()) + " revives left"); list.add(EnumChatFormatting.GOLD + "" + (stack.getMaxDamage() - stack.getItemDamage()) + " revives left");

View File

@ -4,7 +4,6 @@ import java.util.List;
import com.hbm.handler.ArmorModHandler; import com.hbm.handler.ArmorModHandler;
import com.hbm.render.model.ModelJetPack; import com.hbm.render.model.ModelJetPack;
import com.hbm.util.ArmorUtil;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -57,8 +56,6 @@ public abstract class JetpackBase extends ItemArmorMod {
return; return;
onArmorTick(entity.worldObj, (EntityPlayer)entity, jetpack); onArmorTick(entity.worldObj, (EntityPlayer)entity, jetpack);
ArmorUtil.resetFlightTime((EntityPlayer)entity);
ArmorModHandler.applyMod(armor, jetpack); ArmorModHandler.applyMod(armor, jetpack);
} }

View File

@ -7,6 +7,7 @@ import com.hbm.handler.threading.PacketThreading;
import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.FluidType;
import com.hbm.packet.toclient.AuxParticlePacketNT; import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.util.ArmorUtil;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -63,6 +64,7 @@ public class JetpackBooster extends JetpackFueledBase {
world.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:weapon.flamethrowerShoot", 0.25F, 1.0F); world.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:weapon.flamethrowerShoot", 0.25F, 1.0F);
this.useUpFuel(player, stack, 1); this.useUpFuel(player, stack, 1);
ArmorUtil.resetFlightTime(player);
} }
} }

View File

@ -6,6 +6,7 @@ import com.hbm.extprop.HbmPlayerProps;
import com.hbm.handler.threading.PacketThreading; import com.hbm.handler.threading.PacketThreading;
import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.FluidType;
import com.hbm.packet.toclient.AuxParticlePacketNT; import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.util.ArmorUtil;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -37,9 +38,9 @@ public class JetpackBreak extends JetpackFueledBase {
if(getFuel(stack) > 0 && (props.isJetpackActive() || (!player.onGround && !player.isSneaking() && props.enableBackpack))) { if(getFuel(stack) > 0 && (props.isJetpackActive() || (!player.onGround && !player.isSneaking() && props.enableBackpack))) {
NBTTagCompound data = new NBTTagCompound(); NBTTagCompound data = new NBTTagCompound();
data.setString("type", "jetpack"); data.setString("type", "jetpack");
data.setInteger("player", player.getEntityId()); data.setInteger("player", player.getEntityId());
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, player.posX, player.posY, player.posZ), new TargetPoint(world.provider.dimensionId, player.posX, player.posY, player.posZ, 100)); PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, player.posX, player.posY, player.posZ), new TargetPoint(world.provider.dimensionId, player.posX, player.posY, player.posZ, 100));
} }
} }
@ -70,17 +71,18 @@ public class JetpackBreak extends JetpackFueledBase {
world.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:weapon.flamethrowerShoot", 0.25F, 1.5F); world.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:weapon.flamethrowerShoot", 0.25F, 1.5F);
this.useUpFuel(player, stack, 10); this.useUpFuel(player, stack, 10);
ArmorUtil.resetFlightTime(player);
} }
} }
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) { public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
list.add("Regular jetpack that will automatically hover mid-air."); list.add("Regular jetpack that will automatically hover mid-air.");
list.add("Sneaking will stop hover mode."); list.add("Sneaking will stop hover mode.");
list.add("Hover mode will consume less fuel and increase air-mobility."); list.add("Hover mode will consume less fuel and increase air-mobility.");
super.addInformation(stack, player, list, ext); super.addInformation(stack, player, list, ext);
} }
} }

View File

@ -6,6 +6,7 @@ import com.hbm.extprop.HbmPlayerProps;
import com.hbm.handler.threading.PacketThreading; import com.hbm.handler.threading.PacketThreading;
import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.FluidType;
import com.hbm.packet.toclient.AuxParticlePacketNT; import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.util.ArmorUtil;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -50,6 +51,7 @@ public class JetpackRegular extends JetpackFueledBase {
world.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:weapon.flamethrowerShoot", 0.25F, 1.5F); world.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:weapon.flamethrowerShoot", 0.25F, 1.5F);
this.useUpFuel(player, stack, 5); this.useUpFuel(player, stack, 5);
ArmorUtil.resetFlightTime(player);
} }
} }

View File

@ -6,6 +6,7 @@ import com.hbm.extprop.HbmPlayerProps;
import com.hbm.handler.threading.PacketThreading; import com.hbm.handler.threading.PacketThreading;
import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.FluidType;
import com.hbm.packet.toclient.AuxParticlePacketNT; import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.util.ArmorUtil;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -62,6 +63,7 @@ public class JetpackVectorized extends JetpackFueledBase {
world.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:weapon.flamethrowerShoot", 0.25F, 1.5F); world.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:weapon.flamethrowerShoot", 0.25F, 1.5F);
this.useUpFuel(player, stack, 3); this.useUpFuel(player, stack, 3);
ArmorUtil.resetFlightTime(player);
} }
} }

View File

@ -35,18 +35,11 @@ public class ItemCanteen extends Item {
public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player) { public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player) {
stack.setItemDamage(stack.getMaxDamage()); stack.setItemDamage(stack.getMaxDamage());
if (this == ModItems.canteen_vodka) { if(this == ModItems.canteen_vodka) {
player.addPotionEffect(new PotionEffect(Potion.confusion.id, 10 * 20, 0)); player.addPotionEffect(new PotionEffect(Potion.confusion.id, 10 * 20, 0));
player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 30 * 20, 2)); player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 30 * 20, 2));
} }
if (this == ModItems.canteen_fab) {
player.heal(10F);
player.addPotionEffect(new PotionEffect(Potion.confusion.id, 15 * 20, 0));
player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 60 * 20, 2));
player.addPotionEffect(new PotionEffect(Potion.resistance.id, 60 * 20, 2));
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 60 * 20, 1));
}
VersatileConfig.applyPotionSickness(player, 5); VersatileConfig.applyPotionSickness(player, 5);
return stack; return stack;
@ -64,34 +57,27 @@ public class ItemCanteen extends Item {
@Override @Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if (stack.getItemDamage() == 0 && !VersatileConfig.hasPotionSickness(player)) if(stack.getItemDamage() == 0 && !VersatileConfig.hasPotionSickness(player))
player.setItemInUse(stack, this.getMaxItemUseDuration(stack)); player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
return stack; return stack;
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) {
{ if(this == ModItems.canteen_vodka) {
if(this == ModItems.canteen_vodka)
{
list.add("Cooldown: 3 minutes"); list.add("Cooldown: 3 minutes");
list.add("Nausea I for 10 seconds"); list.add("Nausea I for 10 seconds");
list.add("Strength III for 30 seconds"); list.add("Strength III for 30 seconds");
list.add(""); list.add("");
if(MainRegistry.polaroidID == 11) if(MainRegistry.polaroidID == 11)
//list.add("Why sipp when you can succ?"); // list.add("Why sipp when you can succ?");
list.add("Time to get hammered & sickled!"); list.add("Time to get hammered & sickled!");
else else
list.add("Smells like disinfectant, tastes like disinfectant."); list.add("Smells like disinfectant, tastes like disinfectant.");
} }
if(this == ModItems.canteen_fab) }
{
list.add("Cooldown: 2 minutes");
list.add("Engages the fab drive");
}
}
} }

View File

@ -9,7 +9,6 @@ import com.hbm.handler.ArmorModHandler;
import com.hbm.interfaces.Spaghetti; import com.hbm.interfaces.Spaghetti;
import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.Fluids;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.weapon.ItemGunBase;
import com.hbm.potion.HbmPotion; import com.hbm.potion.HbmPotion;
import api.hbm.fluidmk2.IFillableItem; import api.hbm.fluidmk2.IFillableItem;
@ -226,41 +225,6 @@ public class ItemSyringe extends Item {
} }
} }
if(this == ModItems.gun_kit_1 || this == ModItems.gun_kit_2) {
if(!world.isRemote) {
float repair = 0;
if(this == ModItems.gun_kit_1) {
repair = 0.1F;
world.playSoundAtEntity(player, "hbm:item.spray", 1.0F, 1.0F);
}
if(this == ModItems.gun_kit_2) {
repair = 0.5F;
world.playSoundAtEntity(player, "hbm:item.repair", 1.0F, 1.0F);
}
for(int i = 0; i < 9; i++) {
ItemStack gun = player.inventory.mainInventory[i];
if(gun != null && gun.getItem() instanceof ItemGunBase) {
int full = ((ItemGunBase) gun.getItem()).mainConfig.durability;
int wear = ItemGunBase.getItemWear(gun);
int nWear = (int) (wear - (full * repair));
if(nWear < 0)
nWear = 0;
ItemGunBase.setItemWear(gun, nWear);
}
}
stack.stackSize--;
}
}
if(this == ModItems.cbt_device) { if(this == ModItems.cbt_device) {
if(!world.isRemote) { if(!world.isRemote) {
player.addPotionEffect(new PotionEffect(HbmPotion.bang.id, 30, 0)); player.addPotionEffect(new PotionEffect(HbmPotion.bang.id, 30, 0));

View File

@ -1,288 +0,0 @@
package com.hbm.items.weapon;
import java.util.List;
import org.lwjgl.input.Mouse;
import com.hbm.config.GeneralConfig;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.interfaces.IHoldableWeapon;
import com.hbm.items.weapon.sedna.Crosshair;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toclient.GunAnimationPacket;
import com.hbm.packet.toserver.GunButtonPacket;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.render.util.RenderScreenOverlay;
import com.hbm.util.BobMathUtil;
import com.hbm.util.ChatBuilder;
import api.hbm.energymk2.IBatteryItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.creativetab.CreativeTabs;
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");
addAdditionalInformation(stack, list);
}
@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));
}
if(player instanceof EntityPlayerMP)
PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(AnimType.CYCLE.ordinal()), (EntityPlayerMP) player);
setCharge(stack, getCharge(stack) - config.dischargePerShot);;
}
world.playSoundAtEntity(player, mainConfig.firingSound, 1.0F, mainConfig.firingPitch);
}
public void startAction(ItemStack stack, World world, EntityPlayer player, boolean main) {
if(mainConfig.firingMode == GunConfiguration.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(stack);
}
@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(ItemStack stack) {
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(stack));
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

@ -1,847 +0,0 @@
package com.hbm.items.weapon;
import java.util.List;
import com.hbm.handler.threading.PacketThreading;
import org.lwjgl.input.Mouse;
import com.hbm.config.GeneralConfig;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.CasingEjector;
import com.hbm.handler.GunConfiguration;
import com.hbm.handler.HbmKeybinds;
import com.hbm.interfaces.IHoldableWeapon;
import com.hbm.interfaces.IItemHUD;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.IEquipReceiver;
import com.hbm.items.armor.ArmorTrenchmaster;
import com.hbm.items.weapon.sedna.Crosshair;
import com.hbm.lib.HbmCollection;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.packet.toclient.GunAnimationPacket;
import com.hbm.packet.toserver.GunButtonPacket;
import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.render.util.RenderScreenOverlay;
import com.hbm.util.I18nUtil;
import com.hbm.util.InventoryUtil;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
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;
@Deprecated
public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEquipReceiver {
public GunConfiguration mainConfig;
public GunConfiguration altConfig;
@SideOnly(Side.CLIENT)
public boolean m1;// = false;
@SideOnly(Side.CLIENT)
public boolean m2;// = false;
public ItemGunBase(GunConfiguration config) {
mainConfig = config;
this.setMaxStackSize(1);
}
public ItemGunBase(GunConfiguration config, GunConfiguration alt) {
this(config);
altConfig = alt;
}
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean isCurrentItem) {
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 {
updateServer(stack, world, (EntityPlayer)entity, slot, isCurrentItem);
}
}
}
@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);
}
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));
setIsReloading(stack, true);
resetReloadCycle(entity, stack);
}
}
}
}
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);
}
int burstDuration = getBurstDuration(stack);
if(burstDuration > 0) {
if(altConfig == null) {
if (burstDuration % mainConfig.firingDuration == 0 && tryShoot(stack, world, player, true)) {
fire(stack, world, player);
}
} else {
boolean canFire = altConfig.firingDuration == 1 || burstDuration % altConfig.firingDuration == 0;
if (canFire && tryShoot(stack, world, player, false)) {
altFire(stack, world, player);
}
}
setBurstDuration(stack, getBurstDuration(stack) - 1);
if(getBurstDuration(stack) == 0) setDelay(stack, mainConfig.rateOfFire);
}
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, mainConfig.rateOfFire);
}
if(getIsReloading(stack) && isCurrentItem) {
reload2(stack, world, player);
}
BulletConfiguration queued = getCasing(stack);
int timer = getCasingTimer(stack);
if(queued != null && timer > 0) {
timer--;
if(timer <= 0) {
trySpawnCasing(player, mainConfig.ejector, queued, stack);
}
setCasingTimer(stack, timer);
}
}
//whether or not the gun can shoot in its current state
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 == GunConfiguration.RELOAD_SINGLE && getMag(stack) > 0) {
setReloadCycle(stack, 0);
setIsReloading(stack, false);
}
if(main && getDelay(stack) == 0 && !getIsReloading(stack) && getItemWear(stack) < mainConfig.durability) {
return hasAmmo(stack, player, main);
}
if(!main && altConfig != null && getDelay(stack) == 0 && !getIsReloading(stack) && getItemWear(stack) < mainConfig.durability) {
return hasAmmo(stack, player, false);
}
return false;
}
public boolean hasAmmo(ItemStack stack, EntityPlayer player, boolean main) {
GunConfiguration config = mainConfig;
if(!main)
config = altConfig;
if(config.reloadType == GunConfiguration.RELOAD_NONE) {
return getBeltSize(player, getBeltType(player, stack, main)) > 0;
} else {
//return getMag(stack) >= 0 + config.roundsPerCycle;
return getMag(stack) > 0;
}
}
//called every time the gun shoots successfully, calls spawnProjectile(), sets item wear
protected void fire(ItemStack stack, World world, EntityPlayer player) {
BulletConfiguration config = null;
if(mainConfig.reloadType == GunConfiguration.RELOAD_NONE) {
config = getBeltCfg(player, stack, true);
} else {
config = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack)));
}
int bullets = config.bulletsMin;
for(int k = 0; k < mainConfig.roundsPerCycle; k++) {
if(!hasAmmo(stack, player, true))
break;
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));
}
useUpAmmo(player, stack, true);
player.inventoryContainer.detectAndSendChanges();
int wear = (int) Math.ceil(config.wear / (1F + EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack)));
setItemWear(stack, getItemWear(stack) + wear);
}
if(player instanceof EntityPlayerMP) {
AnimType animType = getMag(stack) == 0 ? AnimType.CYCLE_EMPTY : AnimType.CYCLE;
PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(animType.ordinal()), (EntityPlayerMP) player);
}
String firingSound = mainConfig.firingSound;
if (getMag(stack) == 0 && mainConfig.firingSoundEmpty != null) firingSound = mainConfig.firingSoundEmpty;
world.playSoundAtEntity(player, firingSound, mainConfig.firingVolume, mainConfig.firingPitch);
if(mainConfig.ejector != null && !mainConfig.ejector.getAfterReload())
queueCasing(player, mainConfig.ejector, config, stack);
}
//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 == null)
return;
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 != GunConfiguration.RELOAD_NONE && !hasAmmo(stack, player, true))
break;
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));
}
if(player instanceof EntityPlayerMP)
PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(AnimType.ALT_CYCLE.ordinal()), (EntityPlayerMP) player);
useUpAmmo(player, stack, false);
player.inventoryContainer.detectAndSendChanges();
setItemWear(stack, getItemWear(stack) + config.wear);
}
world.playSoundAtEntity(player, altConfig.firingSound, mainConfig.firingVolume, altConfig.firingPitch);
if(altConfig.ejector != null)
queueCasing(player, altConfig.ejector, config, stack);
}
//spawns the actual projectile, can be overridden to change projectile entity
protected void spawnProjectile(World world, EntityPlayer player, ItemStack stack, int config) {
EntityBulletBaseNT bullet = new EntityBulletBaseNT(world, config, player);
world.spawnEntityInWorld(bullet);
}
//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) {
boolean validConfig = mainConfig.firingMode == GunConfiguration.FIRE_MANUAL || mainConfig.firingMode == GunConfiguration.FIRE_BURST;
if(validConfig && main && tryShoot(stack, world, player, main)) {
if(mainConfig.firingMode == GunConfiguration.FIRE_BURST){
if(getBurstDuration(stack) <= 0)
setBurstDuration(stack,mainConfig.firingDuration * mainConfig.roundsPerBurst);
} else {
fire(stack, world, player);
setDelay(stack, mainConfig.rateOfFire);
}
}
if(!main && altConfig != null && tryShoot(stack, world, player, main)) {
if(altConfig.firingMode == GunConfiguration.FIRE_BURST && getBurstDuration(stack) <= 0){
setBurstDuration(stack,altConfig.firingDuration * altConfig.roundsPerBurst);
} else {
altFire(stack, world, player);
setDelay(stack, altConfig.rateOfFire);
}
}
}
//called on click (client side, called by mouse click event)
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 cycle)
public void endActionClient(ItemStack stack, World world, EntityPlayer player, boolean main) { }
//current reload
protected void reload2(ItemStack stack, World world, EntityPlayer player) {
if(getMag(stack) >= mainConfig.ammoCap) {
setIsReloading(stack, false);
return;
}
if(getReloadCycle(stack) <= 0) {
BulletConfiguration prevCfg = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack)));
BulletConfiguration cfg = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack)));
ComparableStack ammo = (ComparableStack) cfg.ammo.copy();
final int countNeeded = (mainConfig.reloadType == GunConfiguration.RELOAD_FULL) ? mainConfig.ammoCap - getMag(stack) : 1;
final int availableStacks = InventoryUtil.countAStackMatches(player, ammo, true);
final int availableFills = availableStacks * cfg.ammoCount;
final boolean hasLoaded = availableFills > 0;
final int toAdd = Math.min(availableFills * cfg.ammoCount, countNeeded);
final int toConsume = (int) Math.ceil((double) toAdd / cfg.ammoCount);
// Skip logic if cannot reload
if(availableFills == 0) {
setIsReloading(stack, false);
return;
}
String reloadSound = mainConfig.reloadSoundEmpty != null && getMag(stack) == 0 ? mainConfig.reloadSoundEmpty : mainConfig.reloadSound;
ammo.stacksize = toConsume;
setMag(stack, getMag(stack) + toAdd);
if (getMag(stack) >= mainConfig.ammoCap) {
setIsReloading(stack, false);
PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(AnimType.RELOAD_END.ordinal()), (EntityPlayerMP) player);
} else {
resetReloadCycle(player, stack);
AnimType animType = availableFills <= 1 ? AnimType.RELOAD_END : AnimType.RELOAD_CYCLE;
PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(animType.ordinal()), (EntityPlayerMP) player);
if (availableFills > 1 && !mainConfig.reloadSoundEnd)
world.playSoundAtEntity(player, reloadSound, 1.0F, 1.0F);
}
if(hasLoaded && mainConfig.reloadSoundEnd)
world.playSoundAtEntity(player, reloadSound, 1.0F, 1.0F);
if(mainConfig.ejector != null && mainConfig.ejector.getAfterReload())
queueCasing(player, mainConfig.ejector, prevCfg, stack);
InventoryUtil.tryConsumeAStack(player.inventory.mainInventory, 0, player.inventory.mainInventory.length - 1, ammo);
} 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(getMag(stack) == 0)
resetAmmoType(stack, world, player);
if(player.isSneaking() && hasInfinity(stack, mainConfig)) {
if(getMag(stack) == mainConfig.ammoCap) {
setMag(stack, 0);
this.resetAmmoType(stack, world, player);
world.playSoundAtEntity(player, "tile.piston.out", 1.0F, 1.0F);
}
return;
}
if(getMag(stack) == mainConfig.ammoCap)
return;
if(getIsReloading(stack))
return;
if(!mainConfig.reloadSoundEnd) {
String reloadSound = mainConfig.reloadSoundEmpty != null && getMag(stack) == 0 ? mainConfig.reloadSoundEmpty : mainConfig.reloadSound;
world.playSoundAtEntity(player, reloadSound, 1.0F, 1.0F);
}
if(!world.isRemote) {
AnimType reloadType = getMag(stack) == 0 ? AnimType.RELOAD_EMPTY : AnimType.RELOAD;
PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(reloadType.ordinal()), (EntityPlayerMP) player);
}
setIsReloading(stack, true);
resetReloadCycle(player, stack);
}
public boolean canReload(ItemStack stack, World world, EntityPlayer player) {
if(getMag(stack) == mainConfig.ammoCap && hasInfinity(stack, mainConfig))
return true;
if(getMag(stack) == 0) {
for(int config : mainConfig.config) {
if(InventoryUtil.doesPlayerHaveAStack(player, BulletConfigSyncingUtil.pullConfig(config).ammo, false, false)) {
return true;
}
}
} else {
ComparableStack ammo = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack))).ammo;
return InventoryUtil.doesPlayerHaveAStack(player, ammo, false, false);
}
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(int config : mainConfig.config) {
BulletConfiguration cfg = BulletConfigSyncingUtil.pullConfig(config);
if(InventoryUtil.doesPlayerHaveAStack(player, cfg.ammo, false, false)) {
setMagType(stack, mainConfig.config.indexOf(config));
break;
}
}
}
//item mouseover text
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
ComparableStack ammo = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack))).ammo;
list.add(I18nUtil.resolveKey(HbmCollection.ammo, mainConfig.ammoCap > 0 ? I18nUtil.resolveKey(HbmCollection.ammoMag, getMag(stack), mainConfig.ammoCap) : I18nUtil.resolveKey(HbmCollection.ammoBelt)));
try {
list.add(I18nUtil.resolveKey(HbmCollection.ammoType, ammo.toStack().getDisplayName()));
if(altConfig != null && altConfig.ammoCap == 0) {
ComparableStack ammo2 = BulletConfigSyncingUtil.pullConfig(altConfig.config.get(0)).ammo;
if(!ammo.isApplicable(ammo2)) {
list.add(I18nUtil.resolveKey(HbmCollection.altAmmoType, ammo2.toStack().getDisplayName()));
}
}
}
catch (Exception e)
{
e.printStackTrace();
list.add("Error: " + e + " has occurred!");
}
addAdditionalInformation(stack, 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)
list.add(I18nUtil.resolveKey(HbmCollection.gunPellets, bulletConfig.bulletsMin, bulletConfig.bulletsMax));
int dura = Math.max(mainConfig.durability - getItemWear(stack), 0);
list.add(I18nUtil.resolveKey(HbmCollection.durability, dura + " / " + mainConfig.durability));
list.add("");
String unloc = "gun.name." + mainConfig.name;
String loc = I18nUtil.resolveKey(unloc);
list.add(I18nUtil.resolveKey(HbmCollection.gunName, unloc.equals(loc) ? mainConfig.name : loc));
list.add(I18nUtil.resolveKey(HbmCollection.gunMaker, I18nUtil.resolveKey(mainConfig.manufacturer.getKey())));
if(!mainConfig.comment.isEmpty()) {
list.add("");
for(String s : mainConfig.comment)
list.add(EnumChatFormatting.ITALIC + s);
}
if(GeneralConfig.enableExtendedLogging) {
list.add("");
list.add("Type: " + getMagType(stack));
list.add("Is Reloading: " + getIsReloading(stack));
list.add("Reload Cycle: " + getReloadCycle(stack));
list.add("RoF Cooldown: " + getDelay(stack));
}
}
//returns ammo item of belt-weapons
public static ComparableStack getBeltType(EntityPlayer player, ItemStack stack, boolean main) {
ItemGunBase gun = (ItemGunBase)stack.getItem();
GunConfiguration guncfg = main ? gun.mainConfig : (gun.altConfig != null ? gun.altConfig : gun.mainConfig);
for(Integer config : guncfg.config) {
BulletConfiguration cfg = BulletConfigSyncingUtil.pullConfig(config);
if(InventoryUtil.doesPlayerHaveAStack(player, cfg.ammo, false, true)) {
return cfg.ammo;
}
}
return BulletConfigSyncingUtil.pullConfig(guncfg.config.get(0)).ammo;
}
//returns BCFG of belt-weapons
public static BulletConfiguration getBeltCfg(EntityPlayer player, ItemStack stack, boolean main) {
ItemGunBase gun = (ItemGunBase)stack.getItem();
GunConfiguration guncfg = main ? gun.mainConfig : (gun.altConfig != null ? gun.altConfig : gun.mainConfig);
getBeltType(player, stack, main);
for(int config : guncfg.config) {
BulletConfiguration cfg = BulletConfigSyncingUtil.pullConfig(config);
if(InventoryUtil.doesPlayerHaveAStack(player, cfg.ammo, false, false)) {
return cfg;
}
}
return BulletConfigSyncingUtil.pullConfig(guncfg.config.get(0));
}
//returns ammo capacity of belt-weapons for current ammo
public static int getBeltSize(EntityPlayer player, ComparableStack ammo) {
int amount = 0;
for(ItemStack stack : player.inventory.mainInventory) {
if(stack != null && ammo.matchesRecipe(stack, true)) {
amount += stack.stackSize;
}
}
return amount;
}
//reduces ammo count for mag and belt-based weapons, should be called AFTER firing
public void useUpAmmo(EntityPlayer player, ItemStack stack, boolean main) {
if(!main && altConfig == null)
return;
GunConfiguration config = mainConfig;
if(!main)
config = altConfig;
if(hasInfinity(stack, config)) return;
if(ArmorTrenchmaster.isTrenchMaster(player) && player.getRNG().nextInt(3) == 0) return;
if(ArmorTrenchmaster.hasAoS(player) && player.getRNG().nextInt(3) == 0) return;
if(config.reloadType != GunConfiguration.RELOAD_NONE) {
setMag(stack, getMag(stack) - 1);
} else {
InventoryUtil.doesPlayerHaveAStack(player, getBeltType(player, stack, main), true, false);
}
}
public boolean hasInfinity(ItemStack stack, GunConfiguration config) {
return config.allowsInfinity && EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0;
}
/// sets reload cycle to config defult ///
public static void resetReloadCycle(EntityPlayer player, ItemStack stack) {
writeNBT(stack, "reload", getReloadDuration(player, stack));
}
/// if reloading routine is active ///
public static void setIsReloading(ItemStack stack, boolean b) {
writeNBT(stack, "isReloading", b ? 1 : 0);
}
public static boolean getIsReloading(ItemStack stack) {
return readNBT(stack, "isReloading") == 1;
}
/// if left mouse button is down ///
public static void setIsMouseDown(ItemStack stack, boolean b) {
writeNBT(stack, "isMouseDown", b ? 1 : 0);
}
public static boolean getIsMouseDown(ItemStack stack) {
return readNBT(stack, "isMouseDown") == 1;
}
/// if alt mouse button is down ///
public static void setIsAltDown(ItemStack stack, boolean b) {
writeNBT(stack, "isAltDown", b ? 1 : 0);
}
public static boolean getIsAltDown(ItemStack stack) {
return readNBT(stack, "isAltDown") == 1;
}
/// RoF cooldown ///
public static void setDelay(ItemStack stack, int i) {
writeNBT(stack, "dlay", i);
}
public static int getDelay(ItemStack stack) {
return readNBT(stack, "dlay");
}
/// Gun wear ///
public static void setItemWear(ItemStack stack, int i) {
writeNBT(stack, "wear", i);
}
public static int getItemWear(ItemStack stack) {
return readNBT(stack, "wear");
}
/// R/W cycle animation timer ///
public static void setCycleAnim(ItemStack stack, int i) {
writeNBT(stack, "cycle", i);
}
public static int getCycleAnim(ItemStack stack) {
return readNBT(stack, "cycle");
}
/// R/W reload animation timer ///
public static void setReloadCycle(ItemStack stack, int i) {
writeNBT(stack, "reload", i);
}
public static int getReloadCycle(ItemStack stack) {
return readNBT(stack, "reload");
}
/// magazine capacity ///
public static void setMag(ItemStack stack, int i) {
writeNBT(stack, "magazine", i);
}
public static int getMag(ItemStack stack) {
return readNBT(stack, "magazine");
}
/// magazine type (int specified by index in bullet config list) ///
public static void setMagType(ItemStack stack, int i) {
writeNBT(stack, "magazineType", i);
}
public static int getMagType(ItemStack stack) {
return readNBT(stack, "magazineType");
}
/// Sets how long a burst fires for, only useful for burst fire weapons ///
public static void setBurstDuration(ItemStack stack, int i) {
writeNBT(stack, "bduration", i);
}
public static int getBurstDuration(ItemStack stack) {
return readNBT(stack, "bduration");
}
/// queued casing for ejection ///
public static void setCasing(ItemStack stack, BulletConfiguration bullet) {
writeNBT(stack, "casing", BulletConfigSyncingUtil.getKey(bullet));
}
public static BulletConfiguration getCasing(ItemStack stack) {
return BulletConfigSyncingUtil.pullConfig(readNBT(stack, "casing"));
}
/// timer for ejecting casing ///
public static void setCasingTimer(ItemStack stack, int i) {
writeNBT(stack, "casingTimer", i);
}
public static int getCasingTimer(ItemStack stack) {
return readNBT(stack, "casingTimer");
}
/// NBT utility ///
public static void writeNBT(ItemStack stack, String key, int value) {
if(!stack.hasTagCompound())
stack.stackTagCompound = new NBTTagCompound();
stack.stackTagCompound.setInteger(key, value);
}
public static int readNBT(ItemStack stack, String key) {
if(!stack.hasTagCompound())
return 0;
return stack.stackTagCompound.getInteger(key);
}
@Override
public Crosshair getCrosshair() {
return mainConfig.crosshair;
}
@Override
@SideOnly(Side.CLIENT)
public void renderHUD(Pre event, ElementType type, EntityPlayer player, ItemStack stack) {
ItemGunBase gun = ((ItemGunBase)stack.getItem());
GunConfiguration gcfg = gun.mainConfig;
if(type == ElementType.HOTBAR) {
int mag = ItemGunBase.getMagType(stack);
if(gun.mainConfig.config.size() == 0) return;
BulletConfiguration bcfg = BulletConfigSyncingUtil.pullConfig(gun.mainConfig.config.get(mag < gun.mainConfig.config.size() ? mag : 0));
if(bcfg == null) {
return;
}
ComparableStack ammo = bcfg.ammo;
int count = ItemGunBase.getMag(stack);
int max = gcfg.ammoCap;
boolean showammo = gcfg.showAmmo;
if(gcfg.reloadType == GunConfiguration.RELOAD_NONE) {
ammo = ItemGunBase.getBeltType(player, stack, true);
count = ItemGunBase.getBeltSize(player, ammo);
max = -1;
}
int dura = ItemGunBase.getItemWear(stack) * 50 / gcfg.durability;
RenderScreenOverlay.renderAmmo(event.resolution, Minecraft.getMinecraft().ingameGUI, ammo.toStack(), count, max, dura, showammo);
if(gun.altConfig != null && gun.altConfig.reloadType == GunConfiguration.RELOAD_NONE) {
ComparableStack oldAmmo = ammo;
ammo = ItemGunBase.getBeltType(player, stack, false);
if(!ammo.isApplicable(oldAmmo)) {
count = ItemGunBase.getBeltSize(player, ammo);
RenderScreenOverlay.renderAmmoAlt(event.resolution, Minecraft.getMinecraft().ingameGUI, ammo.toStack(), count);
}
}
}
if(type == ElementType.CROSSHAIRS && GeneralConfig.enableCrosshairs) {
event.setCanceled(true);
if(!(gcfg.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);
}
}
@SideOnly(Side.CLIENT)
public BusAnimation getAnimation(ItemStack stack, AnimType type) {
GunConfiguration config = ((ItemGunBase) stack.getItem()).mainConfig;
if (!config.animationsLoaded && config.loadAnimations != null) {
config.loadAnimations.accept(null);
config.animationsLoaded = true;
}
return config.animations.get(type);
}
@Override
public void onEquip(EntityPlayer player, ItemStack stack) {
if(!mainConfig.equipSound.isEmpty() && !player.worldObj.isRemote) {
player.worldObj.playSoundAtEntity(player, mainConfig.equipSound, 1, 1);
}
if(player instanceof EntityPlayerMP) PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(AnimType.EQUIP.ordinal()), (EntityPlayerMP) player);
}
protected static void queueCasing(Entity entity, CasingEjector ejector, BulletConfiguration bullet, ItemStack stack) {
if(ejector == null || bullet == null || bullet.spentCasing == null) return;
if(ejector.getDelay() <= 0) {
trySpawnCasing(entity, ejector, bullet, stack);
} else {
setCasing(stack, bullet);
setCasingTimer(stack, ejector.getDelay());
}
}
protected static void trySpawnCasing(Entity entity, CasingEjector ejector, BulletConfiguration bullet, ItemStack stack) {
if(ejector == null) return; //abort if the gun can't eject bullets at all
if(bullet == null) return; //abort if there's no valid bullet cfg
if(bullet.spentCasing == null) return; //abort if the bullet is caseless
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "casing");
data.setFloat("pitch", (float) Math.toRadians(entity.rotationPitch));
data.setFloat("yaw", (float) Math.toRadians(entity.rotationYaw));
data.setBoolean("crouched", entity.isSneaking());
data.setString("name", bullet.spentCasing.getName());
data.setInteger("ej", ejector.getId());
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 50));
}
public static int getReloadDuration(EntityPlayer player, ItemStack stack) {
GunConfiguration config = ((ItemGunBase) stack.getItem()).mainConfig;
int cycle = config.reloadDuration;
if (getMag(stack) == 0) cycle += config.emptyReloadAdditionalDuration;
if(ArmorTrenchmaster.isTrenchMaster(player)) return Math.max(1, cycle / 2);
return cycle;
}
}

View File

@ -1680,6 +1680,8 @@ public class MainRegistry {
ignoreMappings.add("hbm:item.singularity_micro"); ignoreMappings.add("hbm:item.singularity_micro");
ignoreMappings.add("hbm:item.gun_cryocannon"); ignoreMappings.add("hbm:item.gun_cryocannon");
ignoreMappings.add("hbm:item.gun_cryolator_ammo"); ignoreMappings.add("hbm:item.gun_cryolator_ammo");
ignoreMappings.add("hbm:item.canteen_fab");
ignoreMappings.add("hbm:item.fabsols_vodka");
/// REMAP /// /// REMAP ///
remapItems.put("hbm:item.gadget_explosive8", ModItems.early_explosive_lenses); remapItems.put("hbm:item.gadget_explosive8", ModItems.early_explosive_lenses);

View File

@ -11,7 +11,6 @@ import com.hbm.entity.train.EntityRailCarRidable;
import com.hbm.extprop.HbmLivingProps; import com.hbm.extprop.HbmLivingProps;
import com.hbm.extprop.HbmPlayerProps; import com.hbm.extprop.HbmPlayerProps;
import com.hbm.handler.ArmorModHandler; import com.hbm.handler.ArmorModHandler;
import com.hbm.handler.GunConfiguration;
import com.hbm.handler.HTTPHandler; import com.hbm.handler.HTTPHandler;
import com.hbm.handler.HazmatRegistry; import com.hbm.handler.HazmatRegistry;
import com.hbm.handler.HbmKeybinds; import com.hbm.handler.HbmKeybinds;
@ -31,14 +30,12 @@ import com.hbm.items.armor.*;
import com.hbm.items.machine.ItemDepletedFuel; import com.hbm.items.machine.ItemDepletedFuel;
import com.hbm.items.machine.ItemFluidDuct; import com.hbm.items.machine.ItemFluidDuct;
import com.hbm.items.machine.ItemRBMKPellet; import com.hbm.items.machine.ItemRBMKPellet;
import com.hbm.items.weapon.ItemGunBase;
import com.hbm.items.weapon.sedna.GunConfig; import com.hbm.items.weapon.sedna.GunConfig;
import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.lib.Library; import com.hbm.lib.Library;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.packet.PacketDispatcher; import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toserver.AuxButtonPacket; import com.hbm.packet.toserver.AuxButtonPacket;
import com.hbm.packet.toserver.GunButtonPacket;
import com.hbm.packet.toserver.KeybindPacket; import com.hbm.packet.toserver.KeybindPacket;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
import com.hbm.render.anim.HbmAnimations.Animation; import com.hbm.render.anim.HbmAnimations.Animation;
@ -348,15 +345,6 @@ public class ModEventHandlerClient {
/// HANDLE SCOPE OVERLAY /// /// HANDLE SCOPE OVERLAY ///
ItemStack held = player.getHeldItem(); ItemStack held = player.getHeldItem();
if(player.isSneaking() && held != null && held.getItem() instanceof ItemGunBase && event.type == event.type.HOTBAR) {
GunConfiguration config = ((ItemGunBase) held.getItem()).mainConfig;
if(config.scopeTexture != null) {
ScaledResolution resolution = event.resolution;
RenderScreenOverlay.renderScope(resolution, config.scopeTexture);
}
}
if(held != null && held.getItem() instanceof ItemGunBaseNT && ItemGunBaseNT.aimingProgress == ItemGunBaseNT.prevAimingProgress && ItemGunBaseNT.aimingProgress == 1F && event.type == event.type.HOTBAR) { if(held != null && held.getItem() instanceof ItemGunBaseNT && ItemGunBaseNT.aimingProgress == ItemGunBaseNT.prevAimingProgress && ItemGunBaseNT.aimingProgress == 1F && event.type == event.type.HOTBAR) {
ItemGunBaseNT gun = (ItemGunBaseNT) held.getItem(); ItemGunBaseNT gun = (ItemGunBaseNT) held.getItem();
GunConfig cfg = gun.getConfig(held, 0); GunConfig cfg = gun.getConfig(held, 0);
@ -590,36 +578,6 @@ public class ModEventHandlerClient {
} }
} }
@SubscribeEvent
public void clickHandler(MouseEvent event) {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if(player.getHeldItem() != null) {
Item held = player.getHeldItem().getItem();
if(held instanceof ItemGunBase) {
if(event.button == 0)
event.setCanceled(true);
ItemGunBase item = (ItemGunBase)player.getHeldItem().getItem();
if(event.button == 0 && !item.m1 && !item.m2) {
item.m1 = true;
PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(true, (byte) 0));
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));
item.startActionClient(player.getHeldItem(), player.worldObj, player, false);
}
}
}
}
@Spaghetti("please get this shit out of my face") @Spaghetti("please get this shit out of my face")
@SubscribeEvent @SubscribeEvent
public void onPlaySound(PlaySoundEvent17 e) { public void onPlaySound(PlaySoundEvent17 e) {

View File

@ -35,8 +35,6 @@ public class PacketDispatcher {
wrapper.registerMessage(ExtPropPacket.Handler.class, ExtPropPacket.class, i++, Side.CLIENT); wrapper.registerMessage(ExtPropPacket.Handler.class, ExtPropPacket.class, i++, Side.CLIENT);
//Packet for force fields //Packet for force fields
wrapper.registerMessage(TEFFPacket.Handler.class, TEFFPacket.class, i++, Side.CLIENT); wrapper.registerMessage(TEFFPacket.Handler.class, TEFFPacket.class, i++, Side.CLIENT);
//Sends button information for ItemGunBase
wrapper.registerMessage(GunButtonPacket.Handler.class, GunButtonPacket.class, i++, Side.SERVER);
//Signals server to buy offer from bobmazon //Signals server to buy offer from bobmazon
wrapper.registerMessage(ItemBobmazonPacket.Handler.class, ItemBobmazonPacket.class, i++, Side.SERVER); wrapper.registerMessage(ItemBobmazonPacket.Handler.class, ItemBobmazonPacket.class, i++, Side.SERVER);
//Packet to send missile multipart information to TEs //Packet to send missile multipart information to TEs

View File

@ -4,7 +4,6 @@ import java.util.function.BiConsumer;
import java.util.function.BiFunction; import java.util.function.BiFunction;
import com.hbm.items.armor.ArmorTrenchmaster; import com.hbm.items.armor.ArmorTrenchmaster;
import com.hbm.items.weapon.ItemGunBase;
import com.hbm.items.weapon.sedna.GunConfig; import com.hbm.items.weapon.sedna.GunConfig;
import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.Receiver; import com.hbm.items.weapon.sedna.Receiver;
@ -76,40 +75,12 @@ public class GunAnimationPacket implements IMessage {
ItemStack stack = player.getHeldItem(); ItemStack stack = player.getHeldItem();
int slot = player.inventory.currentItem; int slot = player.inventory.currentItem;
if(stack == null) if(stack == null) return null;
return null;
if(stack.getItem() instanceof ItemGunBaseNT) { if(stack.getItem() instanceof ItemGunBaseNT) {
handleSedna(player, stack, slot, AnimType.values()[m.type], m.receiverIndex, m.gunIndex); handleSedna(player, stack, slot, AnimType.values()[m.type], m.receiverIndex, m.gunIndex);
} }
if(!(stack.getItem() instanceof ItemGunBase))
return null;
if(m.type < 0 || m.type >= AnimType.values().length)
return null;
AnimType type = AnimType.values()[m.type];
ItemGunBase base = (ItemGunBase) stack.getItem();
BusAnimation animation = base.getAnimation(stack, type);
// Fallback to regular reload if no empty reload animation
if(animation == null && type == AnimType.RELOAD_EMPTY) {
animation = base.getAnimation(stack, AnimType.RELOAD);
}
// Fallback to regular CYCLE if no ALT_CYCLE (or CYCLE_EMPTY) exists
if(animation == null && (type == AnimType.ALT_CYCLE || type == AnimType.CYCLE_EMPTY)) {
animation = base.getAnimation(stack, AnimType.CYCLE);
}
if(animation != null) {
boolean isReloadAnimation = type == AnimType.RELOAD || type == AnimType.RELOAD_CYCLE || type == AnimType.RELOAD_EMPTY;
if(isReloadAnimation && ArmorTrenchmaster.isTrenchMaster(player)) animation.setTimeMult(0.5D);
HbmAnimations.hotbar[slot][0] = new Animation(stack.getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, type, isReloadAnimation && base.mainConfig.reloadAnimationsSequential);
}
} catch(Exception x) { } } catch(Exception x) { }
return null; return null;

View File

@ -1,81 +0,0 @@
package com.hbm.packet.toserver;
import com.hbm.items.weapon.ItemGunBase;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
public class GunButtonPacket implements IMessage {
//true or false, whether or not the key is pressed
boolean state;
//0: [M1]
//1: [M2]
//2: [R]
byte button;
public GunButtonPacket() { }
public GunButtonPacket(boolean m1, byte b) {
state = m1;
button = b;
}
@Override
public void fromBytes(ByteBuf buf) {
state = buf.readBoolean();
button = buf.readByte();
}
@Override
public void toBytes(ByteBuf buf) {
buf.writeBoolean(state);
buf.writeByte(button);
}
public static class Handler implements IMessageHandler<GunButtonPacket, IMessage> {
@Override
public IMessage onMessage(GunButtonPacket m, MessageContext ctx) {
if(FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
return null;
EntityPlayer p = ctx.getServerHandler().playerEntity;
if(p.getHeldItem() != null && p.getHeldItem().getItem() instanceof ItemGunBase) {
ItemGunBase item = (ItemGunBase)p.getHeldItem().getItem();
switch(m.button) {
case 0: ItemGunBase.setIsMouseDown(p.getHeldItem(), m.state);
if(m.state)
item.startAction(p.getHeldItem(), p.worldObj, p, true);
else
item.endAction(p.getHeldItem(), p.worldObj, p, true);
break;
case 1: ItemGunBase.setIsAltDown(p.getHeldItem(), m.state);
if(m.state)
item.startAction(p.getHeldItem(), p.worldObj, p, false);
else
item.endAction(p.getHeldItem(), p.worldObj, p, false);
break;
case 2:
if(item.canReload(p.getHeldItem(), p.worldObj, p)) {
item.startReloadAction(p.getHeldItem(), p.worldObj, p);
}
break;
}
}
return null;
}
}
}

View File

@ -8,7 +8,7 @@ achievement.bossMaskman.desc=Kloppe den dicken Buben.
achievement.bossMaskman=6 Monate verpflichtender Dienst und alles was ich davon habe ist dieses doofe T-Shirt achievement.bossMaskman=6 Monate verpflichtender Dienst und alles was ich davon habe ist dieses doofe T-Shirt
achievement.bossMeltdown.desc=Mehr schlecht als recht, aber was will man machen. achievement.bossMeltdown.desc=Mehr schlecht als recht, aber was will man machen.
achievement.bossMeltdown=3,6 Röntgen achievement.bossMeltdown=3,6 Röntgen
achievement.bossWorm.desc=Der Fabstaff. Mein Arsch. Jetzt fang an zu rechnen. achievement.bossWorm.desc=Nur ein kleiner Metallwurm.
achievement.bossWorm=Disassembling Balls-O-Tron achievement.bossWorm=Disassembling Balls-O-Tron
achievement.bossUFO.desc=Yo, what do we have here? A huge spacecraft pulling up to the blockship? achievement.bossUFO.desc=Yo, what do we have here? A huge spacecraft pulling up to the blockship?
achievement.bossUFO=Ayy Lmao achievement.bossUFO=Ayy Lmao
@ -1501,8 +1501,6 @@ item.canned_tomato.name=Konservendose (Tomatensuppe)
item.canned_tube.name=Tube (Astronautenessen) item.canned_tube.name=Tube (Astronautenessen)
item.canned_tuna.name=Konservendose (Tunfisch) item.canned_tuna.name=Konservendose (Tunfisch)
item.canned_yogurt.name=Konservendose (Jogurt) item.canned_yogurt.name=Konservendose (Jogurt)
item.canteen_13.name=Vault 13 Kantine
item.canteen_fab.name=Fabulöser Wodka
item.canteen_vodka.name=Stylischer Flachmann item.canteen_vodka.name=Stylischer Flachmann
item.cap_aluminium.name=Aluminiumdeckel item.cap_aluminium.name=Aluminiumdeckel
item.cap_fritz.name=Fritz-Kola Kronkorken item.cap_fritz.name=Fritz-Kola Kronkorken
@ -1919,7 +1917,6 @@ item.euphemium_kit.name=Euphemium Kit
item.euphemium_legs.name=Euphemiumbeinschutz item.euphemium_legs.name=Euphemiumbeinschutz
item.euphemium_plate.name=Euphemiumbrustpanzer item.euphemium_plate.name=Euphemiumbrustpanzer
item.euphemium_stopper.name=Stopper item.euphemium_stopper.name=Stopper
item.fabsols_vodka.name=Fabsols Wodka
item.factory_core_advanced.name=Fortgeschrittener Fabrikenergiecluster item.factory_core_advanced.name=Fortgeschrittener Fabrikenergiecluster
item.factory_core_titanium.name=Einfacher Fabrikenergiecluster item.factory_core_titanium.name=Einfacher Fabrikenergiecluster
item.fallout.name=Fallouthäufchen item.fallout.name=Fallouthäufchen
@ -2166,7 +2163,7 @@ item.hazmat_plate_red.name=Verbesserte Strahlenschutzbrustplatte
item.hazmat_red_kit.name=Lvl 2 Strahlenschutz-Kit item.hazmat_red_kit.name=Lvl 2 Strahlenschutz-Kit
item.heart_booster.name=Herzbooster item.heart_booster.name=Herzbooster
item.heart_container.name=Herzcontainer item.heart_container.name=Herzcontainer
item.heart_fab.name=Fab Herz item.heart_fab.name=Herz der Dunkelheit
item.heart_piece.name=Herzteil item.heart_piece.name=Herzteil
item.heavy_component.name=Schwere %skomponente item.heavy_component.name=Schwere %skomponente
item.hev_battery.name=Anzugs-Batterie item.hev_battery.name=Anzugs-Batterie

View File

@ -16,7 +16,7 @@ achievement.bossMaskman.desc=Bonk the big boy.
achievement.bossMaskman=6 Months of mandatory service and all I got was a lousy t-shirt achievement.bossMaskman=6 Months of mandatory service and all I got was a lousy t-shirt
achievement.bossMeltdown.desc=More terrible than great, but I take what I can get. achievement.bossMeltdown.desc=More terrible than great, but I take what I can get.
achievement.bossMeltdown=3.6 Roentgen achievement.bossMeltdown=3.6 Roentgen
achievement.bossWorm.desc=The Fabstaff. My ass. You do the math. achievement.bossWorm.desc=Just a small metal worm.
achievement.bossWorm=Disassembling Balls-O-Tron achievement.bossWorm=Disassembling Balls-O-Tron
achievement.bossUFO.desc=Yo, what do we have here? A huge spacecraft pulling up to the blockship? achievement.bossUFO.desc=Yo, what do we have here? A huge spacecraft pulling up to the blockship?
achievement.bossUFO=Ayy Lmao achievement.bossUFO=Ayy Lmao
@ -2275,8 +2275,6 @@ item.canned_tuna.name=Canned Tuna
item.canned_tuna.desc=I can't tell if that's actually tuna or dried cement. item.canned_tuna.desc=I can't tell if that's actually tuna or dried cement.
item.canned_yogurt.name=Canned Yogurt item.canned_yogurt.name=Canned Yogurt
item.canned_yogurt.desc=Probably spoiled, but whatever. item.canned_yogurt.desc=Probably spoiled, but whatever.
item.canteen_13.name=Vault 13 Canteen
item.canteen_fab.name=Fabulous Vodka
item.canteen_vodka.name=Stylish Flask item.canteen_vodka.name=Stylish Flask
item.cap_fritz.name=Fritz Cola Bottle Cap item.cap_fritz.name=Fritz Cola Bottle Cap
item.cap_korl.name=Korl Bottle Cap item.cap_korl.name=Korl Bottle Cap
@ -2720,7 +2718,6 @@ item.euphemium_plate.name=Euphemium Chestplate
item.euphemium_stopper.name=Stopper item.euphemium_stopper.name=Stopper
item.explosive_lenses.name=Array of High-Explosive Lenses item.explosive_lenses.name=Array of High-Explosive Lenses
item.explosive_lenses.desc=Assembly of 8 PBX lenses with a thin$aluminium pusher, duraluminium shell, and$miniaturized bridgewire detonators. item.explosive_lenses.desc=Assembly of 8 PBX lenses with a thin$aluminium pusher, duraluminium shell, and$miniaturized bridgewire detonators.
item.fabsols_vodka.name=Fabsol's Vodka
item.factory_core_advanced.name=Advanced Factory Energy Cluster item.factory_core_advanced.name=Advanced Factory Energy Cluster
item.factory_core_titanium.name=Basic Factory Energy Cluster item.factory_core_titanium.name=Basic Factory Energy Cluster
item.fallout.name=Pile of Fallout item.fallout.name=Pile of Fallout
@ -2978,7 +2975,7 @@ item.hazmat_plate_red.name=Advanced Hazmat Chestplate
item.hazmat_red_kit.name=Advanced Hazmat Kit item.hazmat_red_kit.name=Advanced Hazmat Kit
item.heart_booster.name=Heart Booster item.heart_booster.name=Heart Booster
item.heart_container.name=Heart Container item.heart_container.name=Heart Container
item.heart_fab.name=Fab Heart item.heart_fab.name=Heart of Darkness
item.heart_piece.name=Heart Piece item.heart_piece.name=Heart Piece
item.heavy_component.name=Heavy %s Component item.heavy_component.name=Heavy %s Component
item.hev_battery.name=Suit Battery item.hev_battery.name=Suit Battery

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 299 B