Merge remote-tracking branch 'origin/master'

This commit is contained in:
Kellen Hurrey 2025-09-19 10:52:15 -06:00
commit 890eb49747
No known key found for this signature in database
GPG Key ID: CF1E5CF3DB06C0D3
133 changed files with 3460 additions and 5696 deletions

View File

@ -1,10 +1,13 @@
## Changed ## Changed
* Updated chinese localization * Added more QMAW pages
* Added more QMAW manual pages * Removed most old particle accelerator blocks from the creative inventory
* WIAJ presentations now use the same configurable keybind as QMAW * All dual wielded guns now render more accurately when dropped instead of only showing one gun
* Shift has to be held for the presentations, while F1 will open the standard QMAW page * Added support for left handed guns (currently unused)*
* Double UZIs no longer render weirdly when dropped * Removed the presentations for the old particle accelerator and schottky diode
* Gibbing NPCs now also spawns bones, if supported by the skeletonizer
* Gibbed bones only have a 50% chance of spawning and come with a unique red texture
* Gibbed bones have a way shorter lifetime and higher gravity to match the gib particles
## Fixed ## Fixed
* Fixed fusion reactor item IO being broken * Fixed wood burner only being able to create one ash pile per item burned, even when that item yields more, creating a backlog in the internal ash value
* Fixed issue with the chemical factory where the declogging feature would be triggered by a recipe processor that doesn't even own the reported slot * Fixed some QMAW link icons not having the correct block lighting applied

View File

@ -1,6 +1,6 @@
mod_version=1.0.27 mod_version=1.0.27
# Empty build number makes a release type # Empty build number makes a release type
mod_build_number=5441 mod_build_number=5454
credits=HbMinecraft,\ credits=HbMinecraft,\
\ rodolphito (explosion algorithms),\ \ rodolphito (explosion algorithms),\

View File

@ -1007,6 +1007,7 @@ public class ModBlocks {
@Deprecated public static Block machine_assembler; @Deprecated public static Block machine_assembler;
public static Block machine_assembly_machine; public static Block machine_assembly_machine;
@Deprecated public static Block machine_assemfac; @Deprecated public static Block machine_assemfac;
public static Block machine_assembly_factory;
public static Block machine_arc_welder; public static Block machine_arc_welder;
public static Block machine_soldering_station; public static Block machine_soldering_station;
public static Block machine_arc_furnace; public static Block machine_arc_furnace;
@ -1840,13 +1841,13 @@ public class ModBlocks {
machine_exposure_chamber = new MachineExposureChamber(Material.iron).setBlockName("machine_exposure_chamber").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_aluminium"); machine_exposure_chamber = new MachineExposureChamber(Material.iron).setBlockName("machine_exposure_chamber").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_aluminium");
machine_radgen = new MachineRadGen(Material.iron).setBlockName("machine_radgen").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_radgen"); machine_radgen = new MachineRadGen(Material.iron).setBlockName("machine_radgen").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_radgen");
hadron_plating = new BlockHadronPlating(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_plating").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_plating"); hadron_plating = new BlockHadronPlating(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_plating").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":hadron_plating");
hadron_plating_blue = new BlockHadronPlating(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_plating_blue").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_plating_blue"); hadron_plating_blue = new BlockHadronPlating(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_plating_blue").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":hadron_plating_blue");
hadron_plating_black = new BlockHadronPlating(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_plating_black").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_plating_black"); hadron_plating_black = new BlockHadronPlating(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_plating_black").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":hadron_plating_black");
hadron_plating_yellow = new BlockHadronPlating(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_plating_yellow").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_plating_yellow"); hadron_plating_yellow = new BlockHadronPlating(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_plating_yellow").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":hadron_plating_yellow");
hadron_plating_striped = new BlockHadronPlating(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_plating_striped").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_plating_striped"); hadron_plating_striped = new BlockHadronPlating(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_plating_striped").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":hadron_plating_striped");
hadron_plating_voltz = new BlockHadronPlating(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_plating_voltz").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_plating_voltz"); hadron_plating_voltz = new BlockHadronPlating(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_plating_voltz").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":hadron_plating_voltz");
hadron_plating_glass = new BlockNTMGlass(0, RefStrings.MODID + ":hadron_plating_glass", Material.iron, true).setStepSound(Block.soundTypeMetal).setBlockName("hadron_plating_glass").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_plating_glass"); hadron_plating_glass = new BlockNTMGlass(0, RefStrings.MODID + ":hadron_plating_glass", Material.iron, true).setStepSound(Block.soundTypeMetal).setBlockName("hadron_plating_glass").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":hadron_plating_glass");
hadron_coil_alloy = new BlockHadronCoil(Material.iron, 10).setStepSound(Block.soundTypeMetal).setBlockName("hadron_coil_alloy").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_coil_alloy"); hadron_coil_alloy = new BlockHadronCoil(Material.iron, 10).setStepSound(Block.soundTypeMetal).setBlockName("hadron_coil_alloy").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_coil_alloy");
hadron_coil_gold = new BlockHadronCoil(Material.iron, 25).setStepSound(Block.soundTypeMetal).setBlockName("hadron_coil_gold").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_coil_gold"); hadron_coil_gold = new BlockHadronCoil(Material.iron, 25).setStepSound(Block.soundTypeMetal).setBlockName("hadron_coil_gold").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_coil_gold");
hadron_coil_neodymium = new BlockHadronCoil(Material.iron, 50).setStepSound(Block.soundTypeMetal).setBlockName("hadron_coil_neodymium").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_coil_neodymium"); hadron_coil_neodymium = new BlockHadronCoil(Material.iron, 50).setStepSound(Block.soundTypeMetal).setBlockName("hadron_coil_neodymium").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_coil_neodymium");
@ -1856,16 +1857,16 @@ public class ModBlocks {
hadron_coil_starmetal = new BlockHadronCoil(Material.iron, 1000).setStepSound(Block.soundTypeMetal).setBlockName("hadron_coil_starmetal").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_coil_starmetal"); hadron_coil_starmetal = new BlockHadronCoil(Material.iron, 1000).setStepSound(Block.soundTypeMetal).setBlockName("hadron_coil_starmetal").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_coil_starmetal");
hadron_coil_chlorophyte = new BlockHadronCoil(Material.iron, 2500).setStepSound(Block.soundTypeMetal).setBlockName("hadron_coil_chlorophyte").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_coil_chlorophyte"); hadron_coil_chlorophyte = new BlockHadronCoil(Material.iron, 2500).setStepSound(Block.soundTypeMetal).setBlockName("hadron_coil_chlorophyte").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_coil_chlorophyte");
hadron_coil_mese = new BlockHadronCoil(Material.iron, 10000).setStepSound(Block.soundTypeMetal).setBlockName("hadron_coil_mese").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_coil_mese"); hadron_coil_mese = new BlockHadronCoil(Material.iron, 10000).setStepSound(Block.soundTypeMetal).setBlockName("hadron_coil_mese").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_coil_mese");
hadron_power = new BlockHadronPower(Material.iron, 1000000L).setStepSound(Block.soundTypeMetal).setBlockName("hadron_power").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_power"); hadron_power = new BlockHadronPower(Material.iron, 1000000L).setStepSound(Block.soundTypeMetal).setBlockName("hadron_power").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":hadron_power");
hadron_power_10m = new BlockHadronPower(Material.iron, 10000000L).setStepSound(Block.soundTypeMetal).setBlockName("hadron_power_10m").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_power"); hadron_power_10m = new BlockHadronPower(Material.iron, 10000000L).setStepSound(Block.soundTypeMetal).setBlockName("hadron_power_10m").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":hadron_power");
hadron_power_100m = new BlockHadronPower(Material.iron, 100000000L).setStepSound(Block.soundTypeMetal).setBlockName("hadron_power_100m").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_power"); hadron_power_100m = new BlockHadronPower(Material.iron, 100000000L).setStepSound(Block.soundTypeMetal).setBlockName("hadron_power_100m").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":hadron_power");
hadron_power_1g = new BlockHadronPower(Material.iron, 1000000000L).setStepSound(Block.soundTypeMetal).setBlockName("hadron_power_1g").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_power"); hadron_power_1g = new BlockHadronPower(Material.iron, 1000000000L).setStepSound(Block.soundTypeMetal).setBlockName("hadron_power_1g").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":hadron_power");
hadron_power_10g = new BlockHadronPower(Material.iron, 10000000000L).setStepSound(Block.soundTypeMetal).setBlockName("hadron_power_10g").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_power"); hadron_power_10g = new BlockHadronPower(Material.iron, 10000000000L).setStepSound(Block.soundTypeMetal).setBlockName("hadron_power_10g").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":hadron_power");
hadron_diode = new BlockHadronDiode(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_diode").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); hadron_diode = new BlockHadronDiode(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_diode").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null);
hadron_analysis = new BlockHadronPlating(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_analysis").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_analysis"); hadron_analysis = new BlockHadronPlating(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_analysis").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":hadron_analysis");
hadron_analysis_glass = new BlockNTMGlass(0, RefStrings.MODID + ":hadron_analysis_glass", Material.iron, true).setStepSound(Block.soundTypeMetal).setBlockName("hadron_analysis_glass").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_analysis_glass"); hadron_analysis_glass = new BlockNTMGlass(0, RefStrings.MODID + ":hadron_analysis_glass", Material.iron, true).setStepSound(Block.soundTypeMetal).setBlockName("hadron_analysis_glass").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":hadron_analysis_glass");
hadron_access = new BlockHadronAccess(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_access").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_access"); hadron_access = new BlockHadronAccess(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_access").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":hadron_access");
hadron_core = new BlockHadronCore(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_core").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_core"); hadron_core = new BlockHadronCore(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_core").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":hadron_core");
pa_source = new BlockPASource().setStepSound(Block.soundTypeMetal).setBlockName("pa_source").setHardness(5.0F).setResistance(10.0F); pa_source = new BlockPASource().setStepSound(Block.soundTypeMetal).setBlockName("pa_source").setHardness(5.0F).setResistance(10.0F);
pa_beamline = new BlockPABeamline().setStepSound(Block.soundTypeMetal).setBlockName("pa_beamline").setHardness(5.0F).setResistance(10.0F); pa_beamline = new BlockPABeamline().setStepSound(Block.soundTypeMetal).setBlockName("pa_beamline").setHardness(5.0F).setResistance(10.0F);
@ -2240,6 +2241,7 @@ public class ModBlocks {
machine_assembler = new MachineAssembler(Material.iron).setBlockName("machine_assembler").setHardness(5.0F).setResistance(30.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":machine_assembler"); machine_assembler = new MachineAssembler(Material.iron).setBlockName("machine_assembler").setHardness(5.0F).setResistance(30.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":machine_assembler");
machine_assembly_machine = new MachineAssemblyMachine(Material.iron).setBlockName("machine_assembly_machine").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); machine_assembly_machine = new MachineAssemblyMachine(Material.iron).setBlockName("machine_assembly_machine").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_assemfac = new MachineAssemfac(Material.iron).setBlockName("machine_assemfac").setHardness(5.0F).setResistance(30.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel"); machine_assemfac = new MachineAssemfac(Material.iron).setBlockName("machine_assemfac").setHardness(5.0F).setResistance(30.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_assembly_factory = new MachineAssemblyFactory(Material.iron).setBlockName("machine_assembly_factory").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_arc_welder = new MachineArcWelder(Material.iron).setBlockName("machine_arc_welder").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); machine_arc_welder = new MachineArcWelder(Material.iron).setBlockName("machine_arc_welder").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_soldering_station = new MachineSolderingStation(Material.iron).setBlockName("machine_soldering_station").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); machine_soldering_station = new MachineSolderingStation(Material.iron).setBlockName("machine_soldering_station").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_chemplant = new MachineChemplant(Material.iron).setBlockName("machine_chemplant").setHardness(5.0F).setResistance(30.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel"); machine_chemplant = new MachineChemplant(Material.iron).setBlockName("machine_chemplant").setHardness(5.0F).setResistance(30.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
@ -3298,6 +3300,7 @@ public class ModBlocks {
GameRegistry.registerBlock(machine_assembler, machine_assembler.getUnlocalizedName()); GameRegistry.registerBlock(machine_assembler, machine_assembler.getUnlocalizedName());
register(machine_assembly_machine); register(machine_assembly_machine);
GameRegistry.registerBlock(machine_assemfac, machine_assemfac.getUnlocalizedName()); GameRegistry.registerBlock(machine_assemfac, machine_assemfac.getUnlocalizedName());
register(machine_assembly_factory);
GameRegistry.registerBlock(machine_chemplant, machine_chemplant.getUnlocalizedName()); GameRegistry.registerBlock(machine_chemplant, machine_chemplant.getUnlocalizedName());
register(machine_chemical_plant); register(machine_chemical_plant);
register(machine_chemfac); register(machine_chemfac);

View File

@ -7,6 +7,7 @@ import static net.minecraftforge.common.util.ForgeDirection.WEST;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.world.gen.nbt.INBTBlockTransformable;
import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -20,23 +21,23 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
public class BlockChain extends Block { public class BlockChain extends Block implements INBTBlockTransformable {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconEnd; private IIcon iconEnd;
public BlockChain(Material mat) { public BlockChain(Material mat) {
super(mat); super(mat);
} }
public boolean isOpaqueCube() { public boolean isOpaqueCube() {
return false; return false;
} }
public boolean renderAsNormalBlock() { public boolean renderAsNormalBlock() {
return false; return false;
} }
public static int renderID = RenderingRegistry.getNextAvailableRenderId(); public static int renderID = RenderingRegistry.getNextAvailableRenderId();
public int getRenderType() { public int getRenderType() {
@ -47,7 +48,7 @@ public class BlockChain extends Block {
public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity) { public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity) {
return true; return true;
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) { public void registerBlockIcons(IIconRegister iconRegister) {
@ -60,14 +61,14 @@ public class BlockChain extends Block {
if(world.isSideSolid(x, y - 1, z, ForgeDirection.UP, false) || (world.getBlock(x, y - 1, z) == this && world.getBlockMetadata(x, y, z) == world.getBlockMetadata(x, y - 1, z))) if(world.isSideSolid(x, y - 1, z, ForgeDirection.UP, false) || (world.getBlock(x, y - 1, z) == this && world.getBlockMetadata(x, y, z) == world.getBlockMetadata(x, y - 1, z)))
return this.blockIcon; return this.blockIcon;
return this.iconEnd; return this.iconEnd;
} }
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
return null; return null;
} }
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
func_149797_b(world.getBlockMetadata(x, y, z)); func_149797_b(world.getBlockMetadata(x, y, z));
@ -76,11 +77,11 @@ public class BlockChain extends Block {
} }
public void func_149797_b(int meta) { public void func_149797_b(int meta) {
float f = 0.125F; float f = 0.125F;
if(meta == 0) { if(meta == 0) {
this.minX = 3 * f; this.minX = 3 * f;
this.minY = 0; this.minY = 0;
this.minZ = 3 * f; this.minZ = 3 * f;
@ -109,24 +110,24 @@ public class BlockChain extends Block {
this.setBlockBounds(0.0F, 0.0F, 3 * f, f, 1.0F, 5 * f); this.setBlockBounds(0.0F, 0.0F, 3 * f, f, 1.0F, 5 * f);
} }
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) { public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
this.setBlockBoundsBasedOnState(world, x, y, z); this.setBlockBoundsBasedOnState(world, x, y, z);
return super.getSelectedBoundingBoxFromPool(world, x, y, z); return super.getSelectedBoundingBoxFromPool(world, x, y, z);
} }
public boolean canPlaceBlockAt(World world, int x, int y, int z) { public boolean canPlaceBlockAt(World world, int x, int y, int z) {
if(world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN) || world.getBlock(x, y + 1, z) == this) if(world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN) || world.getBlock(x, y + 1, z) == this)
return true; return true;
return world.isSideSolid(x - 1, y, z, EAST ) || return world.isSideSolid(x - 1, y, z, EAST ) ||
world.isSideSolid(x + 1, y, z, WEST ) || world.isSideSolid(x + 1, y, z, WEST ) ||
world.isSideSolid(x, y, z - 1, SOUTH) || world.isSideSolid(x, y, z - 1, SOUTH) ||
world.isSideSolid(x, y, z + 1, NORTH); world.isSideSolid(x, y, z + 1, NORTH);
} }
public int onBlockPlaced(World world, int x, int y, int z, int side, float p_149660_6_, float p_149660_7_, float p_149660_8_, int meta) public int onBlockPlaced(World world, int x, int y, int z, int side, float p_149660_6_, float p_149660_7_, float p_149660_8_, int meta)
{ {
int j1 = meta; int j1 = meta;
@ -142,12 +143,12 @@ public class BlockChain extends Block {
if(side == 5 && world.isSideSolid(x - 1, y, z, EAST)) if(side == 5 && world.isSideSolid(x - 1, y, z, EAST))
j1 = 5; j1 = 5;
if(j1 == 0) { if(j1 == 0) {
if(world.getBlock(x, y + 1, z) == this) if(world.getBlock(x, y + 1, z) == this)
return world.getBlockMetadata(x, y + 1, z); return world.getBlockMetadata(x, y + 1, z);
if(world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)) if(world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN))
return 0; return 0;
} }
@ -155,30 +156,30 @@ public class BlockChain extends Block {
if(j1 == 0) { if(j1 == 0) {
if(world.isSideSolid(x, y, z + 1, NORTH)) if(world.isSideSolid(x, y, z + 1, NORTH))
j1 = 2; j1 = 2;
if(world.isSideSolid(x, y, z - 1, SOUTH)) if(world.isSideSolid(x, y, z - 1, SOUTH))
j1 = 3; j1 = 3;
if(world.isSideSolid(x + 1, y, z, WEST)) if(world.isSideSolid(x + 1, y, z, WEST))
j1 = 4; j1 = 4;
if(world.isSideSolid(x - 1, y, z, EAST)) if(world.isSideSolid(x - 1, y, z, EAST))
j1 = 5; j1 = 5;
} }
return j1; return j1;
} }
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
int l = world.getBlockMetadata(x, y, z); int l = world.getBlockMetadata(x, y, z);
boolean flag = false; boolean flag = false;
if(world.getBlock(x, y + 1, z) == this && world.getBlockMetadata(x, y, z) == world.getBlockMetadata(x, y + 1, z)) { if(world.getBlock(x, y + 1, z) == this && world.getBlockMetadata(x, y, z) == world.getBlockMetadata(x, y + 1, z)) {
super.onNeighborBlockChange(world, x, y, z, block); super.onNeighborBlockChange(world, x, y, z, block);
return; return;
} }
if(world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN) && world.getBlockMetadata(x, y, z) == 0) { if(world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN) && world.getBlockMetadata(x, y, z) == 0) {
super.onNeighborBlockChange(world, x, y, z, block); super.onNeighborBlockChange(world, x, y, z, block);
return; return;
@ -201,4 +202,12 @@ public class BlockChain extends Block {
super.onNeighborBlockChange(world, x, y, z, block); super.onNeighborBlockChange(world, x, y, z, block);
} }
@Override
public int transformMeta(int meta, int coordBaseMode) {
if (coordBaseMode == 0) return meta;
if (meta == 0) return meta;
if (meta == 1) return meta;
return INBTBlockTransformable.transformMetaDeco(meta, coordBaseMode);
}
} }

View File

@ -0,0 +1,88 @@
package com.hbm.blocks.machine;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ILookOverlay;
import com.hbm.blocks.ITooltipProvider;
import com.hbm.tileentity.TileEntityProxyDyn;
import com.hbm.tileentity.machine.TileEntityMachineAssemblyFactory;
import com.hbm.util.fauxpointtwelve.DirPos;
import com.hbm.util.i18n.I18nUtil;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
import net.minecraftforge.common.util.ForgeDirection;
public class MachineAssemblyFactory extends BlockDummyable implements ITooltipProvider, ILookOverlay {
public MachineAssemblyFactory(Material mat) {
super(mat);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
if(meta >= 12) return new TileEntityMachineAssemblyFactory();
if(meta >= 6) return new TileEntityProxyDyn().inventory().power().fluid();
return null;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
return this.standardOpenBehavior(world, x, y, z, player, 0);
}
@Override public int[] getDimensions() { return new int[] {2, 0, 2, 2, 2, 2}; }
@Override public int getOffset() { return 2; }
@Override
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
super.fillSpace(world, x, y, z, dir, o);
x -= dir.offsetX * 2;
z -= dir.offsetZ * 2;
for(int i = -2; i <= 2; i++) for(int j = -2; j <= 2; j++) {
if(Math.abs(i) == 2 || Math.abs(j) == 2) this.makeExtra(world, x + i, y, z + j);
}
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
for(int i = -2; i <= 2; i++) {
this.makeExtra(world, x + dir.offsetX * i + rot.offsetX * 2, y + 2, z + dir.offsetZ * i + rot.offsetZ * 2);
this.makeExtra(world, x + dir.offsetX * i - rot.offsetX * 2, y + 2, z + dir.offsetZ * i - rot.offsetZ * 2);
}
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
this.addStandardInfo(stack, player, list, ext);
}
@Override
public void printHook(Pre event, World world, int x, int y, int z) {
int[] pos = this.findCore(world, x, y, z);
if(pos == null) return;
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
if(!(te instanceof TileEntityMachineAssemblyFactory)) return;
TileEntityMachineAssemblyFactory assemfac = (TileEntityMachineAssemblyFactory) te;
DirPos[] cool = assemfac.getCoolPos();
for(DirPos dirPos : cool) if(dirPos.compare(x + dirPos.getDir().offsetX, y, z + dirPos.getDir().offsetZ)) {
List<String> text = new ArrayList();
text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + assemfac.water.getTankType().getLocalizedName());
text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + assemfac.lps.getTankType().getLocalizedName());
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
break;
}
}
}

View File

@ -13,6 +13,7 @@ import com.hbm.tileentity.network.TileEntityCableBaseNT;
import com.hbm.util.BobMathUtil; import com.hbm.util.BobMathUtil;
import com.hbm.util.i18n.I18nUtil; import com.hbm.util.i18n.I18nUtil;
import com.hbm.world.gen.nbt.INBTBlockTransformable;
import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -37,7 +38,7 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class BlockCableGauge extends BlockContainer implements IBlockMultiPass, ILookOverlay, ITooltipProvider { public class BlockCableGauge extends BlockContainer implements IBlockMultiPass, INBTBlockTransformable, ILookOverlay, ITooltipProvider {
@SideOnly(Side.CLIENT) protected IIcon overlayGauge; @SideOnly(Side.CLIENT) protected IIcon overlayGauge;
@ -84,6 +85,11 @@ public class BlockCableGauge extends BlockContainer implements IBlockMultiPass,
this.addStandardInfo(stack, player, list, ext); this.addStandardInfo(stack, player, list, ext);
} }
@Override
public int transformMeta(int meta, int coordBaseMode) {
return INBTBlockTransformable.transformMetaDeco(meta, coordBaseMode);
}
@Override @Override
public void printHook(Pre event, World world, int x, int y, int z) { public void printHook(Pre event, World world, int x, int y, int z) {
@ -178,5 +184,6 @@ public class BlockCableGauge extends BlockContainer implements IBlockMultiPass,
if((PREFIX_VALUE + "deltasecond").equals(name)) return "" + deltaLastSecond; if((PREFIX_VALUE + "deltasecond").equals(name)) return "" + deltaLastSecond;
return null; return null;
} }
} }
} }

View File

@ -13,6 +13,7 @@ import com.hbm.render.block.RenderBlockMultipass;
import com.hbm.tileentity.network.TileEntityPipeBaseNT; import com.hbm.tileentity.network.TileEntityPipeBaseNT;
import com.hbm.util.i18n.I18nUtil; import com.hbm.util.i18n.I18nUtil;
import com.hbm.world.gen.nbt.INBTBlockTransformable;
import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -37,7 +38,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, ILookOverlay, ITooltipProvider { public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, INBTBlockTransformable, ILookOverlay, ITooltipProvider {
@SideOnly(Side.CLIENT) protected IIcon overlay; @SideOnly(Side.CLIENT) protected IIcon overlay;
@SideOnly(Side.CLIENT) protected IIcon overlayGauge; @SideOnly(Side.CLIENT) protected IIcon overlayGauge;
@ -108,6 +109,11 @@ public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, IL
return IBlockMultiPass.getRenderType(); return IBlockMultiPass.getRenderType();
} }
@Override
public int transformMeta(int meta, int coordBaseMode) {
return INBTBlockTransformable.transformMetaDeco(meta, coordBaseMode);
}
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")}) @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
public static class TileEntityPipeGauge extends TileEntityPipeBaseNT implements SimpleComponent, CompatHandler.OCComponent, IRORValueProvider { public static class TileEntityPipeGauge extends TileEntityPipeBaseNT implements SimpleComponent, CompatHandler.OCComponent, IRORValueProvider {

View File

@ -17,6 +17,50 @@ public class StructureConfig {
public static boolean debugStructures = false; public static boolean debugStructures = false;
public static boolean enableRuins = true;
public static boolean enableOceanStructures = true;
public static int ruinsASpawnWeight = 10;
public static int ruinsBSpawnWeight = 12;
public static int ruinsCSpawnWeight = 12;
public static int ruinsDSpawnWeight = 12;
public static int ruinsESpawnWeight = 12;
public static int ruinsFSpawnWeight = 12;
public static int ruinsGSpawnWeight = 12;
public static int ruinsHSpawnWeight = 12;
public static int ruinsISpawnWeight = 12;
public static int ruinsJSpawnWeight = 12; // Total 120 (used to be 220)
public static int plane1SpawnWeight = 25;
public static int plane2SpawnWeight = 25;
public static int desertShack1SpawnWeight = 18;
public static int desertShack2SpawnWeight = 20;
public static int desertShack3SpawnWeight = 22;
public static int laboratorySpawnWeight = 20;
public static int lighthouseSpawnWeight = 4;
public static int oilRigSpawnWeight = 5;
public static int beachedPatrolSpawnWeight = 15;
public static int vertibirdSpawnWeight = 6;
public static int vertibirdCrashedSpawnWeight = 10;
public static int factorySpawnWeight = 40;
public static int radioSpawnWeight = 30;
public static int forestChemSpawnWeight = 30;
public static int forestPostSpawnWeight = 30;
public static int spireSpawnWeight = 2;
public static int bunkerSpawnWeight = 6;
public static int dishSpawnWeight = 20;
public static int featuresSpawnWeight = 50;
public static int aircraftCarrierSpawnWeight = 3;
// --- Null weights
public static int plainsNullWeight = 4;
public static int oceanNullWeight = 15;
public static void loadFromConfig(Configuration config) { public static void loadFromConfig(Configuration config) {
final String CATEGORY_STRUCTURES = CommonConfig.CATEGORY_STRUCTURES; final String CATEGORY_STRUCTURES = CommonConfig.CATEGORY_STRUCTURES;
@ -32,6 +76,44 @@ public class StructureConfig {
debugStructures = CommonConfig.createConfigBool(config, CATEGORY_STRUCTURES, "5.04_debugStructures", "If enabled, special structure blocks like jigsaw blocks will not be transformed after generating", false); debugStructures = CommonConfig.createConfigBool(config, CATEGORY_STRUCTURES, "5.04_debugStructures", "If enabled, special structure blocks like jigsaw blocks will not be transformed after generating", false);
enableRuins = CommonConfig.createConfigBool(config, CATEGORY_STRUCTURES, "5.05_enableRuins", "Toggle for all ruin structures (A through J)", true);
enableOceanStructures = CommonConfig.createConfigBool(config, CATEGORY_STRUCTURES, "5.06_enableOceanStructures", "Toggle for ocean structures. (Aircraft carrier, oil rig, lighthouse.)", true);
spireSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.07_spireSpawnWeight", "Spawn weight for spire structure.", 2);
featuresSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.08_featuresSpawnWeight", "Spawn weight for misc structures (ex. Houses, offices.)", 50);
bunkerSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.09_bunkerSpawnWeight", "Spawn weight for bunker structure.", 6);
vertibirdSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.10_vertibirdSpawnWeight", "Spawn weight for vertibird structure.", 6);
vertibirdCrashedSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.11_crashedVertibirdSpawnWeight", "Spawn weight for crashed vertibird structure.", 10);
aircraftCarrierSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.12_aircraftCarrierSpawnWeight", "Spawn weight for aircraft carrier structure.", 3);
oilRigSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.13_oilRigSpawnWeight", "Spawn weight for oil rig structure.", 5);
lighthouseSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.14_lighthouseSpawnWeight", "Spawn weight for lighthouse structure.", 1);
beachedPatrolSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.15_beachedPatrolSpawnWeight", "Spawn weight for beached patrol structure.", 15);
dishSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.16_dishSpawnWeight", "Spawn weight for dish structures.", 10);
forestChemSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.17_forestChemSpawnWeight", "Spawn weight for forest chemical plant structure.", 30);
plane1SpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.18_plane1SpawnWeight", "Spawn weight for crashed plane 1 structure.", 25);
plane2SpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.19_plane2SpawnWeight", "Spawn weight for crashed plane 2 structure.", 25);
desertShack1SpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.20_desertShack1SpawnWeight", "Spawn weight for desert shack 1 structure.", 18);
desertShack2SpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.21_desertShack2SpawnWeight", "Spawn weight for desert shack 2 structure.", 20);
desertShack3SpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.22_desertShack3SpawnWeight", "Spawn weight for desert shack 3 structure.", 22);
laboratorySpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.23_laboratorySpawnWeight", "Spawn weight for laboratory structure/", 20);
forestPostSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.24_forestPostSpawnWeight", "Spawn weight for forest post structure.", 30);
ruinsASpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.25_ruinASpawnWeight", "Spawn weight for ruin A structure.", 10);
ruinsBSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.26_ruinBSpawnWeight", "Spawn weight for ruin B structure.", 12);
ruinsCSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.27_ruinCSpawnWeight", "Spawn weight for ruin C structure.", 12);
ruinsDSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.28_ruinDSpawnWeight", "Spawn weight for ruin D structure.", 12);
ruinsESpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.29_ruinESpawnWeight", "Spawn weight for ruin E structure.", 12);
ruinsFSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.30_ruinFSpawnWeight", "Spawn weight for ruin F structure.", 12);
ruinsGSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.31_ruinGSpawnWeight", "Spawn weight for ruin G structure.", 12);
ruinsHSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.32_ruinHSpawnWeight", "Spawn weight for ruin H structure.", 12);
ruinsISpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.33_ruinISpawnWeight", "Spawn weight for ruin I structure.", 12);
ruinsJSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.34_ruinJSpawnWeight", "Spawn weight for ruin J structure.", 12);
radioSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.35_radioSpawnWeight", "Spawn weight for radio structure.", 25);
factorySpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.36_factorySpawnWeight", "Spawn weight for factory structure.", 40);
plainsNullWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.37_plainsNullWeight", "Null spawn weight for plains biome", 20);
oceanNullWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.38_oceanNullWeight", "Null spawn weight for ocean biomes", 35);
structureMinChunks = CommonConfig.setDef(structureMinChunks, 4); structureMinChunks = CommonConfig.setDef(structureMinChunks, 4);
structureMaxChunks = CommonConfig.setDef(structureMaxChunks, 12); structureMaxChunks = CommonConfig.setDef(structureMaxChunks, 12);

View File

@ -87,7 +87,7 @@ public class WorldConfig {
public static int dungeonStructure = 64; public static int dungeonStructure = 64;
public static int relayStructure = 500; public static int relayStructure = 500;
public static int satelliteStructure = 500; public static int satelliteStructure = 500;
public static int factoryStructure = 1000; // public static int factoryStructure = 1000;
public static int dudStructure = 500; public static int dudStructure = 500;
public static int spaceshipStructure = 1000; public static int spaceshipStructure = 1000;
public static int barrelStructure = 5000; public static int barrelStructure = 5000;
@ -210,7 +210,7 @@ public class WorldConfig {
dungeonStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.04_dungeonSpawn", "Spawn library dungeon on every nTH chunk", 64); dungeonStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.04_dungeonSpawn", "Spawn library dungeon on every nTH chunk", 64);
relayStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.05_relaySpawn", "Spawn relay on every nTH chunk", 500); relayStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.05_relaySpawn", "Spawn relay on every nTH chunk", 500);
satelliteStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.06_satelliteSpawn", "Spawn satellite dish on every nTH chunk", 500); satelliteStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.06_satelliteSpawn", "Spawn satellite dish on every nTH chunk", 500);
factoryStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.09_factorySpawn", "Spawn factory on every nTH chunk", 1000); // factoryStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.09_factorySpawn", "Spawn factory on every nTH chunk", 1000);
dudStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.10_dudSpawn", "Spawn dud on every nTH chunk", 500); dudStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.10_dudSpawn", "Spawn dud on every nTH chunk", 500);
spaceshipStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.11_spaceshipSpawn", "Spawn spaceship on every nTH chunk", 1000); spaceshipStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.11_spaceshipSpawn", "Spawn spaceship on every nTH chunk", 1000);
barrelStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.12_barrelSpawn", "Spawn waste tank on every nTH chunk", 5000); barrelStructure = CommonConfig.createConfigInt(config, CATEGORY_DUNGEON, "4.12_barrelSpawn", "Spawn waste tank on every nTH chunk", 5000);
@ -251,7 +251,7 @@ public class WorldConfig {
dungeonStructure = CommonConfig.setDefZero(dungeonStructure, 1000); dungeonStructure = CommonConfig.setDefZero(dungeonStructure, 1000);
relayStructure = CommonConfig.setDefZero(relayStructure, 1000); relayStructure = CommonConfig.setDefZero(relayStructure, 1000);
satelliteStructure = CommonConfig.setDefZero(satelliteStructure, 1000); satelliteStructure = CommonConfig.setDefZero(satelliteStructure, 1000);
factoryStructure = CommonConfig.setDefZero(factoryStructure, 1000); // factoryStructure = CommonConfig.setDefZero(factoryStructure, 1000);
dudStructure = CommonConfig.setDefZero(dudStructure, 1000); dudStructure = CommonConfig.setDefZero(dudStructure, 1000);
spaceshipStructure = CommonConfig.setDefZero(spaceshipStructure, 1000); spaceshipStructure = CommonConfig.setDefZero(spaceshipStructure, 1000);
barrelStructure = CommonConfig.setDefZero(barrelStructure, 1000); barrelStructure = CommonConfig.setDefZero(barrelStructure, 1000);

View File

@ -25,7 +25,6 @@ import com.hbm.entity.train.*;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.util.Tuple.Quartet; import com.hbm.util.Tuple.Quartet;
import cpw.mods.fml.common.registry.EntityRegistry;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.EnumCreatureType;
@ -253,36 +252,36 @@ public class EntityMappings {
addSpawn(EntityCreeperGold.class, 1, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray()); addSpawn(EntityCreeperGold.class, 1, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray());
addSpawn(EntityPlasticBag.class, 1, 1, 3, EnumCreatureType.waterCreature, BiomeDictionary.getBiomesForType(Type.OCEAN)); addSpawn(EntityPlasticBag.class, 1, 1, 3, EnumCreatureType.waterCreature, BiomeDictionary.getBiomesForType(Type.OCEAN));
addSpawn(EntityPigeon.class, 1, 5, 10, EnumCreatureType.creature, BiomeDictionary.getBiomesForType(Type.PLAINS)); addSpawn(EntityPigeon.class, 1, 5, 10, EnumCreatureType.creature, BiomeDictionary.getBiomesForType(Type.PLAINS));
int id = 0; int id = 0;
for(Quartet<Class<? extends Entity>, String, Integer, Boolean> entry : entityMappings) { for(Quartet<Class<? extends Entity>, String, Integer, Boolean> entry : entityMappings) {
EntityRegistry.registerModEntity(entry.getW(), entry.getX(), id++, MainRegistry.instance, entry.getY(), 1, entry.getZ()); ModEntityList.registerEntity(entry.getW(), entry.getX(), id++, MainRegistry.instance, entry.getY(), 1, entry.getZ());
} }
for(Quartet<Class<? extends Entity>, String, Integer, Integer> entry : mobMappings) { for(Quartet<Class<? extends Entity>, String, Integer, Integer> entry : mobMappings) {
EntityRegistry.registerGlobalEntityID(entry.getW(), entry.getX(), EntityRegistry.findGlobalUniqueEntityId(), entry.getY(), entry.getZ()); ModEntityList.registerEntity(entry.getW(), entry.getX(), id++, MainRegistry.instance, entry.getY(), entry.getZ());
} }
} }
private static void addEntity(Class<? extends Entity> clazz, String name, int trackingRange) { private static void addEntity(Class<? extends Entity> clazz, String name, int trackingRange) {
addEntity(clazz, name, trackingRange, true); addEntity(clazz, name, trackingRange, true);
} }
private static void addEntity(Class<? extends Entity> clazz, String name, int trackingRange, boolean velocityUpdates) { private static void addEntity(Class<? extends Entity> clazz, String name, int trackingRange, boolean velocityUpdates) {
entityMappings.add(new Quartet(clazz, name, trackingRange, velocityUpdates)); entityMappings.add(new Quartet(clazz, name, trackingRange, velocityUpdates));
} }
private static void addMob(Class<? extends Entity> clazz, String name, int color1, int color2) { private static void addMob(Class<? extends Entity> clazz, String name, int color1, int color2) {
mobMappings.add(new Quartet(clazz, name, color1, color2)); mobMappings.add(new Quartet(clazz, name, color1, color2));
} }
public static void addSpawn(Class<? extends EntityLiving> entityClass, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, BiomeGenBase... biomes) { public static void addSpawn(Class<? extends EntityLiving> entityClass, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, BiomeGenBase... biomes) {
for(BiomeGenBase biome : biomes) { for(BiomeGenBase biome : biomes) {
if(biome == null) continue; if(biome == null) continue;
if(biome instanceof BiomeGenMushroomIsland) continue; if(biome instanceof BiomeGenMushroomIsland) continue;
List<SpawnListEntry> spawns = biome.getSpawnableList(typeOfCreature); List<SpawnListEntry> spawns = biome.getSpawnableList(typeOfCreature);
for(SpawnListEntry entry : spawns) { for(SpawnListEntry entry : spawns) {

View File

@ -0,0 +1,149 @@
package com.hbm.entity;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import com.hbm.lib.RefStrings;
import cpw.mods.fml.common.registry.EntityRegistry;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityList.EntityEggInfo;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class ModEntityList {
private static EntityData[] array = new EntityData[0];
private static final Map<Integer, Class<? extends Entity>> map = new HashMap<Integer, Class<? extends Entity>>();
public static List<Integer> eggIdList = new ArrayList<Integer>();
public static Map<Class<? extends Entity>, Integer> eggIdMap = new HashMap<Class<? extends Entity>, Integer>();
public static void registerEntity(Class<? extends Entity> entityClass, String entityName, int id, Object mod) {
registerEntity(entityClass, entityName, id, mod, 80, 3, true, -1, -1, false);
}
public static void registerEntity(Class<? extends Entity> entityClass, String entityName, int id, Object mod, int eggColor1, int eggColor2) {
registerEntity(entityClass, entityName, id, mod, 80, 3, true, eggColor1, eggColor2, true);
}
public static void registerEntity(Class<? extends Entity> entityClass, String entityName, int id, Object mod, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates) {
registerEntity(entityClass, entityName, id, mod, trackingRange, updateFrequency, sendsVelocityUpdates, -1, -1, false);
}
public static void registerEntity(Class<? extends Entity> entityClass, String entityName, int id, Object mod, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates, int eggColor1, int eggColor2) {
registerEntity(entityClass, entityName, id, mod, trackingRange, updateFrequency, sendsVelocityUpdates, eggColor1, eggColor2, true);
}
private static void registerEntity(Class<? extends Entity> entityClass, String entityName, int id, Object mod, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates, int eggColor1, int eggColor2, boolean hasEgg) {
EntityRegistry.registerModEntity(entityClass, entityName, id, mod, trackingRange, updateFrequency, sendsVelocityUpdates);
if(id >= array.length) {
EntityData[] newArray = new EntityData[id + 5];
System.arraycopy(array, 0, newArray, 0, array.length);
array = newArray;
}
if(array[id] != null)
throw new IllegalArgumentException("ID " + id + " is already being used! Please report this error!");
array[id] = new EntityData(entityName, id, eggColor1, eggColor2, hasEgg);
map.put(id, entityClass);
if(eggColor1 != -1)
registerEntityEgg(entityClass, eggColor1, eggColor2);
}
public static String getName(int id) {
EntityData data = getData(id);
if(data == null)
return null;
return RefStrings.MODID + "." + data.name;
}
public static EntityData getData(int id) {
if(id >= array.length)
return null;
return array[id];
}
public static boolean hasEntitiesWithEggs() {
for(EntityData data : array) {
if(data != null && data.hasEgg) return true;
}
return false;
}
public static Entity createEntityByID(int id, World world) {
EntityData data = getData(id);
if(data == null || !data.hasEgg)
return null;
try {
Class<? extends Entity> cls = map.get(id);
if(cls != null)
return cls.getConstructor(World.class).newInstance(world);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static EntityData[] getDatasWithEggs() {
List<EntityData> list = new LinkedList<EntityData>();
for(Integer id : map.keySet()) {
EntityData data = getData(id);
if(data != null && data.hasEgg)
list.add(data);
}
return list.toArray(new EntityData[list.size()]);
}
public static int eggIDCounter = 499;
@SuppressWarnings("unchecked")
public static void registerEntityEgg(Class<? extends Entity> entity, int primaryColor, int secondaryColor) {
int id = getUniqueEntityEggId();
EntityList.IDtoClassMapping.put(id, entity);
EntityList.entityEggs.put(id, new EntityEggInfo(id, primaryColor, secondaryColor));
eggIdMap.put(entity, id);
}
public static ItemStack getEggFromEntity(Entity entity) {
return new ItemStack(Items.spawn_egg, 1, eggIdMap.get(entity.getClass()));
}
public static int getUniqueEntityEggId() {
while(EntityList.getClassFromID(++eggIDCounter) != null) {}
eggIdList.add(eggIDCounter);
return eggIDCounter;
}
public static class EntityData {
public final String name;
public final int id, eggColor1, eggColor2;
public final boolean hasEgg;
EntityData(String name, int id, int eggColor1, int eggColor2, boolean hasEgg) {
this.name = name;
this.id = id;
this.eggColor1 = eggColor1;
this.eggColor2 = eggColor2;
this.hasEgg = hasEgg;
}
}
}

View File

@ -1,123 +0,0 @@
package com.hbm.handler;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.function.Consumer;
import com.hbm.items.weapon.sedna.Crosshair;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.util.ResourceLocation;
@Deprecated
public class GunConfiguration implements Cloneable {
/**
* alt function restrictions:
* alt can not be reloaded (reload type of 0, ammo cap of 0)
* alt cooldown and main cooldown are shared (alt cooldown will almoast always be greater or equal)
* alt is always the lower priority, mouse2 will be canceled then mouse1 is activated at the same time
* restrictions must be applied in gun's logic, mechanism may be dysfunctional if these rules are ignored
*/
//amount of ticks between each bullet
public int rateOfFire;
//amount of bullets fired per delay passed
public int roundsPerCycle;
/** Amount of rounds per burst, irrelevant if not a burst fire weapon**/
public int roundsPerBurst;
//0 = normal, 1 = release, 2 = both
public int gunMode;
//0 = manual, 1 = automatic
public int firingMode;
//weapon won't fire after weapon breaks (main only)
public int durability;
//animations!
public HashMap<AnimType, BusAnimation> animations = new HashMap<AnimType, BusAnimation>();
//lazy-ish loading for animations, required for loading animations from ResourceManager, since that occurs after we've initialised the guns
public Consumer<Void> loadAnimations;
public boolean animationsLoaded = false;
//when sneaking, disables crosshair and centers the bullet spawn point
public boolean hasSights;
//does this weapon behave like fully sick old-school boomer shooters
public boolean isCentered;
//texture overlay when sneaking
public ResourceLocation scopeTexture;
//duration of every animation cycle, used also for how quickly a burst fire rifle can fire
public int firingDuration;
//sound path to the shooting sound
public String firingSound = "";
public String firingSoundEmpty = null;
public float firingVolume = 1.0F;
public float firingPitch = 1.0F;
//how long the reload animation will play
//MUST BE GREATER THAN ZERO ! ! !
public int reloadDuration;
public int emptyReloadAdditionalDuration;
//sound path to the reload sound
public String reloadSound = "";
public String reloadSoundEmpty = null;
//whether the reload sound should be played at the beginning or at the end of the reload
public boolean reloadSoundEnd = true;
public String equipSound = "";
//how much ammo the clip can hold, 0 if drawn from inventory
public int ammoCap;
//0 does not allow direct reload, 1 is full clip, 2 is single bullet
public int reloadType;
// If the animations are designed to be sequential, the last frame will be held until the next anmiation starts
public boolean reloadAnimationsSequential = false;
//whether or not the infinity enchantment should work
public boolean allowsInfinity;
//whether the ammo count should be displayed
public boolean showAmmo = true;
//for electrically powered weapons:
//the Maximum capacity of the gun
public long maxCharge;
//the rate at which the gun is charged
public long chargeRate;
//how much energy is discharged per shot
public long dischargePerShot;
public String name = "";
public EnumGunManufacturer manufacturer = EnumGunManufacturer.NONE;
public List<String> comment = new ArrayList<String>();
//bullet configs for main and alt fire
public List<Integer> config = new ArrayList<Integer>();
//crosshair
public Crosshair crosshair;
//casing eject behavior
public CasingEjector ejector = null;
public static final int MODE_NORMAL = 0;
public static final int MODE_RELEASE = 1;
public static final int MODE_BOTH = 1;
public static final int FIRE_MANUAL = 0;
public static final int FIRE_AUTO = 1;
public static final int FIRE_BURST = 2;
public static final int RELOAD_NONE = 0;
public static final int RELOAD_FULL = 1;
public static final int RELOAD_SINGLE = 2;
public static final String RSOUND_REVOLVER = "hbm:weapon.revolverReload";
public static final String RSOUND_RIFLE = "";
public static final String RSOUND_MAG = "hbm:weapon.magReload";
public static final String RSOUND_MAG_BOLT = "hbm:weapon.magReloadBolt";
public static final String RSOUND_SHOTGUN = "hbm:weapon.shotgunReload";
public static final String RSOUND_LAUNCHER = "hbm:weapon.rpgReload";
public static final String RSOUND_GRENADE = "hbm:weapon.hkReload";
public static final String RSOUND_GRENADE_NEW = "hbm:weapon.glReload";
public static final String RSOUND_FATMAN = "hbm:weapon.fatmanReload";
}

View File

@ -3,10 +3,15 @@ package com.hbm.handler.nei;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.recipes.CompressorRecipes; import com.hbm.inventory.recipes.CompressorRecipes;
import net.minecraft.item.ItemStack;
public class CompressorHandler extends NEIUniversalHandler { public class CompressorHandler extends NEIUniversalHandler {
public CompressorHandler() { public CompressorHandler() {
super(ModBlocks.machine_compressor.getLocalizedName(), ModBlocks.machine_compressor, CompressorRecipes.getRecipes()); super(ModBlocks.machine_compressor.getLocalizedName(), new ItemStack[] {
new ItemStack(ModBlocks.machine_compressor),
new ItemStack(ModBlocks.machine_compressor_compact),
}, CompressorRecipes.getRecipes());
} }
@Override @Override

View File

@ -0,0 +1,86 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotCraftingOutput;
import com.hbm.inventory.SlotNonRetarded;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemBlueprints;
import com.hbm.items.machine.ItemMachineUpgrade;
import com.hbm.util.InventoryUtil;
import api.hbm.energymk2.IBatteryItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerMachineAssemblyFactory extends ContainerBase {
public ContainerMachineAssemblyFactory(InventoryPlayer invPlayer, IInventory assemFac) {
super(invPlayer, assemFac);
// Battery
this.addSlotToContainer(new SlotNonRetarded(assemFac, 0, 234, 112));
// Upgrades
this.addSlots(assemFac, 1, 214, 149, 3, 1);
for(int i = 0; i < 4; i++) {
// Template
this.addSlots(assemFac, 4 + i * 14, 25 + (i % 2) * 109, 54 + (i / 2) * 56, 1, 1);
// Solid Input
this.addSlots(assemFac, 5 + i * 14, 7 + (i % 2) * 109, 20 + (i / 2) * 56, 2, 6, 16);
// Solid Output
this.addOutputSlots(invPlayer.player, assemFac, 17 + i * 14, 87 + (i % 2) * 109, 54 + (i / 2) * 56, 1, 1);
}
this.playerInv(invPlayer, 33, 158);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
ItemStack slotOriginal = null;
Slot slot = (Slot) this.inventorySlots.get(index);
if(slot != null && slot.getHasStack()) {
ItemStack slotStack = slot.getStack();
slotOriginal = slotStack.copy();
if(index <= tile.getSizeInventory() - 1) {
SlotCraftingOutput.checkAchievements(player, slotStack);
if(!this.mergeItemStack(slotStack, tile.getSizeInventory(), this.inventorySlots.size(), true)) {
return null;
}
} else {
if(slotOriginal.getItem() instanceof IBatteryItem || slotOriginal.getItem() == ModItems.battery_creative) {
if(!this.mergeItemStack(slotStack, 0, 1, false)) return null;
} else if(slotOriginal.getItem() instanceof ItemBlueprints) {
if(!this.mergeItemStack(slotStack, 4, 5, false)) return null;
} else if(slotOriginal.getItem() instanceof ItemBlueprints) {
if(!this.mergeItemStack(slotStack, 18, 19, false)) return null;
} else if(slotOriginal.getItem() instanceof ItemBlueprints) {
if(!this.mergeItemStack(slotStack, 32, 33, false)) return null;
} else if(slotOriginal.getItem() instanceof ItemBlueprints) {
if(!this.mergeItemStack(slotStack, 44, 45, false)) return null;
} else if(slotOriginal.getItem() instanceof ItemMachineUpgrade) {
if(!this.mergeItemStack(slotStack, 1, 4, false)) return null;
} else {
if(!InventoryUtil.mergeItemStack(this.inventorySlots, slotStack, 5, 17, false) &&
!InventoryUtil.mergeItemStack(this.inventorySlots, slotStack, 19, 31, false) &&
!InventoryUtil.mergeItemStack(this.inventorySlots, slotStack, 33, 46, false) &&
!InventoryUtil.mergeItemStack(this.inventorySlots, slotStack, 47, 59, false)) return null;
}
}
if(slotStack.stackSize == 0) {
slot.putStack(null);
} else {
slot.onSlotChanged();
}
slot.onPickupFromSlot(player, slotStack);
}
return slotOriginal;
}
}

View File

@ -1,6 +1,6 @@
package com.hbm.inventory.container; package com.hbm.inventory.container;
import com.hbm.inventory.SlotTakeOnly; import com.hbm.inventory.SlotCraftingOutput;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.tileentity.machine.albion.TileEntityPADetector; import com.hbm.tileentity.machine.albion.TileEntityPADetector;
@ -24,8 +24,8 @@ public class ContainerPADetector extends Container {
this.addSlotToContainer(new Slot(tile, 1, 62, 18)); this.addSlotToContainer(new Slot(tile, 1, 62, 18));
this.addSlotToContainer(new Slot(tile, 2, 80, 18)); this.addSlotToContainer(new Slot(tile, 2, 80, 18));
//Outputs //Outputs
this.addSlotToContainer(new SlotTakeOnly(tile, 3, 62, 45)); this.addSlotToContainer(new SlotCraftingOutput(playerInv.player, tile, 3, 62, 45));
this.addSlotToContainer(new SlotTakeOnly(tile, 4, 80, 45)); this.addSlotToContainer(new SlotCraftingOutput(playerInv.player, tile, 4, 80, 45));
for(int i = 0; i < 3; i++) { for(int i = 0; i < 3; i++) {
for(int j = 0; j < 9; j++) { for(int j = 0; j < 9; j++) {

View File

@ -0,0 +1,140 @@
package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerMachineAssemblyFactory;
import com.hbm.inventory.recipes.AssemblyMachineRecipes;
import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.items.machine.ItemBlueprints;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityMachineAssemblyFactory;
import com.hbm.util.i18n.I18nUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
public class GUIMachineAssemblyFactory extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_assembly_factory.png");
private TileEntityMachineAssemblyFactory assembler;
public GUIMachineAssemblyFactory(InventoryPlayer invPlayer, TileEntityMachineAssemblyFactory tedf) {
super(new ContainerMachineAssemblyFactory(invPlayer, tedf));
assembler = tedf;
this.xSize = 256;
this.ySize = 240;
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
for(int j = 0; j < 4; j++) {
assembler.inputTanks[j].renderTankInfo(this, mouseX, mouseY, guiLeft + 105 + (j % 2) * 109, guiTop + 20 + (j / 2) * 56, 5, 32);
assembler.outputTanks[j].renderTankInfo(this, mouseX, mouseY, guiLeft + 105 + (j % 2) * 109, guiTop + 54 + (j / 2) * 56, 5, 16);
}
assembler.water.renderTankInfo(this, mouseX, mouseY, guiLeft + 232, guiTop + 149, 7, 52);
assembler.lps.renderTankInfo(this, mouseX, mouseY, guiLeft + 241, guiTop + 149, 7, 52);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 234, guiTop + 18, 16, 92, assembler.power, assembler.maxPower);
for(int i = 0; i < 4; i++) if(guiLeft + 6 + (i % 2) * 109 <= mouseX && guiLeft + 6 + (i % 2) * 109 + 18 > mouseX && guiTop + 53 + (i / 2) * 56 < mouseY && guiTop + 53 + (i / 2) * 56 + 18 >= mouseY) {
if(this.assembler.assemblerModule[i].recipe != null && AssemblyMachineRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule[i].recipe)) {
GenericRecipe recipe = (GenericRecipe) AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(this.assembler.assemblerModule[i].recipe);
this.func_146283_a(recipe.print(), mouseX, mouseY);
} else {
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
}
}
}
@Override
protected void mouseClicked(int x, int y, int button) {
super.mouseClicked(x, y, button);
for(int i = 0; i < 4; i++) if(this.checkClick(x, y, 6 + (i % 2) * 109, 53 + (i / 2) * 56, 18, 18)) GUIScreenRecipeSelector.openSelector(AssemblyMachineRecipes.INSTANCE, assembler, assembler.assemblerModule[i].recipe, i, ItemBlueprints.grabPool(assembler.slots[4 + i * 14]), this);
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.assembler.hasCustomInventoryName() ? this.assembler.getInventoryName() : I18n.format(this.assembler.getInventoryName());
this.fontRendererObj.drawString(name, 113 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 33, this.ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 256, 140);
drawTexturedModalRect(guiLeft + 25, guiTop + 140, 25, 140, 231, 100);
int p = (int) (assembler.power * 92 / assembler.maxPower);
drawTexturedModalRect(guiLeft + 234, guiTop + 110 - p, 0, 232 - p, 16, p);
for(int i = 0; i < 4; i++) if(assembler.assemblerModule[i].progress > 0) {
int j = (int) Math.ceil(37 * assembler.assemblerModule[i].progress);
drawTexturedModalRect(guiLeft + 45 + (i % 2) * 109, guiTop + 63 + (i / 2) * 56, 0, 240, j, 6);
}
for(int g = 0; g < 4; g++) {
GenericRecipe recipe = AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(assembler.assemblerModule[g].recipe);
/// LEFT LED
if(assembler.didProcess[g]) {
drawTexturedModalRect(guiLeft + 45 + (g % 2) * 109, guiTop + 55 + (g / 2) * 56, 4, 236, 4, 4);
} else if(recipe != null) {
drawTexturedModalRect(guiLeft + 45 + (g % 2) * 109, guiTop + 55 + (g / 2) * 56, 0, 236, 4, 4);
}
/// RIGHT LED
if(assembler.didProcess[g]) {
drawTexturedModalRect(guiLeft + 53 + (g % 2) * 109, guiTop + 55 + (g / 2) * 56, 4, 236, 4, 4);
} else if(recipe != null && assembler.power >= recipe.power && assembler.canCool()) {
drawTexturedModalRect(guiLeft + 53 + (g % 2) * 109, guiTop + 55 + (g / 2) * 56, 0, 236, 4, 4);
}
}
for(int g = 0; g < 4; g++) {
GenericRecipe recipe = AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(assembler.assemblerModule[g].recipe);
this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 7 + (g % 2) * 109, 54 + (g / 2) * 56);
if(recipe != null && recipe.inputItem != null) {
for(int i = 0; i < recipe.inputItem.length; i++) {
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(assembler.assemblerModule[g].inputSlots[i]);
if(!slot.getHasStack()) this.renderItem(recipe.inputItem[i].extractForCyclingDisplay(20), slot.xDisplayPosition, slot.yDisplayPosition, 10F);
}
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glColor4f(1F, 1F, 1F, 0.5F);
GL11.glEnable(GL11.GL_BLEND);
this.zLevel = 300F;
for(int i = 0; i < recipe.inputItem.length; i++) {
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(assembler.assemblerModule[g].inputSlots[i]);
if(!slot.getHasStack()) drawTexturedModalRect(guiLeft + slot.xDisplayPosition, guiTop + slot.yDisplayPosition, slot.xDisplayPosition, slot.yDisplayPosition, 16, 16);
}
this.zLevel = 0F;
GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glDisable(GL11.GL_BLEND);
}
}
for(int j = 0; j < 4; j++) {
assembler.inputTanks[j].renderTank(guiLeft + 105 + (j % 2) * 109, guiTop + 52 + (j / 2) * 56, this.zLevel, 5, 32);
assembler.outputTanks[j].renderTank(guiLeft + 105 + (j % 2) * 109, guiTop + 70 + (j / 2) * 56, this.zLevel, 5, 16);
}
assembler.water.renderTank(guiLeft + 232, guiTop + 201, this.zLevel, 7, 52);
assembler.lps.renderTank(guiLeft + 241, guiTop + 201, this.zLevel, 7, 52);
}
}

View File

@ -8,6 +8,7 @@ import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.items.machine.ItemBlueprints; import com.hbm.items.machine.ItemBlueprints;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityMachineChemicalFactory; import com.hbm.tileentity.machine.TileEntityMachineChemicalFactory;
import com.hbm.util.i18n.I18nUtil;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.OpenGlHelper;
@ -49,7 +50,7 @@ public class GUIMachineChemicalFactory extends GuiInfoContainer {
GenericRecipe recipe = (GenericRecipe) ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(this.chemplant.chemplantModule[i].recipe); GenericRecipe recipe = (GenericRecipe) ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(this.chemplant.chemplantModule[i].recipe);
this.func_146283_a(recipe.print(), mouseX, mouseY); this.func_146283_a(recipe.print(), mouseX, mouseY);
} else { } else {
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + "Click to set recipe", mouseX, mouseY); this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
} }
} }
} }

View File

@ -27,6 +27,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
public class GUIScreenRecipeSelector extends GuiScreen { public class GUIScreenRecipeSelector extends GuiScreen {
@ -325,7 +326,16 @@ public class GUIScreenRecipeSelector extends GuiScreen {
search(this.search.getText()); search(this.search.getText());
return; return;
} }
if(keyCode == Keyboard.KEY_UP) pageIndex--;
if(keyCode == Keyboard.KEY_DOWN) pageIndex++;
if(keyCode == Keyboard.KEY_PRIOR) pageIndex -= 5;
if(keyCode == Keyboard.KEY_NEXT) pageIndex += 5;
if(keyCode == Keyboard.KEY_HOME) pageIndex = 0;
if(keyCode == Keyboard.KEY_END) pageIndex = size;
pageIndex = MathHelper.clamp_int(pageIndex, 0, size);
if(keyCode == 1 || keyCode == this.mc.gameSettings.keyBindInventory.getKeyCode()) { if(keyCode == 1 || keyCode == this.mc.gameSettings.keyBindInventory.getKeyCode()) {
FMLCommonHandler.instance().showGuiScreen(previousScreen); FMLCommonHandler.instance().showGuiScreen(previousScreen);
} }

View File

@ -793,29 +793,6 @@ import net.minecraft.item.ItemStack;
new ComparableStack(ModItems.circuit, 16, EnumCircuitType.CAPACITOR_BOARD) new ComparableStack(ModItems.circuit, 16, EnumCircuitType.CAPACITOR_BOARD)
}, 100); }, 100);
makeRecipe(new ComparableStack(ModBlocks.machine_assemfac, 1), new AStack[] {
!exp ? new OreDictStack(STEEL.ingot(), 48) : new OreDictStack(STEEL.heavyComp(), 2),
new OreDictStack(ANY_RESISTANTALLOY.ingot(), 8),
new OreDictStack(B.ingot(), 4),
new OreDictStack(RUBBER.ingot(), 16),
new OreDictStack(KEY_ANYPANE, 64),
new ComparableStack(ModItems.motor, 18),
new OreDictStack(W.bolt(), 16),
new OreDictStack(STEEL.pipe(), 8),
new ComparableStack(ModItems.circuit, 16, EnumCircuitType.BASIC)
}, 400);
makeRecipe(new ComparableStack(ModBlocks.machine_chemical_factory, 1), new AStack[] {
new OreDictStack(DURA.ingot(), 16),
new OreDictStack(ANY_RESISTANTALLOY.ingot(), 8),
new OreDictStack(RUBBER.ingot(), 16),
new OreDictStack(STEEL.shell(), 12),
new OreDictStack(CU.pipe(), 8),
new ComparableStack(ModItems.motor_desh, 4),
new ComparableStack(ModItems.coil_tungsten, 16),
new ComparableStack(ModItems.circuit, 16, EnumCircuitType.BASIC)
}, 400);
makeRecipe(new ComparableStack(ModItems.missile_shuttle, 1), new AStack[] { makeRecipe(new ComparableStack(ModItems.missile_shuttle, 1), new AStack[] {
new ComparableStack(ModItems.missile_generic, 2), new ComparableStack(ModItems.missile_generic, 2),
new ComparableStack(ModItems.missile_strong, 1), new ComparableStack(ModItems.missile_strong, 1),

View File

@ -216,6 +216,8 @@ public class AssemblyMachineRecipes extends GenericRecipes<GenericRecipe> {
this.register(new GenericRecipe("ass.shredder").setup(100, 100).outputItems(new ItemStack(ModBlocks.machine_shredder, 1)) this.register(new GenericRecipe("ass.shredder").setup(100, 100).outputItems(new ItemStack(ModBlocks.machine_shredder, 1))
.inputItems(new OreDictStack(STEEL.plate528(), 8), new OreDictStack(CU.plate(), 4), new ComparableStack(ModItems.motor, 2)) .inputItems(new OreDictStack(STEEL.plate528(), 8), new OreDictStack(CU.plate(), 4), new ComparableStack(ModItems.motor, 2))
.inputItemsEx(new ComparableStack(ModItems.item_expensive, 1, EnumExpensiveType.STEEL_PLATING), new OreDictStack(CU.plate(), 4), new ComparableStack(ModItems.motor, 2))); .inputItemsEx(new ComparableStack(ModItems.item_expensive, 1, EnumExpensiveType.STEEL_PLATING), new OreDictStack(CU.plate(), 4), new ComparableStack(ModItems.motor, 2)));
this.register(new GenericRecipe("ass.assembler").setup(200, 100).outputItems(new ItemStack(ModBlocks.machine_assembly_machine, 1))
.inputItems(new OreDictStack(STEEL.ingot(), 4), new OreDictStack(CU.plate(), 4), new ComparableStack(ModItems.motor, 2), new ComparableStack(ModItems.circuit, 1, EnumCircuitType.ANALOG)));
this.register(new GenericRecipe("ass.chemplant").setup(200, 100).outputItems(new ItemStack(ModBlocks.machine_chemical_plant, 1)) this.register(new GenericRecipe("ass.chemplant").setup(200, 100).outputItems(new ItemStack(ModBlocks.machine_chemical_plant, 1))
.inputItems(new OreDictStack(STEEL.ingot(), 8), new OreDictStack(CU.pipe(), 2), new ComparableStack(ModItems.plate_polymer, 16), new ComparableStack(ModItems.motor, 2), new ComparableStack(ModItems.coil_tungsten, 2), new ComparableStack(ModItems.circuit, 1, EnumCircuitType.ANALOG)) .inputItems(new OreDictStack(STEEL.ingot(), 8), new OreDictStack(CU.pipe(), 2), new ComparableStack(ModItems.plate_polymer, 16), new ComparableStack(ModItems.motor, 2), new ComparableStack(ModItems.coil_tungsten, 2), new ComparableStack(ModItems.circuit, 1, EnumCircuitType.ANALOG))
.inputItemsEx(new ComparableStack(ModItems.item_expensive, 3, EnumExpensiveType.STEEL_PLATING), new OreDictStack(CU.pipe(), 2), new ComparableStack(ModItems.plate_polymer, 16), new ComparableStack(ModItems.motor, 2), new ComparableStack(ModItems.coil_tungsten, 2), new ComparableStack(ModItems.circuit, 3, EnumCircuitType.ANALOG))); .inputItemsEx(new ComparableStack(ModItems.item_expensive, 3, EnumExpensiveType.STEEL_PLATING), new OreDictStack(CU.pipe(), 2), new ComparableStack(ModItems.plate_polymer, 16), new ComparableStack(ModItems.motor, 2), new ComparableStack(ModItems.coil_tungsten, 2), new ComparableStack(ModItems.circuit, 3, EnumCircuitType.ANALOG)));
@ -338,6 +340,9 @@ public class AssemblyMachineRecipes extends GenericRecipes<GenericRecipe> {
this.register(new GenericRecipe("ass.strandcaster").setup(200, 100).outputItems(new ItemStack(ModBlocks.machine_strand_caster, 1)) this.register(new GenericRecipe("ass.strandcaster").setup(200, 100).outputItems(new ItemStack(ModBlocks.machine_strand_caster, 1))
.inputItems(new ComparableStack(ModItems.ingot_firebrick, 16), new OreDictStack(STEEL.plateCast(), 6), new OreDictStack(CU.plateWelded(), 2), new OreDictStack(STEEL.shell(), 2), new OreDictStack(ANY_CONCRETE.any(), 8)) .inputItems(new ComparableStack(ModItems.ingot_firebrick, 16), new OreDictStack(STEEL.plateCast(), 6), new OreDictStack(CU.plateWelded(), 2), new OreDictStack(STEEL.shell(), 2), new OreDictStack(ANY_CONCRETE.any(), 8))
.inputItemsEx(new ComparableStack(ModItems.item_expensive, 1, EnumExpensiveType.HEAVY_FRAME), new ComparableStack(ModItems.ingot_firebrick, 16), new OreDictStack(STEEL.shell(), 4), new OreDictStack(ANY_CONCRETE.any(), 8))); .inputItemsEx(new ComparableStack(ModItems.item_expensive, 1, EnumExpensiveType.HEAVY_FRAME), new ComparableStack(ModItems.ingot_firebrick, 16), new OreDictStack(STEEL.shell(), 4), new OreDictStack(ANY_CONCRETE.any(), 8)));
this.register(new GenericRecipe("ass.assemfac").setup(400, 100).outputItems(new ItemStack(ModBlocks.machine_assembly_factory, 1))
.inputItems(new OreDictStack(DURA.ingot(), 16), new OreDictStack(ANY_RESISTANTALLOY.ingot(), 8), new OreDictStack(RUBBER.ingot(), 16), new OreDictStack(B.ingot(), 8), new OreDictStack(STEEL.shell(), 4), new ComparableStack(ModItems.motor, 12), new ComparableStack(ModItems.circuit, 16, EnumCircuitType.BASIC))
.inputItemsEx(new ComparableStack(ModItems.item_expensive, 4, EnumExpensiveType.HEAVY_FRAME), new OreDictStack(ANY_RESISTANTALLOY.ingot(), 16), new OreDictStack(RUBBER.ingot(), 16), new OreDictStack(B.ingot(), 8), new OreDictStack(STEEL.shell(), 4), new ComparableStack(ModItems.motor, 24), new ComparableStack(ModItems.item_expensive, 4, EnumExpensiveType.CIRCUIT)));
this.register(new GenericRecipe("ass.chemfac").setup(400, 100).outputItems(new ItemStack(ModBlocks.machine_chemical_factory, 1)) this.register(new GenericRecipe("ass.chemfac").setup(400, 100).outputItems(new ItemStack(ModBlocks.machine_chemical_factory, 1))
.inputItems(new OreDictStack(DURA.ingot(), 16), new OreDictStack(ANY_RESISTANTALLOY.ingot(), 8), new OreDictStack(RUBBER.ingot(), 16), new OreDictStack(STEEL.shell(), 12), new OreDictStack(CU.pipe(), 8), new ComparableStack(ModItems.motor_desh, 4), new ComparableStack(ModItems.coil_tungsten, 16), new ComparableStack(ModItems.circuit, 16, EnumCircuitType.BASIC)) .inputItems(new OreDictStack(DURA.ingot(), 16), new OreDictStack(ANY_RESISTANTALLOY.ingot(), 8), new OreDictStack(RUBBER.ingot(), 16), new OreDictStack(STEEL.shell(), 12), new OreDictStack(CU.pipe(), 8), new ComparableStack(ModItems.motor_desh, 4), new ComparableStack(ModItems.coil_tungsten, 16), new ComparableStack(ModItems.circuit, 16, EnumCircuitType.BASIC))
.inputItemsEx(new ComparableStack(ModItems.item_expensive, 4, EnumExpensiveType.HEAVY_FRAME), new OreDictStack(ANY_RESISTANTALLOY.ingot(), 16), new OreDictStack(RUBBER.ingot(), 16), new OreDictStack(STEEL.shell(), 12), new OreDictStack(CU.pipe(), 16), new ComparableStack(ModItems.motor_desh, 16), new ComparableStack(ModItems.item_expensive, 4, EnumExpensiveType.CIRCUIT))); .inputItemsEx(new ComparableStack(ModItems.item_expensive, 4, EnumExpensiveType.HEAVY_FRAME), new OreDictStack(ANY_RESISTANTALLOY.ingot(), 16), new OreDictStack(RUBBER.ingot(), 16), new OreDictStack(STEEL.shell(), 12), new OreDictStack(CU.pipe(), 16), new ComparableStack(ModItems.motor_desh, 16), new ComparableStack(ModItems.item_expensive, 4, EnumExpensiveType.CIRCUIT)));

View File

@ -53,9 +53,9 @@ public class PUREXRecipes extends GenericRecipes<GenericRecipe> {
this.register(new GenericRecipe("purex.zirnoxmeu").setup(100, zirnoxPower).setNameWrapper("purex.recycle").setGroup(autoZirnox, this) this.register(new GenericRecipe("purex.zirnoxmeu").setup(100, zirnoxPower).setNameWrapper("purex.recycle").setGroup(autoZirnox, this)
.inputItems(new ComparableStack(ModItems.waste_uranium)) .inputItems(new ComparableStack(ModItems.waste_uranium))
.inputFluids(new FluidStack(Fluids.KEROSENE, 500), new FluidStack(Fluids.NITRIC_ACID, 250)) .inputFluids(new FluidStack(Fluids.KEROSENE, 500), new FluidStack(Fluids.NITRIC_ACID, 250))
.outputItems(new ItemStack(ModItems.nugget_u238, 1), .outputItems(new ItemStack(ModItems.nugget_pu_mix, 1),
new ItemStack(ModItems.nugget_pu_mix, 2), new ItemStack(ModItems.nugget_plutonium, 2),
new ItemStack(ModItems.nugget_pu239, 1), new ItemStack(ModItems.nugget_technetium, 1),
new ItemStack(ModItems.nuclear_waste_tiny, 2)) new ItemStack(ModItems.nuclear_waste_tiny, 2))
.setIconToFirstIngredient()); .setIconToFirstIngredient());
@ -80,8 +80,7 @@ public class PUREXRecipes extends GenericRecipes<GenericRecipe> {
this.register(new GenericRecipe("purex.zirnoxmep").setup(100, zirnoxPower).setNameWrapper("purex.recycle").setGroup(autoZirnox, this) this.register(new GenericRecipe("purex.zirnoxmep").setup(100, zirnoxPower).setNameWrapper("purex.recycle").setGroup(autoZirnox, this)
.inputItems(new ComparableStack(ModItems.waste_plutonium)) .inputItems(new ComparableStack(ModItems.waste_plutonium))
.inputFluids(new FluidStack(Fluids.KEROSENE, 500), new FluidStack(Fluids.NITRIC_ACID, 250)) .inputFluids(new FluidStack(Fluids.KEROSENE, 500), new FluidStack(Fluids.NITRIC_ACID, 250))
.outputItems(new ItemStack(ModItems.nugget_pu_mix, 1), .outputItems(new ItemStack(ModItems.nugget_pu_mix, 2),
new ItemStack(ModItems.nugget_pu_mix, 1),
new ItemStack(ModItems.nugget_technetium, 1), new ItemStack(ModItems.nugget_technetium, 1),
new ItemStack(ModItems.nuclear_waste_tiny, 3)) new ItemStack(ModItems.nuclear_waste_tiny, 3))
.setIconToFirstIngredient()); .setIconToFirstIngredient());

View File

@ -123,7 +123,6 @@ public class AnvilRecipes extends SerializableRecipe {
smithingRecipes.add(new AnvilSmithingMold(10, new OreDictStack(IRON.ingot(), 9), new OreDictStack("ingot", 9))); smithingRecipes.add(new AnvilSmithingMold(10, new OreDictStack(IRON.ingot(), 9), new OreDictStack("ingot", 9)));
smithingRecipes.add(new AnvilSmithingMold(11, new OreDictStack(IRON.plate(), 9), new OreDictStack("plate", 9))); smithingRecipes.add(new AnvilSmithingMold(11, new OreDictStack(IRON.plate(), 9), new OreDictStack("plate", 9)));
smithingRecipes.add(new AnvilSmithingMold(12, new OreDictStack(IRON.block()), new OreDictStack("block"))); smithingRecipes.add(new AnvilSmithingMold(12, new OreDictStack(IRON.block()), new OreDictStack("block")));
smithingRecipes.add(new AnvilSmithingMold(13, new ComparableStack(ModItems.pipes_steel), new ItemStack[] {new ItemStack(ModItems.pipes_steel)}));
smithingRecipes.add(new AnvilSmithingMold(20, new OreDictStack(ALLOY.wireDense(), 1), new OreDictStack("wireDense", 1))); smithingRecipes.add(new AnvilSmithingMold(20, new OreDictStack(ALLOY.wireDense(), 1), new OreDictStack("wireDense", 1)));
smithingRecipes.add(new AnvilSmithingMold(21, new OreDictStack(ALLOY.wireDense(), 9), new OreDictStack("wireDense", 9))); smithingRecipes.add(new AnvilSmithingMold(21, new OreDictStack(ALLOY.wireDense(), 9), new OreDictStack("wireDense", 9)));

View File

@ -1,14 +1,29 @@
package com.hbm.items; package com.hbm.items;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toclient.HbmAnimationPacket;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import cpw.mods.fml.relauncher.Side; import net.minecraft.entity.player.EntityPlayer;
import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public interface IAnimatedItem { public interface IAnimatedItem<T extends Enum<?>> {
/** Fetch the animation for a given type */
public BusAnimation getAnimation(T type, ItemStack stack);
/** Should a player holding this item aim it like a gun/bow? */
public boolean shouldPlayerModelAim(ItemStack stack);
// Runtime erasure means we have to explicitly give the class a second time :(
public Class<T> getEnum();
// Run a specified animation
public default void playAnimation(EntityPlayer player, T type) {
if(player instanceof EntityPlayerMP) {
PacketDispatcher.wrapper.sendTo(new HbmAnimationPacket(type.ordinal(), 0, 0), (EntityPlayerMP) player);
}
}
@SideOnly(Side.CLIENT)
public BusAnimation getAnimation(NBTTagCompound data, ItemStack stack);
} }

View File

@ -2316,7 +2316,7 @@ public class ModItems {
lithium = new Item().setUnlocalizedName("lithium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":lithium"); lithium = new Item().setUnlocalizedName("lithium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":lithium");
ingot_zirconium = new Item().setUnlocalizedName("ingot_zirconium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_zirconium"); ingot_zirconium = new Item().setUnlocalizedName("ingot_zirconium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_zirconium");
ingot_semtex = new ItemLemon(4, 5, true).setUnlocalizedName("ingot_semtex").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_semtex"); ingot_semtex = new ItemLemon(4, 5, true).setUnlocalizedName("ingot_semtex").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_semtex");
ingot_c4 = new Item().setUnlocalizedName("ingot_c4").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_c4"); ingot_c4 = new ItemLemon(4, 5, true).setUnlocalizedName("ingot_c4").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_c4");
ingot_phosphorus = new Item().setUnlocalizedName("ingot_phosphorus").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_phosphorus"); ingot_phosphorus = new Item().setUnlocalizedName("ingot_phosphorus").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_phosphorus");
coil_advanced_alloy = new Item().setUnlocalizedName("coil_advanced_alloy").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":coil_advanced_alloy"); coil_advanced_alloy = new Item().setUnlocalizedName("coil_advanced_alloy").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":coil_advanced_alloy");
coil_advanced_torus = new Item().setUnlocalizedName("coil_advanced_torus").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":coil_advanced_torus"); coil_advanced_torus = new Item().setUnlocalizedName("coil_advanced_torus").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":coil_advanced_torus");

View File

@ -14,7 +14,7 @@ public class ItemSolinium extends Item {
@Override @Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) { public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
list.add(I18nUtil.resolveKey("item.bomb_part.used_in")); list.add(I18nUtil.resolveKey("item.bomb_part.used_in"));
list.add(ModBlocks.nuke_solinium.getLocalizedName() + " name"); list.add(ModBlocks.nuke_solinium.getLocalizedName());
super.addInformation(itemstack, player, list, bool); super.addInformation(itemstack, player, list, bool);
} }
} }

View File

@ -35,10 +35,10 @@ public class ItemLemon extends ItemFood {
} }
if(this == ModItems.med_ipecac) { if(this == ModItems.med_ipecac) {
String[] lines = I18nUtil.resolveKeyArray("item.med_ipecac.desc"); String[] lines = I18nUtil.resolveKeyArray("item.med_ipecac.desс");
for (String line : lines) { for (String line : lines) {
list.add(line); list.add(line);
} }
} }
if(this == ModItems.med_ptsd) { if(this == ModItems.med_ptsd) {

View File

@ -75,7 +75,7 @@ public class ItemMold extends Item {
registerMold(new MoldShape( 11, L, "plates", MaterialShapes.PLATE, 9)); registerMold(new MoldShape( 11, L, "plates", MaterialShapes.PLATE, 9));
registerMold(new MoldShape( 21, L, "wires_dense", MaterialShapes.DENSEWIRE, 9)); registerMold(new MoldShape( 21, L, "wires_dense", MaterialShapes.DENSEWIRE, 9));
registerMold(new MoldBlock( 12, L, "block", MaterialShapes.BLOCK)); registerMold(new MoldBlock( 12, L, "block", MaterialShapes.BLOCK));
registerMold(new MoldSingle( 13, L, "pipes", new ItemStack(ModItems.pipes_steel), Mats.MAT_STEEL, MaterialShapes.BLOCK.q(3))); //registerMold(new MoldSingle( 13, L, "pipes", new ItemStack(ModItems.pipes_steel), Mats.MAT_STEEL, MaterialShapes.BLOCK.q(3)));
registerMold(new MoldMulti( 16, S, "c9", MaterialShapes.PLATE.q(1, 4), registerMold(new MoldMulti( 16, S, "c9", MaterialShapes.PLATE.q(1, 4),
Mats.MAT_GUNMETAL, DictFrame.fromOne(ModItems.casing, EnumCasingType.SMALL), Mats.MAT_GUNMETAL, DictFrame.fromOne(ModItems.casing, EnumCasingType.SMALL),

View File

@ -14,7 +14,7 @@ public class ItemHotDusted extends ItemHot {
@Override @Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) { public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
list.add(String.format(I18nUtil.resolveKey("item.hot_dusted.forged"), stack.getItemDamage())); list.add(I18nUtil.resolveKey("item.hot_dusted.forged", stack.getItemDamage()));
} }
public static int getMaxHeat(ItemStack stack) { public static int getMaxHeat(ItemStack stack) {

View File

@ -40,9 +40,6 @@ public class ItemSchraranium extends ItemCustomLore {
@Override @Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) { public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
if(GeneralConfig.enableLBSM && GeneralConfig.enableLBSMFullSchrab) if(GeneralConfig.enableLBSM && GeneralConfig.enableLBSMFullSchrab) list.add("pankæk");
list.add("pankæk");
else
super.addInformation(itemstack, player, list, bool);
} }
} }

View File

@ -7,6 +7,7 @@ import com.hbm.items.ModItems;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
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.render.anim.AnimationEnums.ToolAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.util.EntityDamageUtil; import com.hbm.util.EntityDamageUtil;
@ -14,12 +15,9 @@ import com.hbm.util.EntityDamageUtil;
import api.hbm.block.IToolable; import api.hbm.block.IToolable;
import api.hbm.block.IToolable.ToolType; import api.hbm.block.IToolable.ToolType;
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.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -27,7 +25,7 @@ import net.minecraft.util.DamageSource;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
public class ItemBoltgun extends Item implements IAnimatedItem { public class ItemBoltgun extends Item implements IAnimatedItem<ToolAnimation> {
public ItemBoltgun() { public ItemBoltgun() {
this.setMaxStackSize(1); this.setMaxStackSize(1);
@ -73,13 +71,10 @@ public class ItemBoltgun extends Item implements IAnimatedItem {
data.setFloat("size", 1F); data.setFloat("size", 1F);
data.setByte("count", (byte)1); data.setByte("count", (byte)1);
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, entity.posX, entity.posY + entity.height / 2 - entity.yOffset, entity.posZ), new TargetPoint(world.provider.dimensionId, entity.posX, entity.posY, entity.posZ, 50)); PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, entity.posX, entity.posY + entity.height / 2 - entity.yOffset, entity.posZ), new TargetPoint(world.provider.dimensionId, entity.posX, entity.posY, entity.posZ, 50));
} else {
// doing this on the client outright removes the packet delay and makes the animation silky-smooth playAnimation(player, ToolAnimation.SWING);
NBTTagCompound d0 = new NBTTagCompound();
d0.setString("type", "anim");
d0.setString("mode", "generic");
MainRegistry.proxy.effectNT(d0);
} }
return true; return true;
} }
} }
@ -110,10 +105,7 @@ public class ItemBoltgun extends Item implements IAnimatedItem {
data.setByte("count", (byte)1); data.setByte("count", (byte)1);
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, x + fX + dir.offsetX * off, y + fY + dir.offsetY * off, z + fZ + dir.offsetZ * off), new TargetPoint(world.provider.dimensionId, x, y, z, 50)); PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, x + fX + dir.offsetX * off, y + fY + dir.offsetY * off, z + fZ + dir.offsetZ * off), new TargetPoint(world.provider.dimensionId, x, y, z, 50));
NBTTagCompound d0 = new NBTTagCompound(); playAnimation(player, ToolAnimation.SWING);
d0.setString("type", "anim");
d0.setString("mode", "generic");
PacketThreading.createSendToThreadedPacket(new AuxParticlePacketNT(d0, 0, 0, 0), (EntityPlayerMP) player);
} }
return false; return false;
@ -123,11 +115,21 @@ public class ItemBoltgun extends Item implements IAnimatedItem {
} }
@Override @Override
@SideOnly(Side.CLIENT) public Class<ToolAnimation> getEnum() {
public BusAnimation getAnimation(NBTTagCompound data, ItemStack stack) { return ToolAnimation.class;
}
@Override
public BusAnimation getAnimation(ToolAnimation type, ItemStack stack) {
return new BusAnimation() return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence() .addBus("RECOIL", new BusAnimationSequence()
.addPos(1, 0, 1, 50) .addPos(1, 0, 1, 50)
.addPos(0, 0, 1, 100)); .addPos(0, 0, 1, 100));
} }
@Override
public boolean shouldPlayerModelAim(ItemStack stack) {
return false;
}
} }

View File

@ -1,16 +1,19 @@
package com.hbm.items.tool; package com.hbm.items.tool;
import com.hbm.handler.threading.PacketThreading;
import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.FluidType;
import com.hbm.items.IAnimatedItem;
import com.hbm.items.IHeldSoundProvider; import com.hbm.items.IHeldSoundProvider;
import com.hbm.packet.toclient.AuxParticlePacketNT; import com.hbm.render.anim.AnimationEnums.ToolAnimation;
import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.HbmAnimations;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class ItemChainsaw extends ItemToolAbilityFueled implements IHeldSoundProvider { public class ItemChainsaw extends ItemToolAbilityFueled implements IHeldSoundProvider, IAnimatedItem<ToolAnimation> {
public ItemChainsaw(float damage, double movement, ToolMaterial material, EnumToolType type, int maxFuel, int consumption, int fillRate, FluidType... acceptedFuels) { public ItemChainsaw(float damage, double movement, ToolMaterial material, EnumToolType type, int maxFuel, int consumption, int fillRate, FluidType... acceptedFuels) {
super(damage, movement, material, type, maxFuel, consumption, fillRate, acceptedFuels); super(damage, movement, material, type, maxFuel, consumption, fillRate, acceptedFuels);
@ -25,11 +28,57 @@ public class ItemChainsaw extends ItemToolAbilityFueled implements IHeldSoundPro
if(stack.getItemDamage() >= stack.getMaxDamage()) if(stack.getItemDamage() >= stack.getMaxDamage())
return false; return false;
NBTTagCompound nbt = new NBTTagCompound(); playAnimation((EntityPlayer) entityLiving, ToolAnimation.SWING);
nbt.setString("type", "anim");
nbt.setString("mode", "sSwing");
PacketThreading.createSendToThreadedPacket(new AuxParticlePacketNT(nbt, 0, 0, 0), (EntityPlayerMP)entityLiving);
return false; return false;
} }
@Override
public BusAnimation getAnimation(ToolAnimation type, ItemStack stack) {
int forward = 150;
int sideways = 100;
int retire = 200;
if(HbmAnimations.getRelevantAnim() == null) {
return new BusAnimation()
.addBus("SWING_ROT", new BusAnimationSequence()
.addPos(0, 0, 90, forward)
.addPos(45, 0, 90, sideways)
.addPos(0, 0, 0, retire))
.addBus("SWING_TRANS", new BusAnimationSequence()
.addPos(0, 0, 3, forward)
.addPos(2, 0, 2, sideways)
.addPos(0, 0, 0, retire));
} else {
double[] rot = HbmAnimations.getRelevantTransformation("SWING_ROT");
double[] trans = HbmAnimations.getRelevantTransformation("SWING_TRANS");
if(System.currentTimeMillis() - HbmAnimations.getRelevantAnim().startMillis < 50) return null;
return new BusAnimation()
.addBus("SWING_ROT", new BusAnimationSequence()
.addPos(rot[0], rot[1], rot[2], 0)
.addPos(0, 0, 90, forward)
.addPos(45, 0, 90, sideways)
.addPos(0, 0, 0, retire))
.addBus("SWING_TRANS", new BusAnimationSequence()
.addPos(trans[0], trans[1], trans[2], 0)
.addPos(0, 0, 3, forward)
.addPos(2, 0, 2, sideways)
.addPos(0, 0, 0, retire));
}
}
@Override
public Class<ToolAnimation> getEnum() {
return ToolAnimation.class;
}
@Override
public boolean shouldPlayerModelAim(ItemStack stack) {
return false;
}
} }

View File

@ -5,15 +5,22 @@ import java.util.List;
import com.google.common.collect.HashMultimap; import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import com.hbm.handler.threading.PacketThreading; import com.hbm.handler.threading.PacketThreading;
import com.hbm.items.IAnimatedItem;
import com.hbm.items.IEquipReceiver; import com.hbm.items.IEquipReceiver;
import com.hbm.items.tool.ItemSwordAbility; import com.hbm.items.tool.ItemSwordAbility;
import com.hbm.packet.toclient.AuxParticlePacketNT; import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.render.anim.AnimationEnums.ToolAnimation;
import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.HbmAnimations;
import com.hbm.util.ShadyUtil; import com.hbm.util.ShadyUtil;
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;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.ai.attributes.AttributeModifier;
@ -25,9 +32,10 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatStyle; import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.World;
public class ItemCrucible extends ItemSwordAbility implements IEquipReceiver { public class ItemCrucible extends ItemSwordAbility implements IEquipReceiver, IAnimatedItem<ToolAnimation> {
public ItemCrucible(float damage, double movement, ToolMaterial material) { public ItemCrucible(float damage, double movement, ToolMaterial material) {
super(damage, movement, material); super(damage, movement, material);
@ -44,10 +52,7 @@ public class ItemCrucible extends ItemSwordAbility implements IEquipReceiver {
World world = player.worldObj; World world = player.worldObj;
world.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:weapon.cDeploy", 1.0F, 1.0F); world.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:weapon.cDeploy", 1.0F, 1.0F);
NBTTagCompound nbt = new NBTTagCompound(); playAnimation(player, ToolAnimation.EQUIP);
nbt.setString("type", "anim");
nbt.setString("mode", "crucible");
PacketThreading.createSendToThreadedPacket(new AuxParticlePacketNT(nbt, 0, 0, 0), (EntityPlayerMP)player);
} }
} }
@ -64,10 +69,7 @@ public class ItemCrucible extends ItemSwordAbility implements IEquipReceiver {
if(stack.getItemDamage() >= stack.getMaxDamage()) if(stack.getItemDamage() >= stack.getMaxDamage())
return false; return false;
NBTTagCompound nbt = new NBTTagCompound(); playAnimation((EntityPlayerMP)entityLiving, ToolAnimation.SWING);
nbt.setString("type", "anim");
nbt.setString("mode", "cSwing");
PacketThreading.createSendToThreadedPacket(new AuxParticlePacketNT(nbt, 0, 0, 0), (EntityPlayerMP)entityLiving);
return false; return false;
} }
@ -132,4 +134,58 @@ public class ItemCrucible extends ItemSwordAbility implements IEquipReceiver {
list.add(charge); list.add(charge);
} }
@Override
public BusAnimation getAnimation(ToolAnimation type, ItemStack stack) {
/* crucible deploy */
if(type == ToolAnimation.EQUIP) {
return new BusAnimation()
.addBus("GUARD_ROT", new BusAnimationSequence()
.addPos(90, 0, 1, 0)
.addPos(90, 0, 1, 800)
.addPos(0, 0, 1, 50));
}
/* crucible swing */
if(type == ToolAnimation.SWING) {
if(HbmAnimations.getRelevantTransformation("SWING_ROT")[0] == 0) {
int offset = itemRand.nextInt(80) - 20;
playSwing(0.8F + itemRand.nextFloat() * 0.2F);
return new BusAnimation()
.addBus("SWING_ROT", new BusAnimationSequence()
.addPos(90 - offset, 90 - offset, 35, 75)
.addPos(90 + offset, 90 - offset, -45, 150)
.addPos(0, 0, 0, 500))
.addBus("SWING_TRANS", new BusAnimationSequence()
.addPos(-3, 0, 0, 75)
.addPos(8, 0, 0, 150)
.addPos(0, 0, 0, 500));
}
}
return null;
}
// could do this better, but this preserves existing behaviour the closest with the least amount
// of effort, without crashing servers (I'm learning my lesson :o_ )
@SideOnly(Side.CLIENT)
private void playSwing(float pitchProbablyIDontFuckingCare) {
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:weapon.cSwing"), pitchProbablyIDontFuckingCare));
}
@Override
public Class<ToolAnimation> getEnum() {
return ToolAnimation.class;
}
@Override
public boolean shouldPlayerModelAim(ItemStack stack) {
return false;
}
} }

View File

@ -65,33 +65,33 @@ public class ItemCustomMissile extends Item {
ItemCustomMissilePart thruster = (ItemCustomMissilePart) Item.getItemById(readFromNBT(stack, "thruster")); ItemCustomMissilePart thruster = (ItemCustomMissilePart) Item.getItemById(readFromNBT(stack, "thruster"));
// warhead name // warhead name
list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("gui.missile.warhead") + ": " + EnumChatFormatting.GRAY + warhead.getWarhead((WarheadType)warhead.attributes[0])); list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("item.missile.desc.warhead") + ": " + EnumChatFormatting.GRAY + warhead.getWarhead((WarheadType)warhead.attributes[0]));
// strength // strength
list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("gui.missile.strength") + ": " + EnumChatFormatting.GRAY + (Float)warhead.attributes[1]); list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("item.missile.desc.strength") + ": " + EnumChatFormatting.GRAY + (Float)warhead.attributes[1]);
// fuel type & amount // fuel type & amount
list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("gui.missile.fuelType") + ": " + EnumChatFormatting.GRAY + fuselage.getFuel((FuelType)fuselage.attributes[0])); list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("item.missile.desc.fuelType") + ": " + EnumChatFormatting.GRAY + fuselage.getFuel((FuelType)fuselage.attributes[0]));
list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("gui.missile.fuelAmount") + ": " + EnumChatFormatting.GRAY + (Float)fuselage.attributes[1] + "l"); list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("item.missile.desc.fuelAmount") + ": " + EnumChatFormatting.GRAY + (Float)fuselage.attributes[1] + "l");
// chip inaccuracy // chip inaccuracy
list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("gui.missile.chipInaccuracy") + ": " + EnumChatFormatting.GRAY + (Float)chip.attributes[0] * 100 + "%"); list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("item.missile.desc.chipInaccuracy") + ": " + EnumChatFormatting.GRAY + (Float)chip.attributes[0] * 100 + "%");
// fin inaccuracy // fin inaccuracy
if(stability != null) if(stability != null)
list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("gui.missile.finInaccuracy") + ": " + EnumChatFormatting.GRAY + (Float)stability.attributes[0] * 100 + "%"); list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("item.missile.desc.finInaccuracy") + ": " + EnumChatFormatting.GRAY + (Float)stability.attributes[0] * 100 + "%");
else else
list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("gui.missile.finInaccuracy") + ": " + EnumChatFormatting.GRAY + "100%"); list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("item.missile.desc.finInaccuracy") + ": " + EnumChatFormatting.GRAY + "100%");
// size // size
list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("gui.missile.size") + ": " + EnumChatFormatting.GRAY + fuselage.getSize(fuselage.top) + "/" + fuselage.getSize(fuselage.bottom)); list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("item.missile.desc.size") + ": " + EnumChatFormatting.GRAY + fuselage.getSize(fuselage.top) + "/" + fuselage.getSize(fuselage.bottom));
// health // health
float health = warhead.health + fuselage.health + thruster.health; float health = warhead.health + fuselage.health + thruster.health;
if(stability != null) if(stability != null)
health += stability.health; health += stability.health;
list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("gui.missile.health") + ": " + EnumChatFormatting.GRAY + health + "HP"); list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("item.missile.desc.health") + ": " + EnumChatFormatting.GRAY + health + "HP");
} catch(Exception ex) { } catch(Exception ex) {
list.add(EnumChatFormatting.RED + I18nUtil.resolveKey("error.generic")); list.add(EnumChatFormatting.RED + I18nUtil.resolveKey("error.generic"));

View File

@ -305,7 +305,7 @@ public class ItemCustomMissilePart extends Item {
case SOLID: case SOLID:
return EnumChatFormatting.GOLD + I18nUtil.resolveKey("item.missile.fuel.solid"); return EnumChatFormatting.GOLD + I18nUtil.resolveKey("item.missile.fuel.solid");
case HYDROGEN: case HYDROGEN:
return EnumChatFormatting.DARK_AQUA + I18nUtil.resolveKey("item.missile.fuel.ethanol_peroxide"); // closest match return EnumChatFormatting.DARK_AQUA + I18nUtil.resolveKey("item.missile.fuel.hydrogen"); // closest match
case XENON: case XENON:
return EnumChatFormatting.DARK_PURPLE + I18nUtil.resolveKey("item.missile.fuel.xenon"); return EnumChatFormatting.DARK_PURPLE + I18nUtil.resolveKey("item.missile.fuel.xenon");
case BALEFIRE: case BALEFIRE:

View File

@ -11,8 +11,8 @@ import com.hbm.items.weapon.sedna.factory.GunStateDecider;
import com.hbm.items.weapon.sedna.factory.Lego; import com.hbm.items.weapon.sedna.factory.Lego;
import com.hbm.items.weapon.sedna.hud.IHUDComponent; import com.hbm.items.weapon.sedna.hud.IHUDComponent;
import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.items.weapon.sedna.mods.WeaponModManager;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@ -20,13 +20,13 @@ import net.minecraft.util.ResourceLocation;
/** /**
* Despite how complicated the GunConfig looks, it actually only exists to hold together a bunch of fields. Everything else is infrastructure for getting and setting. * Despite how complicated the GunConfig looks, it actually only exists to hold together a bunch of fields. Everything else is infrastructure for getting and setting.
* The gun config determines general gun specific stats like durability, crosshair, animations, receivers, click handling and the decider. * The gun config determines general gun specific stats like durability, crosshair, animations, receivers, click handling and the decider.
* *
* @author hbm * @author hbm
* */ * */
public class GunConfig { public class GunConfig {
public List<SmokeNode> smokeNodes = new ArrayList(); public List<SmokeNode> smokeNodes = new ArrayList<>();
public static final String O_RECEIVERS = "O_RECEIVERS"; public static final String O_RECEIVERS = "O_RECEIVERS";
public static final String F_DURABILITY = "F_DURABILITY"; public static final String F_DURABILITY = "F_DURABILITY";
public static final String I_DRAWDURATION = "I_DRAWDURATION"; public static final String I_DRAWDURATION = "I_DRAWDURATION";
@ -51,9 +51,9 @@ public class GunConfig {
public static final String CON_DECIDER = "CON_DECIDER"; public static final String CON_DECIDER = "CON_DECIDER";
public static final String FUN_ANIMNATIONS = "FUN_ANIMNATIONS"; public static final String FUN_ANIMNATIONS = "FUN_ANIMNATIONS";
public static final String O_HUDCOMPONENTS = "O_HUDCOMPONENTS"; public static final String O_HUDCOMPONENTS = "O_HUDCOMPONENTS";
/* FIELDS */ /* FIELDS */
public int index; public int index;
/** List of receivers used by the gun, primary and secondary are usually indices 0 and 1 respectively, if applicable */ /** List of receivers used by the gun, primary and secondary are usually indices 0 and 1 respectively, if applicable */
protected Receiver[] receivers_DNA; protected Receiver[] receivers_DNA;
@ -84,9 +84,9 @@ public class GunConfig {
/** The engine for the state machine that determines the gun's overall behavior */ /** The engine for the state machine that determines the gun's overall behavior */
protected BiConsumer<ItemStack, LambdaContext> decider_DNA; protected BiConsumer<ItemStack, LambdaContext> decider_DNA;
/** Lambda that returns the relevant animation for the given params */ /** Lambda that returns the relevant animation for the given params */
protected BiFunction<ItemStack, AnimType, BusAnimation> animations_DNA; protected BiFunction<ItemStack, GunAnimation, BusAnimation> animations_DNA;
protected IHUDComponent[] hudComponents_DNA; protected IHUDComponent[] hudComponents_DNA;
/* GETTERS */ /* GETTERS */
public Receiver[] getReceivers(ItemStack stack) { return WeaponModManager.eval(receivers_DNA, stack, O_RECEIVERS, this, this.index); } public Receiver[] getReceivers(ItemStack stack) { return WeaponModManager.eval(receivers_DNA, stack, O_RECEIVERS, this, this.index); }
@ -112,14 +112,14 @@ public class GunConfig {
public BiConsumer<ItemStack, LambdaContext> getReleaseSecondary(ItemStack stack) { return WeaponModManager.eval(this.onReleaseSecondary_DNA, stack, CON_ONRELEASESECONDARY, this, this.index); } public BiConsumer<ItemStack, LambdaContext> getReleaseSecondary(ItemStack stack) { return WeaponModManager.eval(this.onReleaseSecondary_DNA, stack, CON_ONRELEASESECONDARY, this, this.index); }
public BiConsumer<ItemStack, LambdaContext> getReleaseTertiary(ItemStack stack) { return WeaponModManager.eval(this.onReleaseTertiary_DNA, stack, CON_ONRELEASETERTIARY, this, this.index); } public BiConsumer<ItemStack, LambdaContext> getReleaseTertiary(ItemStack stack) { return WeaponModManager.eval(this.onReleaseTertiary_DNA, stack, CON_ONRELEASETERTIARY, this, this.index); }
public BiConsumer<ItemStack, LambdaContext> getReleaseReload(ItemStack stack) { return WeaponModManager.eval(this.onReleaseReload_DNA, stack, CON_ONRELEASERELOAD, this, this.index); } public BiConsumer<ItemStack, LambdaContext> getReleaseReload(ItemStack stack) { return WeaponModManager.eval(this.onReleaseReload_DNA, stack, CON_ONRELEASERELOAD, this, this.index); }
public BiConsumer<ItemStack, LambdaContext> getDecider(ItemStack stack) { return WeaponModManager.eval(this.decider_DNA, stack, CON_DECIDER, this, this.index); } public BiConsumer<ItemStack, LambdaContext> getDecider(ItemStack stack) { return WeaponModManager.eval(this.decider_DNA, stack, CON_DECIDER, this, this.index); }
public BiFunction<ItemStack, AnimType, BusAnimation> getAnims(ItemStack stack) { return WeaponModManager.eval(this.animations_DNA, stack, FUN_ANIMNATIONS, this, this.index); } public BiFunction<ItemStack, GunAnimation, BusAnimation> getAnims(ItemStack stack) { return WeaponModManager.eval(this.animations_DNA, stack, FUN_ANIMNATIONS, this, this.index); }
public IHUDComponent[] getHUDComponents(ItemStack stack) { return WeaponModManager.eval(this.hudComponents_DNA, stack, O_HUDCOMPONENTS, this, this.index); } public IHUDComponent[] getHUDComponents(ItemStack stack) { return WeaponModManager.eval(this.hudComponents_DNA, stack, O_HUDCOMPONENTS, this, this.index); }
/* SETTERS */ /* SETTERS */
public GunConfig rec(Receiver... receivers) { this.receivers_DNA = receivers; for(Receiver r : receivers_DNA) r.parent = this; return this; } public GunConfig rec(Receiver... receivers) { this.receivers_DNA = receivers; for(Receiver r : receivers_DNA) r.parent = this; return this; }
public GunConfig dura(float dura) { this.durability_DNA = dura; return this; } public GunConfig dura(float dura) { this.durability_DNA = dura; return this; }
public GunConfig draw(int draw) { this.drawDuration_DNA = draw; return this; } public GunConfig draw(int draw) { this.drawDuration_DNA = draw; return this; }
@ -134,7 +134,7 @@ public class GunConfig {
public GunConfig smoke(BiConsumer<ItemStack, LambdaContext> smoke) { this.smokeHandler_DNA = smoke; return this; } public GunConfig smoke(BiConsumer<ItemStack, LambdaContext> smoke) { this.smokeHandler_DNA = smoke; return this; }
public GunConfig orchestra(BiConsumer<ItemStack, LambdaContext> orchestra) { this.orchestra_DNA = orchestra; return this; } public GunConfig orchestra(BiConsumer<ItemStack, LambdaContext> orchestra) { this.orchestra_DNA = orchestra; return this; }
//press //press
public GunConfig pp(BiConsumer<ItemStack, LambdaContext> lambda) { this.onPressPrimary_DNA = lambda; return this; } public GunConfig pp(BiConsumer<ItemStack, LambdaContext> lambda) { this.onPressPrimary_DNA = lambda; return this; }
public GunConfig ps(BiConsumer<ItemStack, LambdaContext> lambda) { this.onPressSecondary_DNA = lambda; return this; } public GunConfig ps(BiConsumer<ItemStack, LambdaContext> lambda) { this.onPressSecondary_DNA = lambda; return this; }
@ -146,14 +146,14 @@ public class GunConfig {
public GunConfig rs(BiConsumer<ItemStack, LambdaContext> lambda) { this.onReleaseSecondary_DNA = lambda; return this; } public GunConfig rs(BiConsumer<ItemStack, LambdaContext> lambda) { this.onReleaseSecondary_DNA = lambda; return this; }
public GunConfig rt(BiConsumer<ItemStack, LambdaContext> lambda) { this.onReleaseTertiary_DNA = lambda; return this; } public GunConfig rt(BiConsumer<ItemStack, LambdaContext> lambda) { this.onReleaseTertiary_DNA = lambda; return this; }
public GunConfig rr(BiConsumer<ItemStack, LambdaContext> lambda) { this.onReleaseReload_DNA = lambda; return this; } public GunConfig rr(BiConsumer<ItemStack, LambdaContext> lambda) { this.onReleaseReload_DNA = lambda; return this; }
//decider //decider
public GunConfig decider(BiConsumer<ItemStack, LambdaContext> lambda) { this.decider_DNA = lambda; return this; } public GunConfig decider(BiConsumer<ItemStack, LambdaContext> lambda) { this.decider_DNA = lambda; return this; }
//client //client
public GunConfig anim(BiFunction<ItemStack, AnimType, BusAnimation> lambda) { this.animations_DNA = lambda; return this; } public GunConfig anim(BiFunction<ItemStack, GunAnimation, BusAnimation> lambda) { this.animations_DNA = lambda; return this; }
public GunConfig hud(IHUDComponent... components) { this.hudComponents_DNA = components; return this; } public GunConfig hud(IHUDComponent... components) { this.hudComponents_DNA = components; return this; }
/** Standard package for keybind handling and decider using LEGO prefabs: Primary fire on LMB, /** Standard package for keybind handling and decider using LEGO prefabs: Primary fire on LMB,
* reload on R, aiming on MMB and the standard decider which includes jamming and auto fire handling*/ * reload on R, aiming on MMB and the standard decider which includes jamming and auto fire handling*/
public GunConfig setupStandardConfiguration() { public GunConfig setupStandardConfiguration() {

View File

@ -24,8 +24,8 @@ import com.hbm.items.weapon.sedna.mods.WeaponModManager;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.packet.PacketDispatcher; import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toclient.GunAnimationPacket; import com.hbm.packet.toclient.HbmAnimationPacket;
import com.hbm.render.anim.HbmAnimations.AnimType; import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.util.RenderScreenOverlay; import com.hbm.render.util.RenderScreenOverlay;
import com.hbm.sound.AudioWrapper; import com.hbm.sound.AudioWrapper;
import com.hbm.util.BobMathUtil; import com.hbm.util.BobMathUtil;
@ -247,8 +247,8 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IItemHUD, I
@Override @Override
public void onEquip(EntityPlayer player, ItemStack stack) { public void onEquip(EntityPlayer player, ItemStack stack) {
for(int i = 0; i < this.configs_DNA.length; i++) { for(int i = 0; i < this.configs_DNA.length; i++) {
if(this.getLastAnim(stack, i) == AnimType.EQUIP && this.getAnimTimer(stack, i) < 5) continue; if(this.getLastAnim(stack, i) == GunAnimation.EQUIP && this.getAnimTimer(stack, i) < 5) continue;
playAnimation(player, stack, AnimType.EQUIP, i); playAnimation(player, stack, GunAnimation.EQUIP, i);
this.setPrimary(stack, i, false); this.setPrimary(stack, i, false);
this.setSecondary(stack, i, false); this.setSecondary(stack, i, false);
this.setTertiary(stack, i, false); this.setTertiary(stack, i, false);
@ -256,9 +256,9 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IItemHUD, I
} }
} }
public static void playAnimation(EntityPlayer player, ItemStack stack, AnimType type, int index) { public static void playAnimation(EntityPlayer player, ItemStack stack, GunAnimation type, int index) {
if(player instanceof EntityPlayerMP) { if(player instanceof EntityPlayerMP) {
PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(type.ordinal(), 0, index), (EntityPlayerMP) player); PacketDispatcher.wrapper.sendTo(new HbmAnimationPacket(type.ordinal(), 0, index), (EntityPlayerMP) player);
setLastAnim(stack, index, type); setLastAnim(stack, index, type);
setAnimTimer(stack, index, 0); setAnimTimer(stack, index, 0);
} }
@ -327,7 +327,7 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IItemHUD, I
this.setState(stack, i, GunState.DRAWING); this.setState(stack, i, GunState.DRAWING);
this.setTimer(stack, i, configs[i].getDrawDuration(stack)); this.setTimer(stack, i, configs[i].getDrawDuration(stack));
} }
this.setLastAnim(stack, i, AnimType.CYCLE); //prevents new guns from initializing with DRAWING, 0 this.setLastAnim(stack, i, GunAnimation.CYCLE); //prevents new guns from initializing with DRAWING, 0
} }
this.setIsAiming(stack, false); this.setIsAiming(stack, false);
this.setReloadCancel(stack, false); this.setReloadCancel(stack, false);
@ -371,8 +371,8 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IItemHUD, I
public static boolean getIsLockedOn(ItemStack stack) { return getValueBool(stack, KEY_LOCKEDON); } public static boolean getIsLockedOn(ItemStack stack) { return getValueBool(stack, KEY_LOCKEDON); }
public static void setIsLockedOn(ItemStack stack, boolean value) { setValueBool(stack, KEY_LOCKEDON, value); } public static void setIsLockedOn(ItemStack stack, boolean value) { setValueBool(stack, KEY_LOCKEDON, value); }
// ANIM TRACKING // // ANIM TRACKING //
public static AnimType getLastAnim(ItemStack stack, int index) { return EnumUtil.grabEnumSafely(AnimType.class, getValueInt(stack, KEY_LASTANIM + index)); } public static GunAnimation getLastAnim(ItemStack stack, int index) { return EnumUtil.grabEnumSafely(GunAnimation.class, getValueInt(stack, KEY_LASTANIM + index)); }
public static void setLastAnim(ItemStack stack, int index, AnimType value) { setValueInt(stack, KEY_LASTANIM + index, value.ordinal()); } public static void setLastAnim(ItemStack stack, int index, GunAnimation value) { setValueInt(stack, KEY_LASTANIM + index, value.ordinal()); }
public static int getAnimTimer(ItemStack stack, int index) { return getValueInt(stack, KEY_ANIMTIMER + index); } public static int getAnimTimer(ItemStack stack, int index) { return getValueInt(stack, KEY_ANIMTIMER + index); }
public static void setAnimTimer(ItemStack stack, int index, int value) { setValueInt(stack, KEY_ANIMTIMER + index, value); } public static void setAnimTimer(ItemStack stack, int index, int value) { setValueInt(stack, KEY_ANIMTIMER + index, value); }

View File

@ -48,6 +48,8 @@ public class ConfettiUtil {
if(entity instanceof EntitySkeleton) return; if(entity instanceof EntitySkeleton) return;
if(entity instanceof EntitySlime) return; if(entity instanceof EntitySlime) return;
SkeletonCreator.composeEffectGib(entity.worldObj, entity, 0.25F);
NBTTagCompound vdat = new NBTTagCompound(); NBTTagCompound vdat = new NBTTagCompound();
vdat.setString("type", "giblets"); vdat.setString("type", "giblets");
vdat.setInteger("ent", entity.getEntityId()); vdat.setInteger("ent", entity.getEntityId());

View File

@ -7,17 +7,17 @@ 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;
import com.hbm.items.weapon.sedna.mags.IMagazine; import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.GunState; import com.hbm.items.weapon.sedna.ItemGunBaseNT.GunState;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext; import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.render.anim.HbmAnimations.AnimType;
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.item.ItemStack; import net.minecraft.item.ItemStack;
public class GunStateDecider { public class GunStateDecider {
/** /**
* The meat and bones of the gun system's state machine. * The meat and bones of the gun system's state machine.
* This standard decider can handle guns with an automatic primary receiver, as well as one receiver's reloading state. * This standard decider can handle guns with an automatic primary receiver, as well as one receiver's reloading state.
* It supports draw delays as well as semi and auto fire * It supports draw delays as well as semi and auto fire
@ -30,83 +30,83 @@ public class GunStateDecider {
deciderStandardReload(stack, ctx, lastState, 0, index); deciderStandardReload(stack, ctx, lastState, 0, index);
deciderAutoRefire(stack, ctx, lastState, 0, index, () -> { return ItemGunBaseNT.getPrimary(stack, index) && ItemGunBaseNT.getMode(stack, ctx.configIndex) == 0; }); deciderAutoRefire(stack, ctx, lastState, 0, index, () -> { return ItemGunBaseNT.getPrimary(stack, index) && ItemGunBaseNT.getMode(stack, ctx.configIndex) == 0; });
}; };
/** Transitions the gun from DRAWING to IDLE */ /** Transitions the gun from DRAWING to IDLE */
public static void deciderStandardFinishDraw(ItemStack stack, GunState lastState, int index) { public static void deciderStandardFinishDraw(ItemStack stack, GunState lastState, int index) {
//transition to idle //transition to idle
if(lastState == GunState.DRAWING) { if(lastState == GunState.DRAWING) {
ItemGunBaseNT.setState(stack, index, GunState.IDLE); ItemGunBaseNT.setState(stack, index, GunState.IDLE);
ItemGunBaseNT.setTimer(stack, index, 0); ItemGunBaseNT.setTimer(stack, index, 0);
} }
} }
/** Transitions the gun from DRAWING to IDLE */ /** Transitions the gun from DRAWING to IDLE */
public static void deciderStandardClearJam(ItemStack stack, GunState lastState, int index) { public static void deciderStandardClearJam(ItemStack stack, GunState lastState, int index) {
//transition to idle //transition to idle
if(lastState == GunState.JAMMED) { if(lastState == GunState.JAMMED) {
ItemGunBaseNT.setState(stack, index, GunState.IDLE); ItemGunBaseNT.setState(stack, index, GunState.IDLE);
ItemGunBaseNT.setTimer(stack, index, 0); ItemGunBaseNT.setTimer(stack, index, 0);
} }
} }
/** Triggers a reload action on the first receiver. If the mag is not full and reloading is still possible, set to RELOADING, otherwise IDLE */ /** Triggers a reload action on the first receiver. If the mag is not full and reloading is still possible, set to RELOADING, otherwise IDLE */
public static void deciderStandardReload(ItemStack stack, LambdaContext ctx, GunState lastState, int recIndex, int gunIndex) { public static void deciderStandardReload(ItemStack stack, LambdaContext ctx, GunState lastState, int recIndex, int gunIndex) {
if(lastState == GunState.RELOADING) { if(lastState == GunState.RELOADING) {
EntityLivingBase entity = ctx.entity; EntityLivingBase entity = ctx.entity;
EntityPlayer player = ctx.getPlayer(); EntityPlayer player = ctx.getPlayer();
GunConfig cfg = ctx.config; GunConfig cfg = ctx.config;
Receiver rec = cfg.getReceivers(stack)[recIndex]; Receiver rec = cfg.getReceivers(stack)[recIndex];
IMagazine mag = rec.getMagazine(stack); IMagazine mag = rec.getMagazine(stack);
mag.reloadAction(stack, ctx.inventory); mag.reloadAction(stack, ctx.inventory);
boolean cancel = ItemGunBaseNT.getReloadCancel(stack); boolean cancel = ItemGunBaseNT.getReloadCancel(stack);
//if after reloading the gun can still reload, assume a tube mag and resume reloading //if after reloading the gun can still reload, assume a tube mag and resume reloading
if(!cancel && mag.canReload(stack, ctx.inventory)) { if(!cancel && mag.canReload(stack, ctx.inventory)) {
ItemGunBaseNT.setState(stack, gunIndex, GunState.RELOADING); ItemGunBaseNT.setState(stack, gunIndex, GunState.RELOADING);
ItemGunBaseNT.setTimer(stack, gunIndex, rec.getReloadCycleDuration(stack)); ItemGunBaseNT.setTimer(stack, gunIndex, rec.getReloadCycleDuration(stack));
ItemGunBaseNT.playAnimation(player, stack, AnimType.RELOAD_CYCLE, gunIndex); ItemGunBaseNT.playAnimation(player, stack, GunAnimation.RELOAD_CYCLE, gunIndex);
//if no more reloading can be done, go idle //if no more reloading can be done, go idle
} else { } else {
if(getStandardJamChance(stack, cfg, gunIndex) > entity.getRNG().nextFloat()) { if(getStandardJamChance(stack, cfg, gunIndex) > entity.getRNG().nextFloat()) {
ItemGunBaseNT.setState(stack, gunIndex, GunState.JAMMED); ItemGunBaseNT.setState(stack, gunIndex, GunState.JAMMED);
ItemGunBaseNT.setTimer(stack, gunIndex, rec.getJamDuration(stack)); ItemGunBaseNT.setTimer(stack, gunIndex, rec.getJamDuration(stack));
ItemGunBaseNT.playAnimation(player, stack, AnimType.JAMMED, gunIndex); ItemGunBaseNT.playAnimation(player, stack, GunAnimation.JAMMED, gunIndex);
} else { } else {
ItemGunBaseNT.setState(stack, gunIndex, GunState.DRAWING); ItemGunBaseNT.setState(stack, gunIndex, GunState.DRAWING);
int duration = rec.getReloadEndDuration(stack) + (mag.getAmountBeforeReload(stack) <= 0 ? rec.getReloadCockOnEmptyPost(stack) : 0); int duration = rec.getReloadEndDuration(stack) + (mag.getAmountBeforeReload(stack) <= 0 ? rec.getReloadCockOnEmptyPost(stack) : 0);
ItemGunBaseNT.setTimer(stack, gunIndex, duration); ItemGunBaseNT.setTimer(stack, gunIndex, duration);
ItemGunBaseNT.playAnimation(player, stack, AnimType.RELOAD_END, gunIndex); ItemGunBaseNT.playAnimation(player, stack, GunAnimation.RELOAD_END, gunIndex);
} }
ItemGunBaseNT.setReloadCancel(stack, false); ItemGunBaseNT.setReloadCancel(stack, false);
} }
mag.setAmountAfterReload(stack, mag.getAmount(stack, ctx.inventory)); mag.setAmountAfterReload(stack, mag.getAmount(stack, ctx.inventory));
} }
} }
public static float getStandardJamChance(ItemStack stack, GunConfig config, int index) { public static float getStandardJamChance(ItemStack stack, GunConfig config, int index) {
float percent = (float) ItemGunBaseNT.getWear(stack, index) / config.getDurability(stack); float percent = (float) ItemGunBaseNT.getWear(stack, index) / config.getDurability(stack);
if(percent < 0.66F) return 0F; if(percent < 0.66F) return 0F;
return Math.min((percent - 0.66F) * 4F, 1F); return Math.min((percent - 0.66F) * 4F, 1F);
} }
/** Triggers a re-fire of the primary if the fire delay has expired, the left mouse button is down and re-firing is enabled, otherwise switches to IDLE */ /** Triggers a re-fire of the primary if the fire delay has expired, the left mouse button is down and re-firing is enabled, otherwise switches to IDLE */
public static void deciderAutoRefire(ItemStack stack, LambdaContext ctx, GunState lastState, int recIndex, int gunIndex, BooleanSupplier refireCondition) { public static void deciderAutoRefire(ItemStack stack, LambdaContext ctx, GunState lastState, int recIndex, int gunIndex, BooleanSupplier refireCondition) {
if(lastState == GunState.COOLDOWN) { if(lastState == GunState.COOLDOWN) {
EntityLivingBase entity = ctx.entity; EntityLivingBase entity = ctx.entity;
EntityPlayer player = ctx.getPlayer(); EntityPlayer player = ctx.getPlayer();
GunConfig cfg = ctx.config; GunConfig cfg = ctx.config;
Receiver rec = cfg.getReceivers(stack)[recIndex]; Receiver rec = cfg.getReceivers(stack)[recIndex];
//if the gun supports re-fire (i.e. if it's an auto) //if the gun supports re-fire (i.e. if it's an auto)
if(rec.getRefireOnHold(stack) && refireCondition.getAsBoolean()) { if(rec.getRefireOnHold(stack) && refireCondition.getAsBoolean()) {
//if there's a bullet loaded, fire again //if there's a bullet loaded, fire again
@ -114,9 +114,9 @@ public class GunStateDecider {
rec.getOnFire(stack).accept(stack, ctx); rec.getOnFire(stack).accept(stack, ctx);
ItemGunBaseNT.setState(stack, gunIndex, GunState.COOLDOWN); ItemGunBaseNT.setState(stack, gunIndex, GunState.COOLDOWN);
ItemGunBaseNT.setTimer(stack, gunIndex, rec.getDelayAfterFire(stack)); ItemGunBaseNT.setTimer(stack, gunIndex, rec.getDelayAfterFire(stack));
if(rec.getFireSound(stack) != null) entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, rec.getFireSound(stack), rec.getFireVolume(stack), rec.getFirePitch(stack)); if(rec.getFireSound(stack) != null) entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, rec.getFireSound(stack), rec.getFireVolume(stack), rec.getFirePitch(stack));
int remaining = rec.getRoundsPerCycle(stack) - 1; int remaining = rec.getRoundsPerCycle(stack) - 1;
for(int i = 0; i < remaining; i++) if(rec.getCanFire(stack).apply(stack, ctx)) rec.getOnFire(stack).accept(stack, ctx); for(int i = 0; i < remaining; i++) if(rec.getCanFire(stack).apply(stack, ctx)) rec.getOnFire(stack).accept(stack, ctx);
//if not, check if dry firing is allowed for refires //if not, check if dry firing is allowed for refires
@ -124,7 +124,7 @@ public class GunStateDecider {
//if refire after dry is allowed, switch to COOLDOWN which will trigger a refire, otherwise switch to DRAWING //if refire after dry is allowed, switch to COOLDOWN which will trigger a refire, otherwise switch to DRAWING
ItemGunBaseNT.setState(stack, gunIndex, rec.getRefireAfterDry(stack) ? GunState.COOLDOWN : GunState.DRAWING); ItemGunBaseNT.setState(stack, gunIndex, rec.getRefireAfterDry(stack) ? GunState.COOLDOWN : GunState.DRAWING);
ItemGunBaseNT.setTimer(stack, gunIndex, rec.getDelayAfterDryFire(stack)); ItemGunBaseNT.setTimer(stack, gunIndex, rec.getDelayAfterDryFire(stack));
ItemGunBaseNT.playAnimation(player, stack, AnimType.CYCLE_DRY, gunIndex); ItemGunBaseNT.playAnimation(player, stack, GunAnimation.CYCLE_DRY, gunIndex);
//if not, revert to idle //if not, revert to idle
} else { } else {
ItemGunBaseNT.setState(stack, gunIndex, GunState.IDLE); ItemGunBaseNT.setState(stack, gunIndex, GunState.IDLE);
@ -132,7 +132,7 @@ public class GunStateDecider {
} }
//if not, go idle //if not, go idle
} else { } else {
//reload on empty, only for non-refiring guns //reload on empty, only for non-refiring guns
if(rec.getReloadOnEmpty(stack) && rec.getMagazine(stack).getAmount(stack, ctx.inventory) <= 0) { if(rec.getReloadOnEmpty(stack) && rec.getMagazine(stack).getAmount(stack, ctx.inventory) <= 0) {
ItemGunBaseNT.setIsAiming(stack, false); ItemGunBaseNT.setIsAiming(stack, false);
@ -143,12 +143,12 @@ public class GunStateDecider {
mag.setAmountBeforeReload(stack, loaded); mag.setAmountBeforeReload(stack, loaded);
ItemGunBaseNT.setState(stack, ctx.configIndex, GunState.RELOADING); ItemGunBaseNT.setState(stack, ctx.configIndex, GunState.RELOADING);
ItemGunBaseNT.setTimer(stack, ctx.configIndex, rec.getReloadBeginDuration(stack) + (loaded <= 0 ? rec.getReloadCockOnEmptyPre(stack) : 0)); ItemGunBaseNT.setTimer(stack, ctx.configIndex, rec.getReloadBeginDuration(stack) + (loaded <= 0 ? rec.getReloadCockOnEmptyPre(stack) : 0));
ItemGunBaseNT.playAnimation(player, stack, AnimType.RELOAD, ctx.configIndex); ItemGunBaseNT.playAnimation(player, stack, GunAnimation.RELOAD, ctx.configIndex);
} else { } else {
ItemGunBaseNT.setState(stack, gunIndex, GunState.IDLE); ItemGunBaseNT.setState(stack, gunIndex, GunState.IDLE);
ItemGunBaseNT.setTimer(stack, gunIndex, 0); ItemGunBaseNT.setTimer(stack, gunIndex, 0);
} }
} else { } else {
ItemGunBaseNT.setState(stack, gunIndex, GunState.IDLE); ItemGunBaseNT.setState(stack, gunIndex, GunState.IDLE);
ItemGunBaseNT.setTimer(stack, gunIndex, 0); ItemGunBaseNT.setTimer(stack, gunIndex, 0);

View File

@ -25,9 +25,9 @@ import com.hbm.items.weapon.sedna.Receiver;
import com.hbm.items.weapon.sedna.mags.IMagazine; import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.particle.helper.BlackPowderCreator; import com.hbm.particle.helper.BlackPowderCreator;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -38,38 +38,38 @@ import net.minecraftforge.common.util.ForgeDirection;
/** /**
* "LEGO" - i.e. standardized building blocks which can be used to set up gun configs easily. * "LEGO" - i.e. standardized building blocks which can be used to set up gun configs easily.
* *
* small update, 24/11/03: this turned into fucking spaghetti. fuuuuuuuck. * small update, 24/11/03: this turned into fucking spaghetti. fuuuuuuuck.
* *
* @author hbm * @author hbm
*/ */
@NotableComments @NotableComments
public class Lego { public class Lego {
public static final Random ANIM_RAND = new Random(); public static final Random ANIM_RAND = new Random();
/** /**
* If IDLE and the mag of receiver 0 can be loaded, set state to RELOADING. Used by keybinds. */ * If IDLE and the mag of receiver 0 can be loaded, set state to RELOADING. Used by keybinds. */
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_RELOAD = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_RELOAD = (stack, ctx) -> {
EntityPlayer player = ctx.getPlayer(); EntityPlayer player = ctx.getPlayer();
Receiver rec = ctx.config.getReceivers(stack)[0]; Receiver rec = ctx.config.getReceivers(stack)[0];
GunState state = ItemGunBaseNT.getState(stack, ctx.configIndex); GunState state = ItemGunBaseNT.getState(stack, ctx.configIndex);
if(state == GunState.IDLE) { if(state == GunState.IDLE) {
ItemGunBaseNT.setIsAiming(stack, false); ItemGunBaseNT.setIsAiming(stack, false);
IMagazine mag = rec.getMagazine(stack); IMagazine mag = rec.getMagazine(stack);
if(mag.canReload(stack, ctx.inventory)) { if(mag.canReload(stack, ctx.inventory)) {
int loaded = mag.getAmount(stack, ctx.inventory); int loaded = mag.getAmount(stack, ctx.inventory);
mag.setAmountBeforeReload(stack, loaded); mag.setAmountBeforeReload(stack, loaded);
ItemGunBaseNT.setState(stack, ctx.configIndex, GunState.RELOADING); ItemGunBaseNT.setState(stack, ctx.configIndex, GunState.RELOADING);
ItemGunBaseNT.setTimer(stack, ctx.configIndex, rec.getReloadBeginDuration(stack) + (loaded <= 0 ? rec.getReloadCockOnEmptyPre(stack) : 0)); ItemGunBaseNT.setTimer(stack, ctx.configIndex, rec.getReloadBeginDuration(stack) + (loaded <= 0 ? rec.getReloadCockOnEmptyPre(stack) : 0));
ItemGunBaseNT.playAnimation(player, stack, AnimType.RELOAD, ctx.configIndex); ItemGunBaseNT.playAnimation(player, stack, GunAnimation.RELOAD, ctx.configIndex);
if(ctx.config.getReloadChangesType(stack)) mag.initNewType(stack, ctx.inventory); if(ctx.config.getReloadChangesType(stack)) mag.initNewType(stack, ctx.inventory);
} else { } else {
ItemGunBaseNT.playAnimation(player, stack, AnimType.INSPECT, ctx.configIndex); ItemGunBaseNT.playAnimation(player, stack, GunAnimation.INSPECT, ctx.configIndex);
if(!ctx.config.getInspectCancel(stack)) { if(!ctx.config.getInspectCancel(stack)) {
ItemGunBaseNT.setState(stack, ctx.configIndex, GunState.DRAWING); ItemGunBaseNT.setState(stack, ctx.configIndex, GunState.DRAWING);
ItemGunBaseNT.setTimer(stack, ctx.configIndex, ctx.config.getInspectDuration(stack)); ItemGunBaseNT.setTimer(stack, ctx.configIndex, ctx.config.getInspectDuration(stack));
@ -77,10 +77,10 @@ public class Lego {
} }
} }
}; };
/** If IDLE and ammo is loaded, fire and set to JUST_FIRED. */ /** If IDLE and ammo is loaded, fire and set to JUST_FIRED. */
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_CLICK_PRIMARY = (stack, ctx) -> { clickReceiver(stack, ctx, 0); }; public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_CLICK_PRIMARY = (stack, ctx) -> { clickReceiver(stack, ctx, 0); };
public static void clickReceiver(ItemStack stack, LambdaContext ctx, int receiver) { public static void clickReceiver(ItemStack stack, LambdaContext ctx, int receiver) {
EntityLivingBase entity = ctx.entity; EntityLivingBase entity = ctx.entity;
@ -88,42 +88,42 @@ public class Lego {
Receiver rec = ctx.config.getReceivers(stack)[receiver]; Receiver rec = ctx.config.getReceivers(stack)[receiver];
int index = ctx.configIndex; int index = ctx.configIndex;
GunState state = ItemGunBaseNT.getState(stack, index); GunState state = ItemGunBaseNT.getState(stack, index);
if(state == GunState.IDLE) { if(state == GunState.IDLE) {
if(rec.getCanFire(stack).apply(stack, ctx)) { if(rec.getCanFire(stack).apply(stack, ctx)) {
rec.getOnFire(stack).accept(stack, ctx); rec.getOnFire(stack).accept(stack, ctx);
if(rec.getFireSound(stack) != null) if(rec.getFireSound(stack) != null)
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, rec.getFireSound(stack), rec.getFireVolume(stack), rec.getFirePitch(stack)); entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, rec.getFireSound(stack), rec.getFireVolume(stack), rec.getFirePitch(stack));
int remaining = rec.getRoundsPerCycle(stack) - 1; int remaining = rec.getRoundsPerCycle(stack) - 1;
for(int i = 0; i < remaining; i++) if(rec.getCanFire(stack).apply(stack, ctx)) rec.getOnFire(stack).accept(stack, ctx); for(int i = 0; i < remaining; i++) if(rec.getCanFire(stack).apply(stack, ctx)) rec.getOnFire(stack).accept(stack, ctx);
ItemGunBaseNT.setState(stack, index, GunState.COOLDOWN); ItemGunBaseNT.setState(stack, index, GunState.COOLDOWN);
ItemGunBaseNT.setTimer(stack, index, rec.getDelayAfterFire(stack)); ItemGunBaseNT.setTimer(stack, index, rec.getDelayAfterFire(stack));
} else { } else {
if(rec.getDoesDryFire(stack)) { if(rec.getDoesDryFire(stack)) {
ItemGunBaseNT.playAnimation(player, stack, AnimType.CYCLE_DRY, index); ItemGunBaseNT.playAnimation(player, stack, GunAnimation.CYCLE_DRY, index);
ItemGunBaseNT.setState(stack, index, rec.getRefireAfterDry(stack) ? GunState.COOLDOWN : GunState.DRAWING); ItemGunBaseNT.setState(stack, index, rec.getRefireAfterDry(stack) ? GunState.COOLDOWN : GunState.DRAWING);
ItemGunBaseNT.setTimer(stack, index, rec.getDelayAfterDryFire(stack)); ItemGunBaseNT.setTimer(stack, index, rec.getDelayAfterDryFire(stack));
} }
} }
} }
if(state == GunState.RELOADING) { if(state == GunState.RELOADING) {
ItemGunBaseNT.setReloadCancel(stack, true); ItemGunBaseNT.setReloadCancel(stack, true);
} }
} }
/** If IDLE, switch mode between 0 and 1. */ /** If IDLE, switch mode between 0 and 1. */
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_CLICK_SECONDARY = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_CLICK_SECONDARY = (stack, ctx) -> {
EntityLivingBase entity = ctx.entity; EntityLivingBase entity = ctx.entity;
int index = ctx.configIndex; int index = ctx.configIndex;
GunState state = ItemGunBaseNT.getState(stack, index); GunState state = ItemGunBaseNT.getState(stack, index);
if(state == GunState.IDLE) { if(state == GunState.IDLE) {
int mode = ItemGunBaseNT.getMode(stack, 0); int mode = ItemGunBaseNT.getMode(stack, 0);
ItemGunBaseNT.setMode(stack, index, 1 - mode); ItemGunBaseNT.setMode(stack, index, 1 - mode);
@ -133,12 +133,12 @@ public class Lego {
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, "hbm:weapon.switchmode2", 1F, 1F); entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, "hbm:weapon.switchmode2", 1F, 1F);
} }
}; };
/** Default smoke. */ /** Default smoke. */
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_SMOKE = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_SMOKE = (stack, ctx) -> {
handleStandardSmoke(ctx.entity, stack, 2000, 0.025D, 1.15D, ctx.configIndex); handleStandardSmoke(ctx.entity, stack, 2000, 0.025D, 1.15D, ctx.configIndex);
}; };
public static void handleStandardSmoke(EntityLivingBase entity, ItemStack stack, int smokeDuration, double alphaDecay, double widthGrowth, int index) { public static void handleStandardSmoke(EntityLivingBase entity, ItemStack stack, int smokeDuration, double alphaDecay, double widthGrowth, int index) {
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem(); ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
long lastShot = gun.lastShot[index]; long lastShot = gun.lastShot[index];
@ -146,14 +146,14 @@ public class Lego {
boolean smoking = lastShot + smokeDuration > System.currentTimeMillis(); boolean smoking = lastShot + smokeDuration > System.currentTimeMillis();
if(!smoking && !smokeNodes.isEmpty()) smokeNodes.clear(); if(!smoking && !smokeNodes.isEmpty()) smokeNodes.clear();
if(smoking) { if(smoking) {
Vec3 prev = Vec3.createVectorHelper(-entity.motionX, -entity.motionY, -entity.motionZ); Vec3 prev = Vec3.createVectorHelper(-entity.motionX, -entity.motionY, -entity.motionZ);
prev.rotateAroundY((float) (entity.rotationYaw * Math.PI / 180D)); prev.rotateAroundY((float) (entity.rotationYaw * Math.PI / 180D));
double accel = 15D; double accel = 15D;
double side = (entity.rotationYaw - entity.prevRotationYawHead) * 0.1D; double side = (entity.rotationYaw - entity.prevRotationYawHead) * 0.1D;
double waggle = 0.025D; double waggle = 0.025D;
for(SmokeNode node : smokeNodes) { for(SmokeNode node : smokeNodes) {
node.forward += -prev.zCoord * accel + entity.worldObj.rand.nextGaussian() * waggle; node.forward += -prev.zCoord * accel + entity.worldObj.rand.nextGaussian() * waggle;
node.lift += prev.yCoord + 1.5D; node.lift += prev.yCoord + 1.5D;
@ -161,50 +161,50 @@ public class Lego {
if(node.alpha > 0) node.alpha -= alphaDecay; if(node.alpha > 0) node.alpha -= alphaDecay;
node.width *= widthGrowth; node.width *= widthGrowth;
} }
double alpha = (System.currentTimeMillis() - lastShot) / (double) smokeDuration; double alpha = (System.currentTimeMillis() - lastShot) / (double) smokeDuration;
alpha = (1 - alpha) * 0.5D; alpha = (1 - alpha) * 0.5D;
if(gun.getState(stack, index) == GunState.RELOADING || smokeNodes.size() == 0) alpha = 0; if(gun.getState(stack, index) == GunState.RELOADING || smokeNodes.size() == 0) alpha = 0;
smokeNodes.add(new SmokeNode(alpha)); smokeNodes.add(new SmokeNode(alpha));
} }
} }
/** Toggles isAiming. Used by keybinds. */ /** Toggles isAiming. Used by keybinds. */
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_TOGGLE_AIM = (stack, ctx) -> { ItemGunBaseNT.setIsAiming(stack, !ItemGunBaseNT.getIsAiming(stack)); }; public static BiConsumer<ItemStack, LambdaContext> LAMBDA_TOGGLE_AIM = (stack, ctx) -> { ItemGunBaseNT.setIsAiming(stack, !ItemGunBaseNT.getIsAiming(stack)); };
/** Returns true if the mag has ammo in it. Used by keybind functions on whether to fire, and deciders on whether to trigger a refire. */ /** Returns true if the mag has ammo in it. Used by keybind functions on whether to fire, and deciders on whether to trigger a refire. */
public static BiFunction<ItemStack, LambdaContext, Boolean> LAMBDA_STANDARD_CAN_FIRE = (stack, ctx) -> { return ctx.config.getReceivers(stack)[0].getMagazine(stack).getAmount(stack, ctx.inventory) > 0; }; public static BiFunction<ItemStack, LambdaContext, Boolean> LAMBDA_STANDARD_CAN_FIRE = (stack, ctx) -> { return ctx.config.getReceivers(stack)[0].getMagazine(stack).getAmount(stack, ctx.inventory) > 0; };
/** Returns true if the mag has ammo in it, and the gun is in the locked on state */ /** Returns true if the mag has ammo in it, and the gun is in the locked on state */
public static BiFunction<ItemStack, LambdaContext, Boolean> LAMBDA_LOCKON_CAN_FIRE = (stack, ctx) -> { return ctx.config.getReceivers(stack)[0].getMagazine(stack).getAmount(stack, ctx.inventory) > 0 && ItemGunBaseNT.getIsLockedOn(stack); }; public static BiFunction<ItemStack, LambdaContext, Boolean> LAMBDA_LOCKON_CAN_FIRE = (stack, ctx) -> { return ctx.config.getReceivers(stack)[0].getMagazine(stack).getAmount(stack, ctx.inventory) > 0 && ItemGunBaseNT.getIsLockedOn(stack); };
/** JUMPER - bypasses mag testing and just allows constant fire */ /** JUMPER - bypasses mag testing and just allows constant fire */
public static BiFunction<ItemStack, LambdaContext, Boolean> LAMBDA_DEBUG_CAN_FIRE = (stack, ctx) -> { return true; }; public static BiFunction<ItemStack, LambdaContext, Boolean> LAMBDA_DEBUG_CAN_FIRE = (stack, ctx) -> { return true; };
/** Spawns an EntityBulletBaseMK4 with the loaded bulletcfg */ /** Spawns an EntityBulletBaseMK4 with the loaded bulletcfg */
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_FIRE = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_FIRE = (stack, ctx) -> {
doStandardFire(stack, ctx, AnimType.CYCLE, true); doStandardFire(stack, ctx, GunAnimation.CYCLE, true);
}; };
/** Spawns an EntityBulletBaseMK4 with the loaded bulletcfg, ignores wear */ /** Spawns an EntityBulletBaseMK4 with the loaded bulletcfg, ignores wear */
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_NOWEAR_FIRE = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_NOWEAR_FIRE = (stack, ctx) -> {
doStandardFire(stack, ctx, AnimType.CYCLE, false); doStandardFire(stack, ctx, GunAnimation.CYCLE, false);
}; };
/** Spawns an EntityBulletBaseMK4 with the loaded bulletcfg, then resets lockon progress */ /** Spawns an EntityBulletBaseMK4 with the loaded bulletcfg, then resets lockon progress */
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_LOCKON_FIRE = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_LOCKON_FIRE = (stack, ctx) -> {
doStandardFire(stack, ctx, AnimType.CYCLE, true); doStandardFire(stack, ctx, GunAnimation.CYCLE, true);
ItemGunBaseNT.setIsLockedOn(stack, false); ItemGunBaseNT.setIsLockedOn(stack, false);
}; };
public static void doStandardFire(ItemStack stack, LambdaContext ctx, AnimType anim, boolean calcWear) { public static void doStandardFire(ItemStack stack, LambdaContext ctx, GunAnimation anim, boolean calcWear) {
EntityLivingBase entity = ctx.entity; EntityLivingBase entity = ctx.entity;
EntityPlayer player = ctx.getPlayer(); EntityPlayer player = ctx.getPlayer();
int index = ctx.configIndex; int index = ctx.configIndex;
if(anim != null) ItemGunBaseNT.playAnimation(player, stack, anim, ctx.configIndex); if(anim != null) ItemGunBaseNT.playAnimation(player, stack, anim, ctx.configIndex);
boolean aim = ItemGunBaseNT.getIsAiming(stack); boolean aim = ItemGunBaseNT.getIsAiming(stack);
Receiver primary = ctx.config.getReceivers(stack)[0]; Receiver primary = ctx.config.getReceivers(stack)[0];
IMagazine mag = primary.getMagazine(stack); IMagazine mag = primary.getMagazine(stack);
@ -214,19 +214,19 @@ public class Lego {
double forwardOffset = offset.xCoord; double forwardOffset = offset.xCoord;
double heightOffset = offset.yCoord; double heightOffset = offset.yCoord;
double sideOffset = offset.zCoord; double sideOffset = offset.zCoord;
/*forwardOffset = 0.75; /*forwardOffset = 0.75;
heightOffset = -0.125; heightOffset = -0.125;
sideOffset = -0.25D;*/ sideOffset = -0.25D;*/
int projectiles = config.projectilesMin; int projectiles = config.projectilesMin;
if(config.projectilesMax > config.projectilesMin) projectiles += entity.getRNG().nextInt(config.projectilesMax - config.projectilesMin + 1); if(config.projectilesMax > config.projectilesMin) projectiles += entity.getRNG().nextInt(config.projectilesMax - config.projectilesMin + 1);
projectiles = (int) (projectiles * primary.getSplitProjectiles(stack)); projectiles = (int) (projectiles * primary.getSplitProjectiles(stack));
for(int i = 0; i < projectiles; i++) { for(int i = 0; i < projectiles; i++) {
float damage = calcDamage(ctx, stack, primary, calcWear, index); float damage = calcDamage(ctx, stack, primary, calcWear, index);
float spread = calcSpread(ctx, stack, primary, config, calcWear, index, aim); float spread = calcSpread(ctx, stack, primary, config, calcWear, index, aim);
if(config.pType == ProjectileType.BULLET) { if(config.pType == ProjectileType.BULLET) {
EntityBulletBaseMK4 mk4 = new EntityBulletBaseMK4(entity, config, damage, spread, sideOffset, heightOffset, forwardOffset); EntityBulletBaseMK4 mk4 = new EntityBulletBaseMK4(entity, config, damage, spread, sideOffset, heightOffset, forwardOffset);
if(ItemGunBaseNT.getIsLockedOn(stack)) mk4.lockonTarget = entity.worldObj.getEntityByID(ItemGunBaseNT.getLockonTarget(stack)); if(ItemGunBaseNT.getIsLockedOn(stack)) mk4.lockonTarget = entity.worldObj.getEntityByID(ItemGunBaseNT.getLockonTarget(stack));
@ -242,18 +242,18 @@ public class Lego {
entity.worldObj.spawnEntityInWorld(mk4); entity.worldObj.spawnEntityInWorld(mk4);
} }
} }
if(player != null) player.addStat(MainRegistry.statBullets, 1); if(player != null) player.addStat(MainRegistry.statBullets, 1);
mag.useUpAmmo(stack, ctx.inventory, 1); mag.useUpAmmo(stack, ctx.inventory, 1);
if(calcWear) ItemGunBaseNT.setWear(stack, index, Math.min(ItemGunBaseNT.getWear(stack, index) + config.wear, ctx.config.getDurability(stack))); if(calcWear) ItemGunBaseNT.setWear(stack, index, Math.min(ItemGunBaseNT.getWear(stack, index) + config.wear, ctx.config.getDurability(stack)));
} }
public static float getStandardWearSpread(ItemStack stack, GunConfig config, int index) { public static float getStandardWearSpread(ItemStack stack, GunConfig config, int index) {
float percent = (float) ItemGunBaseNT.getWear(stack, index) / config.getDurability(stack); float percent = (float) ItemGunBaseNT.getWear(stack, index) / config.getDurability(stack);
if(percent < 0.5F) return 0F; if(percent < 0.5F) return 0F;
return (percent - 0.5F) * 2F; return (percent - 0.5F) * 2F;
} }
/** Returns the standard multiplier for damage based on wear */ /** Returns the standard multiplier for damage based on wear */
public static float getStandardWearDamage(ItemStack stack, GunConfig config, int index) { public static float getStandardWearDamage(ItemStack stack, GunConfig config, int index) {
float percent = (float) ItemGunBaseNT.getWear(stack, index) / config.getDurability(stack); float percent = (float) ItemGunBaseNT.getWear(stack, index) / config.getDurability(stack);
@ -265,7 +265,7 @@ public class Lego {
public static float calcDamage(LambdaContext ctx, ItemStack stack, Receiver primary, boolean calcWear, int index) { public static float calcDamage(LambdaContext ctx, ItemStack stack, Receiver primary, boolean calcWear, int index) {
return primary.getBaseDamage(stack) * (calcWear ? getStandardWearDamage(stack, ctx.config, index) : 1); return primary.getBaseDamage(stack) * (calcWear ? getStandardWearDamage(stack, ctx.config, index) : 1);
} }
public static float calcSpread(LambdaContext ctx, ItemStack stack, Receiver primary, BulletConfig config, boolean calcWear, int index, boolean aim) { public static float calcSpread(LambdaContext ctx, ItemStack stack, Receiver primary, BulletConfig config, boolean calcWear, int index, boolean aim) {
// the gun's innate spread, SMGs will have poor accuracy no matter what // the gun's innate spread, SMGs will have poor accuracy no matter what
float spreadInnate = primary.getInnateSpread(stack); float spreadInnate = primary.getInnateSpread(stack);
@ -275,10 +275,10 @@ public class Lego {
float spreadHipfire = aim ? 0F : primary.getHipfireSpread(stack); float spreadHipfire = aim ? 0F : primary.getHipfireSpread(stack);
// extra spread caused by weapon durability, [0;0.125] by default // extra spread caused by weapon durability, [0;0.125] by default
float spreadWear = !calcWear ? 0F : (getStandardWearSpread(stack, ctx.config, index) * primary.getDurabilitySpread(stack)); float spreadWear = !calcWear ? 0F : (getStandardWearSpread(stack, ctx.config, index) * primary.getDurabilitySpread(stack));
return spreadInnate + spreadAmmo + spreadHipfire + spreadWear; return spreadInnate + spreadAmmo + spreadHipfire + spreadWear;
} }
public static void standardExplode(EntityBulletBaseMK4 bullet, MovingObjectPosition mop, float range) { standardExplode(bullet, mop, range, 1F); } public static void standardExplode(EntityBulletBaseMK4 bullet, MovingObjectPosition mop, float range) { standardExplode(bullet, mop, range, 1F); }
public static void standardExplode(EntityBulletBaseMK4 bullet, MovingObjectPosition mop, float range, float damageMod) { public static void standardExplode(EntityBulletBaseMK4 bullet, MovingObjectPosition mop, float range, float damageMod) {
ExplosionVNT vnt = new ExplosionVNT(bullet.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, range, bullet.getThrower()); ExplosionVNT vnt = new ExplosionVNT(bullet.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, range, bullet.getThrower());
@ -301,9 +301,9 @@ public class Lego {
vnt.setSFX(new ExplosionEffectTiny()); vnt.setSFX(new ExplosionEffectTiny());
vnt.explode(); vnt.explode();
} }
/** anims for the DEBUG revolver, mostly a copy of the li'lpip but with some fixes regarding the cylinder movement */ /** anims for the DEBUG revolver, mostly a copy of the li'lpip but with some fixes regarding the cylinder movement */
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_DEBUG_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_DEBUG_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case CYCLE: return new BusAnimation() case CYCLE: return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, 0, 50).addPos(0, 0, -3, 50).addPos(0, 0, 0, 250)) .addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, 0, 50).addPos(0, 0, -3, 50).addPos(0, 0, 0, 250))
@ -325,15 +325,15 @@ public class Lego {
.addBus("RELAOD_TILT", new BusAnimationSequence().addPos(-15, 0, 0, 100).addPos(65, 0, 0, 100).addPos(45, 0, 0, 50).addPos(0, 0, 0, 200).addPos(0, 0, 0, 200).addPos(-80, 0, 0, 100).addPos(-80, 0, 0, 100).addPos(0, 0, 0, 200)) .addBus("RELAOD_TILT", new BusAnimationSequence().addPos(-15, 0, 0, 100).addPos(65, 0, 0, 100).addPos(45, 0, 0, 50).addPos(0, 0, 0, 200).addPos(0, 0, 0, 200).addPos(-80, 0, 0, 100).addPos(-80, 0, 0, 100).addPos(0, 0, 0, 200))
.addBus("RELOAD_CYLINDER", new BusAnimationSequence().addPos(0, 0, 0, 200).addPos(90, 0, 0, 100).addPos(90, 0, 0, 450).addPos(0, 0, 0, 70)); .addBus("RELOAD_CYLINDER", new BusAnimationSequence().addPos(0, 0, 0, 200).addPos(90, 0, 0, 100).addPos(90, 0, 0, 450).addPos(0, 0, 0, 70));
} }
return null; return null;
}; };
/* /*
* Be honest. Do you genuinely think posting a random screenshot of your game with absolutely ZERO context of what modpack, what * Be honest. Do you genuinely think posting a random screenshot of your game with absolutely ZERO context of what modpack, what
* Shaders if any or literally any context at all would come to a magic solution? * Shaders if any or literally any context at all would come to a magic solution?
* For all we know you accidentally rubbed Vaseline all over your monitor and jizzed in the hdmi socket of your pc * For all we know you accidentally rubbed Vaseline all over your monitor and jizzed in the hdmi socket of your pc
* *
* ~ u/Wolfyy47_, 2024 * ~ u/Wolfyy47_, 2024
*/ */
} }

View File

@ -17,10 +17,10 @@ import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType; import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
@ -32,7 +32,7 @@ public class XFactory10ga {
public static BulletConfig g10_du; public static BulletConfig g10_du;
public static BulletConfig g10_slug; public static BulletConfig g10_slug;
public static BulletConfig g10_explosive; public static BulletConfig g10_explosive;
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_TINY_EXPLODE = (bullet, mop) -> { public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_TINY_EXPLODE = (bullet, mop) -> {
if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3 && mop.entityHit == bullet.getThrower()) return; if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3 && mop.entityHit == bullet.getThrower()) return;
Lego.tinyExplode(bullet, mop, 1.5F); bullet.setDead(); Lego.tinyExplode(bullet, mop, 1.5F); bullet.setDead();
@ -79,12 +79,12 @@ public class XFactory10ga {
.anim(XFactory12ga.LAMBDA_SEXY_ANIMS).orchestra(Orchestras.ORCHESTRA_SHREDDER_SEXY) .anim(XFactory12ga.LAMBDA_SEXY_ANIMS).orchestra(Orchestras.ORCHESTRA_SHREDDER_SEXY)
).setUnlocalizedName("gun_autoshotgun_heretic"); ).setUnlocalizedName("gun_autoshotgun_heretic");
} }
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_DOUBLE_BARREL = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_DOUBLE_BARREL = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil(10, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5)); ItemGunBaseNT.setupRecoil(10, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5));
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_DOUBLE_BARREL_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_DOUBLE_BARREL_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(-60, 0, 0, 0).addPos(0, 0, -3, 500, IType.SIN_DOWN)); .addBus("EQUIP", new BusAnimationSequence().addPos(-60, 0, 0, 0).addPos(0, 0, -3, 500, IType.SIN_DOWN));
@ -148,7 +148,7 @@ public class XFactory10ga {
.addPos(-5, 0, 0, 150, IType.SIN_DOWN) .addPos(-5, 0, 0, 150, IType.SIN_DOWN)
.addPos(0, 0, 0, 100, IType.SIN_FULL)); .addPos(0, 0, 0, 100, IType.SIN_FULL));
} }
return null; return null;
}; };
} }

View File

@ -32,10 +32,10 @@ import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toclient.AuxParticlePacketNT; import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType; import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.util.BobMathUtil; import com.hbm.util.BobMathUtil;
import com.hbm.util.TrackerUtil; import com.hbm.util.TrackerUtil;
import com.hbm.util.Vec3NT; import com.hbm.util.Vec3NT;
@ -86,11 +86,11 @@ public class XFactory12ga {
public static BulletConfig g12_sub_magnum; public static BulletConfig g12_sub_magnum;
public static BulletConfig g12_sub_explosive; public static BulletConfig g12_sub_explosive;
public static BulletConfig g12_sub_phosphorus; public static BulletConfig g12_sub_phosphorus;
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_STANDARD_EXPLODE = (bullet, mop) -> { public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_STANDARD_EXPLODE = (bullet, mop) -> {
Lego.standardExplode(bullet, mop, 2F); bullet.setDead(); Lego.standardExplode(bullet, mop, 2F); bullet.setDead();
}; };
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_BOAT = (bullet, mop) -> { public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_BOAT = (bullet, mop) -> {
EntityDuchessGambit pippo = new EntityDuchessGambit(bullet.worldObj); EntityDuchessGambit pippo = new EntityDuchessGambit(bullet.worldObj);
pippo.posX = mop.hitVec.xCoord; pippo.posX = mop.hitVec.xCoord;
@ -100,13 +100,13 @@ public class XFactory12ga {
bullet.worldObj.playSoundEffect(pippo.posX, pippo.posY + 50, pippo.posZ, "hbm:weapon.boat", 100F, 1F); bullet.worldObj.playSoundEffect(pippo.posX, pippo.posY + 50, pippo.posZ, "hbm:weapon.boat", 100F, 1F);
bullet.setDead(); bullet.setDead();
}; };
public static BulletConfig makeShredderConfig(BulletConfig original, BulletConfig submunition) { public static BulletConfig makeShredderConfig(BulletConfig original, BulletConfig submunition) {
BulletConfig cfg = new BulletConfig().setBeam().setRenderRotations(false).setLife(5).setDamage(original.damageMult * original.projectilesMax).setupDamageClass(DamageClass.LASER); BulletConfig cfg = new BulletConfig().setBeam().setRenderRotations(false).setLife(5).setDamage(original.damageMult * original.projectilesMax).setupDamageClass(DamageClass.LASER);
cfg.setItem(original.ammo); cfg.setItem(original.ammo);
cfg.setCasing(original.casing); cfg.setCasing(original.casing);
cfg.setOnBeamImpact((beam, mop) -> { cfg.setOnBeamImpact((beam, mop) -> {
int projectiles = submunition.projectilesMin; int projectiles = submunition.projectilesMin;
if(submunition.projectilesMax > submunition.projectilesMin) projectiles += beam.worldObj.rand.nextInt(submunition.projectilesMax - submunition.projectilesMin + 1); if(submunition.projectilesMax > submunition.projectilesMin) projectiles += beam.worldObj.rand.nextInt(submunition.projectilesMax - submunition.projectilesMin + 1);
@ -117,9 +117,9 @@ public class XFactory12ga {
mop.hitVec.xCoord += dir.offsetX * 0.1; mop.hitVec.xCoord += dir.offsetX * 0.1;
mop.hitVec.yCoord += dir.offsetY * 0.1; mop.hitVec.yCoord += dir.offsetY * 0.1;
mop.hitVec.zCoord += dir.offsetZ * 0.1; mop.hitVec.zCoord += dir.offsetZ * 0.1;
spawnPulse(beam.worldObj, mop, beam.rotationYaw, beam.rotationPitch); spawnPulse(beam.worldObj, mop, beam.rotationYaw, beam.rotationPitch);
List<Entity> blast = beam.worldObj.getEntitiesWithinAABBExcludingEntity(beam, AxisAlignedBB.getBoundingBox(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord).expand(0.75, 0.75, 0.75)); List<Entity> blast = beam.worldObj.getEntitiesWithinAABBExcludingEntity(beam, AxisAlignedBB.getBoundingBox(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord).expand(0.75, 0.75, 0.75));
DamageSource source = BulletConfig.getDamage(beam, beam.getThrower(), DamageClass.LASER); DamageSource source = BulletConfig.getDamage(beam, beam.getThrower(), DamageClass.LASER);
@ -132,17 +132,17 @@ public class XFactory12ga {
e.attackEntityFrom(source, beam.damage); e.attackEntityFrom(source, beam.damage);
} }
} }
for(int i = 0; i < projectiles; i++) { for(int i = 0; i < projectiles; i++) {
EntityBulletBaseMK4 bullet = new EntityBulletBaseMK4(beam.worldObj, beam.thrower, submunition, beam.damage * submunition.damageMult, 0.2F, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, dir.offsetX, dir.offsetY, dir.offsetZ); EntityBulletBaseMK4 bullet = new EntityBulletBaseMK4(beam.worldObj, beam.thrower, submunition, beam.damage * submunition.damageMult, 0.2F, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, dir.offsetX, dir.offsetY, dir.offsetZ);
bullet.worldObj.spawnEntityInWorld(bullet); bullet.worldObj.spawnEntityInWorld(bullet);
} }
} }
if(mop.typeOfHit == mop.typeOfHit.ENTITY) { if(mop.typeOfHit == mop.typeOfHit.ENTITY) {
spawnPulse(beam.worldObj, mop, beam.rotationYaw, beam.rotationPitch); spawnPulse(beam.worldObj, mop, beam.rotationYaw, beam.rotationPitch);
for(int i = 0; i < projectiles; i++) { for(int i = 0; i < projectiles; i++) {
Vec3NT vec = new Vec3NT(beam.worldObj.rand.nextGaussian(), beam.worldObj.rand.nextGaussian(), beam.worldObj.rand.nextGaussian()).normalizeSelf(); Vec3NT vec = new Vec3NT(beam.worldObj.rand.nextGaussian(), beam.worldObj.rand.nextGaussian(), beam.worldObj.rand.nextGaussian()).normalizeSelf();
EntityBulletBaseMK4 bullet = new EntityBulletBaseMK4(beam.worldObj, beam.thrower, submunition, beam.damage * submunition.damageMult, 0.2F, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, vec.xCoord, vec.yCoord, vec.zCoord); EntityBulletBaseMK4 bullet = new EntityBulletBaseMK4(beam.worldObj, beam.thrower, submunition, beam.damage * submunition.damageMult, 0.2F, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, vec.xCoord, vec.yCoord, vec.zCoord);
@ -152,18 +152,18 @@ public class XFactory12ga {
}); });
return cfg; return cfg;
} }
public static BulletConfig makeShredderSubmunition(BulletConfig original) { public static BulletConfig makeShredderSubmunition(BulletConfig original) {
BulletConfig cfg = original.clone(); BulletConfig cfg = original.clone();
cfg.setRicochetAngle(90).setRicochetCount(3).setVel(0.5F).setLife(50).setupDamageClass(DamageClass.LASER).setOnRicochet(LAMBDA_SHREDDER_RICOCHET); cfg.setRicochetAngle(90).setRicochetCount(3).setVel(0.5F).setLife(50).setupDamageClass(DamageClass.LASER).setOnRicochet(LAMBDA_SHREDDER_RICOCHET);
return cfg; return cfg;
} }
//this sucks //this sucks
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_SHREDDER_RICOCHET = (bullet, mop) -> { public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_SHREDDER_RICOCHET = (bullet, mop) -> {
if(mop.typeOfHit == mop.typeOfHit.BLOCK) { if(mop.typeOfHit == mop.typeOfHit.BLOCK) {
Block b = bullet.worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ); Block b = bullet.worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ);
if(b.getMaterial() == Material.glass) { if(b.getMaterial() == Material.glass) {
bullet.worldObj.func_147480_a(mop.blockX, mop.blockY, mop.blockZ, false); bullet.worldObj.func_147480_a(mop.blockX, mop.blockY, mop.blockZ, false);
@ -185,12 +185,12 @@ public class XFactory12ga {
double angle = Math.abs(BobMathUtil.getCrossAngle(vel, face) - 90); double angle = Math.abs(BobMathUtil.getCrossAngle(vel, face) - 90);
if(angle <= bullet.config.ricochetAngle) { if(angle <= bullet.config.ricochetAngle) {
spawnPulse(bullet.worldObj, mop, bullet.rotationYaw, bullet.rotationPitch); spawnPulse(bullet.worldObj, mop, bullet.rotationYaw, bullet.rotationPitch);
List<Entity> blast = bullet.worldObj.getEntitiesWithinAABBExcludingEntity(bullet, AxisAlignedBB.getBoundingBox(bullet.posX, bullet.posY, bullet.posZ, bullet.posX, bullet.posY, bullet.posZ).expand(0.5, 0.5, 0.5)); List<Entity> blast = bullet.worldObj.getEntitiesWithinAABBExcludingEntity(bullet, AxisAlignedBB.getBoundingBox(bullet.posX, bullet.posY, bullet.posZ, bullet.posX, bullet.posY, bullet.posZ).expand(0.5, 0.5, 0.5));
DamageSource source = BulletConfig.getDamage(bullet, bullet.getThrower(), DamageClass.LASER); DamageSource source = BulletConfig.getDamage(bullet, bullet.getThrower(), DamageClass.LASER);
for(Entity e : blast) { for(Entity e : blast) {
if(!e.isEntityAlive()) continue; if(!e.isEntityAlive()) continue;
if(e instanceof EntityLivingBase) { if(e instanceof EntityLivingBase) {
@ -200,13 +200,13 @@ public class XFactory12ga {
e.attackEntityFrom(source, bullet.damage); e.attackEntityFrom(source, bullet.damage);
} }
} }
bullet.ricochets++; bullet.ricochets++;
if(bullet.ricochets > bullet.config.maxRicochetCount) { if(bullet.ricochets > bullet.config.maxRicochetCount) {
bullet.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord); bullet.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
bullet.setDead(); bullet.setDead();
} }
switch(mop.sideHit) { switch(mop.sideHit) {
case 0: case 1: bullet.motionY *= -1; break; case 0: case 1: bullet.motionY *= -1; break;
case 2: case 3: bullet.motionZ *= -1; break; case 2: case 3: bullet.motionZ *= -1; break;
@ -223,13 +223,13 @@ public class XFactory12ga {
} }
} }
}; };
public static void spawnPulse(World world, MovingObjectPosition mop, float yaw, float pitch) { public static void spawnPulse(World world, MovingObjectPosition mop, float yaw, float pitch) {
double x = mop.hitVec.xCoord; double x = mop.hitVec.xCoord;
double y = mop.hitVec.yCoord; double y = mop.hitVec.yCoord;
double z = mop.hitVec.zCoord; double z = mop.hitVec.zCoord;
if(mop.typeOfHit == mop.typeOfHit.BLOCK) { if(mop.typeOfHit == mop.typeOfHit.BLOCK) {
if(mop.sideHit == ForgeDirection.UP.ordinal()) { yaw = 0F; pitch = 0F; } if(mop.sideHit == ForgeDirection.UP.ordinal()) { yaw = 0F; pitch = 0F; }
if(mop.sideHit == ForgeDirection.DOWN.ordinal()) { yaw = 0F; pitch = 0F; } if(mop.sideHit == ForgeDirection.DOWN.ordinal()) { yaw = 0F; pitch = 0F; }
@ -255,7 +255,7 @@ public class XFactory12ga {
data.setFloat("scale", 0.75F); data.setFloat("scale", 0.75F);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(world.provider.dimensionId, x, y, z, 100)); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(world.provider.dimensionId, x, y, z, 100));
} }
public static void init() { public static void init() {
float buckshotSpread = 0.035F; float buckshotSpread = 0.035F;
@ -288,7 +288,7 @@ public class XFactory12ga {
g12_shredder_magnum = makeShredderConfig(g12_magnum, g12_sub_magnum); g12_shredder_magnum = makeShredderConfig(g12_magnum, g12_sub_magnum);
g12_shredder_explosive = makeShredderConfig(g12_explosive, g12_sub_explosive); g12_shredder_explosive = makeShredderConfig(g12_explosive, g12_sub_explosive);
g12_shredder_phosphorus = makeShredderConfig(g12_phosphorus, g12_sub_phosphorus); g12_shredder_phosphorus = makeShredderConfig(g12_phosphorus, g12_sub_phosphorus);
ModItems.gun_maresleg = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig() ModItems.gun_maresleg = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig()
.dura(600).draw(10).inspect(39).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE) .dura(600).draw(10).inspect(39).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0) .rec(new Receiver(0)
@ -330,7 +330,7 @@ public class XFactory12ga {
.setupStandardConfiguration() .setupStandardConfiguration()
.anim(LAMBDA_MARESLEG_SHORT_ANIMS).orchestra(Orchestras.ORCHESTRA_MARESLEG_SHORT) .anim(LAMBDA_MARESLEG_SHORT_ANIMS).orchestra(Orchestras.ORCHESTRA_MARESLEG_SHORT)
).setUnlocalizedName("gun_maresleg_broken"); ).setUnlocalizedName("gun_maresleg_broken");
ModItems.gun_liberator = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig() ModItems.gun_liberator = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig()
.dura(200).draw(20).inspect(21).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE) .dura(200).draw(20).inspect(21).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0) .rec(new Receiver(0)
@ -373,7 +373,7 @@ public class XFactory12ga {
.setupStandardConfiguration() .setupStandardConfiguration()
.anim(LAMBDA_SHREDDER_ANIMS).orchestra(Orchestras.ORCHESTRA_SHREDDER) .anim(LAMBDA_SHREDDER_ANIMS).orchestra(Orchestras.ORCHESTRA_SHREDDER)
).setUnlocalizedName("gun_autoshotgun_shredder"); ).setUnlocalizedName("gun_autoshotgun_shredder");
ModItems.gun_autoshotgun_sexy = new ItemGunBaseNT(WeaponQuality.LEGENDARY, new GunConfig() ModItems.gun_autoshotgun_sexy = new ItemGunBaseNT(WeaponQuality.LEGENDARY, new GunConfig()
.dura(5_000).draw(20).inspect(65).reloadSequential(true).inspectCancel(false).crosshair(Crosshair.L_CIRCLE).hideCrosshair(false).smoke(Lego.LAMBDA_STANDARD_SMOKE) .dura(5_000).draw(20).inspect(65).reloadSequential(true).inspectCancel(false).crosshair(Crosshair.L_CIRCLE).hideCrosshair(false).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0) .rec(new Receiver(0)
@ -385,28 +385,28 @@ public class XFactory12ga {
.anim(LAMBDA_SEXY_ANIMS).orchestra(Orchestras.ORCHESTRA_SHREDDER_SEXY) .anim(LAMBDA_SEXY_ANIMS).orchestra(Orchestras.ORCHESTRA_SHREDDER_SEXY)
).setUnlocalizedName("gun_autoshotgun_sexy"); ).setUnlocalizedName("gun_autoshotgun_sexy");
} }
public static Function<ItemStack, String> LAMBDA_NAME_MARESLEG = (stack) -> { public static Function<ItemStack, String> LAMBDA_NAME_MARESLEG = (stack) -> {
if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SAWED_OFF)) return stack.getUnlocalizedName() + "_short"; if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SAWED_OFF)) return stack.getUnlocalizedName() + "_short";
return null; return null;
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_MARESLEG = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_MARESLEG = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil(10, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5)); ItemGunBaseNT.setupRecoil(10, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5));
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_LIBERATOR = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_LIBERATOR = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil(5, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5)); ItemGunBaseNT.setupRecoil(5, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5));
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_AUTOSHOTGUN = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_AUTOSHOTGUN = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil((float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5) + 1.5F, (float) (ctx.getPlayer().getRNG().nextGaussian() * 0.5)); ItemGunBaseNT.setupRecoil((float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5) + 1.5F, (float) (ctx.getPlayer().getRNG().nextGaussian() * 0.5));
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_SEXY = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_SEXY = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil((float) (ctx.getPlayer().getRNG().nextGaussian() * 0.5), (float) (ctx.getPlayer().getRNG().nextGaussian() * 0.5)); ItemGunBaseNT.setupRecoil((float) (ctx.getPlayer().getRNG().nextGaussian() * 0.5), (float) (ctx.getPlayer().getRNG().nextGaussian() * 0.5));
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SPAS_SECONDARY = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SPAS_SECONDARY = (stack, ctx) -> {
EntityLivingBase entity = ctx.entity; EntityLivingBase entity = ctx.entity;
EntityPlayer player = ctx.getPlayer(); EntityPlayer player = ctx.getPlayer();
@ -429,7 +429,7 @@ public class XFactory12ga {
ItemGunBaseNT.setTimer(stack, index, 20); ItemGunBaseNT.setTimer(stack, index, 20);
} else { } else {
if(rec.getDoesDryFire(stack)) { if(rec.getDoesDryFire(stack)) {
ItemGunBaseNT.playAnimation(player, stack, AnimType.CYCLE_DRY, index); ItemGunBaseNT.playAnimation(player, stack, GunAnimation.CYCLE_DRY, index);
ItemGunBaseNT.setState(stack, index, GunState.DRAWING); ItemGunBaseNT.setState(stack, index, GunState.DRAWING);
ItemGunBaseNT.setTimer(stack, index, rec.getDelayAfterDryFire(stack)); ItemGunBaseNT.setTimer(stack, index, rec.getDelayAfterDryFire(stack));
} }
@ -440,7 +440,7 @@ public class XFactory12ga {
} }
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_MARESLEG_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_MARESLEG_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(-60, 0, 0, 0).addPos(0, 0, -3, 500, IType.SIN_DOWN)); .addBus("EQUIP", new BusAnimationSequence().addPos(-60, 0, 0, 0).addPos(0, 0, -3, 500, IType.SIN_DOWN));
@ -479,11 +479,11 @@ public class XFactory12ga {
.addBus("LIFT", new BusAnimationSequence().addPos(-35, 0, 0, 300, IType.SIN_FULL).addPos(-35, 0, 0, 1150).addPos(0, 0, 0, 500, IType.SIN_FULL)) .addBus("LIFT", new BusAnimationSequence().addPos(-35, 0, 0, 300, IType.SIN_FULL).addPos(-35, 0, 0, 1150).addPos(0, 0, 0, 500, IType.SIN_FULL))
.addBus("TURN", new BusAnimationSequence().addPos(0, 0, 0, 450).addPos(0, 0, -90, 500, IType.SIN_FULL).addPos(0, 0, -90, 500).addPos(0, 0, 0, 500, IType.SIN_FULL)); .addBus("TURN", new BusAnimationSequence().addPos(0, 0, 0, 450).addPos(0, 0, -90, 500, IType.SIN_FULL).addPos(0, 0, -90, 500).addPos(0, 0, 0, 500, IType.SIN_FULL));
} }
return null; return null;
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_MARESLEG_SHORT_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_MARESLEG_SHORT_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(-60, 0, 0, 0).addPos(0, 0, -3, 250, IType.SIN_DOWN)); .addBus("EQUIP", new BusAnimationSequence().addPos(-60, 0, 0, 0).addPos(0, 0, -3, 250, IType.SIN_DOWN));
@ -504,12 +504,12 @@ public class XFactory12ga {
.addBus("LEVER", new BusAnimationSequence().addPos(-85, 0, 0, 0).addPos(-15, 0, 0, 200).addPos(-15, 0, 0, 650).addPos(-85, 0, 0, 200).addPos(-15, 0, 0, 200).addPos(-15, 0, 0, 200).addPos(-85, 0, 0, 200).addPos(0, 0, 0, 200)) .addBus("LEVER", new BusAnimationSequence().addPos(-85, 0, 0, 0).addPos(-15, 0, 0, 200).addPos(-15, 0, 0, 650).addPos(-85, 0, 0, 200).addPos(-15, 0, 0, 200).addPos(-15, 0, 0, 200).addPos(-85, 0, 0, 200).addPos(0, 0, 0, 200))
.addBus("FLAG", new BusAnimationSequence().addPos(1, 1, 1, 0)); .addBus("FLAG", new BusAnimationSequence().addPos(1, 1, 1, 0));
} }
return LAMBDA_MARESLEG_ANIMS.apply(stack, type); return LAMBDA_MARESLEG_ANIMS.apply(stack, type);
}; };
/** This fucking sucks */ /** This fucking sucks */
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_LIBERATOR_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_LIBERATOR_ANIMS = (stack, type) -> {
int ammo = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory); int ammo = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory);
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
@ -602,11 +602,11 @@ public class XFactory12ga {
.addBus(ammo < 3 ? "SHELL3" : "NULL", new BusAnimationSequence().addPos(2, -8, -2, 0)) .addBus(ammo < 3 ? "SHELL3" : "NULL", new BusAnimationSequence().addPos(2, -8, -2, 0))
.addBus(ammo < 4 ? "SHELL4" : "NULL", new BusAnimationSequence().addPos(2, -8, -2, 0)); .addBus(ammo < 4 ? "SHELL4" : "NULL", new BusAnimationSequence().addPos(2, -8, -2, 0));
} }
return null; return null;
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_SPAS_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_SPAS_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(-60, 0, 0, 0).addPos(0, 0, -3, 500, IType.SIN_DOWN)); .addBus("EQUIP", new BusAnimationSequence().addPos(-60, 0, 0, 0).addPos(0, 0, -3, 500, IType.SIN_DOWN));
@ -621,11 +621,11 @@ public class XFactory12ga {
case JAMMED: return ResourceManager.spas_12_anim.get("Jammed"); case JAMMED: return ResourceManager.spas_12_anim.get("Jammed");
case INSPECT: return ResourceManager.spas_12_anim.get("Inspect"); case INSPECT: return ResourceManager.spas_12_anim.get("Inspect");
} }
return null; return null;
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_SHREDDER_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_SHREDDER_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN)); .addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN));
@ -647,11 +647,11 @@ public class XFactory12ga {
.addBus("SPEEN", new BusAnimationSequence().addPos(0, 0, 0, 300).addPos(360, 0, 0, 700)) .addBus("SPEEN", new BusAnimationSequence().addPos(0, 0, 0, 300).addPos(360, 0, 0, 700))
.addBus("LIFT", new BusAnimationSequence().addPos(0, 0, 0, 1450).addPos(-2, 0, 0, 100, IType.SIN_DOWN).addPos(0, 0, 0, 100, IType.SIN_FULL)); .addBus("LIFT", new BusAnimationSequence().addPos(0, 0, 0, 1450).addPos(-2, 0, 0, 100, IType.SIN_DOWN).addPos(0, 0, 0, 100, IType.SIN_FULL));
} }
return null; return null;
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_SEXY_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_SEXY_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 1000, IType.SIN_DOWN)); .addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 1000, IType.SIN_DOWN));
@ -676,7 +676,7 @@ public class XFactory12ga {
.addBus("BOTTLE", new BusAnimationSequence().setPos(8, -8, -2).addPos(6, -4, -2, 500, IType.SIN_DOWN).addPos(3, -3, -5, 500, IType.SIN_FULL).addPos(3, -2, -5, 1000).addPos(4, -6, -2, 750, IType.SIN_FULL).addPos(6, -8, -2, 500, IType.SIN_UP)) .addBus("BOTTLE", new BusAnimationSequence().setPos(8, -8, -2).addPos(6, -4, -2, 500, IType.SIN_DOWN).addPos(3, -3, -5, 500, IType.SIN_FULL).addPos(3, -2, -5, 1000).addPos(4, -6, -2, 750, IType.SIN_FULL).addPos(6, -8, -2, 500, IType.SIN_UP))
.addBus("SIP", new BusAnimationSequence().setPos(25, 0, 0).hold(500).addPos(-90, 0, 0, 500, IType.SIN_FULL).addPos(-110, 0, 0, 1000).addPos(25, 0, 0, 750, IType.SIN_FULL)); .addBus("SIP", new BusAnimationSequence().setPos(25, 0, 0).hold(500).addPos(-90, 0, 0, 500, IType.SIN_FULL).addPos(-110, 0, 0, 1000).addPos(25, 0, 0, 750, IType.SIN_FULL));
} }
return null; return null;
}; };
} }

View File

@ -20,10 +20,10 @@ import com.hbm.items.weapon.sedna.mods.WeaponModManager;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType; import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -57,21 +57,21 @@ public class XFactory22lr {
).setNameMutator(LAMBDA_NAME_AM180) ).setNameMutator(LAMBDA_NAME_AM180)
.setUnlocalizedName("gun_am180"); .setUnlocalizedName("gun_am180");
} }
public static Function<ItemStack, String> LAMBDA_NAME_AM180 = (stack) -> { public static Function<ItemStack, String> LAMBDA_NAME_AM180 = (stack) -> {
if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SILENCER)) return stack.getUnlocalizedName() + "_silenced"; if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SILENCER)) return stack.getUnlocalizedName() + "_silenced";
return null; return null;
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SMOKE = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SMOKE = (stack, ctx) -> {
Lego.handleStandardSmoke(ctx.entity, stack, 3000, 0.05D, 1.1D, 0); Lego.handleStandardSmoke(ctx.entity, stack, 3000, 0.05D, 1.1D, 0);
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_AM180 = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_AM180 = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil((float) (ctx.getPlayer().getRNG().nextGaussian() * 0.25), (float) (ctx.getPlayer().getRNG().nextGaussian() * 0.25)); ItemGunBaseNT.setupRecoil((float) (ctx.getPlayer().getRNG().nextGaussian() * 0.25), (float) (ctx.getPlayer().getRNG().nextGaussian() * 0.25));
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_AM180_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_AM180_ANIMS = (stack, type) -> {
if(ClientConfig.GUN_ANIMS_LEGACY.get()) { if(ClientConfig.GUN_ANIMS_LEGACY.get()) {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
@ -106,7 +106,7 @@ public class XFactory22lr {
case INSPECT: return ResourceManager.am180_anim.get("Inspect"); case INSPECT: return ResourceManager.am180_anim.get("Inspect");
} }
} }
return null; return null;
}; };
} }

View File

@ -14,10 +14,10 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality; import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -37,7 +37,7 @@ public class XFactory357 {
m357_jhp = new BulletConfig().setItem(EnumAmmo.M357_JHP).setCasing(EnumCasingType.SMALL, 8).setDamage(1.5F).setHeadshot(1.5F).setArmorPiercing(-0.25F); m357_jhp = new BulletConfig().setItem(EnumAmmo.M357_JHP).setCasing(EnumCasingType.SMALL, 8).setDamage(1.5F).setHeadshot(1.5F).setArmorPiercing(-0.25F);
m357_ap = new BulletConfig().setItem(EnumAmmo.M357_AP).setCasing(EnumCasingType.SMALL_STEEL, 8).setDoesPenetrate(true).setDamageFalloffByPen(false).setDamage(1.25F).setThresholdNegation(5F).setArmorPiercing(0.15F); m357_ap = new BulletConfig().setItem(EnumAmmo.M357_AP).setCasing(EnumCasingType.SMALL_STEEL, 8).setDoesPenetrate(true).setDamageFalloffByPen(false).setDamage(1.25F).setThresholdNegation(5F).setArmorPiercing(0.15F);
m357_express = new BulletConfig().setItem(EnumAmmo.M357_EXPRESS).setCasing(EnumCasingType.SMALL, 8).setDoesPenetrate(true).setDamage(1.5F).setThresholdNegation(2F).setArmorPiercing(0.1F).setWear(1.5F); m357_express = new BulletConfig().setItem(EnumAmmo.M357_EXPRESS).setCasing(EnumCasingType.SMALL, 8).setDoesPenetrate(true).setDamage(1.5F).setThresholdNegation(2F).setArmorPiercing(0.1F).setWear(1.5F);
ModItems.gun_light_revolver = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig() ModItems.gun_light_revolver = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig()
.dura(300).draw(4).inspect(23).crosshair(Crosshair.CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE) .dura(300).draw(4).inspect(23).crosshair(Crosshair.CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0) .rec(new Receiver(0)
@ -79,16 +79,16 @@ public class XFactory357 {
.anim(LAMBDA_DANI_ANIMS).orchestra(Orchestras.ORCHESTRA_DANI) .anim(LAMBDA_DANI_ANIMS).orchestra(Orchestras.ORCHESTRA_DANI)
).setUnlocalizedName("gun_light_revolver_dani"); ).setUnlocalizedName("gun_light_revolver_dani");
} }
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_ATLAS = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_ATLAS = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil(10, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5)); ItemGunBaseNT.setupRecoil(10, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5));
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_DANI = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_DANI = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil(5, (float) (ctx.getPlayer().getRNG().nextGaussian() * 0.75)); ItemGunBaseNT.setupRecoil(5, (float) (ctx.getPlayer().getRNG().nextGaussian() * 0.75));
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_ATLAS_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_ATLAS_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(-90, 0, 0, 0).addPos(0, 0, 0, 350, IType.SIN_DOWN)); .addBus("EQUIP", new BusAnimationSequence().addPos(-90, 0, 0, 0).addPos(0, 0, 0, 350, IType.SIN_DOWN));
@ -116,15 +116,15 @@ public class XFactory357 {
.addBus("RELOAD_ROT", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(0, 0, 0, 300).addPos(45, 0, 0, 500, IType.SIN_FULL).addPos(45, 0, 0, 500).addPos(-45, 0, 0, 50).addPos(-45, 0, 0, 100).addPos(0, 0, 0, 300)) .addBus("RELOAD_ROT", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(0, 0, 0, 300).addPos(45, 0, 0, 500, IType.SIN_FULL).addPos(45, 0, 0, 500).addPos(-45, 0, 0, 50).addPos(-45, 0, 0, 100).addPos(0, 0, 0, 300))
.addBus("RELOAD_MOVE", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(0, 0, 0, 300).addPos(0, -2.5, 0, 500, IType.SIN_FULL).addPos(0, -2.5, 0, 500).addPos(0, 0, 0, 350)); .addBus("RELOAD_MOVE", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(0, 0, 0, 300).addPos(0, -2.5, 0, 500, IType.SIN_FULL).addPos(0, -2.5, 0, 500).addPos(0, 0, 0, 350));
} }
return null; return null;
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_DANI_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_DANI_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation().addBus("EQUIP", new BusAnimationSequence().addPos(360 * 3, 0, 0, 1000, IType.SIN_DOWN)); case EQUIP: return new BusAnimation().addBus("EQUIP", new BusAnimationSequence().addPos(360 * 3, 0, 0, 1000, IType.SIN_DOWN));
} }
return LAMBDA_ATLAS_ANIMS.apply(stack, type); return LAMBDA_ATLAS_ANIMS.apply(stack, type);
}; };
} }

View File

@ -18,10 +18,10 @@ import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmoSecret;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType; import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
@ -32,7 +32,7 @@ public class XFactory35800 {
public static BulletConfig p35800; public static BulletConfig p35800;
public static BulletConfig p35800_bl; public static BulletConfig p35800_bl;
public static BiConsumer<EntityBulletBeamBase, MovingObjectPosition> LAMBDA_BLACK_IMPACT = (bullet, mop) -> { public static BiConsumer<EntityBulletBeamBase, MovingObjectPosition> LAMBDA_BLACK_IMPACT = (bullet, mop) -> {
if(mop.typeOfHit == mop.typeOfHit.ENTITY) { if(mop.typeOfHit == mop.typeOfHit.ENTITY) {
Entity hit = mop.entityHit; Entity hit = mop.entityHit;
@ -45,10 +45,10 @@ public class XFactory35800 {
fire.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord); fire.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
bullet.worldObj.spawnEntityInWorld(fire); bullet.worldObj.spawnEntityInWorld(fire);
} }
BulletConfig.LAMBDA_STANDARD_BEAM_HIT.accept(bullet, mop); BulletConfig.LAMBDA_STANDARD_BEAM_HIT.accept(bullet, mop);
}; };
public static void init() { public static void init() {
p35800 = new BulletConfig().setItem(EnumAmmoSecret.P35_800).setArmorPiercing(0.5F).setThresholdNegation(50F).setBeam().setSpread(0.0F).setLife(3).setRenderRotations(false) p35800 = new BulletConfig().setItem(EnumAmmoSecret.P35_800).setArmorPiercing(0.5F).setThresholdNegation(50F).setBeam().setSpread(0.0F).setLife(3).setRenderRotations(false)
@ -66,7 +66,7 @@ public class XFactory35800 {
.setupStandardConfiguration() .setupStandardConfiguration()
.anim(LAMBDA_ABERRATOR).orchestra(Orchestras.ORCHESTRA_ABERRATOR) .anim(LAMBDA_ABERRATOR).orchestra(Orchestras.ORCHESTRA_ABERRATOR)
).setUnlocalizedName("gun_aberrator"); ).setUnlocalizedName("gun_aberrator");
ModItems.gun_aberrator_eott = new ItemGunBaseNT(WeaponQuality.SECRET, ModItems.gun_aberrator_eott = new ItemGunBaseNT(WeaponQuality.SECRET,
new GunConfig().dura(2_000).draw(10).inspect(26).crosshair(Crosshair.CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE) new GunConfig().dura(2_000).draw(10).inspect(26).crosshair(Crosshair.CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0) .rec(new Receiver(0)
@ -88,12 +88,12 @@ public class XFactory35800 {
.anim(LAMBDA_ABERRATOR).orchestra(Orchestras.ORCHESTRA_ABERRATOR) .anim(LAMBDA_ABERRATOR).orchestra(Orchestras.ORCHESTRA_ABERRATOR)
).setUnlocalizedName("gun_aberrator_eott"); ).setUnlocalizedName("gun_aberrator_eott");
} }
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_ABERRATOR = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_ABERRATOR = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil(10, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5)); ItemGunBaseNT.setupRecoil(10, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5));
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_ABERRATOR = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_ABERRATOR = (stack, type) -> {
boolean aim = ItemGunBaseNT.getIsAiming(stack); boolean aim = ItemGunBaseNT.getIsAiming(stack);
int ammo = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, null); int ammo = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, null);
switch(type) { switch(type) {
@ -122,7 +122,7 @@ public class XFactory35800 {
case INSPECT: return new BusAnimation() case INSPECT: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(0, 0, 0, 0).addPos(-720, 0, 0, 1000, IType.SIN_FULL).addPos(-720, 0, 0, 250).addPos(0, 0, 0, 1000, IType.SIN_FULL)); .addBus("EQUIP", new BusAnimationSequence().addPos(0, 0, 0, 0).addPos(-720, 0, 0, 1000, IType.SIN_FULL).addPos(-720, 0, 0, 250).addPos(0, 0, 0, 1000, IType.SIN_FULL));
} }
return null; return null;
}; };
} }

View File

@ -30,10 +30,10 @@ import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType; import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.util.EntityDamageUtil; import com.hbm.util.EntityDamageUtil;
import com.hbm.util.TrackerUtil; import com.hbm.util.TrackerUtil;
import com.hbm.util.DamageResistanceHandler.DamageClass; import com.hbm.util.DamageResistanceHandler.DamageClass;
@ -52,7 +52,7 @@ public class XFactory40mm {
public static BulletConfig g26_flare; public static BulletConfig g26_flare;
public static BulletConfig g26_flare_supply; public static BulletConfig g26_flare_supply;
public static BulletConfig g26_flare_weapon; public static BulletConfig g26_flare_weapon;
public static BulletConfig g40_he; public static BulletConfig g40_he;
public static BulletConfig g40_heat; public static BulletConfig g40_heat;
public static BulletConfig g40_demo; public static BulletConfig g40_demo;
@ -97,7 +97,7 @@ public class XFactory40mm {
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_STANDARD_EXPLODE_PHOSPHORUS = (bullet, mop) -> { public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_STANDARD_EXPLODE_PHOSPHORUS = (bullet, mop) -> {
spawnFire(bullet, mop, true, 400); spawnFire(bullet, mop, true, 400);
}; };
public static void spawnFire(EntityBulletBaseMK4 bullet, MovingObjectPosition mop, boolean phosphorus, int duration) { public static void spawnFire(EntityBulletBaseMK4 bullet, MovingObjectPosition mop, boolean phosphorus, int duration) {
if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3) return; if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3) return;
World world = bullet.worldObj; World world = bullet.worldObj;
@ -125,7 +125,7 @@ public class XFactory40mm {
public static Consumer<Entity> LAMBDA_SPAWN_C130_SUPPLIESS = (entity) -> { spawnPlane(entity, C130PayloadType.SUPPLIES); }; public static Consumer<Entity> LAMBDA_SPAWN_C130_SUPPLIESS = (entity) -> { spawnPlane(entity, C130PayloadType.SUPPLIES); };
public static Consumer<Entity> LAMBDA_SPAWN_C130_WEAPONS = (entity) -> { spawnPlane(entity, C130PayloadType.WEAPONS); }; public static Consumer<Entity> LAMBDA_SPAWN_C130_WEAPONS = (entity) -> { spawnPlane(entity, C130PayloadType.WEAPONS); };
public static void spawnPlane(Entity entity, C130PayloadType payload) { public static void spawnPlane(Entity entity, C130PayloadType payload) {
if(!entity.worldObj.isRemote && entity.ticksExisted == 40) { if(!entity.worldObj.isRemote && entity.ticksExisted == 40) {
EntityBulletBaseMK4 bullet = (EntityBulletBaseMK4) entity; EntityBulletBaseMK4 bullet = (EntityBulletBaseMK4) entity;
@ -139,13 +139,13 @@ public class XFactory40mm {
TrackerUtil.setTrackingRange(bullet.worldObj, c130, 250); TrackerUtil.setTrackingRange(bullet.worldObj, c130, 250);
} }
} }
public static void init() { public static void init() {
g26_flare = new BulletConfig().setItem(EnumAmmo.G26_FLARE).setCasing(EnumCasingType.LARGE, 4).setLife(100).setVel(2F).setGrav(0.015D).setRenderRotations(false).setOnImpact(LAMBDA_STANDARD_IGNITE).setCasing(new SpentCasing(CasingType.STRAIGHT).setColor(0x9E1616).setScale(2F).register("g26Flare")); g26_flare = new BulletConfig().setItem(EnumAmmo.G26_FLARE).setCasing(EnumCasingType.LARGE, 4).setLife(100).setVel(2F).setGrav(0.015D).setRenderRotations(false).setOnImpact(LAMBDA_STANDARD_IGNITE).setCasing(new SpentCasing(CasingType.STRAIGHT).setColor(0x9E1616).setScale(2F).register("g26Flare"));
g26_flare_supply = new BulletConfig().setItem(EnumAmmo.G26_FLARE_SUPPLY).setCasing(EnumCasingType.LARGE, 4).setLife(100).setVel(2F).setGrav(0.015D).setRenderRotations(false).setOnImpact(LAMBDA_STANDARD_IGNITE).setOnUpdate(LAMBDA_SPAWN_C130_SUPPLIESS).setCasing(new SpentCasing(CasingType.STRAIGHT).setColor(0x3C80F0).setScale(2F).register("g26FlareSupply")); g26_flare_supply = new BulletConfig().setItem(EnumAmmo.G26_FLARE_SUPPLY).setCasing(EnumCasingType.LARGE, 4).setLife(100).setVel(2F).setGrav(0.015D).setRenderRotations(false).setOnImpact(LAMBDA_STANDARD_IGNITE).setOnUpdate(LAMBDA_SPAWN_C130_SUPPLIESS).setCasing(new SpentCasing(CasingType.STRAIGHT).setColor(0x3C80F0).setScale(2F).register("g26FlareSupply"));
g26_flare_weapon = new BulletConfig().setItem(EnumAmmo.G26_FLARE_WEAPON).setCasing(EnumCasingType.LARGE, 4).setLife(100).setVel(2F).setGrav(0.015D).setRenderRotations(false).setOnImpact(LAMBDA_STANDARD_IGNITE).setOnUpdate(LAMBDA_SPAWN_C130_WEAPONS).setCasing(new SpentCasing(CasingType.STRAIGHT).setColor(0x278400).setScale(2F).register("g26FlareWeapon")); g26_flare_weapon = new BulletConfig().setItem(EnumAmmo.G26_FLARE_WEAPON).setCasing(EnumCasingType.LARGE, 4).setLife(100).setVel(2F).setGrav(0.015D).setRenderRotations(false).setOnImpact(LAMBDA_STANDARD_IGNITE).setOnUpdate(LAMBDA_SPAWN_C130_WEAPONS).setCasing(new SpentCasing(CasingType.STRAIGHT).setColor(0x278400).setScale(2F).register("g26FlareWeapon"));
BulletConfig g40_base = new BulletConfig().setLife(200).setVel(2F).setGrav(0.035D); BulletConfig g40_base = new BulletConfig().setLife(200).setVel(2F).setGrav(0.035D);
g40_he = g40_base.clone().setItem(EnumAmmo.G40_HE).setCasing(EnumCasingType.LARGE, 4).setOnImpact(LAMBDA_STANDARD_EXPLODE).setCasing(new SpentCasing(CasingType.STRAIGHT).setColor(0x777777).setScale(2, 2F, 1.5F).register("g40")); g40_he = g40_base.clone().setItem(EnumAmmo.G40_HE).setCasing(EnumCasingType.LARGE, 4).setOnImpact(LAMBDA_STANDARD_EXPLODE).setCasing(new SpentCasing(CasingType.STRAIGHT).setColor(0x777777).setScale(2, 2F, 1.5F).register("g40"));
g40_heat = g40_base.clone().setItem(EnumAmmo.G40_HEAT).setCasing(EnumCasingType.LARGE, 4).setOnImpact(LAMBDA_STANDARD_EXPLODE_HEAT).setDamage(0.5F).setCasing(new SpentCasing(CasingType.STRAIGHT).setColor(0x5E6854).setScale(2, 2F, 1.5F).register("g40heat")); g40_heat = g40_base.clone().setItem(EnumAmmo.G40_HEAT).setCasing(EnumCasingType.LARGE, 4).setOnImpact(LAMBDA_STANDARD_EXPLODE_HEAT).setDamage(0.5F).setCasing(new SpentCasing(CasingType.STRAIGHT).setColor(0x5E6854).setScale(2, 2F, 1.5F).register("g40heat"));
@ -163,7 +163,7 @@ public class XFactory40mm {
.setupStandardConfiguration() .setupStandardConfiguration()
.anim(LAMBDA_FLAREGUN_ANIMS).orchestra(Orchestras.ORCHESTRA_FLAREGUN) .anim(LAMBDA_FLAREGUN_ANIMS).orchestra(Orchestras.ORCHESTRA_FLAREGUN)
).setUnlocalizedName("gun_flaregun"); ).setUnlocalizedName("gun_flaregun");
ModItems.gun_congolake = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig() ModItems.gun_congolake = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig()
.dura(400).draw(7).inspect(39).reloadSequential(true).reloadChangeType(true).crosshair(Crosshair.L_CIRCUMFLEX).smoke(LAMBDA_SMOKE) .dura(400).draw(7).inspect(39).reloadSequential(true).reloadChangeType(true).crosshair(Crosshair.L_CIRCUMFLEX).smoke(LAMBDA_SMOKE)
.rec(new Receiver(0) .rec(new Receiver(0)
@ -175,16 +175,16 @@ public class XFactory40mm {
.anim(LAMBDA_CONGOLAKE_ANIMS).orchestra(Orchestras.ORCHESTRA_CONGOLAKE) .anim(LAMBDA_CONGOLAKE_ANIMS).orchestra(Orchestras.ORCHESTRA_CONGOLAKE)
).setUnlocalizedName("gun_congolake"); ).setUnlocalizedName("gun_congolake");
} }
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SMOKE = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SMOKE = (stack, ctx) -> {
Lego.handleStandardSmoke(ctx.entity, stack, 1500, 0.025D, 1.05D, 0); Lego.handleStandardSmoke(ctx.entity, stack, 1500, 0.025D, 1.05D, 0);
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_GL = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_GL = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil(10, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5)); ItemGunBaseNT.setupRecoil(10, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5));
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_FLAREGUN_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_FLAREGUN_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(-90, 0, 0, 0).addPos(0, 0, 0, 350, IType.SIN_DOWN)); .addBus("EQUIP", new BusAnimationSequence().addPos(-90, 0, 0, 0).addPos(0, 0, 0, 350, IType.SIN_DOWN));
@ -203,11 +203,11 @@ public class XFactory40mm {
case INSPECT: return new BusAnimation() case INSPECT: return new BusAnimation()
.addBus("FLIP", new BusAnimationSequence().addPos(-360 * 3, 0, 0, 1500, IType.SIN_FULL)); .addBus("FLIP", new BusAnimationSequence().addPos(-360 * 3, 0, 0, 1500, IType.SIN_FULL));
} }
return null; return null;
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_CONGOLAKE_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_CONGOLAKE_ANIMS = (stack, type) -> {
int ammo = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory); int ammo = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory);
switch(type) { switch(type) {
case EQUIP: return ResourceManager.congolake_anim.get("Equip"); case EQUIP: return ResourceManager.congolake_anim.get("Equip");
@ -218,7 +218,7 @@ public class XFactory40mm {
case JAMMED: return ResourceManager.congolake_anim.get("Jammed"); case JAMMED: return ResourceManager.congolake_anim.get("Jammed");
case INSPECT: return ResourceManager.congolake_anim.get("Inspect"); case INSPECT: return ResourceManager.congolake_anim.get("Inspect");
} }
return null; return null;
}; };
} }

View File

@ -25,10 +25,10 @@ import com.hbm.items.weapon.sedna.mods.WeaponModManager;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType; import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
@ -37,7 +37,7 @@ import net.minecraft.util.ResourceLocation;
public class XFactory44 { public class XFactory44 {
public static final ResourceLocation scope_lilmac = new ResourceLocation(RefStrings.MODID, "textures/misc/scope_44.png"); public static final ResourceLocation scope_lilmac = new ResourceLocation(RefStrings.MODID, "textures/misc/scope_44.png");
public static BulletConfig m44_bp; public static BulletConfig m44_bp;
public static BulletConfig m44_sp; public static BulletConfig m44_sp;
public static BulletConfig m44_fmj; public static BulletConfig m44_fmj;
@ -46,7 +46,7 @@ public class XFactory44 {
public static BulletConfig m44_express; public static BulletConfig m44_express;
public static BulletConfig m44_equestrian_pip; public static BulletConfig m44_equestrian_pip;
public static BulletConfig m44_equestrian_mn7; public static BulletConfig m44_equestrian_mn7;
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_BOXCAR = (bullet, mop) -> { public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_BOXCAR = (bullet, mop) -> {
EntityBoxcar pippo = new EntityBoxcar(bullet.worldObj); EntityBoxcar pippo = new EntityBoxcar(bullet.worldObj);
pippo.posX = mop.hitVec.xCoord; pippo.posX = mop.hitVec.xCoord;
@ -56,7 +56,7 @@ public class XFactory44 {
bullet.worldObj.playSoundEffect(pippo.posX, pippo.posY + 50, pippo.posZ, "hbm:alarm.trainHorn", 100F, 1F); bullet.worldObj.playSoundEffect(pippo.posX, pippo.posY + 50, pippo.posZ, "hbm:alarm.trainHorn", 100F, 1F);
bullet.setDead(); bullet.setDead();
}; };
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_TORPEDO = (bullet, mop) -> { public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_TORPEDO = (bullet, mop) -> {
EntityTorpedo murky = new EntityTorpedo(bullet.worldObj); EntityTorpedo murky = new EntityTorpedo(bullet.worldObj);
murky.posX = mop.hitVec.xCoord; murky.posX = mop.hitVec.xCoord;
@ -149,34 +149,34 @@ public class XFactory44 {
.anim(LAMBDA_HANGMAN_ANIMS).orchestra(Orchestras.ORCHESTRA_HANGMAN) .anim(LAMBDA_HANGMAN_ANIMS).orchestra(Orchestras.ORCHESTRA_HANGMAN)
).setUnlocalizedName("gun_hangman"); ).setUnlocalizedName("gun_hangman");
} }
public static Function<ItemStack, String> LAMBDA_NAME_NOPIP = (stack) -> { public static Function<ItemStack, String> LAMBDA_NAME_NOPIP = (stack) -> {
if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SCOPE)) return stack.getUnlocalizedName() + "_scoped"; if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SCOPE)) return stack.getUnlocalizedName() + "_scoped";
return null; return null;
}; };
public static BiConsumer<ItemStack, LambdaContext> SMACK_A_FUCKER = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> SMACK_A_FUCKER = (stack, ctx) -> {
if(ItemGunBaseNT.getState(stack, ctx.configIndex) == GunState.IDLE || ItemGunBaseNT.getLastAnim(stack, ctx.configIndex) == AnimType.CYCLE) { if(ItemGunBaseNT.getState(stack, ctx.configIndex) == GunState.IDLE || ItemGunBaseNT.getLastAnim(stack, ctx.configIndex) == GunAnimation.CYCLE) {
ItemGunBaseNT.setIsAiming(stack, false); ItemGunBaseNT.setIsAiming(stack, false);
ItemGunBaseNT.setState(stack, ctx.configIndex, GunState.DRAWING); ItemGunBaseNT.setState(stack, ctx.configIndex, GunState.DRAWING);
ItemGunBaseNT.setTimer(stack, ctx.configIndex, ctx.config.getInspectDuration(stack)); ItemGunBaseNT.setTimer(stack, ctx.configIndex, ctx.config.getInspectDuration(stack));
ItemGunBaseNT.playAnimation(ctx.getPlayer(), stack, AnimType.INSPECT, ctx.configIndex); ItemGunBaseNT.playAnimation(ctx.getPlayer(), stack, GunAnimation.INSPECT, ctx.configIndex);
} }
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_HENRY = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_HENRY = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil(5, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1)); ItemGunBaseNT.setupRecoil(5, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1));
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_NOPIP = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_NOPIP = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil(10, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5)); ItemGunBaseNT.setupRecoil(10, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5));
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_HANGMAN = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_HANGMAN = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil(5, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1)); ItemGunBaseNT.setupRecoil(5, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1));
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_HENRY_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_HENRY_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(-90, 0, 0, 0).addPos(0, 0, -3, 350, IType.SIN_DOWN)) .addBus("EQUIP", new BusAnimationSequence().addPos(-90, 0, 0, 0).addPos(0, 0, -3, 350, IType.SIN_DOWN))
@ -215,11 +215,11 @@ public class XFactory44 {
.addBus("YEET", new BusAnimationSequence().addPos(0, 2, 0, 200, IType.SIN_DOWN).addPos(0, 0, 0, 200, IType.SIN_UP)) .addBus("YEET", new BusAnimationSequence().addPos(0, 2, 0, 200, IType.SIN_DOWN).addPos(0, 0, 0, 200, IType.SIN_UP))
.addBus("ROLL", new BusAnimationSequence().addPos(0, 0, 360, 400)); .addBus("ROLL", new BusAnimationSequence().addPos(0, 0, 360, 400));
} }
return null; return null;
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_NOPIP_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_NOPIP_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case CYCLE: return new BusAnimation() case CYCLE: return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, 0, 50).addPos(0, 0, -3, 50).addPos(0, 0, 0, 250)) .addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, 0, 50).addPos(0, 0, -3, 50).addPos(0, 0, 0, 250))
@ -241,18 +241,18 @@ public class XFactory44 {
.addBus("RELAOD_TILT", new BusAnimationSequence().addPos(-15, 0, 0, 100).addPos(65, 0, 0, 100).addPos(45, 0, 0, 50).addPos(0, 0, 0, 200).addPos(0, 0, 0, 200).addPos(-80, 0, 0, 100).addPos(-80, 0, 0, 100).addPos(0, 0, 0, 200)) .addBus("RELAOD_TILT", new BusAnimationSequence().addPos(-15, 0, 0, 100).addPos(65, 0, 0, 100).addPos(45, 0, 0, 50).addPos(0, 0, 0, 200).addPos(0, 0, 0, 200).addPos(-80, 0, 0, 100).addPos(-80, 0, 0, 100).addPos(0, 0, 0, 200))
.addBus("RELOAD_CYLINDER", new BusAnimationSequence().addPos(0, 0, 0, 200).addPos(90, 0, 0, 100).addPos(90, 0, 0, 450).addPos(0, 0, 0, 70)); .addBus("RELOAD_CYLINDER", new BusAnimationSequence().addPos(0, 0, 0, 200).addPos(90, 0, 0, 100).addPos(90, 0, 0, 450).addPos(0, 0, 0, 70));
} }
return null; return null;
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_LILMAC_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_LILMAC_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation().addBus("SPIN", new BusAnimationSequence().addPos(-360, 0, 0, 350)); case EQUIP: return new BusAnimation().addBus("SPIN", new BusAnimationSequence().addPos(-360, 0, 0, 350));
} }
return LAMBDA_NOPIP_ANIMS.apply(stack, type); return LAMBDA_NOPIP_ANIMS.apply(stack, type);
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_HANGMAN_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_HANGMAN_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation().addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN)); case EQUIP: return new BusAnimation().addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN));
case CYCLE: return new BusAnimation() case CYCLE: return new BusAnimation()
@ -273,7 +273,7 @@ public class XFactory44 {
.addBus("EQUIP", new BusAnimationSequence().addPos(0, 0, 0, 1000).addPos(-10, 0, 0, 100, IType.SIN_DOWN).addPos(0, 0, 0, 350, IType.SIN_FULL)) .addBus("EQUIP", new BusAnimationSequence().addPos(0, 0, 0, 1000).addPos(-10, 0, 0, 100, IType.SIN_DOWN).addPos(0, 0, 0, 350, IType.SIN_FULL))
.addBus("ROLL", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(0, 0, 25, 250, IType.SIN_FULL).addPos(0, 0, 25, 300).addPos(0, 0, 0, 250, IType.SIN_FULL)); .addBus("ROLL", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(0, 0, 25, 250, IType.SIN_FULL).addPos(0, 0, 25, 300).addPos(0, 0, 0, 250, IType.SIN_FULL));
} }
return null; return null;
}; };
} }

View File

@ -21,10 +21,10 @@ import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType; import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
@ -34,7 +34,7 @@ public class XFactory50 {
public static final ResourceLocation scope = new ResourceLocation(RefStrings.MODID, "textures/misc/scope_amat.png"); public static final ResourceLocation scope = new ResourceLocation(RefStrings.MODID, "textures/misc/scope_amat.png");
public static final ResourceLocation scope_thermal = new ResourceLocation(RefStrings.MODID, "textures/misc/scope_penance.png"); public static final ResourceLocation scope_thermal = new ResourceLocation(RefStrings.MODID, "textures/misc/scope_penance.png");
public static BulletConfig bmg50_sp; public static BulletConfig bmg50_sp;
public static BulletConfig bmg50_fmj; public static BulletConfig bmg50_fmj;
public static BulletConfig bmg50_jhp; public static BulletConfig bmg50_jhp;
@ -44,7 +44,7 @@ public class XFactory50 {
public static BulletConfig bmg50_sm; public static BulletConfig bmg50_sm;
public static BulletConfig bmg50_black; public static BulletConfig bmg50_black;
public static BulletConfig bmg50_equestrian; public static BulletConfig bmg50_equestrian;
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_BUILDING = (bullet, mop) -> { public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_BUILDING = (bullet, mop) -> {
EntityBuilding silver = new EntityBuilding(bullet.worldObj); EntityBuilding silver = new EntityBuilding(bullet.worldObj);
silver.posX = mop.hitVec.xCoord; silver.posX = mop.hitVec.xCoord;
@ -53,7 +53,7 @@ public class XFactory50 {
bullet.worldObj.spawnEntityInWorld(silver); bullet.worldObj.spawnEntityInWorld(silver);
bullet.setDead(); bullet.setDead();
}; };
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_STANDARD_EXPLODE = (bullet, mop) -> { public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_STANDARD_EXPLODE = (bullet, mop) -> {
if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3 && mop.entityHit == bullet.getThrower()) return; if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3 && mop.entityHit == bullet.getThrower()) return;
Lego.tinyExplode(bullet, mop, 2F); bullet.setDead(); Lego.tinyExplode(bullet, mop, 2F); bullet.setDead();
@ -79,7 +79,7 @@ public class XFactory50 {
.setCasing(casing50.clone().setColor(SpentCasing.COLOR_CASE_EQUESTRIAN).register("bmg50black")); .setCasing(casing50.clone().setColor(SpentCasing.COLOR_CASE_EQUESTRIAN).register("bmg50black"));
bmg50_equestrian = new BulletConfig().setItem(EnumAmmoSecret.BMG50_EQUESTRIAN).setDamage(0F).setOnImpact(LAMBDA_BUILDING) bmg50_equestrian = new BulletConfig().setItem(EnumAmmoSecret.BMG50_EQUESTRIAN).setDamage(0F).setOnImpact(LAMBDA_BUILDING)
.setCasing(casing50.clone().setColor(SpentCasing.COLOR_CASE_EQUESTRIAN).register("bmg50equestrian")); .setCasing(casing50.clone().setColor(SpentCasing.COLOR_CASE_EQUESTRIAN).register("bmg50equestrian"));
ModItems.gun_amat = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig() ModItems.gun_amat = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig()
.dura(350).draw(20).inspect(50).crosshair(Crosshair.CIRCLE).scopeTexture(scope).smoke(LAMBDA_SMOKE) .dura(350).draw(20).inspect(50).crosshair(Crosshair.CIRCLE).scopeTexture(scope).smoke(LAMBDA_SMOKE)
.rec(new Receiver(0) .rec(new Receiver(0)
@ -110,7 +110,7 @@ public class XFactory50 {
.setupStandardConfiguration() .setupStandardConfiguration()
.anim(LAMBDA_AMAT_ANIMS).orchestra(Orchestras.ORCHESTRA_AMAT) .anim(LAMBDA_AMAT_ANIMS).orchestra(Orchestras.ORCHESTRA_AMAT)
).setUnlocalizedName("gun_amat_penance"); ).setUnlocalizedName("gun_amat_penance");
ModItems.gun_m2 = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig() ModItems.gun_m2 = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig()
.dura(3_000).draw(10).inspect(31).crosshair(Crosshair.L_CIRCLE).smoke(LAMBDA_SMOKE) .dura(3_000).draw(10).inspect(31).crosshair(Crosshair.L_CIRCLE).smoke(LAMBDA_SMOKE)
.rec(new Receiver(0) .rec(new Receiver(0)
@ -122,27 +122,27 @@ public class XFactory50 {
.anim(LAMBDA_M2_ANIMS).orchestra(Orchestras.ORCHESTRA_M2) .anim(LAMBDA_M2_ANIMS).orchestra(Orchestras.ORCHESTRA_M2)
).setUnlocalizedName("gun_m2"); ).setUnlocalizedName("gun_m2");
} }
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SMOKE = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SMOKE = (stack, ctx) -> {
Lego.handleStandardSmoke(ctx.entity, stack, 2000, 0.05D, 1.1D, 0); Lego.handleStandardSmoke(ctx.entity, stack, 2000, 0.05D, 1.1D, 0);
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_AMAT = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_AMAT = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil(12.5F, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1)); ItemGunBaseNT.setupRecoil(12.5F, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1));
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_M2 = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_M2 = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil((float) (ctx.getPlayer().getRNG().nextGaussian() * 0.5), (float) (ctx.getPlayer().getRNG().nextGaussian() * 0.5)); ItemGunBaseNT.setupRecoil((float) (ctx.getPlayer().getRNG().nextGaussian() * 0.5), (float) (ctx.getPlayer().getRNG().nextGaussian() * 0.5));
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_AMAT_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_AMAT_ANIMS = (stack, type) -> {
double turn = -60; double turn = -60;
double pullAmount = -2.5; double pullAmount = -2.5;
double side = 4; double side = 4;
double down = -2; double down = -2;
double detach = 0.5; double detach = 0.5;
double apex = 7; double apex = 7;
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_FULL)) .addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_FULL))
@ -169,18 +169,18 @@ public class XFactory50 {
.addBus("SCOPE_THROW", new BusAnimationSequence().addPos(0, detach, 0, 100, IType.SIN_FULL).addPos(side, down, 0, 500, IType.SIN_FULL).addPos(side, down - 0.5, 0, 100).addPos(side, apex, 0, 350, IType.SIN_FULL).addPos(side, down - 0.5, 0, 350, IType.SIN_DOWN).addPos(side, down, 0, 100).hold(250).addPos(0, detach, 0, 500, IType.SIN_FULL).addPos(0, 0, 0, 250, IType.SIN_FULL)) .addBus("SCOPE_THROW", new BusAnimationSequence().addPos(0, detach, 0, 100, IType.SIN_FULL).addPos(side, down, 0, 500, IType.SIN_FULL).addPos(side, down - 0.5, 0, 100).addPos(side, apex, 0, 350, IType.SIN_FULL).addPos(side, down - 0.5, 0, 350, IType.SIN_DOWN).addPos(side, down, 0, 100).hold(250).addPos(0, detach, 0, 500, IType.SIN_FULL).addPos(0, 0, 0, 250, IType.SIN_FULL))
.addBus("SCOPE_SPIN", new BusAnimationSequence().hold(700).addPos(-360, 0, 0, 700)); .addBus("SCOPE_SPIN", new BusAnimationSequence().hold(700).addPos(-360, 0, 0, 700));
} }
return null; return null;
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_M2_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_M2_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(80, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_FULL)); .addBus("EQUIP", new BusAnimationSequence().addPos(80, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_FULL));
case CYCLE: return new BusAnimation() case CYCLE: return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, -0.25, 25).addPos(0, 0, 0, 75)); .addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, -0.25, 25).addPos(0, 0, 0, 75));
} }
return null; return null;
}; };
} }

View File

@ -25,10 +25,10 @@ import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType; import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -43,12 +43,12 @@ public class XFactory556mm {
public static BulletConfig r556_fmj; public static BulletConfig r556_fmj;
public static BulletConfig r556_jhp; public static BulletConfig r556_jhp;
public static BulletConfig r556_ap; public static BulletConfig r556_ap;
public static BulletConfig r556_inc_sp; public static BulletConfig r556_inc_sp;
public static BulletConfig r556_inc_fmj; public static BulletConfig r556_inc_fmj;
public static BulletConfig r556_inc_jhp; public static BulletConfig r556_inc_jhp;
public static BulletConfig r556_inc_ap; public static BulletConfig r556_inc_ap;
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> INCENDIARY = (bullet, mop) -> { public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> INCENDIARY = (bullet, mop) -> {
if(mop.entityHit != null && mop.entityHit instanceof EntityLivingBase) { if(mop.entityHit != null && mop.entityHit instanceof EntityLivingBase) {
HbmLivingProps data = HbmLivingProps.getData((EntityLivingBase) mop.entityHit); HbmLivingProps data = HbmLivingProps.getData((EntityLivingBase) mop.entityHit);
@ -71,7 +71,7 @@ public class XFactory556mm {
r556_inc_fmj = r556_fmj.clone().setOnImpact(INCENDIARY); r556_inc_fmj = r556_fmj.clone().setOnImpact(INCENDIARY);
r556_inc_jhp = r556_jhp.clone().setOnImpact(INCENDIARY); r556_inc_jhp = r556_jhp.clone().setOnImpact(INCENDIARY);
r556_inc_ap = r556_ap.clone().setOnImpact(INCENDIARY); r556_inc_ap = r556_ap.clone().setOnImpact(INCENDIARY);
ModItems.gun_g3 = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig() ModItems.gun_g3 = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig()
.dura(3_000).draw(10).inspect(33).crosshair(Crosshair.CIRCLE).smoke(LAMBDA_SMOKE) .dura(3_000).draw(10).inspect(33).crosshair(Crosshair.CIRCLE).smoke(LAMBDA_SMOKE)
.rec(new Receiver(0) .rec(new Receiver(0)
@ -105,21 +105,21 @@ public class XFactory556mm {
.anim(LAMBDA_STG77_ANIMS).orchestra(Orchestras.ORCHESTRA_STG77) .anim(LAMBDA_STG77_ANIMS).orchestra(Orchestras.ORCHESTRA_STG77)
).setUnlocalizedName("gun_stg77"); ).setUnlocalizedName("gun_stg77");
} }
public static Function<ItemStack, String> LAMBDA_NAME_G3 = (stack) -> { public static Function<ItemStack, String> LAMBDA_NAME_G3 = (stack) -> {
if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SILENCER) && if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SILENCER) &&
WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_NO_STOCK) && WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_NO_STOCK) &&
WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_FURNITURE_BLACK) && WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_FURNITURE_BLACK) &&
WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SCOPE)) return stack.getUnlocalizedName() + "_infiltrator"; WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SCOPE)) return stack.getUnlocalizedName() + "_infiltrator";
if(!WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_NO_STOCK) && if(!WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_NO_STOCK) &&
WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_FURNITURE_GREEN)) return stack.getUnlocalizedName() + "_a3"; WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_FURNITURE_GREEN)) return stack.getUnlocalizedName() + "_a3";
return null; return null;
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SMOKE = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SMOKE = (stack, ctx) -> {
Lego.handleStandardSmoke(ctx.entity, stack, 1500, 0.075D, 1.1D, 0); Lego.handleStandardSmoke(ctx.entity, stack, 1500, 0.075D, 1.1D, 0);
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STG77_DECIDER = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STG77_DECIDER = (stack, ctx) -> {
int index = ctx.configIndex; int index = ctx.configIndex;
GunState lastState = ItemGunBaseNT.getState(stack, index); GunState lastState = ItemGunBaseNT.getState(stack, index);
@ -128,18 +128,18 @@ public class XFactory556mm {
GunStateDecider.deciderStandardReload(stack, ctx, lastState, 0, index); GunStateDecider.deciderStandardReload(stack, ctx, lastState, 0, index);
GunStateDecider.deciderAutoRefire(stack, ctx, lastState, 0, index, () -> { return ItemGunBaseNT.getSecondary(stack, index); }); GunStateDecider.deciderAutoRefire(stack, ctx, lastState, 0, index, () -> { return ItemGunBaseNT.getSecondary(stack, index); });
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_G3 = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_G3 = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil((float) (ctx.getPlayer().getRNG().nextGaussian() * 0.25), (float) (ctx.getPlayer().getRNG().nextGaussian() * 0.25)); ItemGunBaseNT.setupRecoil((float) (ctx.getPlayer().getRNG().nextGaussian() * 0.25), (float) (ctx.getPlayer().getRNG().nextGaussian() * 0.25));
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_ZEBRA = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_ZEBRA = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil((float) (ctx.getPlayer().getRNG().nextGaussian() * 0.125), (float) (ctx.getPlayer().getRNG().nextGaussian() * 0.125)); ItemGunBaseNT.setupRecoil((float) (ctx.getPlayer().getRNG().nextGaussian() * 0.125), (float) (ctx.getPlayer().getRNG().nextGaussian() * 0.125));
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_STG = (stack, ctx) -> { }; public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_STG = (stack, ctx) -> { };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_G3_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_G3_ANIMS = (stack, type) -> {
boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory) <= 0; boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory) <= 0;
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
@ -206,11 +206,11 @@ public class XFactory556mm {
.addBus("BOLT", new BusAnimationSequence().addPos(0, 0, 0, 1000).addPos(0, 0, -3.25, 150).addPos(0, 0, 0, 100).addPos(0, 0, 0, 250).addPos(0, 0, -3.25, 150).addPos(0, 0, 0, 100)) .addBus("BOLT", new BusAnimationSequence().addPos(0, 0, 0, 1000).addPos(0, 0, -3.25, 150).addPos(0, 0, 0, 100).addPos(0, 0, 0, 250).addPos(0, 0, -3.25, 150).addPos(0, 0, 0, 100))
.addBus("PLUG", new BusAnimationSequence().addPos(0, 0, 0, 1000).addPos(0, 0, -3.25, 150).addPos(0, 0, 0, 100).addPos(0, 0, 0, 250).addPos(0, 0, -3.25, 150).addPos(0, 0, 0, 100)); .addBus("PLUG", new BusAnimationSequence().addPos(0, 0, 0, 1000).addPos(0, 0, -3.25, 150).addPos(0, 0, 0, 100).addPos(0, 0, 0, 250).addPos(0, 0, -3.25, 150).addPos(0, 0, 0, 100));
} }
return null; return null;
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_STG77_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_STG77_ANIMS = (stack, type) -> {
if(ClientConfig.GUN_ANIMS_LEGACY.get()) { if(ClientConfig.GUN_ANIMS_LEGACY.get()) {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
@ -245,8 +245,8 @@ public class XFactory556mm {
case INSPECT: return ResourceManager.stg77_anim.get("Inspect"); case INSPECT: return ResourceManager.stg77_anim.get("Inspect");
} }
} }
return null; return null;
}; };
} }

View File

@ -17,9 +17,9 @@ import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType; import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -47,7 +47,7 @@ public class XFactory75Bolt {
public static void init() { public static void init() {
SpentCasing casing75 = new SpentCasing(CasingType.STRAIGHT).setColor(SpentCasing.COLOR_CASE_BRASS).setScale(2F, 2F, 1.5F); SpentCasing casing75 = new SpentCasing(CasingType.STRAIGHT).setColor(SpentCasing.COLOR_CASE_BRASS).setScale(2F, 2F, 1.5F);
b75 = new BulletConfig().setItem(EnumAmmo.B75) b75 = new BulletConfig().setItem(EnumAmmo.B75)
.setCasing(casing75.clone().register("b75")).setOnImpact(LAMBDA_TINY_EXPLODE); .setCasing(casing75.clone().register("b75")).setOnImpact(LAMBDA_TINY_EXPLODE);
b75_inc = new BulletConfig().setItem(EnumAmmo.B75_INC).setDamage(0.8F).setArmorPiercing(0.1F) b75_inc = new BulletConfig().setItem(EnumAmmo.B75_INC).setDamage(0.8F).setArmorPiercing(0.1F)
@ -66,16 +66,16 @@ public class XFactory75Bolt {
.anim(LAMBDA_BOLTER_ANIMS).orchestra(Orchestras.ORCHESTRA_BOLTER) .anim(LAMBDA_BOLTER_ANIMS).orchestra(Orchestras.ORCHESTRA_BOLTER)
).setUnlocalizedName("gun_bolter"); ).setUnlocalizedName("gun_bolter");
} }
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SMOKE = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SMOKE = (stack, ctx) -> {
Lego.handleStandardSmoke(ctx.entity, stack, 2000, 0.05D, 1.1D, 0); Lego.handleStandardSmoke(ctx.entity, stack, 2000, 0.05D, 1.1D, 0);
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_BOLT = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_BOLT = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil((float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5), (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5)); ItemGunBaseNT.setupRecoil((float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5), (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5));
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_BOLTER_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_BOLTER_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case CYCLE: return new BusAnimation() case CYCLE: return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence().addPos(1, 0, 0, 25).addPos(0, 0, 0, 75)); .addBus("RECOIL", new BusAnimationSequence().addPos(1, 0, 0, 25).addPos(0, 0, 0, 75));
@ -86,7 +86,7 @@ public class XFactory75Bolt {
.addBus("TILT", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(1, 0, 0, 250).addPos(1, 0, 0, 700).addPos(0, 0, 0, 250)) .addBus("TILT", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(1, 0, 0, 250).addPos(1, 0, 0, 700).addPos(0, 0, 0, 250))
.addBus("MAG", new BusAnimationSequence().addPos(0, 0, 0, 750).addPos(0.6, 0, 0, 250).addPos(0, 0, 0, 250)); .addBus("MAG", new BusAnimationSequence().addPos(0, 0, 0, 750).addPos(0.6, 0, 0, 250).addPos(0, 0, 0, 250));
} }
return null; return null;
}; };
} }

View File

@ -20,10 +20,10 @@ import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType; import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.util.DamageResistanceHandler.DamageClass; import com.hbm.util.DamageResistanceHandler.DamageClass;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -41,7 +41,7 @@ public class XFactory762mm {
public static BulletConfig energy_lacunae; public static BulletConfig energy_lacunae;
public static BulletConfig energy_lacunae_overcharge; public static BulletConfig energy_lacunae_overcharge;
public static BulletConfig energy_lacunae_ir; public static BulletConfig energy_lacunae_ir;
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_TINY_EXPLODE = (bullet, mop) -> { public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_TINY_EXPLODE = (bullet, mop) -> {
if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3 && mop.entityHit == bullet.getThrower()) return; if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3 && mop.entityHit == bullet.getThrower()) return;
Lego.tinyExplode(bullet, mop, 1.5F); bullet.setDead(); Lego.tinyExplode(bullet, mop, 1.5F); bullet.setDead();
@ -61,7 +61,7 @@ public class XFactory762mm {
.setCasing(casing762.clone().setColor(SpentCasing.COLOR_CASE_44).register("r762du")); .setCasing(casing762.clone().setColor(SpentCasing.COLOR_CASE_44).register("r762du"));
r762_he = new BulletConfig().setItem(EnumAmmo.R762_HE).setCasing(EnumCasingType.SMALL_STEEL, 6).setWear(3F).setDamage(1.75F).setOnImpact(LAMBDA_TINY_EXPLODE) r762_he = new BulletConfig().setItem(EnumAmmo.R762_HE).setCasing(EnumCasingType.SMALL_STEEL, 6).setWear(3F).setDamage(1.75F).setOnImpact(LAMBDA_TINY_EXPLODE)
.setCasing(casing762.clone().setColor(SpentCasing.COLOR_CASE_44).register("r762he")); .setCasing(casing762.clone().setColor(SpentCasing.COLOR_CASE_44).register("r762he"));
energy_lacunae = new BulletConfig().setItem(EnumAmmo.CAPACITOR).setCasing(new ItemStack(ModItems.ingot_polymer, 2), 4 * 40).setupDamageClass(DamageClass.LASER).setBeam().setReloadCount(40).setSpread(0.0F).setLife(5).setRenderRotations(false).setOnBeamImpact(BulletConfig.LAMBDA_STANDARD_BEAM_HIT); energy_lacunae = new BulletConfig().setItem(EnumAmmo.CAPACITOR).setCasing(new ItemStack(ModItems.ingot_polymer, 2), 4 * 40).setupDamageClass(DamageClass.LASER).setBeam().setReloadCount(40).setSpread(0.0F).setLife(5).setRenderRotations(false).setOnBeamImpact(BulletConfig.LAMBDA_STANDARD_BEAM_HIT);
energy_lacunae_overcharge = new BulletConfig().setItem(EnumAmmo.CAPACITOR_OVERCHARGE).setCasing(new ItemStack(ModItems.ingot_polymer, 2), 4 * 40).setupDamageClass(DamageClass.LASER).setBeam().setReloadCount(40).setSpread(0.0F).setLife(5).setRenderRotations(false).setDoesPenetrate(true).setOnBeamImpact(BulletConfig.LAMBDA_STANDARD_BEAM_HIT); energy_lacunae_overcharge = new BulletConfig().setItem(EnumAmmo.CAPACITOR_OVERCHARGE).setCasing(new ItemStack(ModItems.ingot_polymer, 2), 4 * 40).setupDamageClass(DamageClass.LASER).setBeam().setReloadCount(40).setSpread(0.0F).setLife(5).setRenderRotations(false).setDoesPenetrate(true).setOnBeamImpact(BulletConfig.LAMBDA_STANDARD_BEAM_HIT);
energy_lacunae_ir = new BulletConfig().setItem(EnumAmmo.CAPACITOR_IR).setCasing(new ItemStack(ModItems.ingot_polymer, 2), 4 * 40).setupDamageClass(DamageClass.FIRE).setBeam().setReloadCount(40).setSpread(0.0F).setLife(5).setRenderRotations(false).setOnBeamImpact(XFactoryEnergy.LAMBDA_IR_HIT); energy_lacunae_ir = new BulletConfig().setItem(EnumAmmo.CAPACITOR_IR).setCasing(new ItemStack(ModItems.ingot_polymer, 2), 4 * 40).setupDamageClass(DamageClass.FIRE).setBeam().setReloadCount(40).setSpread(0.0F).setLife(5).setRenderRotations(false).setOnBeamImpact(XFactoryEnergy.LAMBDA_IR_HIT);
@ -131,7 +131,7 @@ public class XFactory762mm {
.anim(LAMBDA_MAS36_ANIMS).orchestra(Orchestras.ORCHESTRA_MAS36) .anim(LAMBDA_MAS36_ANIMS).orchestra(Orchestras.ORCHESTRA_MAS36)
).setUnlocalizedName("gun_mas36"); ).setUnlocalizedName("gun_mas36");
} }
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SECOND_MINIGUN = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SECOND_MINIGUN = (stack, ctx) -> {
int index = ctx.configIndex; int index = ctx.configIndex;
GunState lastState = ItemGunBaseNT.getState(stack, index); GunState lastState = ItemGunBaseNT.getState(stack, index);
@ -140,22 +140,22 @@ public class XFactory762mm {
GunStateDecider.deciderStandardReload(stack, ctx, lastState, 0, index); GunStateDecider.deciderStandardReload(stack, ctx, lastState, 0, index);
GunStateDecider.deciderAutoRefire(stack, ctx, lastState, 0, index, () -> { return ItemGunBaseNT.getSecondary(stack, index) && ItemGunBaseNT.getMode(stack, ctx.configIndex) == 0; }); GunStateDecider.deciderAutoRefire(stack, ctx, lastState, 0, index, () -> { return ItemGunBaseNT.getSecondary(stack, index) && ItemGunBaseNT.getMode(stack, ctx.configIndex) == 0; });
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SMOKE = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SMOKE = (stack, ctx) -> {
Lego.handleStandardSmoke(ctx.entity, stack, 1500, 0.075D, 1.1D, 0); Lego.handleStandardSmoke(ctx.entity, stack, 1500, 0.075D, 1.1D, 0);
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_CARBINE = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_CARBINE = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil(5, (float) (ctx.getPlayer().getRNG().nextGaussian() * 0.5)); ItemGunBaseNT.setupRecoil(5, (float) (ctx.getPlayer().getRNG().nextGaussian() * 0.5));
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_MINIGUN = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_MINIGUN = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil((float) (ctx.getPlayer().getRNG().nextGaussian() * 0.5), (float) (ctx.getPlayer().getRNG().nextGaussian() * 0.5)); ItemGunBaseNT.setupRecoil((float) (ctx.getPlayer().getRNG().nextGaussian() * 0.5), (float) (ctx.getPlayer().getRNG().nextGaussian() * 0.5));
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_LACUNAE = (stack, ctx) -> { }; public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_LACUNAE = (stack, ctx) -> { };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_CARBINE_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_CARBINE_ANIMS = (stack, type) -> {
int ammo = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory); int ammo = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory);
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
@ -183,11 +183,11 @@ public class XFactory762mm {
.addBus("SLIDE", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(0, 0, -0.75, 150, IType.SIN_DOWN).addPos(0, 0, -0.75, 1000).addPos(0, 0, 0, 100, IType.SIN_UP)) .addBus("SLIDE", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(0, 0, -0.75, 150, IType.SIN_DOWN).addPos(0, 0, -0.75, 1000).addPos(0, 0, 0, 100, IType.SIN_UP))
.addBus(ammo == 0 ? "NULL" : "REL", new BusAnimationSequence().addPos(0, 0.125, 1.25, 0).addPos(0, 0.125, 1.25, 500).addPos(0, 0.125, 0.5, 150, IType.SIN_DOWN).addPos(0, 0.125, 0.5, 1000).addPos(0, 0.125, 1.25, 100, IType.SIN_UP)); .addBus(ammo == 0 ? "NULL" : "REL", new BusAnimationSequence().addPos(0, 0.125, 1.25, 0).addPos(0, 0.125, 1.25, 500).addPos(0, 0.125, 0.5, 150, IType.SIN_DOWN).addPos(0, 0.125, 0.5, 1000).addPos(0, 0.125, 1.25, 100, IType.SIN_UP));
} }
return null; return null;
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_MINIGUN_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_MINIGUN_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 1000, IType.SIN_FULL)); .addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 1000, IType.SIN_FULL));
@ -203,11 +203,11 @@ public class XFactory762mm {
.addBus("EQUIP", new BusAnimationSequence().addPos(3, 0, 0, 150, IType.SIN_DOWN).addPos(0, 0, 0, 100, IType.SIN_FULL)) .addBus("EQUIP", new BusAnimationSequence().addPos(3, 0, 0, 150, IType.SIN_DOWN).addPos(0, 0, 0, 100, IType.SIN_FULL))
.addBus("ROTATE", new BusAnimationSequence().addPos(0, 0, -720, 1000, IType.SIN_DOWN)); .addBus("ROTATE", new BusAnimationSequence().addPos(0, 0, -720, 1000, IType.SIN_DOWN));
} }
return null; return null;
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_MAS36_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_MAS36_ANIMS = (stack, type) -> {
int mag = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory); int mag = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory);
double turn = -90; double turn = -90;
double pullAmount = ItemGunBaseNT.getIsAiming(stack) ? -1F : -1.5D; double pullAmount = ItemGunBaseNT.getIsAiming(stack) ? -1F : -1.5D;
@ -244,7 +244,7 @@ public class XFactory762mm {
.addBus("BOLT_PULL", new BusAnimationSequence().hold(100).addPos(0, 0, -1D, 250, IType.SIN_UP).hold(500).addPos(0, 0, 0, 200, IType.LINEAR)) .addBus("BOLT_PULL", new BusAnimationSequence().hold(100).addPos(0, 0, -1D, 250, IType.SIN_UP).hold(500).addPos(0, 0, 0, 200, IType.LINEAR))
.addBus("BULLET", mag == 0 ? new BusAnimationSequence().setPos(-100, 0, 0) : new BusAnimationSequence().setPos(0, 0.1875, 1.5).hold(100).addPos(0, 0.125, 0.5, 250, IType.SIN_UP).hold(500).addPos(0, 0.1875, 1.5, 200, IType.LINEAR)); .addBus("BULLET", mag == 0 ? new BusAnimationSequence().setPos(-100, 0, 0) : new BusAnimationSequence().setPos(0, 0.1875, 1.5).hold(100).addPos(0, 0.125, 0.5, 250, IType.SIN_UP).hold(500).addPos(0, 0.1875, 1.5, 200, IType.LINEAR));
} }
return null; return null;
}; };
} }

View File

@ -22,10 +22,10 @@ import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType; import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.util.EntityDamageUtil; import com.hbm.util.EntityDamageUtil;
import com.hbm.util.DamageResistanceHandler.DamageClass; import com.hbm.util.DamageResistanceHandler.DamageClass;
@ -105,29 +105,29 @@ public class XFactory9mm {
.anim(LAMBDA_UZI_ANIMS).orchestra(Orchestras.ORCHESTRA_UZI_AKIMBO) .anim(LAMBDA_UZI_ANIMS).orchestra(Orchestras.ORCHESTRA_UZI_AKIMBO)
).setUnlocalizedName("gun_uzi_akimbo"); ).setUnlocalizedName("gun_uzi_akimbo");
} }
public static Function<ItemStack, String> LAMBDA_NAME_GREASEGUN = (stack) -> { public static Function<ItemStack, String> LAMBDA_NAME_GREASEGUN = (stack) -> {
if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_GREASEGUN_CLEAN)) return stack.getUnlocalizedName() + "_m3"; if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_GREASEGUN_CLEAN)) return stack.getUnlocalizedName() + "_m3";
return null; return null;
}; };
public static Function<ItemStack, String> LAMBDA_NAME_UZI = (stack) -> { public static Function<ItemStack, String> LAMBDA_NAME_UZI = (stack) -> {
if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SILENCER)) return stack.getUnlocalizedName() + "_richter"; if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SILENCER)) return stack.getUnlocalizedName() + "_richter";
return null; return null;
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_GREASEGUN = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_GREASEGUN = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil(2, (float) (ctx.getPlayer().getRNG().nextGaussian() * 0.5)); ItemGunBaseNT.setupRecoil(2, (float) (ctx.getPlayer().getRNG().nextGaussian() * 0.5));
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_LAG = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_LAG = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil(5, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5)); ItemGunBaseNT.setupRecoil(5, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5));
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_UZI = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_UZI = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil(1, (float) (ctx.getPlayer().getRNG().nextGaussian() * 0.25)); ItemGunBaseNT.setupRecoil(1, (float) (ctx.getPlayer().getRNG().nextGaussian() * 0.25));
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SECOND_UZI = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SECOND_UZI = (stack, ctx) -> {
int index = ctx.configIndex; int index = ctx.configIndex;
GunState lastState = ItemGunBaseNT.getState(stack, index); GunState lastState = ItemGunBaseNT.getState(stack, index);
@ -136,12 +136,12 @@ public class XFactory9mm {
GunStateDecider.deciderStandardReload(stack, ctx, lastState, 0, index); GunStateDecider.deciderStandardReload(stack, ctx, lastState, 0, index);
GunStateDecider.deciderAutoRefire(stack, ctx, lastState, 0, index, () -> { return ItemGunBaseNT.getSecondary(stack, index) && ItemGunBaseNT.getMode(stack, ctx.configIndex) == 0; }); GunStateDecider.deciderAutoRefire(stack, ctx, lastState, 0, index, () -> { return ItemGunBaseNT.getSecondary(stack, index) && ItemGunBaseNT.getMode(stack, ctx.configIndex) == 0; });
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_FIRE_LAG = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_FIRE_LAG = (stack, ctx) -> {
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); GunAnimation type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
EntityPlayer player = ctx.getPlayer(); EntityPlayer player = ctx.getPlayer();
if(player != null && type == AnimType.INSPECT && timer > 20 && timer < 60) { if(player != null && type == GunAnimation.INSPECT && timer > 20 && timer < 60) {
int index = ctx.configIndex; int index = ctx.configIndex;
Receiver primary = ctx.config.getReceivers(stack)[0]; Receiver primary = ctx.config.getReceivers(stack)[0];
IMagazine mag = primary.getMagazine(stack); IMagazine mag = primary.getMagazine(stack);
@ -154,15 +154,15 @@ public class XFactory9mm {
ItemGunBaseNT.setTimer(stack, index, primary.getDelayAfterFire(stack)); ItemGunBaseNT.setTimer(stack, index, primary.getDelayAfterFire(stack));
EntityDamageUtil.attackEntityFromNT(player, BulletConfig.getDamage(player, player, DamageClass.PHYSICAL), 1_000F, true, false, 1D, 5F, 0F); EntityDamageUtil.attackEntityFromNT(player, BulletConfig.getDamage(player, player, DamageClass.PHYSICAL), 1_000F, true, false, 1D, 5F, 0F);
} else { } else {
Lego.doStandardFire(stack, ctx, AnimType.CYCLE, true); Lego.doStandardFire(stack, ctx, GunAnimation.CYCLE, true);
} }
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SMOKE = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SMOKE = (stack, ctx) -> {
Lego.handleStandardSmoke(ctx.entity, stack, 2000, 0.05D, 1.1D, ctx.configIndex); Lego.handleStandardSmoke(ctx.entity, stack, 2000, 0.05D, 1.1D, ctx.configIndex);
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_GREASEGUN_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_GREASEGUN_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(80, 0, 0, 0).addPos(80, 0, 0, 500).addPos(0, 0, 0, 500, IType.SIN_FULL)) .addBus("EQUIP", new BusAnimationSequence().addPos(80, 0, 0, 0).addPos(80, 0, 0, 500).addPos(0, 0, 0, 500, IType.SIN_FULL))
@ -190,11 +190,11 @@ public class XFactory9mm {
.addBus("TURN", new BusAnimationSequence().addPos(0, 0, -45, 150).addPos(0, 0, 45, 150).addPos(0, 0, 45, 50).addPos(0, 0, 0, 250).addPos(0, 0, 0, 500).addPos(0, 0, 45, 150).addPos(0, 0, -45, 150).addPos(0, 0, 0, 150)) .addBus("TURN", new BusAnimationSequence().addPos(0, 0, -45, 150).addPos(0, 0, 45, 150).addPos(0, 0, 45, 50).addPos(0, 0, 0, 250).addPos(0, 0, 0, 500).addPos(0, 0, 45, 150).addPos(0, 0, -45, 150).addPos(0, 0, 0, 150))
.addBus("FLAP", new BusAnimationSequence().addPos(0, 0, 0, 300).addPos(0, 0, 180, 150).addPos(0, 0, 180, 850).addPos(0, 0, 0, 150)); .addBus("FLAP", new BusAnimationSequence().addPos(0, 0, 0, 300).addPos(0, 0, 180, 150).addPos(0, 0, 180, 850).addPos(0, 0, 0, 150));
} }
return null; return null;
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_LAG_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_LAG_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(-90, 0, 0, 0).addPos(0, 0, 0, 350, IType.SIN_DOWN)); .addBus("EQUIP", new BusAnimationSequence().addPos(-90, 0, 0, 0).addPos(0, 0, 0, 350, IType.SIN_DOWN));
@ -207,11 +207,11 @@ public class XFactory9mm {
.addBus("ADD_TRANS", new BusAnimationSequence().addPos(-4, 0, -3, 500).addPos(-4, 0, -3, 2000).addPos(0, 0, 0, 500)) .addBus("ADD_TRANS", new BusAnimationSequence().addPos(-4, 0, -3, 500).addPos(-4, 0, -3, 2000).addPos(0, 0, 0, 500))
.addBus("ADD_ROT", new BusAnimationSequence().addPos(0, -2, 5, 500).addPos(0, -2, 5, 2000).addPos(0, 0, 0, 500)); .addBus("ADD_ROT", new BusAnimationSequence().addPos(0, -2, 5, 500).addPos(0, -2, 5, 2000).addPos(0, 0, 0, 500));
} }
return null; return null;
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_UZI_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_UZI_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(80, 0, 0, 0).addPos(80, 0, 0, 500).addPos(0, 0, 0, 500, IType.SIN_FULL)) .addBus("EQUIP", new BusAnimationSequence().addPos(80, 0, 0, 0).addPos(80, 0, 0, 500).addPos(0, 0, 0, 500, IType.SIN_FULL))

View File

@ -20,10 +20,10 @@ import com.hbm.items.weapon.sedna.mags.MagazineBelt;
import com.hbm.items.weapon.sedna.mags.MagazineInfinite; import com.hbm.items.weapon.sedna.mags.MagazineInfinite;
import com.hbm.items.weapon.sedna.mags.MagazineSingleReload; import com.hbm.items.weapon.sedna.mags.MagazineSingleReload;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.util.DamageResistanceHandler.DamageClass; import com.hbm.util.DamageResistanceHandler.DamageClass;
import com.hbm.util.Vec3NT; import com.hbm.util.Vec3NT;
@ -37,7 +37,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
public class XFactoryAccelerator { public class XFactoryAccelerator {
public static MagazineBelt tauChargeMag = new MagazineBelt(); public static MagazineBelt tauChargeMag = new MagazineBelt();
public static BulletConfig tau_uranium; public static BulletConfig tau_uranium;
@ -50,13 +50,13 @@ public class XFactoryAccelerator {
public static Consumer<Entity> LAMBDA_UPDATE_TUNGSTEN = (entity) -> {breakInPath(entity, 1.25F); }; public static Consumer<Entity> LAMBDA_UPDATE_TUNGSTEN = (entity) -> {breakInPath(entity, 1.25F); };
public static Consumer<Entity> LAMBDA_UPDATE_FERRO = (entity) -> { breakInPath(entity, 2.5F); }; public static Consumer<Entity> LAMBDA_UPDATE_FERRO = (entity) -> { breakInPath(entity, 2.5F); };
public static void breakInPath(Entity entity, float threshold) { public static void breakInPath(Entity entity, float threshold) {
Vec3 vec = Vec3.createVectorHelper(entity.posX - entity.prevPosX, entity.posY - entity.prevPosY, entity.posZ - entity.prevPosZ); Vec3 vec = Vec3.createVectorHelper(entity.posX - entity.prevPosX, entity.posY - entity.prevPosY, entity.posZ - entity.prevPosZ);
double motion = Math.max(vec.lengthVector(), 0.1); double motion = Math.max(vec.lengthVector(), 0.1);
vec = vec.normalize(); vec = vec.normalize();
for(double d = 0; d < motion; d += 0.5) { for(double d = 0; d < motion; d += 0.5) {
double dX = entity.posX - vec.xCoord * d; double dX = entity.posX - vec.xCoord * d;
@ -71,7 +71,7 @@ public class XFactoryAccelerator {
nbt.setDouble("posY", dY); nbt.setDouble("posY", dY);
nbt.setDouble("posZ", dZ); nbt.setDouble("posZ", dZ);
MainRegistry.proxy.effectNT(nbt); MainRegistry.proxy.effectNT(nbt);
} else { } else {
int x = (int) Math.floor(dX); int x = (int) Math.floor(dX);
int y = (int) Math.floor(dY); int y = (int) Math.floor(dY);
@ -84,7 +84,7 @@ public class XFactoryAccelerator {
} }
} }
} }
public static void init() { public static void init() {
tau_uranium = new BulletConfig().setItem(EnumAmmo.TAU_URANIUM).setCasing(new ItemStack(ModItems.plate_lead, 2), 16).setupDamageClass(DamageClass.SUBATOMIC).setBeam().setLife(5).setRenderRotations(false).setDoesPenetrate(true).setDamageFalloffByPen(false) tau_uranium = new BulletConfig().setItem(EnumAmmo.TAU_URANIUM).setCasing(new ItemStack(ModItems.plate_lead, 2), 16).setupDamageClass(DamageClass.SUBATOMIC).setBeam().setLife(5).setRenderRotations(false).setDoesPenetrate(true).setDamageFalloffByPen(false)
@ -99,7 +99,7 @@ public class XFactoryAccelerator {
ni4ni_arc = new BulletConfig().setupDamageClass(DamageClass.PHYSICAL).setBeam().setLife(5).setThresholdNegation(10F).setArmorPiercing(0.2F).setRenderRotations(false).setDoesPenetrate(false) ni4ni_arc = new BulletConfig().setupDamageClass(DamageClass.PHYSICAL).setBeam().setLife(5).setThresholdNegation(10F).setArmorPiercing(0.2F).setRenderRotations(false).setDoesPenetrate(false)
.setOnBeamImpact(BulletConfig.LAMBDA_BEAM_HIT); .setOnBeamImpact(BulletConfig.LAMBDA_BEAM_HIT);
tauChargeMag.addConfigs(tau_uranium_charge); tauChargeMag.addConfigs(tau_uranium_charge);
ModItems.gun_tau = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig() ModItems.gun_tau = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig()
@ -141,54 +141,54 @@ public class XFactoryAccelerator {
.anim(LAMBDA_NI4NI_ANIMS).orchestra(Orchestras.ORCHESTRA_COILGUN) .anim(LAMBDA_NI4NI_ANIMS).orchestra(Orchestras.ORCHESTRA_COILGUN)
).setUnlocalizedName("gun_n_i_4_n_i"); ).setUnlocalizedName("gun_n_i_4_n_i");
} }
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_TAU_PRIMARY_RELEASE = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_TAU_PRIMARY_RELEASE = (stack, ctx) -> {
if(ctx.getPlayer() == null || ItemGunBaseNT.getLastAnim(stack, ctx.configIndex) != AnimType.CYCLE) return; if(ctx.getPlayer() == null || ItemGunBaseNT.getLastAnim(stack, ctx.configIndex) != GunAnimation.CYCLE) return;
ctx.getPlayer().worldObj.playSoundEffect(ctx.getPlayer().posX, ctx.getPlayer().posY, ctx.getPlayer().posZ, "hbm:weapon.fire.tauRelease", 1F, 1F); ctx.getPlayer().worldObj.playSoundEffect(ctx.getPlayer().posX, ctx.getPlayer().posY, ctx.getPlayer().posZ, "hbm:weapon.fire.tauRelease", 1F, 1F);
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_TAU_SECONDARY_PRESS = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_TAU_SECONDARY_PRESS = (stack, ctx) -> {
if(ctx.getPlayer() == null) return; if(ctx.getPlayer() == null) return;
if(ctx.config.getReceivers(stack)[0].getMagazine(stack).getAmount(stack, ctx.inventory) <= 0) return; if(ctx.config.getReceivers(stack)[0].getMagazine(stack).getAmount(stack, ctx.inventory) <= 0) return;
ItemGunBaseNT.playAnimation(ctx.getPlayer(), stack, AnimType.SPINUP, ctx.configIndex); ItemGunBaseNT.playAnimation(ctx.getPlayer(), stack, GunAnimation.SPINUP, ctx.configIndex);
tauChargeMag.getMagType(stack); //caches the last loaded ammo tauChargeMag.getMagType(stack); //caches the last loaded ammo
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_TAU_SECONDARY_RELEASE = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_TAU_SECONDARY_RELEASE = (stack, ctx) -> {
if(ctx.getPlayer() == null) return; if(ctx.getPlayer() == null) return;
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
if(timer >= 10 && ItemGunBaseNT.getLastAnim(stack, ctx.configIndex) == AnimType.SPINUP) { if(timer >= 10 && ItemGunBaseNT.getLastAnim(stack, ctx.configIndex) == GunAnimation.SPINUP) {
ItemGunBaseNT.playAnimation(ctx.getPlayer(), stack, AnimType.ALT_CYCLE, ctx.configIndex); ItemGunBaseNT.playAnimation(ctx.getPlayer(), stack, GunAnimation.ALT_CYCLE, ctx.configIndex);
int unitsUsed = 1 + Math.min(12, timer / 10); int unitsUsed = 1 + Math.min(12, timer / 10);
EntityLivingBase entity = ctx.entity; EntityLivingBase entity = ctx.entity;
int index = ctx.configIndex; int index = ctx.configIndex;
Receiver primary = ctx.config.getReceivers(stack)[0]; Receiver primary = ctx.config.getReceivers(stack)[0];
BulletConfig config = tauChargeMag.getFirstConfig(stack, ctx.inventory); BulletConfig config = tauChargeMag.getFirstConfig(stack, ctx.inventory);
Vec3 offset = primary.getProjectileOffset(stack); Vec3 offset = primary.getProjectileOffset(stack);
double forwardOffset = offset.xCoord; double forwardOffset = offset.xCoord;
double heightOffset = offset.yCoord; double heightOffset = offset.yCoord;
double sideOffset = offset.zCoord; double sideOffset = offset.zCoord;
float damage = Lego.getStandardWearDamage(stack, ctx.config, index) * unitsUsed * 5; float damage = Lego.getStandardWearDamage(stack, ctx.config, index) * unitsUsed * 5;
float spread = Lego.calcSpread(ctx, stack, primary, config, true, index, false); float spread = Lego.calcSpread(ctx, stack, primary, config, true, index, false);
EntityBulletBeamBase mk4 = new EntityBulletBeamBase(entity, config, damage, spread, sideOffset, heightOffset, forwardOffset); EntityBulletBeamBase mk4 = new EntityBulletBeamBase(entity, config, damage, spread, sideOffset, heightOffset, forwardOffset);
entity.worldObj.spawnEntityInWorld(mk4); entity.worldObj.spawnEntityInWorld(mk4);
ItemGunBaseNT.setWear(stack, index, Math.min(ItemGunBaseNT.getWear(stack, index) + config.wear * unitsUsed, ctx.config.getDurability(stack))); ItemGunBaseNT.setWear(stack, index, Math.min(ItemGunBaseNT.getWear(stack, index) + config.wear * unitsUsed, ctx.config.getDurability(stack)));
} else { } else {
ItemGunBaseNT.playAnimation(ctx.getPlayer(), stack, AnimType.CYCLE_DRY, ctx.configIndex); ItemGunBaseNT.playAnimation(ctx.getPlayer(), stack, GunAnimation.CYCLE_DRY, ctx.configIndex);
} }
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_NI4NI_SECONDARY_PRESS = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_NI4NI_SECONDARY_PRESS = (stack, ctx) -> {
if(ctx.getPlayer() == null) return; if(ctx.getPlayer() == null) return;
EntityPlayer player = ctx.getPlayer(); EntityPlayer player = ctx.getPlayer();
if(ItemGunNI4NI.getCoinCount(stack) > 0) { if(ItemGunNI4NI.getCoinCount(stack) > 0) {
Vec3NT vec = new Vec3NT(player.getLookVec()).multiply(0.8D); Vec3NT vec = new Vec3NT(player.getLookVec()).multiply(0.8D);
EntityCoin coin = new EntityCoin(player.worldObj); EntityCoin coin = new EntityCoin(player.worldObj);
@ -199,20 +199,20 @@ public class XFactoryAccelerator {
coin.rotationYaw = player.rotationYaw; coin.rotationYaw = player.rotationYaw;
coin.setThrower(player); coin.setThrower(player);
player.worldObj.spawnEntityInWorld(coin); player.worldObj.spawnEntityInWorld(coin);
player.worldObj.playSoundAtEntity(player, "random.orb", 1.0F, 1F + player.getRNG().nextFloat() * 0.25F); player.worldObj.playSoundAtEntity(player, "random.orb", 1.0F, 1F + player.getRNG().nextFloat() * 0.25F);
ItemGunNI4NI.setCoinCount(stack, ItemGunNI4NI.getCoinCount(stack) - 1); ItemGunNI4NI.setCoinCount(stack, ItemGunNI4NI.getCoinCount(stack) - 1);
} }
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_TAU = (stack, ctx) -> { }; public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_TAU = (stack, ctx) -> { };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_COILGUN = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_COILGUN = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil(10, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5)); ItemGunBaseNT.setupRecoil(10, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5));
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_TAU_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_TAU_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_FULL)); .addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_FULL));
@ -229,18 +229,18 @@ public class XFactoryAccelerator {
case SPINUP: return new BusAnimation() case SPINUP: return new BusAnimation()
.addBus("ROTATE", new BusAnimationSequence().addPos(0, 0, 360 * 6, 3000, IType.SIN_UP).addPos(0, 0, 0, 0).addPos(0, 0, 360 * 40, 500 * 20)); .addBus("ROTATE", new BusAnimationSequence().addPos(0, 0, 360 * 6, 3000, IType.SIN_UP).addPos(0, 0, 0, 0).addPos(0, 0, 360 * 40, 500 * 20));
} }
return null; return null;
}; };
public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_COILGUN_ANIMS = (stack, type) -> { public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_COILGUN_ANIMS = (stack, type) -> {
if(type == AnimType.EQUIP) return new BusAnimation().addBus("RELOAD", new BusAnimationSequence().addPos(1, 0, 0, 0).addPos(0, 0, 0, 250)); if(type == GunAnimation.EQUIP) return new BusAnimation().addBus("RELOAD", new BusAnimationSequence().addPos(1, 0, 0, 0).addPos(0, 0, 0, 250));
if(type == AnimType.CYCLE) return new BusAnimation().addBus("RECOIL", new BusAnimationSequence().addPos(ItemGunBaseNT.getIsAiming(stack) ? 0.5 : 1, 0, 0, 100).addPos(0, 0, 0, 200)); if(type == GunAnimation.CYCLE) return new BusAnimation().addBus("RECOIL", new BusAnimationSequence().addPos(ItemGunBaseNT.getIsAiming(stack) ? 0.5 : 1, 0, 0, 100).addPos(0, 0, 0, 200));
if(type == AnimType.RELOAD) return new BusAnimation().addBus("RELOAD", new BusAnimationSequence().addPos(1, 0, 0, 250).addPos(1, 0, 0, 500).addPos(0, 0, 0, 250)); if(type == GunAnimation.RELOAD) return new BusAnimation().addBus("RELOAD", new BusAnimationSequence().addPos(1, 0, 0, 250).addPos(1, 0, 0, 500).addPos(0, 0, 0, 250));
return null; return null;
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_NI4NI_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_NI4NI_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(-360 * 2, 0, 0, 500)); .addBus("EQUIP", new BusAnimationSequence().addPos(-360 * 2, 0, 0, 500));
@ -252,7 +252,7 @@ public class XFactoryAccelerator {
case INSPECT: return new BusAnimation() case INSPECT: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(-360 * 3, 0, 0, 750).hold(100).addPos(0, 0, 0, 750)); .addBus("EQUIP", new BusAnimationSequence().addPos(-360 * 3, 0, 0, 750).hold(100).addPos(0, 0, 0, 750));
} }
return null; return null;
}; };
} }

View File

@ -13,10 +13,10 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality; import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -28,7 +28,7 @@ public class XFactoryBlackPowder {
public static BulletConfig shot = new BulletConfig().setItem(EnumAmmo.STONE_SHOT).setBlackPowder(true).setHeadshot(1F).setSpread(0.1F).setRicochetAngle(45).setProjectiles(6, 6).setDamage(1F/6F); public static BulletConfig shot = new BulletConfig().setItem(EnumAmmo.STONE_SHOT).setBlackPowder(true).setHeadshot(1F).setSpread(0.1F).setRicochetAngle(45).setProjectiles(6, 6).setDamage(1F/6F);
public static void init() { public static void init() {
ModItems.gun_pepperbox = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig() ModItems.gun_pepperbox = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig()
.dura(300).draw(4).inspect(23).crosshair(Crosshair.CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE) .dura(300).draw(4).inspect(23).crosshair(Crosshair.CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0) .rec(new Receiver(0)
@ -40,12 +40,12 @@ public class XFactoryBlackPowder {
.anim(LAMBDA_PEPPERBOX_ANIMS).orchestra(Orchestras.ORCHESTRA_PEPPERBOX) .anim(LAMBDA_PEPPERBOX_ANIMS).orchestra(Orchestras.ORCHESTRA_PEPPERBOX)
).setUnlocalizedName("gun_pepperbox"); ).setUnlocalizedName("gun_pepperbox");
} }
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_PEPPERBOX = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_PEPPERBOX = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil(10, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5)); ItemGunBaseNT.setupRecoil(10, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5));
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_PEPPERBOX_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_PEPPERBOX_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case CYCLE: return new BusAnimation() case CYCLE: return new BusAnimation()
.addBus("ROTATE", new BusAnimationSequence().addPos(0, 0, 0, 1025).addPos(60, 0, 0, 250)) .addBus("ROTATE", new BusAnimationSequence().addPos(0, 0, 0, 1025).addPos(60, 0, 0, 250))
@ -72,7 +72,7 @@ public class XFactoryBlackPowder {
.addBus("TRANSLATE", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(0, -6, 0, 400, IType.SIN_FULL).addPos(0, -6, 0, 2000).addPos(0, 0, 0, 400, IType.SIN_FULL)) .addBus("TRANSLATE", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(0, -6, 0, 400, IType.SIN_FULL).addPos(0, -6, 0, 2000).addPos(0, 0, 0, 400, IType.SIN_FULL))
.addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(45, 0, 0, 400, IType.SIN_FULL).addPos(45, 0, 0, 2000).addPos(0, 0, 0, 400, IType.SIN_FULL)); .addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(45, 0, 0, 400, IType.SIN_FULL).addPos(45, 0, 0, 2000).addPos(0, 0, 0, 400, IType.SIN_FULL));
} }
return null; return null;
}; };
} }

View File

@ -28,10 +28,10 @@ import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.mags.MagazineSingleReload; import com.hbm.items.weapon.sedna.mags.MagazineSingleReload;
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.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -99,7 +99,7 @@ public class XFactoryCatapult {
vnt.explode(); vnt.explode();
incrementRad(bullet.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 1.5F); incrementRad(bullet.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 1.5F);
bullet.worldObj.playSoundEffect(mop.hitVec.xCoord, mop.hitVec.yCoord + 0.5, mop.hitVec.zCoord, "hbm:weapon.mukeExplosion", 15.0F, 1.0F); bullet.worldObj.playSoundEffect(mop.hitVec.xCoord, mop.hitVec.yCoord + 0.5, mop.hitVec.zCoord, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
NBTTagCompound data = new NBTTagCompound(); NBTTagCompound data = new NBTTagCompound();
data.setString("type", "muke"); data.setString("type", "muke");
@ -176,7 +176,7 @@ public class XFactoryCatapult {
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_FATMAN = (stack, ctx) -> { }; public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_FATMAN = (stack, ctx) -> { };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_FATMAN_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_FATMAN_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 1000, IType.SIN_DOWN)); .addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 1000, IType.SIN_DOWN));

View File

@ -26,10 +26,10 @@ import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
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.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.util.DamageResistanceHandler.DamageClass; import com.hbm.util.DamageResistanceHandler.DamageClass;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
@ -104,15 +104,15 @@ public class XFactoryEnergy {
public static BiConsumer<EntityBulletBeamBase, MovingObjectPosition> LAMBDA_LIGHTNING_SPLIT = (beam, mop) -> { public static BiConsumer<EntityBulletBeamBase, MovingObjectPosition> LAMBDA_LIGHTNING_SPLIT = (beam, mop) -> {
LAMBDA_LIGHTNING_HIT.accept(beam, mop); LAMBDA_LIGHTNING_HIT.accept(beam, mop);
if(mop.typeOfHit != mop.typeOfHit.ENTITY) return; if(mop.typeOfHit != mop.typeOfHit.ENTITY) return;
double range = 20; double range = 20;
List<EntityLivingBase> potentialTargets = beam.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord).expand(range, range, range)); List<EntityLivingBase> potentialTargets = beam.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord).expand(range, range, range));
Collections.shuffle(potentialTargets); Collections.shuffle(potentialTargets);
for(EntityLivingBase target : potentialTargets) { for(EntityLivingBase target : potentialTargets) {
if(target == beam.thrower) continue; if(target == beam.thrower) continue;
if(target == mop.entityHit) continue; if(target == mop.entityHit) continue;
Vec3 delta = Vec3.createVectorHelper(target.posX - mop.hitVec.xCoord, target.posY + target.height / 2 - mop.hitVec.yCoord, target.posZ - mop.hitVec.zCoord); Vec3 delta = Vec3.createVectorHelper(target.posX - mop.hitVec.xCoord, target.posY + target.height / 2 - mop.hitVec.yCoord, target.posZ - mop.hitVec.zCoord);
if(delta.lengthVector() > 20) continue; if(delta.lengthVector() > 20) continue;
EntityBulletBeamBase sub = new EntityBulletBeamBase(beam.thrower, energy_tesla_ir_sub, beam.damage); EntityBulletBeamBase sub = new EntityBulletBeamBase(beam.thrower, energy_tesla_ir_sub, beam.damage);
@ -169,7 +169,7 @@ public class XFactoryEnergy {
energy_emerald = energy_las.clone().setArmorPiercing(0.5F).setThresholdNegation(10F); energy_emerald = energy_las.clone().setArmorPiercing(0.5F).setThresholdNegation(10F);
energy_emerald_overcharge = energy_las_overcharge.clone().setArmorPiercing(0.5F).setThresholdNegation(15F); energy_emerald_overcharge = energy_las_overcharge.clone().setArmorPiercing(0.5F).setThresholdNegation(15F);
energy_emerald_ir = energy_las_ir.clone().setArmorPiercing(0.5F).setThresholdNegation(10F); energy_emerald_ir = energy_las_ir.clone().setArmorPiercing(0.5F).setThresholdNegation(10F);
ModItems.gun_tesla_cannon = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig() ModItems.gun_tesla_cannon = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig()
.dura(1_000).draw(10).inspect(33).crosshair(Crosshair.CIRCLE) .dura(1_000).draw(10).inspect(33).crosshair(Crosshair.CIRCLE)
.rec(new Receiver(0) .rec(new Receiver(0)
@ -226,7 +226,7 @@ public class XFactoryEnergy {
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_ENERGY = (stack, ctx) -> { }; public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_ENERGY = (stack, ctx) -> { };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_TESLA_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_TESLA_ANIMS = (stack, type) -> {
int amount = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory); int amount = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory);
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
@ -245,7 +245,7 @@ public class XFactoryEnergy {
return null; return null;
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_LASER_PISTOL = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_LASER_PISTOL = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN)); .addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN));
@ -266,7 +266,7 @@ public class XFactoryEnergy {
return null; return null;
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_LASRIFLE = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_LASRIFLE = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN)); .addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN));

View File

@ -22,10 +22,10 @@ import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.particle.helper.FlameCreator; import com.hbm.particle.helper.FlameCreator;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.util.DamageResistanceHandler.DamageClass; import com.hbm.util.DamageResistanceHandler.DamageClass;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -42,7 +42,7 @@ public class XFactoryFlamer {
public static BulletConfig flame_nograv; public static BulletConfig flame_nograv;
public static BulletConfig flame_nograv_bf; public static BulletConfig flame_nograv_bf;
public static BulletConfig flame_diesel; public static BulletConfig flame_diesel;
public static BulletConfig flame_gas; public static BulletConfig flame_gas;
public static BulletConfig flame_napalm; public static BulletConfig flame_napalm;
@ -80,7 +80,7 @@ public class XFactoryFlamer {
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_LINGER_GAS = (bullet, mop) -> { igniteIfPossible(bullet, mop); }; public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_LINGER_GAS = (bullet, mop) -> { igniteIfPossible(bullet, mop); };
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_LINGER_NAPALM = (bullet, mop) -> { if(!igniteIfPossible(bullet, mop)) spawnFire(bullet, mop, 2.5F, 1F, 200, EntityFireLingering.TYPE_DIESEL); }; public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_LINGER_NAPALM = (bullet, mop) -> { if(!igniteIfPossible(bullet, mop)) spawnFire(bullet, mop, 2.5F, 1F, 200, EntityFireLingering.TYPE_DIESEL); };
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_LINGER_BALEFIRE = (bullet, mop) -> { spawnFire(bullet, mop, 3F, 1F, 300, EntityFireLingering.TYPE_BALEFIRE); }; public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_LINGER_BALEFIRE = (bullet, mop) -> { spawnFire(bullet, mop, 3F, 1F, 300, EntityFireLingering.TYPE_BALEFIRE); };
public static boolean igniteIfPossible(EntityBulletBaseMK4 bullet, MovingObjectPosition mop) { public static boolean igniteIfPossible(EntityBulletBaseMK4 bullet, MovingObjectPosition mop) {
if(mop.typeOfHit == mop.typeOfHit.BLOCK) { if(mop.typeOfHit == mop.typeOfHit.BLOCK) {
World world = bullet.worldObj; World world = bullet.worldObj;
@ -96,7 +96,7 @@ public class XFactoryFlamer {
} }
return false; return false;
} }
public static void spawnFire(EntityBulletBaseMK4 bullet, MovingObjectPosition mop, float width, float height, int duration, int type) { public static void spawnFire(EntityBulletBaseMK4 bullet, MovingObjectPosition mop, float width, float height, int duration, int type) {
if(mop.typeOfHit == mop.typeOfHit.BLOCK) { if(mop.typeOfHit == mop.typeOfHit.BLOCK) {
List<EntityFireLingering> fires = bullet.worldObj.getEntitiesWithinAABB(EntityFireLingering.class, List<EntityFireLingering> fires = bullet.worldObj.getEntitiesWithinAABB(EntityFireLingering.class,
@ -119,15 +119,15 @@ public class XFactoryFlamer {
.setOnUpdate(LAMBDA_FIRE).setOnRicochet(LAMBDA_LINGER_NAPALM); .setOnUpdate(LAMBDA_FIRE).setOnRicochet(LAMBDA_LINGER_NAPALM);
flame_balefire = new BulletConfig().setItem(EnumAmmo.FLAME_BALEFIRE).setCasing(new ItemStack(ModItems.plate_steel, 2), 500).setupDamageClass(DamageClass.FIRE).setLife(200).setVel(1F).setGrav(0.02D).setReloadCount(500).setSelfDamageDelay(20).setKnockback(0F) flame_balefire = new BulletConfig().setItem(EnumAmmo.FLAME_BALEFIRE).setCasing(new ItemStack(ModItems.plate_steel, 2), 500).setupDamageClass(DamageClass.FIRE).setLife(200).setVel(1F).setGrav(0.02D).setReloadCount(500).setSelfDamageDelay(20).setKnockback(0F)
.setOnUpdate(LAMBDA_BALEFIRE).setOnRicochet(LAMBDA_LINGER_BALEFIRE); .setOnUpdate(LAMBDA_BALEFIRE).setOnRicochet(LAMBDA_LINGER_BALEFIRE);
flame_nograv = flame_diesel.clone().setGrav(0); flame_nograv = flame_diesel.clone().setGrav(0);
flame_nograv_bf = flame_balefire.clone().setGrav(0).setLife(100); flame_nograv_bf = flame_balefire.clone().setGrav(0).setLife(100);
flame_topaz_diesel = flame_diesel .clone().setProjectiles(2).setSpread(0.05F).setLife(60).setGrav(0.0D); flame_topaz_diesel = flame_diesel .clone().setProjectiles(2).setSpread(0.05F).setLife(60).setGrav(0.0D);
flame_topaz_gas = flame_gas .clone().setProjectiles(2).setSpread(0.05F); flame_topaz_gas = flame_gas .clone().setProjectiles(2).setSpread(0.05F);
flame_topaz_napalm = flame_napalm .clone().setProjectiles(2).setSpread(0.05F).setLife(60).setGrav(0.0D); flame_topaz_napalm = flame_napalm .clone().setProjectiles(2).setSpread(0.05F).setLife(60).setGrav(0.0D);
flame_topaz_balefire = flame_balefire .clone().setProjectiles(2).setSpread(0.05F).setLife(60).setGrav(0.0D); flame_topaz_balefire = flame_balefire .clone().setProjectiles(2).setSpread(0.05F).setLife(60).setGrav(0.0D);
flame_daybreaker_diesel = flame_diesel.clone().setLife(200).setVel(2F).setGrav(0.035D) flame_daybreaker_diesel = flame_diesel.clone().setLife(200).setVel(2F).setGrav(0.035D)
.setOnImpact((bullet, mop) -> { Lego.standardExplode(bullet, mop, 5F); spawnFire(bullet, mop, 6F, 2F, 200, EntityFireLingering.TYPE_DIESEL); bullet.setDead(); }); .setOnImpact((bullet, mop) -> { Lego.standardExplode(bullet, mop, 5F); spawnFire(bullet, mop, 6F, 2F, 200, EntityFireLingering.TYPE_DIESEL); bullet.setDead(); });
flame_daybreaker_gas = flame_gas.clone().setLife(200).setVel(2F).setGrav(0.035D) flame_daybreaker_gas = flame_gas.clone().setLife(200).setVel(2F).setGrav(0.035D)
@ -136,7 +136,7 @@ public class XFactoryFlamer {
.setOnImpact((bullet, mop) -> { Lego.standardExplode(bullet, mop, 7.5F); spawnFire(bullet, mop, 6F, 2F, 300, EntityFireLingering.TYPE_DIESEL); bullet.setDead(); }); .setOnImpact((bullet, mop) -> { Lego.standardExplode(bullet, mop, 7.5F); spawnFire(bullet, mop, 6F, 2F, 300, EntityFireLingering.TYPE_DIESEL); bullet.setDead(); });
flame_daybreaker_balefire = flame_balefire.clone().setLife(200).setVel(2F).setGrav(0.035D) flame_daybreaker_balefire = flame_balefire.clone().setLife(200).setVel(2F).setGrav(0.035D)
.setOnImpact((bullet, mop) -> { Lego.standardExplode(bullet, mop, 5F); spawnFire(bullet, mop, 7.5F, 2.5F, 400, EntityFireLingering.TYPE_BALEFIRE); bullet.setDead(); }); .setOnImpact((bullet, mop) -> { Lego.standardExplode(bullet, mop, 5F); spawnFire(bullet, mop, 7.5F, 2.5F, 400, EntityFireLingering.TYPE_BALEFIRE); bullet.setDead(); });
ModItems.gun_flamer = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig() ModItems.gun_flamer = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig()
.dura(20_000).draw(10).inspect(17).crosshair(Crosshair.L_CIRCLE) .dura(20_000).draw(10).inspect(17).crosshair(Crosshair.L_CIRCLE)
.rec(new Receiver(0) .rec(new Receiver(0)
@ -167,7 +167,7 @@ public class XFactoryFlamer {
.setupStandardConfiguration() .setupStandardConfiguration()
.anim(LAMBDA_FLAMER_ANIMS).orchestra(Orchestras.ORCHESTRA_FLAMER_DAYBREAKER) .anim(LAMBDA_FLAMER_ANIMS).orchestra(Orchestras.ORCHESTRA_FLAMER_DAYBREAKER)
).setUnlocalizedName("gun_flamer_daybreaker"); ).setUnlocalizedName("gun_flamer_daybreaker");
ModItems.gun_chemthrower = new ItemGunChemthrower(WeaponQuality.A_SIDE, new GunConfig() ModItems.gun_chemthrower = new ItemGunChemthrower(WeaponQuality.A_SIDE, new GunConfig()
.dura(90_000).draw(10).inspect(17).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE) .dura(90_000).draw(10).inspect(17).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0) .rec(new Receiver(0)
@ -180,7 +180,7 @@ public class XFactoryFlamer {
).setUnlocalizedName("gun_chemthrower"); ).setUnlocalizedName("gun_chemthrower");
} }
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_FLAMER_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_FLAMER_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(-45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN)); .addBus("EQUIP", new BusAnimationSequence().addPos(-45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN));
@ -189,16 +189,16 @@ public class XFactoryFlamer {
case JAMMED: return new BusAnimation() case JAMMED: return new BusAnimation()
.addBus("ROTATE", new BusAnimationSequence().addPos(0, 0, 45, 250, IType.SIN_FULL).addPos(0, 0, 45, 350).addPos(0, 0, -15, 150, IType.SIN_FULL).addPos(0, 0, 0, 100, IType.SIN_FULL)); .addBus("ROTATE", new BusAnimationSequence().addPos(0, 0, 45, 250, IType.SIN_FULL).addPos(0, 0, 45, 350).addPos(0, 0, -15, 150, IType.SIN_FULL).addPos(0, 0, 0, 100, IType.SIN_FULL));
} }
return null; return null;
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_CHEMTHROWER_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_CHEMTHROWER_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(-45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN)); .addBus("EQUIP", new BusAnimationSequence().addPos(-45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN));
} }
return null; return null;
}; };
} }

View File

@ -22,10 +22,10 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmoSecret; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmoSecret;
import com.hbm.items.weapon.sedna.mags.MagazineSingleReload; import com.hbm.items.weapon.sedna.mags.MagazineSingleReload;
import com.hbm.packet.toclient.AuxParticlePacketNT; import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.util.ContaminationUtil; import com.hbm.util.ContaminationUtil;
import com.hbm.util.EntityDamageUtil; import com.hbm.util.EntityDamageUtil;
import com.hbm.util.Vec3NT; import com.hbm.util.Vec3NT;
@ -119,17 +119,17 @@ public class XFactoryFolly {
if(ItemGunBaseNT.getState(stack, ctx.configIndex) == GunState.IDLE) { if(ItemGunBaseNT.getState(stack, ctx.configIndex) == GunState.IDLE) {
boolean wasAiming = ItemGunBaseNT.getIsAiming(stack); boolean wasAiming = ItemGunBaseNT.getIsAiming(stack);
ItemGunBaseNT.setIsAiming(stack, !wasAiming); ItemGunBaseNT.setIsAiming(stack, !wasAiming);
if(!wasAiming) ItemGunBaseNT.playAnimation(ctx.getPlayer(), stack, AnimType.SPINUP, ctx.configIndex); if(!wasAiming) ItemGunBaseNT.playAnimation(ctx.getPlayer(), stack, GunAnimation.SPINUP, ctx.configIndex);
} }
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_FIRE = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_FIRE = (stack, ctx) -> {
Lego.doStandardFire(stack, ctx, AnimType.CYCLE, false); Lego.doStandardFire(stack, ctx, GunAnimation.CYCLE, false);
}; };
public static BiFunction<ItemStack, LambdaContext, Boolean> LAMBDA_CAN_FIRE = (stack, ctx) -> { public static BiFunction<ItemStack, LambdaContext, Boolean> LAMBDA_CAN_FIRE = (stack, ctx) -> {
if(!ItemGunBaseNT.getIsAiming(stack)) return false; if(!ItemGunBaseNT.getIsAiming(stack)) return false;
if(ItemGunBaseNT.getLastAnim(stack, ctx.configIndex) != AnimType.SPINUP) return false; if(ItemGunBaseNT.getLastAnim(stack, ctx.configIndex) != GunAnimation.SPINUP) return false;
if(ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex) < 100) return false; if(ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex) < 100) return false;
return ctx.config.getReceivers(stack)[0].getMagazine(stack).getAmount(stack, ctx.inventory) > 0; return ctx.config.getReceivers(stack)[0].getMagazine(stack).getAmount(stack, ctx.inventory) > 0;
}; };
@ -138,7 +138,7 @@ public class XFactoryFolly {
ItemGunBaseNT.setupRecoil(25, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5)); ItemGunBaseNT.setupRecoil(25, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5));
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_FOLLY_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_FOLLY_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(-60, 0, 0, 0).addPos(5, 0, 0, 1500, IType.SIN_DOWN).addPos(0, 0, 0, 500, IType.SIN_FULL)); .addBus("EQUIP", new BusAnimationSequence().addPos(-60, 0, 0, 0).addPos(5, 0, 0, 1500, IType.SIN_DOWN).addPos(0, 0, 0, 500, IType.SIN_FULL));

View File

@ -26,10 +26,10 @@ import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.items.weapon.sedna.mags.MagazineSingleReload; import com.hbm.items.weapon.sedna.mags.MagazineSingleReload;
import com.hbm.lib.Library; import com.hbm.lib.Library;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.util.EntityDamageUtil; import com.hbm.util.EntityDamageUtil;
import com.hbm.util.DamageResistanceHandler.DamageClass; import com.hbm.util.DamageResistanceHandler.DamageClass;
@ -46,7 +46,7 @@ import net.minecraftforge.common.util.ForgeDirection;
public class XFactoryRocket { public class XFactoryRocket {
public static BulletConfig[] rocket_template; public static BulletConfig[] rocket_template;
public static BulletConfig[] rocket_rpzb; public static BulletConfig[] rocket_rpzb;
public static BulletConfig[] rocket_qd; public static BulletConfig[] rocket_qd;
public static BulletConfig[] rocket_ml; public static BulletConfig[] rocket_ml;
@ -60,24 +60,24 @@ public class XFactoryRocket {
EntityBulletBaseMK4 bullet = (EntityBulletBaseMK4) entity; EntityBulletBaseMK4 bullet = (EntityBulletBaseMK4) entity;
if(bullet.accel < 4) bullet.accel += 0.4D; if(bullet.accel < 4) bullet.accel += 0.4D;
if(bullet.getThrower() == null || !(bullet.getThrower() instanceof EntityPlayer)) return; if(bullet.getThrower() == null || !(bullet.getThrower() instanceof EntityPlayer)) return;
EntityPlayer player = (EntityPlayer) bullet.getThrower(); EntityPlayer player = (EntityPlayer) bullet.getThrower();
if(Vec3.createVectorHelper(bullet.posX - player.posX, bullet.posY - player.posY, bullet.posZ - player.posZ).lengthVector() > 100) return; if(Vec3.createVectorHelper(bullet.posX - player.posX, bullet.posY - player.posY, bullet.posZ - player.posZ).lengthVector() > 100) return;
if(player.getHeldItem() == null || !(player.getHeldItem().getItem() instanceof ItemGunBaseNT) || !ItemGunBaseNT.getIsAiming(player.getHeldItem())) return; if(player.getHeldItem() == null || !(player.getHeldItem().getItem() instanceof ItemGunBaseNT) || !ItemGunBaseNT.getIsAiming(player.getHeldItem())) return;
MovingObjectPosition mop = Library.rayTrace(player, 200, 1); MovingObjectPosition mop = Library.rayTrace(player, 200, 1);
if(mop == null || mop.hitVec == null) return; if(mop == null || mop.hitVec == null) return;
Vec3 vec = Vec3.createVectorHelper(mop.hitVec.xCoord - bullet.posX, mop.hitVec.yCoord - bullet.posY, mop.hitVec.zCoord - bullet.posZ); Vec3 vec = Vec3.createVectorHelper(mop.hitVec.xCoord - bullet.posX, mop.hitVec.yCoord - bullet.posY, mop.hitVec.zCoord - bullet.posZ);
if(vec.lengthVector() < 3) return; if(vec.lengthVector() < 3) return;
vec = vec.normalize(); vec = vec.normalize();
double speed = Vec3.createVectorHelper(bullet.motionX, bullet.motionY, bullet.motionZ).lengthVector(); double speed = Vec3.createVectorHelper(bullet.motionX, bullet.motionY, bullet.motionZ).lengthVector();
bullet.motionX = vec.xCoord * speed; bullet.motionX = vec.xCoord * speed;
bullet.motionY = vec.yCoord * speed; bullet.motionY = vec.yCoord * speed;
bullet.motionZ = vec.zCoord * speed; bullet.motionZ = vec.zCoord * speed;
}; };
// IMPACT // IMPACT
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_STANDARD_EXPLODE = (bullet, mop) -> { public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_STANDARD_EXPLODE = (bullet, mop) -> {
if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3) return; if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3) return;
@ -110,7 +110,7 @@ public class XFactoryRocket {
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_STANDARD_EXPLODE_PHOSPHORUS = (bullet, mop) -> { public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_STANDARD_EXPLODE_PHOSPHORUS = (bullet, mop) -> {
spawnFire(bullet, mop, true, 600); spawnFire(bullet, mop, true, 600);
}; };
public static void spawnFire(EntityBulletBaseMK4 bullet, MovingObjectPosition mop, boolean phosphorus, int duration) { public static void spawnFire(EntityBulletBaseMK4 bullet, MovingObjectPosition mop, boolean phosphorus, int duration) {
if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3) return; if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3) return;
World world = bullet.worldObj; World world = bullet.worldObj;
@ -135,18 +135,18 @@ public class XFactoryRocket {
} }
} }
} }
public static BulletConfig makeRPZB(BulletConfig original) { return original.clone(); } public static BulletConfig makeRPZB(BulletConfig original) { return original.clone(); }
public static BulletConfig makeQD(BulletConfig original) { return original.clone().setLife(400).setOnUpdate(LAMBDA_STEERING_ACCELERATE); } public static BulletConfig makeQD(BulletConfig original) { return original.clone().setLife(400).setOnUpdate(LAMBDA_STEERING_ACCELERATE); }
public static BulletConfig makeML(BulletConfig original) { return original.clone(); } public static BulletConfig makeML(BulletConfig original) { return original.clone(); }
//this is starting to get messy but we need to put this crap *somewhere* and fragmenting it into a billion classes with two methods each just isn't gonna help //this is starting to get messy but we need to put this crap *somewhere* and fragmenting it into a billion classes with two methods each just isn't gonna help
public static void init() { public static void init() {
rocket_template = new BulletConfig[5]; rocket_template = new BulletConfig[5];
BulletConfig baseRocket = new BulletConfig().setLife(300).setSelfDamageDelay(10).setVel(0F).setGrav(0D).setOnEntityHit(null).setOnRicochet(null).setOnUpdate(LAMBDA_STANDARD_ACCELERATE); BulletConfig baseRocket = new BulletConfig().setLife(300).setSelfDamageDelay(10).setVel(0F).setGrav(0D).setOnEntityHit(null).setOnRicochet(null).setOnUpdate(LAMBDA_STANDARD_ACCELERATE);
rocket_template[0] = baseRocket.clone().setItem(EnumAmmo.ROCKET_HE).setOnImpact(LAMBDA_STANDARD_EXPLODE); rocket_template[0] = baseRocket.clone().setItem(EnumAmmo.ROCKET_HE).setOnImpact(LAMBDA_STANDARD_EXPLODE);
rocket_template[1] = baseRocket.clone().setItem(EnumAmmo.ROCKET_HEAT).setDamage(0.5F).setOnImpact(LAMBDA_STANDARD_EXPLODE_HEAT); rocket_template[1] = baseRocket.clone().setItem(EnumAmmo.ROCKET_HEAT).setDamage(0.5F).setOnImpact(LAMBDA_STANDARD_EXPLODE_HEAT);
rocket_template[2] = baseRocket.clone().setItem(EnumAmmo.ROCKET_DEMO).setDamage(0.75F).setOnImpact(LAMBDA_STANDARD_EXPLODE_DEMO); rocket_template[2] = baseRocket.clone().setItem(EnumAmmo.ROCKET_DEMO).setDamage(0.75F).setOnImpact(LAMBDA_STANDARD_EXPLODE_DEMO);
@ -156,7 +156,7 @@ public class XFactoryRocket {
rocket_rpzb = new BulletConfig[rocket_template.length]; rocket_rpzb = new BulletConfig[rocket_template.length];
rocket_qd = new BulletConfig[rocket_template.length]; rocket_qd = new BulletConfig[rocket_template.length];
rocket_ml = new BulletConfig[rocket_template.length]; rocket_ml = new BulletConfig[rocket_template.length];
for(int i = 0; i < rocket_template.length; i++) { for(int i = 0; i < rocket_template.length; i++) {
rocket_rpzb[i] = makeRPZB(rocket_template[i]); rocket_rpzb[i] = makeRPZB(rocket_template[i]);
rocket_qd[i] = makeQD(rocket_template[i]); rocket_qd[i] = makeQD(rocket_template[i]);
@ -210,7 +210,7 @@ public class XFactoryRocket {
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STINGER_SECONDARY_PRESS = (stack, ctx) -> { ItemGunStinger.setIsLockingOn(stack, true); }; public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STINGER_SECONDARY_PRESS = (stack, ctx) -> { ItemGunStinger.setIsLockingOn(stack, true); };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STINGER_SECONDARY_RELEASE = (stack, ctx) -> { ItemGunStinger.setIsLockingOn(stack, false); }; public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STINGER_SECONDARY_RELEASE = (stack, ctx) -> { ItemGunStinger.setIsLockingOn(stack, false); };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_MISSILE_LAUNCHER_PRIMARY_PRESS = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_MISSILE_LAUNCHER_PRIMARY_PRESS = (stack, ctx) -> {
if(ItemGunBaseNT.getIsAiming(stack)) { if(ItemGunBaseNT.getIsAiming(stack)) {
int target = ItemGunStinger.getLockonTarget(ctx.getPlayer(), 150D, 20D); int target = ItemGunStinger.getLockonTarget(ctx.getPlayer(), 150D, 20D);
@ -222,10 +222,10 @@ public class XFactoryRocket {
Lego.LAMBDA_STANDARD_CLICK_PRIMARY.accept(stack, ctx); Lego.LAMBDA_STANDARD_CLICK_PRIMARY.accept(stack, ctx);
ItemGunBaseNT.setIsLockedOn(stack, false); ItemGunBaseNT.setIsLockedOn(stack, false);
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_ROCKET = (stack, ctx) -> { }; public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_ROCKET = (stack, ctx) -> { };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_PANZERSCHRECK_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_PANZERSCHRECK_ANIMS = (stack, type) -> {
boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory) <= 0; boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory) <= 0;
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
@ -242,7 +242,7 @@ public class XFactoryRocket {
return null; return null;
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_QUADRO_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_QUADRO_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN)); .addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN));
@ -258,7 +258,7 @@ public class XFactoryRocket {
return null; return null;
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_MISSILE_LAUNCHER_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_MISSILE_LAUNCHER_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 1000, IType.SIN_DOWN)); .addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 1000, IType.SIN_DOWN));

View File

@ -28,10 +28,10 @@ import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.particle.helper.ExplosionCreator; import com.hbm.particle.helper.ExplosionCreator;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.tileentity.IRepairable; import com.hbm.tileentity.IRepairable;
import com.hbm.tileentity.IRepairable.EnumExtinguishType; import com.hbm.tileentity.IRepairable.EnumExtinguishType;
import com.hbm.util.CompatExternal; import com.hbm.util.CompatExternal;
@ -52,15 +52,15 @@ import net.minecraftforge.common.util.ForgeDirection;
public class XFactoryTool { public class XFactoryTool {
public static final ResourceLocation scope = new ResourceLocation(RefStrings.MODID, "textures/misc/scope_tool.png"); public static final ResourceLocation scope = new ResourceLocation(RefStrings.MODID, "textures/misc/scope_tool.png");
public static BulletConfig fext_water; public static BulletConfig fext_water;
public static BulletConfig fext_foam; public static BulletConfig fext_foam;
public static BulletConfig fext_sand; public static BulletConfig fext_sand;
public static BulletConfig ct_hook; public static BulletConfig ct_hook;
public static BulletConfig ct_mortar; public static BulletConfig ct_mortar;
public static BulletConfig ct_mortar_charge; public static BulletConfig ct_mortar_charge;
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_WATER_HIT = (bullet, mop) -> { public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_WATER_HIT = (bullet, mop) -> {
if(!bullet.worldObj.isRemote) { if(!bullet.worldObj.isRemote) {
int ix = mop.blockX; int ix = mop.blockX;
@ -80,7 +80,7 @@ public class XFactoryTool {
bullet.setDead(); bullet.setDead();
} }
}; };
public static Consumer<Entity> LAMBDA_WATER_UPDATE = (bullet) -> { public static Consumer<Entity> LAMBDA_WATER_UPDATE = (bullet) -> {
if(bullet.worldObj.isRemote) { if(bullet.worldObj.isRemote) {
NBTTagCompound data = new NBTTagCompound(); NBTTagCompound data = new NBTTagCompound();
@ -102,7 +102,7 @@ public class XFactoryTool {
} }
} }
}; };
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_FOAM_HIT = (bullet, mop) -> { public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_FOAM_HIT = (bullet, mop) -> {
if(!bullet.worldObj.isRemote) { if(!bullet.worldObj.isRemote) {
int ix = mop.blockX; int ix = mop.blockX;
@ -135,7 +135,7 @@ public class XFactoryTool {
if(fizz) bullet.worldObj.playSoundEffect(bullet.posX, bullet.posY, bullet.posZ, "random.fizz", 1.0F, 1.5F + bullet.worldObj.rand.nextFloat() * 0.5F); if(fizz) bullet.worldObj.playSoundEffect(bullet.posX, bullet.posY, bullet.posZ, "random.fizz", 1.0F, 1.5F + bullet.worldObj.rand.nextFloat() * 0.5F);
} }
}; };
public static Consumer<Entity> LAMBDA_FOAM_UPDATE = (bullet) -> { public static Consumer<Entity> LAMBDA_FOAM_UPDATE = (bullet) -> {
if(bullet.worldObj.isRemote) { if(bullet.worldObj.isRemote) {
NBTTagCompound data = new NBTTagCompound(); NBTTagCompound data = new NBTTagCompound();
@ -149,7 +149,7 @@ public class XFactoryTool {
MainRegistry.proxy.effectNT(data); MainRegistry.proxy.effectNT(data);
} }
}; };
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_SAND_HIT = (bullet, mop) -> { public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_SAND_HIT = (bullet, mop) -> {
if(!bullet.worldObj.isRemote) { if(!bullet.worldObj.isRemote) {
int ix = mop.blockX; int ix = mop.blockX;
@ -174,7 +174,7 @@ public class XFactoryTool {
} }
} }
}; };
public static Consumer<Entity> LAMBDA_SAND_UPDATE = (bullet) -> { public static Consumer<Entity> LAMBDA_SAND_UPDATE = (bullet) -> {
if(bullet.worldObj.isRemote) { if(bullet.worldObj.isRemote) {
NBTTagCompound data = new NBTTagCompound(); NBTTagCompound data = new NBTTagCompound();
@ -199,7 +199,7 @@ public class XFactoryTool {
} }
bullet.ignoreFrustumCheck = true; bullet.ignoreFrustumCheck = true;
}; };
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_HOOK = (bullet, mop) -> { public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_HOOK = (bullet, mop) -> {
if(mop.typeOfHit == mop.typeOfHit.BLOCK) { if(mop.typeOfHit == mop.typeOfHit.BLOCK) {
Vec3NT vec = new Vec3NT(-bullet.motionX, -bullet.motionY, -bullet.motionZ).normalizeSelf().multiply(0.05); Vec3NT vec = new Vec3NT(-bullet.motionX, -bullet.motionY, -bullet.motionZ).normalizeSelf().multiply(0.05);
@ -207,7 +207,7 @@ public class XFactoryTool {
bullet.getStuck(mop.blockX, mop.blockY, mop.blockZ, mop.sideHit); bullet.getStuck(mop.blockX, mop.blockY, mop.blockZ, mop.sideHit);
} }
}; };
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_MORTAR = (bullet, mop) -> { public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_MORTAR = (bullet, mop) -> {
if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3 && mop.entityHit == bullet.getThrower()) return; if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3 && mop.entityHit == bullet.getThrower()) return;
ExplosionVNT vnt = new ExplosionVNT(bullet.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 5, bullet.getThrower()); ExplosionVNT vnt = new ExplosionVNT(bullet.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 5, bullet.getThrower());
@ -219,7 +219,7 @@ public class XFactoryTool {
vnt.explode(); vnt.explode();
bullet.setDead(); bullet.setDead();
}; };
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_MORTAR_CHARGE = (bullet, mop) -> { public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_MORTAR_CHARGE = (bullet, mop) -> {
if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3 && mop.entityHit == bullet.getThrower()) return; if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3 && mop.entityHit == bullet.getThrower()) return;
ExplosionVNT vnt = new ExplosionVNT(bullet.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 15, bullet.getThrower()); ExplosionVNT vnt = new ExplosionVNT(bullet.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 15, bullet.getThrower());
@ -246,14 +246,14 @@ public class XFactoryTool {
.setOnUpdate(LAMBDA_SAND_UPDATE) .setOnUpdate(LAMBDA_SAND_UPDATE)
.setOnEntityHit((bulletEntity, target) -> { if(target.entityHit != null) target.entityHit.extinguish(); }) .setOnEntityHit((bulletEntity, target) -> { if(target.entityHit != null) target.entityHit.extinguish(); })
.setOnRicochet(LAMBDA_SAND_HIT); .setOnRicochet(LAMBDA_SAND_HIT);
ct_hook = new BulletConfig().setItem(EnumAmmo.CT_HOOK).setRenderRotations(false).setLife(6_000).setVel(3F).setGrav(0.035D).setDoesPenetrate(true).setDamageFalloffByPen(false) ct_hook = new BulletConfig().setItem(EnumAmmo.CT_HOOK).setRenderRotations(false).setLife(6_000).setVel(3F).setGrav(0.035D).setDoesPenetrate(true).setDamageFalloffByPen(false)
.setOnUpdate(LAMBDA_SET_HOOK).setOnImpact(LAMBDA_HOOK); .setOnUpdate(LAMBDA_SET_HOOK).setOnImpact(LAMBDA_HOOK);
ct_mortar = new BulletConfig().setItem(EnumAmmo.CT_MORTAR).setDamage(2.5F).setLife(200).setVel(3F).setGrav(0.035D) ct_mortar = new BulletConfig().setItem(EnumAmmo.CT_MORTAR).setDamage(2.5F).setLife(200).setVel(3F).setGrav(0.035D)
.setOnImpact(LAMBDA_MORTAR); .setOnImpact(LAMBDA_MORTAR);
ct_mortar_charge = new BulletConfig().setItem(EnumAmmo.CT_MORTAR_CHARGE).setDamage(5F).setLife(200).setVel(3F).setGrav(0.035D) ct_mortar_charge = new BulletConfig().setItem(EnumAmmo.CT_MORTAR_CHARGE).setDamage(5F).setLife(200).setVel(3F).setGrav(0.035D)
.setOnImpact(LAMBDA_MORTAR_CHARGE); .setOnImpact(LAMBDA_MORTAR_CHARGE);
ModItems.gun_fireext = new ItemGunBaseNT(WeaponQuality.UTILITY, new GunConfig() ModItems.gun_fireext = new ItemGunBaseNT(WeaponQuality.UTILITY, new GunConfig()
.dura(5_000).draw(10).inspect(55).reloadChangeType(true).hideCrosshair(false).crosshair(Crosshair.L_CIRCLE) .dura(5_000).draw(10).inspect(55).reloadChangeType(true).hideCrosshair(false).crosshair(Crosshair.L_CIRCLE)
.rec(new Receiver(0) .rec(new Receiver(0)
@ -264,7 +264,7 @@ public class XFactoryTool {
.setupStandardConfiguration() .setupStandardConfiguration()
.orchestra(Orchestras.ORCHESTRA_FIREEXT) .orchestra(Orchestras.ORCHESTRA_FIREEXT)
).setUnlocalizedName("gun_fireext"); ).setUnlocalizedName("gun_fireext");
ModItems.gun_charge_thrower = new ItemGunChargeThrower(WeaponQuality.UTILITY, new GunConfig() ModItems.gun_charge_thrower = new ItemGunChargeThrower(WeaponQuality.UTILITY, new GunConfig()
.dura(3_000).draw(10).inspect(55).reloadChangeType(true).hideCrosshair(false).crosshair(Crosshair.L_CIRCUMFLEX) .dura(3_000).draw(10).inspect(55).reloadChangeType(true).hideCrosshair(false).crosshair(Crosshair.L_CIRCUMFLEX)
.rec(new Receiver(0) .rec(new Receiver(0)
@ -276,12 +276,12 @@ public class XFactoryTool {
.anim(LAMBDA_CT_ANIMS).orchestra(Orchestras.ORCHESTRA_CHARGE_THROWER) .anim(LAMBDA_CT_ANIMS).orchestra(Orchestras.ORCHESTRA_CHARGE_THROWER)
).setUnlocalizedName("gun_charge_thrower"); ).setUnlocalizedName("gun_charge_thrower");
} }
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_CT = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_CT = (stack, ctx) -> {
ItemGunBaseNT.setupRecoil(10, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5)); ItemGunBaseNT.setupRecoil(10, (float) (ctx.getPlayer().getRNG().nextGaussian() * 1.5));
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_CT_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_CT_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(-45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN)); .addBus("EQUIP", new BusAnimationSequence().addPos(-45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN));
@ -295,7 +295,7 @@ public class XFactoryTool {
.addBus("TURN", new BusAnimationSequence().addPos(0, 60, 0, 500, IType.SIN_FULL).hold(1750).addPos(0, 0, 0, 500, IType.SIN_FULL)) .addBus("TURN", new BusAnimationSequence().addPos(0, 60, 0, 500, IType.SIN_FULL).hold(1750).addPos(0, 0, 0, 500, IType.SIN_FULL))
.addBus("ROLL", new BusAnimationSequence().hold(750).addPos(0, 0, -90, 500, IType.SIN_FULL).hold(1000).addPos(0, 0, 0, 500, IType.SIN_FULL)); .addBus("ROLL", new BusAnimationSequence().hold(750).addPos(0, 0, -90, 500, IType.SIN_FULL).hold(1000).addPos(0, 0, 0, 500, IType.SIN_FULL));
} }
return null; return null;
}; };
} }

View File

@ -11,7 +11,7 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.Receiver; import com.hbm.items.weapon.sedna.Receiver;
import com.hbm.items.weapon.sedna.mags.IMagazine; import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.items.weapon.sedna.mags.MagazineFluid; import com.hbm.items.weapon.sedna.mags.MagazineFluid;
import com.hbm.render.anim.HbmAnimations.AnimType; import com.hbm.render.anim.AnimationEnums.GunAnimation;
import api.hbm.fluidmk2.IFillableItem; import api.hbm.fluidmk2.IFillableItem;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
@ -20,35 +20,35 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
public class ItemGunChemthrower extends ItemGunBaseNT implements IFillableItem { public class ItemGunChemthrower extends ItemGunBaseNT implements IFillableItem {
public static final int CONSUMPTION = 3; public static final int CONSUMPTION = 3;
public ItemGunChemthrower(WeaponQuality quality, GunConfig... cfg) { public ItemGunChemthrower(WeaponQuality quality, GunConfig... cfg) {
super(quality, cfg); super(quality, cfg);
} }
@Override @Override
public boolean acceptsFluid(FluidType type, ItemStack stack) { public boolean acceptsFluid(FluidType type, ItemStack stack) {
return getFluidType(stack) == type || this.getMagCount(stack) == 0; return getFluidType(stack) == type || this.getMagCount(stack) == 0;
} }
public static final int transferSpeed = 50; public static final int transferSpeed = 50;
@Override @Override
public int tryFill(FluidType type, int amount, ItemStack stack) { public int tryFill(FluidType type, int amount, ItemStack stack) {
if(!acceptsFluid(type, stack)) return amount; if(!acceptsFluid(type, stack)) return amount;
if(this.getMagCount(stack) == 0) this.setMagType(stack, type.getID()); if(this.getMagCount(stack) == 0) this.setMagType(stack, type.getID());
int fill = this.getMagCount(stack); int fill = this.getMagCount(stack);
int req = this.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getCapacity(stack) - fill; int req = this.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getCapacity(stack) - fill;
int toFill = Math.min(amount, req); int toFill = Math.min(amount, req);
toFill = Math.min(toFill, transferSpeed); toFill = Math.min(toFill, transferSpeed);
this.setMagCount(stack, fill + toFill); this.setMagCount(stack, fill + toFill);
return amount - toFill; return amount - toFill;
} }
public FluidType getFluidType(ItemStack stack) { public FluidType getFluidType(ItemStack stack) {
return Fluids.fromID(this.getMagType(stack)); return Fluids.fromID(this.getMagType(stack));
} }
@ -69,32 +69,32 @@ public class ItemGunChemthrower extends ItemGunBaseNT implements IFillableItem {
@Override public FluidType getFirstFluidType(ItemStack stack) { return Fluids.fromID(this.getMagType(stack)); } @Override public FluidType getFirstFluidType(ItemStack stack) { return Fluids.fromID(this.getMagType(stack)); }
@Override public int getFill(ItemStack stack) { return this.getMagCount(stack); } @Override public int getFill(ItemStack stack) { return this.getMagCount(stack); }
public static int getMagType(ItemStack stack) { return ItemGunBaseNT.getValueInt(stack, MagazineFluid.KEY_MAG_TYPE + 0); } public static int getMagType(ItemStack stack) { return ItemGunBaseNT.getValueInt(stack, MagazineFluid.KEY_MAG_TYPE + 0); }
public static void setMagType(ItemStack stack, int value) { ItemGunBaseNT.setValueInt(stack, MagazineFluid.KEY_MAG_TYPE + 0, value); } public static void setMagType(ItemStack stack, int value) { ItemGunBaseNT.setValueInt(stack, MagazineFluid.KEY_MAG_TYPE + 0, value); }
public static int getMagCount(ItemStack stack) { return ItemGunBaseNT.getValueInt(stack, MagazineFluid.KEY_MAG_COUNT + 0); } public static int getMagCount(ItemStack stack) { return ItemGunBaseNT.getValueInt(stack, MagazineFluid.KEY_MAG_COUNT + 0); }
public static void setMagCount(ItemStack stack, int value) { ItemGunBaseNT.setValueInt(stack, MagazineFluid.KEY_MAG_COUNT + 0, value); } public static void setMagCount(ItemStack stack, int value) { ItemGunBaseNT.setValueInt(stack, MagazineFluid.KEY_MAG_COUNT + 0, value); }
public static BiFunction<ItemStack, LambdaContext, Boolean> LAMBDA_CAN_FIRE = (stack, ctx) -> { return ctx.config.getReceivers(stack)[0].getMagazine(stack).getAmount(stack, ctx.inventory) >= CONSUMPTION; }; public static BiFunction<ItemStack, LambdaContext, Boolean> LAMBDA_CAN_FIRE = (stack, ctx) -> { return ctx.config.getReceivers(stack)[0].getMagazine(stack).getAmount(stack, ctx.inventory) >= CONSUMPTION; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_FIRE = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_FIRE = (stack, ctx) -> {
EntityLivingBase entity = ctx.entity; EntityLivingBase entity = ctx.entity;
EntityPlayer player = ctx.getPlayer(); EntityPlayer player = ctx.getPlayer();
int index = ctx.configIndex; int index = ctx.configIndex;
ItemGunBaseNT.playAnimation(player, stack, AnimType.CYCLE, ctx.configIndex); ItemGunBaseNT.playAnimation(player, stack, GunAnimation.CYCLE, ctx.configIndex);
Receiver primary = ctx.config.getReceivers(stack)[0]; Receiver primary = ctx.config.getReceivers(stack)[0];
IMagazine mag = primary.getMagazine(stack); IMagazine mag = primary.getMagazine(stack);
Vec3 offset = primary.getProjectileOffset(stack); Vec3 offset = primary.getProjectileOffset(stack);
double forwardOffset = offset.xCoord; double forwardOffset = offset.xCoord;
double heightOffset = offset.yCoord; double heightOffset = offset.yCoord;
double sideOffset = offset.zCoord; double sideOffset = offset.zCoord;
EntityChemical chem = new EntityChemical(entity.worldObj, entity, sideOffset, heightOffset, forwardOffset); EntityChemical chem = new EntityChemical(entity.worldObj, entity, sideOffset, heightOffset, forwardOffset);
chem.setFluid((FluidType) mag.getType(stack, ctx.inventory)); chem.setFluid((FluidType) mag.getType(stack, ctx.inventory));
entity.worldObj.spawnEntityInWorld(chem); entity.worldObj.spawnEntityInWorld(chem);
mag.useUpAmmo(stack, ctx.inventory, CONSUMPTION); mag.useUpAmmo(stack, ctx.inventory, CONSUMPTION);
ItemGunBaseNT.setWear(stack, index, Math.min(ItemGunBaseNT.getWear(stack, index) + 1F, ctx.config.getDurability(stack))); ItemGunBaseNT.setWear(stack, index, Math.min(ItemGunBaseNT.getWear(stack, index) + 1F, ctx.config.getDurability(stack)));
}; };

View File

@ -4,10 +4,10 @@ import java.util.function.BiFunction;
import com.hbm.items.weapon.sedna.GunConfig; import com.hbm.items.weapon.sedna.GunConfig;
import com.hbm.items.weapon.sedna.factory.XFactory556mm; import com.hbm.items.weapon.sedna.factory.XFactory556mm;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -23,8 +23,8 @@ public class WeapnModG3SawedOff extends WeaponModBase {
if(key == GunConfig.FUN_ANIMNATIONS) return (T) LAMBDA_G3_ANIMS; if(key == GunConfig.FUN_ANIMNATIONS) return (T) LAMBDA_G3_ANIMS;
return base; return base;
} }
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_G3_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_G3_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation().addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 250, IType.SIN_FULL)); case EQUIP: return new BusAnimation().addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 250, IType.SIN_FULL));
} }

View File

@ -9,10 +9,10 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.factory.Orchestras; import com.hbm.items.weapon.sedna.factory.Orchestras;
import com.hbm.items.weapon.sedna.factory.XFactory44; import com.hbm.items.weapon.sedna.factory.XFactory44;
import com.hbm.items.weapon.sedna.factory.XFactory762mm; import com.hbm.items.weapon.sedna.factory.XFactory762mm;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.util.EntityDamageUtil; import com.hbm.util.EntityDamageUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -36,15 +36,15 @@ public class WeaponModCarbineBayonet extends WeaponModBase {
if(key == GunConfig.I_INSPECTCANCEL) return cast(false, base); if(key == GunConfig.I_INSPECTCANCEL) return cast(false, base);
return base; return base;
} }
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_CARBINE = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_CARBINE = (stack, ctx) -> {
EntityLivingBase entity = ctx.entity; EntityLivingBase entity = ctx.entity;
if(entity.worldObj.isRemote) return; if(entity.worldObj.isRemote) return;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); GunAnimation type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
if(type == AnimType.INSPECT) { if(type == GunAnimation.INSPECT) {
if(timer == 15 && ctx.getPlayer() != null) { if(timer == 15 && ctx.getPlayer() != null) {
MovingObjectPosition mop = EntityDamageUtil.getMouseOver(ctx.getPlayer(), 3.0D); MovingObjectPosition mop = EntityDamageUtil.getMouseOver(ctx.getPlayer(), 3.0D);
if(mop != null) { if(mop != null) {
@ -63,16 +63,16 @@ public class WeaponModCarbineBayonet extends WeaponModBase {
} }
return; return;
} }
Orchestras.ORCHESTRA_CARBINE.accept(stack, ctx); Orchestras.ORCHESTRA_CARBINE.accept(stack, ctx);
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_CARBINE_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_CARBINE_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case INSPECT: return new BusAnimation() case INSPECT: return new BusAnimation()
.addBus("STAB", new BusAnimationSequence().addPos(0, 1, -2, 250, IType.SIN_DOWN).hold(250).addPos(0, 1, 5, 250, IType.SIN_UP).hold(250).addPos(0, 0, 0, 500, IType.SIN_FULL)); .addBus("STAB", new BusAnimationSequence().addPos(0, 1, -2, 250, IType.SIN_DOWN).hold(250).addPos(0, 1, 5, 250, IType.SIN_UP).hold(250).addPos(0, 0, 0, 500, IType.SIN_FULL));
} }
return XFactory762mm.LAMBDA_CARBINE_ANIMS.apply(stack, type); return XFactory762mm.LAMBDA_CARBINE_ANIMS.apply(stack, type);
}; };
} }

View File

@ -9,7 +9,7 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.factory.Orchestras; import com.hbm.items.weapon.sedna.factory.Orchestras;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.particle.helper.CasingCreator; import com.hbm.particle.helper.CasingCreator;
import com.hbm.render.anim.HbmAnimations.AnimType; import com.hbm.render.anim.AnimationEnums.GunAnimation;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -30,15 +30,15 @@ public class WeaponModGreasegun extends WeaponModBase {
if(key == GunConfig.CON_ORCHESTRA) return (T) ORCHESTRA_GREASEGUN; if(key == GunConfig.CON_ORCHESTRA) return (T) ORCHESTRA_GREASEGUN;
return base; return base;
} }
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_GREASEGUN = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_GREASEGUN = (stack, ctx) -> {
EntityLivingBase entity = ctx.entity; EntityLivingBase entity = ctx.entity;
if(entity.worldObj.isRemote) return; if(entity.worldObj.isRemote) return;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); GunAnimation type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack); boolean aiming = ItemGunBaseNT.getIsAiming(stack);
if(type == AnimType.CYCLE) { if(type == GunAnimation.CYCLE) {
if(timer == 1) { if(timer == 1) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory); SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.55, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, 0.18, -0.12, 0.01, -7.5F + (float)entity.getRNG().nextGaussian() * 5F, 12F + (float)entity.getRNG().nextGaussian() * 5F, casing.getName()); if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.55, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, 0.18, -0.12, 0.01, -7.5F + (float)entity.getRNG().nextGaussian() * 5F, 12F + (float)entity.getRNG().nextGaussian() * 5F, casing.getName());

View File

@ -8,15 +8,15 @@ import com.hbm.items.weapon.sedna.factory.XFactory12ga;
import com.hbm.items.weapon.sedna.mags.IMagazine; import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.items.weapon.sedna.mags.MagazineSingleReload; import com.hbm.items.weapon.sedna.mags.MagazineSingleReload;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class WeaponModLiberatorSpeedloader extends WeaponModBase { public class WeaponModLiberatorSpeedloader extends WeaponModBase {
public static MagazineFullReload MAG = new MagazineFullReload(0, 4); public static MagazineFullReload MAG = new MagazineFullReload(0, 4);
public WeaponModLiberatorSpeedloader(int id) { public WeaponModLiberatorSpeedloader(int id) {
@ -31,11 +31,11 @@ public class WeaponModLiberatorSpeedloader extends WeaponModBase {
if(MAG.acceptedBullets.isEmpty()) MAG.acceptedBullets.addAll(originalMag.acceptedBullets); if(MAG.acceptedBullets.isEmpty()) MAG.acceptedBullets.addAll(originalMag.acceptedBullets);
return (T) MAG; return (T) MAG;
} }
return base; return base;
} }
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_LIBERATOR_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_LIBERATOR_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case RELOAD: return new BusAnimation() case RELOAD: return new BusAnimation()
.addBus("LATCH", new BusAnimationSequence().addPos(15, 0, 0, 100)) .addBus("LATCH", new BusAnimationSequence().addPos(15, 0, 0, 100))
@ -51,7 +51,7 @@ public class WeaponModLiberatorSpeedloader extends WeaponModBase {
.addBus("LATCH", new BusAnimationSequence().addPos(15, 0, 0, 0).addPos(15, 0, 0, 250).addPos(0, 0, 0, 50).addPos(0, 0, 0, 550).addPos(15, 0, 0, 100).addPos(15, 0, 0, 600).addPos(0, 0, 0, 50)) .addBus("LATCH", new BusAnimationSequence().addPos(15, 0, 0, 0).addPos(15, 0, 0, 250).addPos(0, 0, 0, 50).addPos(0, 0, 0, 550).addPos(15, 0, 0, 100).addPos(15, 0, 0, 600).addPos(0, 0, 0, 50))
.addBus("BREAK", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 250, IType.SIN_UP).addPos(0, 0, 0, 600).addPos(45, 0, 0, 250, IType.SIN_DOWN).addPos(45, 0, 0, 300).addPos(0, 0, 0, 150, IType.SIN_UP)); .addBus("BREAK", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 250, IType.SIN_UP).addPos(0, 0, 0, 600).addPos(45, 0, 0, 250, IType.SIN_DOWN).addPos(45, 0, 0, 300).addPos(0, 0, 0, 150, IType.SIN_UP));
} }
return XFactory12ga.LAMBDA_LIBERATOR_ANIMS.apply(stack, type); return XFactory12ga.LAMBDA_LIBERATOR_ANIMS.apply(stack, type);
}; };
} }

View File

@ -9,10 +9,10 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.factory.Orchestras; import com.hbm.items.weapon.sedna.factory.Orchestras;
import com.hbm.items.weapon.sedna.factory.XFactory44; import com.hbm.items.weapon.sedna.factory.XFactory44;
import com.hbm.items.weapon.sedna.factory.XFactory762mm; import com.hbm.items.weapon.sedna.factory.XFactory762mm;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.util.EntityDamageUtil; import com.hbm.util.EntityDamageUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -36,15 +36,15 @@ public class WeaponModMASBayonet extends WeaponModBase {
if(key == GunConfig.I_INSPECTCANCEL) return cast(false, base); if(key == GunConfig.I_INSPECTCANCEL) return cast(false, base);
return base; return base;
} }
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_MAS36 = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_MAS36 = (stack, ctx) -> {
EntityLivingBase entity = ctx.entity; EntityLivingBase entity = ctx.entity;
if(entity.worldObj.isRemote) return; if(entity.worldObj.isRemote) return;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); GunAnimation type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
if(type == AnimType.INSPECT) { if(type == GunAnimation.INSPECT) {
if(timer == 15 && ctx.getPlayer() != null) { if(timer == 15 && ctx.getPlayer() != null) {
MovingObjectPosition mop = EntityDamageUtil.getMouseOver(ctx.getPlayer(), 3.0D); MovingObjectPosition mop = EntityDamageUtil.getMouseOver(ctx.getPlayer(), 3.0D);
if(mop != null) { if(mop != null) {
@ -63,16 +63,16 @@ public class WeaponModMASBayonet extends WeaponModBase {
} }
return; return;
} }
Orchestras.ORCHESTRA_MAS36.accept(stack, ctx); Orchestras.ORCHESTRA_MAS36.accept(stack, ctx);
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_MAS36_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_MAS36_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case INSPECT: return new BusAnimation() case INSPECT: return new BusAnimation()
.addBus("STAB", new BusAnimationSequence().addPos(0, 1, -2, 250, IType.SIN_DOWN).hold(250).addPos(0, 1, 5, 250, IType.SIN_UP).hold(250).addPos(0, 0, 0, 500, IType.SIN_FULL)); .addBus("STAB", new BusAnimationSequence().addPos(0, 1, -2, 250, IType.SIN_DOWN).hold(250).addPos(0, 1, 5, 250, IType.SIN_UP).hold(250).addPos(0, 0, 0, 500, IType.SIN_FULL));
} }
return XFactory762mm.LAMBDA_MAS36_ANIMS.apply(stack, type); return XFactory762mm.LAMBDA_MAS36_ANIMS.apply(stack, type);
}; };
} }

View File

@ -10,10 +10,10 @@ import com.hbm.items.weapon.sedna.Receiver;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext; import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.factory.Lego; import com.hbm.items.weapon.sedna.factory.Lego;
import com.hbm.items.weapon.sedna.factory.XFactoryRocket; import com.hbm.items.weapon.sedna.factory.XFactoryRocket;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.util.EntityDamageUtil; import com.hbm.util.EntityDamageUtil;
import com.hbm.util.DamageResistanceHandler.DamageClass; import com.hbm.util.DamageResistanceHandler.DamageClass;
@ -32,13 +32,13 @@ public class WeaponModPanzerschreckSawedOff extends WeaponModBase {
return base; return base;
} }
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_PANZERSCHRECK_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, GunAnimation, BusAnimation> LAMBDA_PANZERSCHRECK_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation().addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 250, IType.SIN_DOWN)); case EQUIP: return new BusAnimation().addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 250, IType.SIN_DOWN));
} }
return XFactoryRocket.LAMBDA_PANZERSCHRECK_ANIMS.apply(stack, type); return XFactoryRocket.LAMBDA_PANZERSCHRECK_ANIMS.apply(stack, type);
}; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_FIRE = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_FIRE = (stack, ctx) -> {
Lego.LAMBDA_STANDARD_FIRE.accept(stack, ctx); Lego.LAMBDA_STANDARD_FIRE.accept(stack, ctx);
if(ctx.entity != null) { if(ctx.entity != null) {

View File

@ -290,13 +290,13 @@ public class HbmWorldGen implements IWorldGenerator {
} }
} }
if(WorldConfig.factoryStructure > 0 && rand.nextInt(WorldConfig.factoryStructure) == 0) { // if(WorldConfig.factoryStructure > 0 && rand.nextInt(WorldConfig.factoryStructure) == 0) {
int x = i + rand.nextInt(16); // int x = i + rand.nextInt(16);
int z = j + rand.nextInt(16); // int z = j + rand.nextInt(16);
int y = world.getHeightValue(x, z); // int y = world.getHeightValue(x, z);
//
new Factory().generate(world, rand, x, y, z); // new Factory().generate(world, rand, x, y, z);
} // }
if(WorldConfig.dudStructure > 0 && rand.nextInt(WorldConfig.dudStructure) == 0) { if(WorldConfig.dudStructure > 0 && rand.nextInt(WorldConfig.dudStructure) == 0) {
int x = i + 8 + rand.nextInt(16); int x = i + 8 + rand.nextInt(16);

View File

@ -3,7 +3,7 @@ package com.hbm.lib;
public class RefStrings { public class RefStrings {
public static final String MODID = "hbm"; public static final String MODID = "hbm";
public static final String NAME = "Hbm's Nuclear Tech Mod"; public static final String NAME = "Hbm's Nuclear Tech Mod";
public static final String VERSION = "1.0.27 BETA (5441)"; public static final String VERSION = "1.0.27 BETA (5454)";
//HBM's Beta Naming Convention: //HBM's Beta Naming Convention:
//V T (X) //V T (X)
//V -> next release version //V -> next release version

View File

@ -41,7 +41,6 @@ import com.hbm.handler.HbmKeybinds;
import com.hbm.handler.HbmKeybinds.EnumKeybind; import com.hbm.handler.HbmKeybinds.EnumKeybind;
import com.hbm.handler.ImpactWorldHandler; import com.hbm.handler.ImpactWorldHandler;
import com.hbm.handler.imc.IMCHandlerNHNEI; import com.hbm.handler.imc.IMCHandlerNHNEI;
import com.hbm.items.IAnimatedItem;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.factory.GunFactoryClient; import com.hbm.items.weapon.sedna.factory.GunFactoryClient;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
@ -49,10 +48,6 @@ import com.hbm.particle.*;
import com.hbm.particle.helper.ParticleCreators; import com.hbm.particle.helper.ParticleCreators;
import com.hbm.particle.psys.engine.EventHandlerParticleEngine; import com.hbm.particle.psys.engine.EventHandlerParticleEngine;
import com.hbm.qmaw.QMAWLoader; import com.hbm.qmaw.QMAWLoader;
import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.HbmAnimations;
import com.hbm.render.anim.HbmAnimations.Animation;
import com.hbm.render.block.*; import com.hbm.render.block.*;
import com.hbm.render.entity.RenderEmpty; import com.hbm.render.entity.RenderEmpty;
import com.hbm.render.entity.effect.*; import com.hbm.render.entity.effect.*;
@ -271,6 +266,7 @@ public class ClientProxy extends ServerProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineAssembler.class, new RenderAssembler()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineAssembler.class, new RenderAssembler());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineAssemblyMachine.class, new RenderAssemblyMachine()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineAssemblyMachine.class, new RenderAssemblyMachine());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineAssemfac.class, new RenderAssemfac()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineAssemfac.class, new RenderAssemfac());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineAssemblyFactory.class, new RenderAssemblyFactory());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineChemplant.class, new RenderChemplant()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineChemplant.class, new RenderChemplant());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineChemicalPlant.class, new RenderChemicalPlant()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineChemicalPlant.class, new RenderChemicalPlant());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineChemfac.class, new RenderChemfac()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineChemfac.class, new RenderChemfac());
@ -1787,105 +1783,6 @@ public class ClientProxy extends ServerProxy {
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleDeadLeaf(man, world, x, y, z)); Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleDeadLeaf(man, world, x, y, z));
} }
if("anim".equals(type)) {
String mode = data.getString("mode");
/* crucible deploy */
if("crucible".equals(mode) && player.getHeldItem() != null) {
BusAnimation animation = new BusAnimation()
.addBus("GUARD_ROT", new BusAnimationSequence()
.addPos(90, 0, 1, 0)
.addPos(90, 0, 1, 800)
.addPos(0, 0, 1, 50));
String id = ModItems.crucible.getUnlocalizedName();
HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(id, System.currentTimeMillis(), animation, null);
}
/* crucible swing */
if("cSwing".equals(mode)) {
if(HbmAnimations.getRelevantTransformation("SWING_ROT")[0] == 0) {
int offset = rand.nextInt(80) - 20;
BusAnimation animation = new BusAnimation()
.addBus("SWING_ROT", new BusAnimationSequence()
.addPos(90 - offset, 90 - offset, 35, 75)
.addPos(90 + offset, 90 - offset, -45, 150)
.addPos(0, 0, 0, 500))
.addBus("SWING_TRANS", new BusAnimationSequence()
.addPos(-3, 0, 0, 75)
.addPos(8, 0, 0, 150)
.addPos(0, 0, 0, 500));
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:weapon.cSwing"), 0.8F + player.getRNG().nextFloat() * 0.2F));
String id = ModItems.crucible.getUnlocalizedName();
HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(id, System.currentTimeMillis(), animation, null);
}
}
/* chainsaw swing */
if("sSwing".equals(mode) || "lSwing".equals(mode)) { //temp for lance
int forward = 150;
int sideways = 100;
int retire = 200;
if(HbmAnimations.getRelevantAnim() == null) {
BusAnimation animation = new BusAnimation()
.addBus("SWING_ROT", new BusAnimationSequence()
.addPos(0, 0, 90, forward)
.addPos(45, 0, 90, sideways)
.addPos(0, 0, 0, retire))
.addBus("SWING_TRANS", new BusAnimationSequence()
.addPos(0, 0, 3, forward)
.addPos(2, 0, 2, sideways)
.addPos(0, 0, 0, retire));
HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, null);
} else {
double[] rot = HbmAnimations.getRelevantTransformation("SWING_ROT");
double[] trans = HbmAnimations.getRelevantTransformation("SWING_TRANS");
if(System.currentTimeMillis() - HbmAnimations.getRelevantAnim().startMillis < 50) return;
BusAnimation animation = new BusAnimation()
.addBus("SWING_ROT", new BusAnimationSequence()
.addPos(rot[0], rot[1], rot[2], 0)
.addPos(0, 0, 90, forward)
.addPos(45, 0, 90, sideways)
.addPos(0, 0, 0, retire))
.addBus("SWING_TRANS", new BusAnimationSequence()
.addPos(trans[0], trans[1], trans[2], 0)
.addPos(0, 0, 3, forward)
.addPos(2, 0, 2, sideways)
.addPos(0, 0, 0, retire));
HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, null);
}
}
if("generic".equals(mode)) {
ItemStack stack = player.getHeldItem();
if(stack != null && stack.getItem() instanceof IAnimatedItem) {
IAnimatedItem item = (IAnimatedItem) stack.getItem();
BusAnimation anim = item.getAnimation(data, stack);
if(anim != null) {
HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), anim, null);
}
}
}
}
if("tau".equals(type)) { if("tau".equals(type)) {
for(int i = 0; i < data.getByte("count"); i++) for(int i = 0; i < data.getByte("count"); i++)

View File

@ -97,7 +97,6 @@ public class CraftingManager {
addRecipeAuto(new ItemStack(ModItems.hazmat_cloth_grey, 1), new Object[] { " P ", "ICI", " L ", 'C', ModItems.hazmat_cloth_red, 'P', IRON.plate(), 'L', PB.plate(), 'I', ANY_RUBBER.ingot() }); addRecipeAuto(new ItemStack(ModItems.hazmat_cloth_grey, 1), new Object[] { " P ", "ICI", " L ", 'C', ModItems.hazmat_cloth_red, 'P', IRON.plate(), 'L', PB.plate(), 'I', ANY_RUBBER.ingot() });
addRecipeAuto(new ItemStack(ModItems.asbestos_cloth, 8), new Object[] { "SCS", "CPC", "SCS", 'S', Items.string, 'P', BR.dust(), 'C', Blocks.wool }); addRecipeAuto(new ItemStack(ModItems.asbestos_cloth, 8), new Object[] { "SCS", "CPC", "SCS", 'S', Items.string, 'P', BR.dust(), 'C', Blocks.wool });
addRecipeAuto(new ItemStack(ModItems.bolt_spike, 2), new Object[] { "BB", "B ", "B ", 'B', STEEL.bolt()}); addRecipeAuto(new ItemStack(ModItems.bolt_spike, 2), new Object[] { "BB", "B ", "B ", 'B', STEEL.bolt()});
addRecipeAuto(new ItemStack(ModItems.pipes_steel, 1), new Object[] { "B", "B", "B", 'B', STEEL.block() });
addRecipeAuto(new ItemStack(ModItems.plate_polymer, 8), new Object[] { "DD", 'D', ANY_PLASTIC.ingot() }); addRecipeAuto(new ItemStack(ModItems.plate_polymer, 8), new Object[] { "DD", 'D', ANY_PLASTIC.ingot() });
addRecipeAuto(new ItemStack(ModItems.plate_polymer, 8), new Object[] { "DD", 'D', ANY_RUBBER.ingot() }); addRecipeAuto(new ItemStack(ModItems.plate_polymer, 8), new Object[] { "DD", 'D', ANY_RUBBER.ingot() });
addRecipeAuto(new ItemStack(ModItems.plate_polymer, 16), new Object[] { "DD", 'D', FIBER.ingot()}); addRecipeAuto(new ItemStack(ModItems.plate_polymer, 16), new Object[] { "DD", 'D', FIBER.ingot()});
@ -355,7 +354,7 @@ public class CraftingManager {
addRecipeAuto(new ItemStack(ModItems.stamp_desh_flat, 1), new Object[] { "BDB", "DSD", "BDB", 'B', brick, 'D', DESH.ingot(), 'S', FERRO.ingot() }); addRecipeAuto(new ItemStack(ModItems.stamp_desh_flat, 1), new Object[] { "BDB", "DSD", "BDB", 'B', brick, 'D', DESH.ingot(), 'S', FERRO.ingot() });
} }
addRecipeAuto(new ItemStack(ModBlocks.watz_pump, 1), new Object[] { "MPM", "PCP", "PSP", 'M', ModItems.motor_desh, 'P', ANY_RESISTANTALLOY.plateCast(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BISMOID), 'S', ModItems.pipes_steel }); addRecipeAuto(new ItemStack(ModBlocks.watz_pump, 1), new Object[] { "MPM", "PCP", "PSP", 'M', ModItems.motor_desh, 'P', ANY_RESISTANTALLOY.plateCast(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BISMOID), 'S', DURA.pipe() });
addRecipeAuto(new ItemStack(ModBlocks.reinforced_stone, 4), new Object[] { "FBF", "BFB", "FBF", 'F', Blocks.cobblestone, 'B', Blocks.stone }); addRecipeAuto(new ItemStack(ModBlocks.reinforced_stone, 4), new Object[] { "FBF", "BFB", "FBF", 'F', Blocks.cobblestone, 'B', Blocks.stone });
addRecipeAuto(new ItemStack(ModBlocks.brick_light, 4), new Object[] { "FBF", "BFB", "FBF", 'F', Blocks.fence, 'B', Blocks.brick_block }); addRecipeAuto(new ItemStack(ModBlocks.brick_light, 4), new Object[] { "FBF", "BFB", "FBF", 'F', Blocks.fence, 'B', Blocks.brick_block });
@ -755,7 +754,7 @@ public class CraftingManager {
addRecipeAuto(new ItemStack(ModBlocks.dfc_core, 1), new Object[] { "DLD", "LML", "DLD", 'D', ModItems.ingot_bismuth, 'L', DNT.block(), 'M', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BISMOID) }); addRecipeAuto(new ItemStack(ModBlocks.dfc_core, 1), new Object[] { "DLD", "LML", "DLD", 'D', ModItems.ingot_bismuth, 'L', DNT.block(), 'M', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BISMOID) });
addRecipeAuto(new ItemStack(ModBlocks.dfc_emitter, 1), new Object[] { "SDS", "TXL", "SDS", 'S', OSMIRIDIUM.plateWelded(), 'D', ModItems.plate_desh, 'T', ModBlocks.machine_transformer_dnt, 'X', ModItems.crystal_xen, 'L', ModItems.sat_head_laser }); addRecipeAuto(new ItemStack(ModBlocks.dfc_emitter, 1), new Object[] { "SDS", "TXL", "SDS", 'S', OSMIRIDIUM.plateWelded(), 'D', ModItems.plate_desh, 'T', ModBlocks.machine_transformer_dnt, 'X', ModItems.crystal_xen, 'L', ModItems.sat_head_laser });
addRecipeAuto(new ItemStack(ModBlocks.dfc_receiver, 1), new Object[] { "SDS", "TXL", "SDS", 'S', OSMIRIDIUM.plateWelded(), 'D', ModItems.plate_desh, 'T', ModBlocks.machine_transformer_dnt, 'X', ModBlocks.block_dineutronium, 'L', STEEL.shell() }); addRecipeAuto(new ItemStack(ModBlocks.dfc_receiver, 1), new Object[] { "SDS", "TXL", "SDS", 'S', OSMIRIDIUM.plateWelded(), 'D', ModItems.plate_desh, 'T', ModBlocks.machine_transformer_dnt, 'X', ModBlocks.block_dineutronium, 'L', STEEL.shell() });
addRecipeAuto(new ItemStack(ModBlocks.dfc_injector, 1), new Object[] { "SDS", "TXL", "SDS", 'S', OSMIRIDIUM.plateWelded(), 'D', CMB.plate(), 'T', ModBlocks.machine_fluidtank, 'X', ModItems.motor, 'L', ModItems.pipes_steel }); addRecipeAuto(new ItemStack(ModBlocks.dfc_injector, 1), new Object[] { "SDS", "TXL", "SDS", 'S', OSMIRIDIUM.plateWelded(), 'D', CMB.plate(), 'T', ModBlocks.machine_fluidtank, 'X', ModItems.motor, 'L', STEEL.pipe() });
addRecipeAuto(new ItemStack(ModBlocks.dfc_stabilizer, 1), new Object[] { "SDS", "TXL", "SDS", 'S', OSMIRIDIUM.plateWelded(), 'D', ModItems.plate_desh, 'T', ModItems.singularity_spark, 'X', ModBlocks.fusion_conductor, 'L', ModItems.crystal_xen }); addRecipeAuto(new ItemStack(ModBlocks.dfc_stabilizer, 1), new Object[] { "SDS", "TXL", "SDS", 'S', OSMIRIDIUM.plateWelded(), 'D', ModItems.plate_desh, 'T', ModItems.singularity_spark, 'X', ModBlocks.fusion_conductor, 'L', ModItems.crystal_xen });
addRecipeAuto(new ItemStack(ModBlocks.barrel_plastic, 1), new Object[] { "IPI", "I I", "IPI", 'I', ModItems.plate_polymer, 'P', AL.plate() }); addRecipeAuto(new ItemStack(ModBlocks.barrel_plastic, 1), new Object[] { "IPI", "I I", "IPI", 'I', ModItems.plate_polymer, 'P', AL.plate() });
addRecipeAuto(new ItemStack(ModBlocks.barrel_iron, 1), new Object[] { "IPI", "I I", "IPI", 'I', IRON.plate(), 'P', IRON.ingot() }); addRecipeAuto(new ItemStack(ModBlocks.barrel_iron, 1), new Object[] { "IPI", "I I", "IPI", 'I', IRON.plate(), 'P', IRON.ingot() });

View File

@ -4,6 +4,7 @@ import com.hbm.blocks.ICustomBlockHighlight;
import com.hbm.config.ClientConfig; import com.hbm.config.ClientConfig;
import com.hbm.config.RadiationConfig; import com.hbm.config.RadiationConfig;
import com.hbm.handler.pollution.PollutionHandler.PollutionType; import com.hbm.handler.pollution.PollutionHandler.PollutionType;
import com.hbm.items.IAnimatedItem;
import com.hbm.items.armor.IArmorDisableModel; import com.hbm.items.armor.IArmorDisableModel;
import com.hbm.items.armor.IArmorDisableModel.EnumPlayerPart; import com.hbm.items.armor.IArmorDisableModel.EnumPlayerPart;
import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.ItemGunBaseNT;
@ -55,7 +56,7 @@ public class ModEventHandlerRenderer {
private static ModelMan manlyModel; private static ModelMan manlyModel;
private static boolean[] partsHidden = new boolean[7]; private static boolean[] partsHidden = new boolean[7];
@SubscribeEvent @SubscribeEvent
public void onRenderTickPre(TickEvent.RenderTickEvent event) { } public void onRenderTickPre(TickEvent.RenderTickEvent event) { }
@ -89,6 +90,12 @@ public class ModEventHandlerRenderer {
ModelRenderer box = getBoxFromType(renderer, EnumPlayerPart.LEFT_ARM); ModelRenderer box = getBoxFromType(renderer, EnumPlayerPart.LEFT_ARM);
box.isHidden = true; box.isHidden = true;
} }
if(renderGun.isLeftHanded()) {
partsHidden[EnumPlayerPart.LEFT_ARM.ordinal()] = true;
partsHidden[EnumPlayerPart.RIGHT_ARM.ordinal()] = true;
getBoxFromType(renderer, EnumPlayerPart.LEFT_ARM).isHidden = true;
getBoxFromType(renderer, EnumPlayerPart.RIGHT_ARM).isHidden = true;
}
} }
} }
@ -121,6 +128,7 @@ public class ModEventHandlerRenderer {
RenderPlayer renderer = event.renderer; RenderPlayer renderer = event.renderer;
boolean akimbo = false; boolean akimbo = false;
boolean leftHand = false;
ItemStack held = player.getHeldItem(); ItemStack held = player.getHeldItem();
@ -128,9 +136,8 @@ public class ModEventHandlerRenderer {
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(held, IItemRenderer.ItemRenderType.EQUIPPED); IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(held, IItemRenderer.ItemRenderType.EQUIPPED);
if(customRenderer instanceof ItemRenderWeaponBase) { if(customRenderer instanceof ItemRenderWeaponBase) {
ItemRenderWeaponBase renderGun = (ItemRenderWeaponBase) customRenderer; ItemRenderWeaponBase renderGun = (ItemRenderWeaponBase) customRenderer;
if(renderGun.isAkimbo()) { if(renderGun.isAkimbo()) akimbo = true;
akimbo = true; if(renderGun.isLeftHanded()) leftHand = true;
}
} }
} }
@ -148,6 +155,23 @@ public class ModEventHandlerRenderer {
} }
} }
if(leftHand) {
ModelBiped biped = renderer.modelBipedMain;
renderer.modelArmorChestplate.bipedLeftArm.rotateAngleY = renderer.modelArmor.bipedLeftArm.rotateAngleY = biped.bipedLeftArm.rotateAngleY =
0.1F + biped.bipedHead.rotateAngleY;
renderer.modelArmorChestplate.bipedRightArm.rotateAngleY = renderer.modelArmor.bipedRightArm.rotateAngleY = biped.bipedRightArm.rotateAngleY =
-0.5F + biped.bipedHead.rotateAngleY;
if(!isManly) {
AbstractClientPlayer acp = (AbstractClientPlayer) player;
Minecraft.getMinecraft().getTextureManager().bindTexture(acp.getLocationSkin());
biped.bipedLeftArm.isHidden = false;
biped.bipedLeftArm.render(0.0625F);
biped.bipedRightArm.isHidden = false;
biped.bipedRightArm.render(0.0625F);
}
}
if(isManly) { if(isManly) {
if(manlyModel == null) if(manlyModel == null)
manlyModel = new ModelMan(); manlyModel = new ModelMan();
@ -187,7 +211,17 @@ public class ModEventHandlerRenderer {
RenderPlayer renderer = event.renderer; RenderPlayer renderer = event.renderer;
ItemStack held = player.getHeldItem(); ItemStack held = player.getHeldItem();
if(held != null && player.getHeldItem().getItem() instanceof ItemGunBaseNT) { if(held == null) return;
if(held.getItem() instanceof IAnimatedItem) {
if(((IAnimatedItem<?>) held.getItem()).shouldPlayerModelAim(held)) {
renderer.modelBipedMain.aimedBow = true;
renderer.modelArmor.aimedBow = true;
renderer.modelArmorChestplate.aimedBow = true;
}
}
if(held.getItem() instanceof ItemGunBaseNT) {
renderer.modelBipedMain.aimedBow = true; renderer.modelBipedMain.aimedBow = true;
renderer.modelArmor.aimedBow = true; renderer.modelArmor.aimedBow = true;
renderer.modelArmorChestplate.aimedBow = true; renderer.modelArmorChestplate.aimedBow = true;
@ -200,6 +234,11 @@ public class ModEventHandlerRenderer {
ModelBiped biped = renderer.modelBipedMain; ModelBiped biped = renderer.modelBipedMain;
renderer.modelArmorChestplate.bipedLeftArm.rotateAngleY = renderer.modelArmor.bipedLeftArm.rotateAngleY = biped.bipedLeftArm.rotateAngleY = 0.1F + biped.bipedHead.rotateAngleY; renderer.modelArmorChestplate.bipedLeftArm.rotateAngleY = renderer.modelArmor.bipedLeftArm.rotateAngleY = biped.bipedLeftArm.rotateAngleY = 0.1F + biped.bipedHead.rotateAngleY;
} }
if(renderGun.isLeftHanded()) {
ModelBiped biped = renderer.modelBipedMain;
renderer.modelArmorChestplate.bipedLeftArm.rotateAngleY = renderer.modelArmor.bipedLeftArm.rotateAngleY = biped.bipedLeftArm.rotateAngleY = 0.1F + biped.bipedHead.rotateAngleY;
renderer.modelArmorChestplate.bipedRightArm.rotateAngleY = renderer.modelArmor.bipedRightArm.rotateAngleY = biped.bipedRightArm.rotateAngleY = -0.5F + biped.bipedHead.rotateAngleY;
}
} }
} }
} }
@ -216,7 +255,7 @@ public class ModEventHandlerRenderer {
if(customRenderer instanceof ItemRenderWeaponBase) { if(customRenderer instanceof ItemRenderWeaponBase) {
ItemRenderWeaponBase renderWeapon = (ItemRenderWeaponBase) customRenderer; ItemRenderWeaponBase renderWeapon = (ItemRenderWeaponBase) customRenderer;
if(renderWeapon.isAkimbo()) { if(renderWeapon.isAkimbo() || renderWeapon.isLeftHanded()) {
GL11.glPushMatrix(); GL11.glPushMatrix();
renderer.modelBipedMain.bipedLeftArm.isHidden = false; renderer.modelBipedMain.bipedLeftArm.isHidden = false;
renderer.modelBipedMain.bipedLeftArm.postRender(0.0625F); renderer.modelBipedMain.bipedLeftArm.postRender(0.0625F);
@ -235,8 +274,14 @@ public class ModEventHandlerRenderer {
GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F); GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F);
renderWeapon.setupThirdPersonAkimbo(held); if(renderWeapon.isLeftHanded()) {
renderWeapon.renderEquippedAkimbo(held); GL11.glTranslatef(0.1875F, 0F, 0.0F);
renderWeapon.setupThirdPerson(held);
renderWeapon.renderEquippedAkimbo(held);
} else {
renderWeapon.setupThirdPersonAkimbo(held);
renderWeapon.renderEquippedAkimbo(held);
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix(); GL11.glPopMatrix();
} }

View File

@ -142,6 +142,7 @@ public class ResourceManager {
public static final IModelCustom assembler_arm = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/assembler_new_arm.obj")); public static final IModelCustom assembler_arm = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/assembler_new_arm.obj"));
public static final IModelCustom assembly_machine = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/assembly_machine.obj")).asVBO(); public static final IModelCustom assembly_machine = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/assembly_machine.obj")).asVBO();
public static final IModelCustom assemfac = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/assemfac.obj")).asVBO(); public static final IModelCustom assemfac = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/assemfac.obj")).asVBO();
public static final IModelCustom assembly_factory = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/assembly_factory.obj")).asVBO();
//Chemplant //Chemplant
public static final IModelCustom chemplant_body = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/chemplant_new_body.obj")).asVBO(); public static final IModelCustom chemplant_body = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/chemplant_new_body.obj")).asVBO();
@ -578,6 +579,8 @@ public class ResourceManager {
public static final ResourceLocation assembler_arm_tex = new ResourceLocation(RefStrings.MODID, "textures/models/assembler_arm_new.png"); public static final ResourceLocation assembler_arm_tex = new ResourceLocation(RefStrings.MODID, "textures/models/assembler_arm_new.png");
public static final ResourceLocation assembly_machine_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/assembly_machine.png"); public static final ResourceLocation assembly_machine_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/assembly_machine.png");
public static final ResourceLocation assemfac_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/assemfac.png"); public static final ResourceLocation assemfac_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/assemfac.png");
public static final ResourceLocation assembly_factory_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/assembly_factory.png");
public static final ResourceLocation assembly_factory_sparks_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/assembly_factory_sparks.png");
//Chemplant //Chemplant
public static final ResourceLocation chemplant_body_tex = new ResourceLocation(RefStrings.MODID, "textures/models/chemplant_base_new.png"); public static final ResourceLocation chemplant_body_tex = new ResourceLocation(RefStrings.MODID, "textures/models/chemplant_base_new.png");

View File

@ -83,6 +83,8 @@ public class StructureManager {
public static final NBTStructure plane1 = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/crashed_plane_1.nbt")); public static final NBTStructure plane1 = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/crashed_plane_1.nbt"));
public static final NBTStructure plane2 = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/crashed_plane_2.nbt")); public static final NBTStructure plane2 = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/crashed_plane_2.nbt"));
public static final NBTStructure factory = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/factory.nbt"));
public static final NBTStructure spire = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/spire.nbt")); public static final NBTStructure spire = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/spire.nbt"));
// public static final NBTStructure test_rot = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/test-rot.nbt")); // public static final NBTStructure test_rot = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/test-rot.nbt"));

View File

@ -44,7 +44,7 @@ public class PacketDispatcher {
//Signals server to do coord based satellite stuff //Signals server to do coord based satellite stuff
wrapper.registerMessage(SatCoordPacket.Handler.class, SatCoordPacket.class, i++, Side.SERVER); wrapper.registerMessage(SatCoordPacket.Handler.class, SatCoordPacket.class, i++, Side.SERVER);
//Triggers gun animations of the client //Triggers gun animations of the client
wrapper.registerMessage(GunAnimationPacket.Handler.class, GunAnimationPacket.class, i++, Side.CLIENT); wrapper.registerMessage(HbmAnimationPacket.Handler.class, HbmAnimationPacket.class, i++, Side.CLIENT);
//Sends a funi text to display like a music disc announcement //Sends a funi text to display like a music disc announcement
wrapper.registerMessage(PlayerInformPacket.Handler.class, PlayerInformPacket.class, i++, Side.CLIENT); wrapper.registerMessage(PlayerInformPacket.Handler.class, PlayerInformPacket.class, i++, Side.CLIENT);
//Universal keybind packet //Universal keybind packet

View File

@ -3,15 +3,17 @@ package com.hbm.packet.toclient;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
import java.util.function.BiFunction; import java.util.function.BiFunction;
import com.hbm.items.IAnimatedItem;
import com.hbm.items.armor.ArmorTrenchmaster; import com.hbm.items.armor.ArmorTrenchmaster;
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;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext; import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.render.anim.HbmAnimations.Animation; import com.hbm.render.anim.HbmAnimations.Animation;
import com.hbm.util.EnumUtil;
import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
@ -23,74 +25,76 @@ import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class GunAnimationPacket implements IMessage { public class HbmAnimationPacket implements IMessage {
public short type; public short type;
public int receiverIndex; public int receiverIndex;
public int gunIndex; public int itemIndex;
public GunAnimationPacket() { } public HbmAnimationPacket() { }
public GunAnimationPacket(int type) { public HbmAnimationPacket(int type) {
this.type = (short) type; this.type = (short) type;
this.receiverIndex = 0; this.receiverIndex = 0;
this.gunIndex = 0; this.itemIndex = 0;
} }
public GunAnimationPacket(int type, int rec) { public HbmAnimationPacket(int type, int rec) {
this.type = (short) type; this.type = (short) type;
this.receiverIndex = rec; this.receiverIndex = rec;
this.gunIndex = 0; this.itemIndex = 0;
} }
public GunAnimationPacket(int type, int rec, int gun) { public HbmAnimationPacket(int type, int rec, int gun) {
this.type = (short) type; this.type = (short) type;
this.receiverIndex = rec; this.receiverIndex = rec;
this.gunIndex = gun; this.itemIndex = gun;
} }
@Override @Override
public void fromBytes(ByteBuf buf) { public void fromBytes(ByteBuf buf) {
type = buf.readShort(); type = buf.readShort();
receiverIndex = buf.readInt(); receiverIndex = buf.readInt();
gunIndex = buf.readInt(); itemIndex = buf.readInt();
} }
@Override @Override
public void toBytes(ByteBuf buf) { public void toBytes(ByteBuf buf) {
buf.writeShort(type); buf.writeShort(type);
buf.writeInt(receiverIndex); buf.writeInt(receiverIndex);
buf.writeInt(gunIndex); buf.writeInt(itemIndex);
} }
public static class Handler implements IMessageHandler<GunAnimationPacket, IMessage> { public static class Handler implements IMessageHandler<HbmAnimationPacket, IMessage> {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IMessage onMessage(GunAnimationPacket m, MessageContext ctx) { public IMessage onMessage(HbmAnimationPacket m, MessageContext ctx) {
try { try {
EntityPlayer player = Minecraft.getMinecraft().thePlayer; EntityPlayer player = Minecraft.getMinecraft().thePlayer;
ItemStack stack = player.getHeldItem(); ItemStack stack = player.getHeldItem();
int slot = player.inventory.currentItem; int slot = player.inventory.currentItem;
if(stack == null) return null; if(stack == 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, GunAnimation.values()[m.type], m.receiverIndex, m.itemIndex);
} else if(stack.getItem() instanceof IAnimatedItem) {
handleItem(player, stack, slot, m.type, m.receiverIndex, m.itemIndex);
} }
} catch(Exception x) { } } catch(Exception x) { }
return null; return null;
} }
public static void handleSedna(EntityPlayer player, ItemStack stack, int slot, AnimType type, int receiverIndex, int gunIndex) { public static void handleSedna(EntityPlayer player, ItemStack stack, int slot, GunAnimation type, int receiverIndex, int gunIndex) {
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem(); ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
GunConfig config = gun.getConfig(stack, gunIndex); GunConfig config = gun.getConfig(stack, gunIndex);
if(type == AnimType.CYCLE) { if(type == GunAnimation.CYCLE) {
if(gunIndex < gun.lastShot.length) gun.lastShot[gunIndex] = System.currentTimeMillis(); if(gunIndex < gun.lastShot.length) gun.lastShot[gunIndex] = System.currentTimeMillis();
gun.shotRand = player.worldObj.rand.nextDouble(); gun.shotRand = player.worldObj.rand.nextDouble();
@ -101,24 +105,33 @@ public class GunAnimationPacket implements IMessage {
if(onRecoil != null) onRecoil.accept(stack, new LambdaContext(config, player, player.inventory, receiverIndex)); if(onRecoil != null) onRecoil.accept(stack, new LambdaContext(config, player, player.inventory, receiverIndex));
} }
} }
BiFunction<ItemStack, AnimType, BusAnimation> anims = config.getAnims(stack); BiFunction<ItemStack, GunAnimation, BusAnimation> anims = config.getAnims(stack);
BusAnimation animation = anims.apply(stack, type); BusAnimation animation = anims.apply(stack, type);
if(animation == null && type == AnimType.RELOAD_EMPTY) { if(animation == null && (type == GunAnimation.ALT_CYCLE || type == GunAnimation.CYCLE_EMPTY)) {
animation = anims.apply(stack, AnimType.RELOAD); animation = anims.apply(stack, GunAnimation.CYCLE);
} }
if(animation == null && (type == AnimType.ALT_CYCLE || type == AnimType.CYCLE_EMPTY)) {
animation = anims.apply(stack, AnimType.CYCLE);
}
if(animation != null) { if(animation != null) {
Minecraft.getMinecraft().entityRenderer.itemRenderer.resetEquippedProgress(); Minecraft.getMinecraft().entityRenderer.itemRenderer.resetEquippedProgress();
Minecraft.getMinecraft().entityRenderer.itemRenderer.itemToRender = stack; Minecraft.getMinecraft().entityRenderer.itemRenderer.itemToRender = stack;
boolean isReloadAnimation = type == AnimType.RELOAD || type == AnimType.RELOAD_CYCLE || type == AnimType.RELOAD_EMPTY; boolean isReloadAnimation = type == GunAnimation.RELOAD || type == GunAnimation.RELOAD_CYCLE;
if(isReloadAnimation && ArmorTrenchmaster.isTrenchMaster(player)) animation.setTimeMult(0.5D); if(isReloadAnimation && ArmorTrenchmaster.isTrenchMaster(player)) animation.setTimeMult(0.5D);
HbmAnimations.hotbar[slot][gunIndex] = new Animation(stack.getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, type, isReloadAnimation && config.getReloadAnimSequential(stack)); HbmAnimations.hotbar[slot][gunIndex] = new Animation(stack.getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, isReloadAnimation && config.getReloadAnimSequential(stack));
} }
} }
public static void handleItem(EntityPlayer player, ItemStack stack, int slot, short type, int receiverIndex, int itemIndex) {
IAnimatedItem<?> item = (IAnimatedItem<?>) stack.getItem();
Class<? extends Enum<?>> animClass = item.getEnum();
BusAnimation animation = item.getAnimation(EnumUtil.grabEnumSafely(animClass, type), stack);
if(animation != null) {
HbmAnimations.hotbar[slot][itemIndex] = new Animation(stack.getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
}
}
} }
} }

View File

@ -26,8 +26,13 @@ public class ParticleSkeleton extends EntityFX {
public static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/particle/skeleton.png"); public static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/particle/skeleton.png");
public static final ResourceLocation texture_ext = new ResourceLocation(RefStrings.MODID + ":textures/particle/skoilet.png"); public static final ResourceLocation texture_ext = new ResourceLocation(RefStrings.MODID + ":textures/particle/skoilet.png");
public static final ResourceLocation texture_blood = new ResourceLocation(RefStrings.MODID + ":textures/particle/skeleton_blood.png");
public static final ResourceLocation texture_blood_ext = new ResourceLocation(RefStrings.MODID + ":textures/particle/skoilet_blood.png");
public static final IModelCustom skeleton = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/effect/skeleton.obj"), false).asVBO(); public static final IModelCustom skeleton = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/effect/skeleton.obj"), false).asVBO();
protected EnumSkeletonType type; protected EnumSkeletonType type;
public ResourceLocation useTexture;
public ResourceLocation useTextureExt;
private float momentumYaw; private float momentumYaw;
private float momentumPitch; private float momentumPitch;
@ -50,6 +55,18 @@ public class ParticleSkeleton extends EntityFX {
this.momentumPitch = rand.nextFloat() * 5 * (rand.nextBoolean() ? 1 : -1); this.momentumPitch = rand.nextFloat() * 5 * (rand.nextBoolean() ? 1 : -1);
this.momentumYaw = rand.nextFloat() * 5 * (rand.nextBoolean() ? 1 : -1); this.momentumYaw = rand.nextFloat() * 5 * (rand.nextBoolean() ? 1 : -1);
this.useTexture = texture;
this.useTextureExt = texture_ext;
}
public ParticleSkeleton makeGib() {
this.initialDelay = -2; // skip post delay motion randomization
this.useTexture = texture_blood;
this.useTextureExt = texture_blood_ext;
this.particleGravity = 0.04F;
this.particleMaxAge = 600 + rand.nextInt(20);
return this;
} }
@Override @Override
@ -139,16 +156,16 @@ public class ParticleSkeleton extends EntityFX {
switch(type) { switch(type) {
case SKULL: case SKULL:
this.textureManager.bindTexture(texture); this.textureManager.bindTexture(useTexture);
skeleton.renderPart("Skull"); break; skeleton.renderPart("Skull"); break;
case TORSO: case TORSO:
this.textureManager.bindTexture(texture); this.textureManager.bindTexture(useTexture);
skeleton.renderPart("Torso"); break; skeleton.renderPart("Torso"); break;
case LIMB: case LIMB:
this.textureManager.bindTexture(texture); this.textureManager.bindTexture(useTexture);
skeleton.renderPart("Limb"); break; skeleton.renderPart("Limb"); break;
case SKULL_VILLAGER: case SKULL_VILLAGER:
this.textureManager.bindTexture(texture_ext); this.textureManager.bindTexture(useTextureExt);
skeleton.renderPart("SkullVillager"); break; skeleton.renderPart("SkullVillager"); break;
} }

View File

@ -33,20 +33,31 @@ public class SkeletonCreator implements IParticleCreator {
public static HashMap<String, Function<EntityLivingBase, BoneDefinition[]>> skullanizer = new HashMap(); public static HashMap<String, Function<EntityLivingBase, BoneDefinition[]>> skullanizer = new HashMap();
public static void composeEffect(World world, Entity toSkeletonize, float brightness) { public static void composeEffect(World world, Entity toSkeletonize, float brightness) {
NBTTagCompound data = new NBTTagCompound(); NBTTagCompound data = new NBTTagCompound();
data.setString("type", "skeleton"); data.setString("type", "skeleton");
data.setInteger("entityID", toSkeletonize.getEntityId()); data.setInteger("entityID", toSkeletonize.getEntityId());
data.setFloat("brightness", brightness); data.setFloat("brightness", brightness);
IParticleCreator.sendPacket(world, toSkeletonize.posX, toSkeletonize.posY, toSkeletonize.posZ, 100, data); IParticleCreator.sendPacket(world, toSkeletonize.posX, toSkeletonize.posY, toSkeletonize.posZ, 100, data);
} }
public static void composeEffectGib(World world, Entity toSkeletonize, float force) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "skeleton");
data.setInteger("entityID", toSkeletonize.getEntityId());
data.setFloat("brightness", 1F);
data.setFloat("force", force);
data.setBoolean("gib", true);
IParticleCreator.sendPacket(world, toSkeletonize.posX, toSkeletonize.posY, toSkeletonize.posZ, 100, data);
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void makeParticle(World world, EntityPlayer player, TextureManager texman, Random rand, double x, double y, double z, NBTTagCompound data) { public void makeParticle(World world, EntityPlayer player, TextureManager texman, Random rand, double x, double y, double z, NBTTagCompound data) {
if(skullanizer.isEmpty()) init(); if(skullanizer.isEmpty()) init();
boolean gib = data.getBoolean("gib");
float force = data.getFloat("force");
int entityID = data.getInteger("entityID"); int entityID = data.getInteger("entityID");
Entity entity = world.getEntityByID(entityID); Entity entity = world.getEntityByID(entityID);
if(!(entity instanceof EntityLivingBase)) return; if(!(entity instanceof EntityLivingBase)) return;
@ -61,9 +72,16 @@ public class SkeletonCreator implements IParticleCreator {
if(bonealizer != null) { if(bonealizer != null) {
BoneDefinition[] bones = bonealizer.apply(living); BoneDefinition[] bones = bonealizer.apply(living);
for(BoneDefinition bone : bones) { for(BoneDefinition bone : bones) {
if(gib && rand.nextBoolean()) continue;
ParticleSkeleton skeleton = new ParticleSkeleton(Minecraft.getMinecraft().getTextureManager(), world, bone.x, bone.y, bone.z, brightness, brightness, brightness, bone.type); ParticleSkeleton skeleton = new ParticleSkeleton(Minecraft.getMinecraft().getTextureManager(), world, bone.x, bone.y, bone.z, brightness, brightness, brightness, bone.type);
skeleton.prevRotationYaw = skeleton.rotationYaw = bone.yaw; skeleton.prevRotationYaw = skeleton.rotationYaw = bone.yaw;
skeleton.prevRotationPitch = skeleton.rotationPitch = bone.pitch; skeleton.prevRotationPitch = skeleton.rotationPitch = bone.pitch;
if(gib) {
skeleton.makeGib();
skeleton.motionX = rand.nextGaussian() * force;
skeleton.motionY = (rand.nextGaussian() + 1) * force;
skeleton.motionZ = rand.nextGaussian() * force;
}
Minecraft.getMinecraft().effectRenderer.addEffect(skeleton); Minecraft.getMinecraft().effectRenderer.addEffect(skeleton);
} }
} }
@ -161,7 +179,7 @@ public class SkeletonCreator implements IParticleCreator {
skullanizer.put(EntityDummy.class.getSimpleName(), BONES_DUMMY); skullanizer.put(EntityDummy.class.getSimpleName(), BONES_DUMMY);
//techguns compat, for some reason //techguns compat, for some reason
//not alwayss accurate because of variable arm position, but better than nothing //not always accurate because of variable arm position, but better than nothing
skullanizer.put("ArmySoldier", BONES_ZOMBIE); skullanizer.put("ArmySoldier", BONES_ZOMBIE);
skullanizer.put("PsychoSteve", BONES_ZOMBIE); skullanizer.put("PsychoSteve", BONES_ZOMBIE);
skullanizer.put("SkeletonSoldier", BONES_ZOMBIE); skullanizer.put("SkeletonSoldier", BONES_ZOMBIE);

View File

@ -1,6 +1,7 @@
package com.hbm.qmaw.components; package com.hbm.qmaw.components;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import com.hbm.qmaw.GuiQMAW; import com.hbm.qmaw.GuiQMAW;
import com.hbm.qmaw.ManualElement; import com.hbm.qmaw.ManualElement;
@ -64,6 +65,7 @@ public class QComponentLink extends ManualElement {
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
Minecraft mc = Minecraft.getMinecraft(); Minecraft mc = Minecraft.getMinecraft();
GL11.glRotated(180, 1, 0, 0); GL11.glRotated(180, 1, 0, 0);
RenderHelper.enableStandardItemLighting(); RenderHelper.enableStandardItemLighting();
@ -71,6 +73,7 @@ public class QComponentLink extends ManualElement {
itemRender.renderItemAndEffectIntoGUI(this.font, mc.renderEngine, this.icon, x, y - 1); itemRender.renderItemAndEffectIntoGUI(this.font, mc.renderEngine, this.icon, x, y - 1);
itemRender.renderItemOverlayIntoGUI(this.font, mc.renderEngine, this.icon, x, y - 1, null); itemRender.renderItemOverlayIntoGUI(this.font, mc.renderEngine, this.icon, x, y - 1, null);
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glPopMatrix(); GL11.glPopMatrix();

View File

@ -0,0 +1,27 @@
package com.hbm.render.anim;
public class AnimationEnums {
// A NOTE ON SHOTGUN STYLE RELOADS
// Make sure the RELOAD adds shells, not just RELOAD_CYCLE, they all proc once for each loaded shell
public static enum GunAnimation {
RELOAD, //either a full reload or start of a reload
RELOAD_CYCLE, //animation that plays for every individual round (for shotguns and similar single round loading weapons)
RELOAD_END, //animation for transitioning from our RELOAD_CYCLE to idle
CYCLE, //animation for every firing cycle
CYCLE_EMPTY, //animation for the final shot in the magazine
CYCLE_DRY, //animation for trying to fire, but no round is available
ALT_CYCLE, //animation for alt fire cycles
SPINUP, //animation for actionstart
SPINDOWN, //animation for actionend
EQUIP, //animation for drawing the weapon
INSPECT, //animation for inspecting the weapon
JAMMED, //animation for jammed weapons
}
public static enum ToolAnimation {
SWING,
EQUIP,
}
}

View File

@ -8,7 +8,7 @@ import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
public class HbmAnimations { public class HbmAnimations {
//in flans mod and afaik also MW, there's an issue that there is only one //in flans mod and afaik also MW, there's an issue that there is only one
//single animation timer for each client. this is fine for the most part, //single animation timer for each client. this is fine for the most part,
//but once you reload and switch weapons while the animation plays, the //but once you reload and switch weapons while the animation plays, the
@ -17,28 +17,9 @@ public class HbmAnimations {
//"trick" the system by putting a weapon into a different slot while an //"trick" the system by putting a weapon into a different slot while an
//animation is playing, though this will cancel the animation entirely. //animation is playing, though this will cancel the animation entirely.
public static final Animation[][] hotbar = new Animation[9][8]; //now with 8 parallel rails per slot! time to get railed! public static final Animation[][] hotbar = new Animation[9][8]; //now with 8 parallel rails per slot! time to get railed!
public static enum AnimType {
RELOAD, //either a full reload or start of a reload
@Deprecated RELOAD_EMPTY, //same as reload, but the mag is completely empty
RELOAD_CYCLE, //animation that plays for every individual round (for shotguns and similar single round loading weapons)
RELOAD_END, //animation for transitioning from our RELOAD_CYCLE to idle
CYCLE, //animation for every firing cycle
CYCLE_EMPTY, //animation for the final shot in the magazine
CYCLE_DRY, //animation for trying to fire, but no round is available
ALT_CYCLE, //animation for alt fire cycles
SPINUP, //animation for actionstart
SPINDOWN, //animation for actionend
EQUIP, //animation for drawing the weapon
INSPECT, //animation for inspecting the weapon
JAMMED //animation for jammed weapons
}
// A NOTE ON SHOTGUN STYLE RELOADS
// Make sure the RELOAD and RELOAD_EMPTY adds shells, not just RELOAD_CYCLE, they all proc once for each loaded shell
public static class Animation { public static class Animation {
//the "name" of the animation slot. if the item has a different key than //the "name" of the animation slot. if the item has a different key than
//the animation, the animation will be canceled. //the animation, the animation will be canceled.
public String key; public String key;
@ -48,64 +29,58 @@ public class HbmAnimations {
public BusAnimation animation; public BusAnimation animation;
// If set, don't cancel this animation when the timer ends, instead wait for the next to start // If set, don't cancel this animation when the timer ends, instead wait for the next to start
public boolean holdLastFrame = false; public boolean holdLastFrame = false;
// so we know what type of animation we're playing, only used rarely
public AnimType type; public Animation(String key, long startMillis, BusAnimation animation) {
public Animation(String key, long startMillis, BusAnimation animation, AnimType type) {
this.key = key; this.key = key;
this.startMillis = startMillis; this.startMillis = startMillis;
this.animation = animation; this.animation = animation;
this.type = type;
} }
public Animation(String key, long startMillis, BusAnimation animation, AnimType type, boolean holdLastFrame) { public Animation(String key, long startMillis, BusAnimation animation, boolean holdLastFrame) {
this.key = key; this(key, startMillis, animation);
this.startMillis = startMillis;
this.animation = animation;
this.holdLastFrame = holdLastFrame; this.holdLastFrame = holdLastFrame;
this.type = type;
} }
} }
public static Animation getRelevantAnim() { return getRelevantAnim(0); } public static Animation getRelevantAnim() { return getRelevantAnim(0); }
public static Animation getRelevantAnim(int index) { public static Animation getRelevantAnim(int index) {
EntityPlayer player = Minecraft.getMinecraft().thePlayer; EntityPlayer player = Minecraft.getMinecraft().thePlayer;
int slot = player.inventory.currentItem; int slot = player.inventory.currentItem;
ItemStack stack = player.getHeldItem(); ItemStack stack = player.getHeldItem();
if(stack == null) if(stack == null)
return null; return null;
if(slot < 0 || slot > 8) { //for freak of nature hotbars, probably won't work right but at least it doesn't crash if(slot < 0 || slot > 8) { //for freak of nature hotbars, probably won't work right but at least it doesn't crash
slot = Math.abs(slot) % 9; slot = Math.abs(slot) % 9;
} }
if(hotbar[slot][index] == null) if(hotbar[slot][index] == null)
return null; return null;
if(hotbar[slot][index].key.equals(stack.getItem().getUnlocalizedName())) { if(hotbar[slot][index].key.equals(stack.getItem().getUnlocalizedName())) {
return hotbar[slot][index]; return hotbar[slot][index];
} }
return null; return null;
} }
public static double[] getRelevantTransformation(String bus) { return getRelevantTransformation(bus, 0); } public static double[] getRelevantTransformation(String bus) { return getRelevantTransformation(bus, 0); }
public static double[] getRelevantTransformation(String bus, int index) { public static double[] getRelevantTransformation(String bus, int index) {
Animation anim = HbmAnimations.getRelevantAnim(index); Animation anim = HbmAnimations.getRelevantAnim(index);
if(anim != null) { if(anim != null) {
BusAnimation buses = anim.animation; BusAnimation buses = anim.animation;
int millis = (int)(Clock.get_ms() - anim.startMillis); int millis = (int)(Clock.get_ms() - anim.startMillis);
BusAnimationSequence seq = buses.getBus(bus); BusAnimationSequence seq = buses.getBus(bus);
if(seq != null) { if(seq != null) {
double[] trans = seq.getTransformation(millis); double[] trans = seq.getTransformation(millis);
if(trans != null) if(trans != null)
return trans; return trans;
} }
@ -124,7 +99,7 @@ public class HbmAnimations {
public static void applyRelevantTransformation(String bus, int index) { public static void applyRelevantTransformation(String bus, int index) {
double[] transform = getRelevantTransformation(bus, index); double[] transform = getRelevantTransformation(bus, index);
int[] rot = new int[] { (int)transform[12], (int)transform[13], (int)transform[14] }; int[] rot = new int[] { (int)transform[12], (int)transform[13], (int)transform[14] };
GL11.glTranslated(transform[0], transform[1], transform[2]); GL11.glTranslated(transform[0], transform[1], transform[2]);
GL11.glRotated(transform[3 + rot[0]], rot[0] == 0 ? 1 : 0, rot[0] == 1 ? 1 : 0, rot[0] == 2 ? 1 : 0); GL11.glRotated(transform[3 + rot[0]], rot[0] == 0 ? 1 : 0, rot[0] == 1 ? 1 : 0, rot[0] == 2 ? 1 : 0);
GL11.glRotated(transform[3 + rot[1]], rot[1] == 0 ? 1 : 0, rot[1] == 1 ? 1 : 0, rot[1] == 2 ? 1 : 0); GL11.glRotated(transform[3 + rot[1]], rot[1] == 0 ? 1 : 0, rot[1] == 1 ? 1 : 0, rot[1] == 2 ? 1 : 0);

View File

@ -9,8 +9,8 @@ import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -29,7 +29,7 @@ public class ItemRenderCongoLake extends ItemRenderWeaponBase {
@Override @Override
public void setupFirstPerson(ItemStack stack) { public void setupFirstPerson(ItemStack stack) {
GL11.glTranslated(0, 0, 0.875); GL11.glTranslated(0, 0, 0.875);
float offset = 0.8F; float offset = 0.8F;
standardAimingTransform(stack, standardAimingTransform(stack,
-1.5F * offset, -2F * offset, 1.25F * offset, -1.5F * offset, -2F * offset, 1.25F * offset,
@ -38,12 +38,12 @@ public class ItemRenderCongoLake extends ItemRenderWeaponBase {
@Override @Override
public void renderFirstPerson(ItemStack stack) { public void renderFirstPerson(ItemStack stack) {
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem(); ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.congolake_tex); Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.congolake_tex);
double scale = 0.5D; double scale = 0.5D;
GL11.glScaled(scale, scale, scale); GL11.glScaled(scale, scale, scale);
HbmAnimations.applyRelevantTransformation("Gun"); HbmAnimations.applyRelevantTransformation("Gun");
ResourceManager.congolake.renderPart("Gun"); ResourceManager.congolake.renderPart("Gun");
@ -94,30 +94,30 @@ public class ItemRenderCongoLake extends ItemRenderWeaponBase {
GL11.glPushMatrix(); GL11.glPushMatrix();
{ {
IMagazine mag = gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack); IMagazine mag = gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack);
if(gun.getLastAnim(stack, 0) != AnimType.INSPECT || mag.getAmount(stack, MainRegistry.proxy.me().inventory) > 0) { //omit when inspecting and no shell is loaded if(gun.getLastAnim(stack, 0) != GunAnimation.INSPECT || mag.getAmount(stack, MainRegistry.proxy.me().inventory) > 0) { //omit when inspecting and no shell is loaded
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.casings_tex); Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.casings_tex);
HbmAnimations.applyRelevantTransformation("Shell"); HbmAnimations.applyRelevantTransformation("Shell");
SpentCasing casing = mag.getCasing(stack, MainRegistry.proxy.me().inventory); SpentCasing casing = mag.getCasing(stack, MainRegistry.proxy.me().inventory);
int[] colors = casing != null ? casing.getColors() : new int[] { SpentCasing.COLOR_CASE_40MM }; int[] colors = casing != null ? casing.getColors() : new int[] { SpentCasing.COLOR_CASE_40MM };
Color shellColor = new Color(colors[0]); Color shellColor = new Color(colors[0]);
GL11.glColor3f(shellColor.getRed() / 255F, shellColor.getGreen() / 255F, shellColor.getBlue() / 255F); GL11.glColor3f(shellColor.getRed() / 255F, shellColor.getGreen() / 255F, shellColor.getBlue() / 255F);
ResourceManager.congolake.renderPart("Shell"); ResourceManager.congolake.renderPart("Shell");
Color shellForeColor = new Color(colors.length > 1 ? colors[1] : colors[0]); Color shellForeColor = new Color(colors.length > 1 ? colors[1] : colors[0]);
GL11.glColor3f(shellForeColor.getRed() / 255F, shellForeColor.getGreen() / 255F, shellForeColor.getBlue() / 255F); GL11.glColor3f(shellForeColor.getRed() / 255F, shellForeColor.getGreen() / 255F, shellForeColor.getBlue() / 255F);
ResourceManager.congolake.renderPart("ShellFore"); ResourceManager.congolake.renderPart("ShellFore");
GL11.glColor3f(1F, 1F, 1F); GL11.glColor3f(1F, 1F, 1F);
} }
} }
GL11.glPopMatrix(); GL11.glPopMatrix();
double smokeScale = 0.25; double smokeScale = 0.25;
GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glTranslated(0, 1.75, 4.25); GL11.glTranslated(0, 1.75, 4.25);
@ -170,7 +170,7 @@ public class ItemRenderCongoLake extends ItemRenderWeaponBase {
@Override @Override
public void renderOther(ItemStack stack, ItemRenderType type) { public void renderOther(ItemStack stack, ItemRenderType type) {
GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_LIGHTING);
GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glShadeModel(GL11.GL_SMOOTH);
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.congolake_tex); Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.congolake_tex);
ResourceManager.congolake.renderAll(); ResourceManager.congolake.renderAll();

View File

@ -193,6 +193,27 @@ public class ItemRenderDANI extends ItemRenderWeaponBase {
ResourceManager.bio_revolver.renderAll(); ResourceManager.bio_revolver.renderAll();
GL11.glShadeModel(GL11.GL_FLAT); GL11.glShadeModel(GL11.GL_FLAT);
} }
@Override
public void renderEntity(ItemStack stack) {
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glPushMatrix();
GL11.glTranslated(-2, 1, 0);
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.dani_lunar_tex);
ResourceManager.bio_revolver.renderAll();
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(2, 1, 0);
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.dani_celestial_tex);
ResourceManager.bio_revolver.renderAll();
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
}
@Override @Override
public void renderOther(ItemStack stack, ItemRenderType type) { public void renderOther(ItemStack stack, ItemRenderType type) {

View File

@ -238,6 +238,34 @@ public class ItemRenderEOTT extends ItemRenderWeaponBase {
public void renderModTable(ItemStack stack, int index) { public void renderModTable(ItemStack stack, int index) {
renderOther(stack, ItemRenderType.INVENTORY); renderOther(stack, ItemRenderType.INVENTORY);
} }
@Override
public void renderEntity(ItemStack stack) {
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glPushMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.eott_tex);
GL11.glTranslated(-1, 1, 0);
ResourceManager.aberrator.renderPart("Gun");
ResourceManager.aberrator.renderPart("Hammer");
ResourceManager.aberrator.renderPart("Magazine");
ResourceManager.aberrator.renderPart("Slide");
ResourceManager.aberrator.renderPart("Sight");
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(1, 1, 0);
ResourceManager.aberrator.renderPart("Gun");
ResourceManager.aberrator.renderPart("Hammer");
ResourceManager.aberrator.renderPart("Magazine");
ResourceManager.aberrator.renderPart("Slide");
ResourceManager.aberrator.renderPart("Sight");
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
}
@Override @Override
public void renderOther(ItemStack stack, ItemRenderType type) { public void renderOther(ItemStack stack, ItemRenderType type) {

View File

@ -19,7 +19,7 @@ public class ItemRenderHeavyRevolver extends ItemRenderWeaponBase {
public ItemRenderHeavyRevolver(ResourceLocation texture) { public ItemRenderHeavyRevolver(ResourceLocation texture) {
this.texture = texture; this.texture = texture;
} }
@Override @Override
protected float getTurnMagnitude(ItemStack stack) { return ItemGunBaseNT.getIsAiming(stack) ? 2.5F : -0.25F; } protected float getTurnMagnitude(ItemStack stack) { return ItemGunBaseNT.getIsAiming(stack) ? 2.5F : -0.25F; }

View File

@ -180,6 +180,28 @@ public class ItemRenderMareslegAkimbo extends ItemRenderWeaponBase {
public void renderModTable(ItemStack stack, int index) { public void renderModTable(ItemStack stack, int index) {
renderOther(stack, ItemRenderType.INVENTORY); renderOther(stack, ItemRenderType.INVENTORY);
} }
@Override
public void renderEntity(ItemStack stack) {
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glPushMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.maresleg_tex);
GL11.glTranslated(-1, 1, 0);
ResourceManager.maresleg.renderPart("Gun");
ResourceManager.maresleg.renderPart("Lever");
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(1, 1, 0);
ResourceManager.maresleg.renderPart("Gun");
ResourceManager.maresleg.renderPart("Lever");
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
}
@Override @Override
public void renderOther(ItemStack stack, ItemRenderType type) { public void renderOther(ItemStack stack, ItemRenderType type) {

View File

@ -195,6 +195,7 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase {
GL11.glShadeModel(GL11.GL_FLAT); GL11.glShadeModel(GL11.GL_FLAT);
} }
@Override
public void renderEntity(ItemStack stack) { public void renderEntity(ItemStack stack) {
GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_LIGHTING);
GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glShadeModel(GL11.GL_SMOOTH);

View File

@ -33,8 +33,9 @@ public abstract class ItemRenderWeaponBase implements IItemRenderer {
public static final ResourceLocation laser_flash = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/laser_flash.png"); public static final ResourceLocation laser_flash = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/laser_flash.png");
public static float interp; public static float interp;
public boolean isAkimbo() { return false; } public boolean isAkimbo() { return false; }
public boolean isLeftHanded() { return false; }
@Override @Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) { public boolean handleRenderType(ItemStack item, ItemRenderType type) {
@ -53,7 +54,8 @@ public abstract class ItemRenderWeaponBase implements IItemRenderer {
GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_CULL_FACE);
switch(type) { switch(type) {
case EQUIPPED_FIRST_PERSON: setupFirstPerson(item); renderFirstPerson(item); break; case EQUIPPED_FIRST_PERSON: setupFirstPerson(item); renderFirstPerson(item); break;
case EQUIPPED: setupThirdPerson(item); renderEquipped(item); break; case EQUIPPED:
if(isLeftHanded()) break; setupThirdPerson(item); renderEquipped(item); break;
case INVENTORY: setupInv(item); renderInv(item); break; case INVENTORY: setupInv(item); renderInv(item); break;
case ENTITY: setupEntity(item); renderEntity(item); break; case ENTITY: setupEntity(item); renderEntity(item); break;
} }

View File

@ -0,0 +1,283 @@
package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.recipes.AssemblyMachineRecipes;
import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager;
import com.hbm.render.item.ItemRenderBase;
import com.hbm.tileentity.machine.TileEntityMachineAssemblyFactory;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.client.IItemRenderer;
public class RenderAssemblyFactory extends TileEntitySpecialRenderer implements IItemRendererProvider {
public static EntityItem dummy;
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float interp) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y, z + 0.5);
GL11.glRotated(90, 0, 1, 0);
GL11.glShadeModel(GL11.GL_SMOOTH);
switch(tileEntity.getBlockMetadata() - BlockDummyable.offset) {
case 2: GL11.glRotatef(0, 0F, 1F, 0F); break;
case 4: GL11.glRotatef(90, 0F, 1F, 0F); break;
case 3: GL11.glRotatef(180, 0F, 1F, 0F); break;
case 5: GL11.glRotatef(270, 0F, 1F, 0F); break;
}
TileEntityMachineAssemblyFactory assemfac = (TileEntityMachineAssemblyFactory) tileEntity;
bindTexture(ResourceManager.assembly_factory_tex);
ResourceManager.assembly_factory.renderPart("Base");
if(assemfac.frame) ResourceManager.assembly_factory.renderPart("Frame");
double slide1 = assemfac.animations[0].getSlider(interp);
double slide2 = assemfac.animations[1].getSlider(interp);
double[] arm1 = assemfac.animations[0].striker.getPositions(interp);
double[] arm2 = assemfac.animations[0].saw.getPositions(interp);
double[] arm3 = assemfac.animations[1].striker.getPositions(interp);
double[] arm4 = assemfac.animations[1].saw.getPositions(interp);
GL11.glPushMatrix(); {
GL11.glTranslated(0.5 - slide1, 0, 0);
ResourceManager.assembly_factory.renderPart("Slider1");
GL11.glTranslated(0, 1.625, -0.9375);
GL11.glRotated(-arm1[0], 1, 0, 0);
GL11.glTranslated(0, -1.625, 0.9375);
ResourceManager.assembly_factory.renderPart("ArmLower1");
GL11.glTranslated(0, 2.375, -0.9375);
GL11.glRotated(-arm1[1], 1, 0, 0);
GL11.glTranslated(0, -2.375, 0.9375);
ResourceManager.assembly_factory.renderPart("ArmUpper1");
GL11.glTranslated(0, 2.375, -0.4375);
GL11.glRotated(-arm1[2], 1, 0, 0);
GL11.glTranslated(0, -2.375, 0.4375);
ResourceManager.assembly_factory.renderPart("Head1");
GL11.glTranslated(0, arm1[3], 0);
ResourceManager.assembly_factory.renderPart("Striker1");
} GL11.glPopMatrix();
GL11.glPushMatrix(); {
GL11.glTranslated(-0.5 + slide1, 0, 0);
ResourceManager.assembly_factory.renderPart("Slider2");
GL11.glTranslated(0, 1.625, 0.9375);
GL11.glRotated(arm2[0], 1, 0, 0);
GL11.glTranslated(0, -1.625, -0.9375);
ResourceManager.assembly_factory.renderPart("ArmLower2");
GL11.glTranslated(0, 2.375, 0.9375);
GL11.glRotated(arm2[1], 1, 0, 0);
GL11.glTranslated(0, -2.375, -0.9375);
ResourceManager.assembly_factory.renderPart("ArmUpper2");
GL11.glTranslated(0, 2.375, 0.4375);
GL11.glRotated(arm2[2], 1, 0, 0);
GL11.glTranslated(0, -2.375, -0.4375);
ResourceManager.assembly_factory.renderPart("Head2");
GL11.glTranslated(0, arm2[3], 0);
ResourceManager.assembly_factory.renderPart("Striker2");
GL11.glTranslated(0, 1.625, 0.3125);
GL11.glRotated(-arm2[4], 1, 0, 0);
GL11.glTranslated(0, -1.625, -0.3125);
ResourceManager.assembly_factory.renderPart("Blade2");
} GL11.glPopMatrix();
GL11.glPushMatrix(); {
GL11.glTranslated(-0.5 + slide2, 0, 0);
ResourceManager.assembly_factory.renderPart("Slider3");
GL11.glTranslated(0, 1.625, 0.9375);
GL11.glRotated(arm3[0], 1, 0, 0);
GL11.glTranslated(0, -1.625, -0.9375);
ResourceManager.assembly_factory.renderPart("ArmLower3");
GL11.glTranslated(0, 2.375, 0.9375);
GL11.glRotated(arm3[1], 1, 0, 0);
GL11.glTranslated(0, -2.375, -0.9375);
ResourceManager.assembly_factory.renderPart("ArmUpper3");
GL11.glTranslated(0, 2.375, 0.4375);
GL11.glRotated(arm3[2], 1, 0, 0);
GL11.glTranslated(0, -2.375, -0.4375);
ResourceManager.assembly_factory.renderPart("Head3");
GL11.glTranslated(0, arm3[3], 0);
ResourceManager.assembly_factory.renderPart("Striker3");
} GL11.glPopMatrix();
GL11.glPushMatrix(); {
GL11.glTranslated(0.5 - slide2, 0, 0);
ResourceManager.assembly_factory.renderPart("Slider4");
GL11.glTranslated(0, 1.625, -0.9375);
GL11.glRotated(-arm4[0], 1, 0, 0);
GL11.glTranslated(0, -1.625, 0.9375);
ResourceManager.assembly_factory.renderPart("ArmLower4");
GL11.glTranslated(0, 2.375, -0.9375);
GL11.glRotated(-arm4[1], 1, 0, 0);
GL11.glTranslated(0, -2.375, 0.9375);
ResourceManager.assembly_factory.renderPart("ArmUpper4");
GL11.glTranslated(0, 2.375, -0.4375);
GL11.glRotated(-arm4[2], 1, 0, 0);
GL11.glTranslated(0, -2.375, 0.4375);
ResourceManager.assembly_factory.renderPart("Head4");
GL11.glTranslated(0, arm4[3], 0);
ResourceManager.assembly_factory.renderPart("Striker4");
GL11.glTranslated(0, 1.625, -0.3125);
GL11.glRotated(arm4[4], 1, 0, 0);
GL11.glTranslated(0, -1.625, 0.3125);
ResourceManager.assembly_factory.renderPart("Blade4");
} GL11.glPopMatrix();
if(MainRegistry.proxy.me().getDistanceSq(tileEntity.xCoord + 0.5, tileEntity.yCoord + 1, tileEntity.zCoord + 0.5) < 35 * 35) {
for(int i = 0; i < 4; i++) {
GL11.glPushMatrix();
GL11.glTranslated(1.5 - i, 0, 0);
GL11.glRotated(90, 0, 1, 0);
GL11.glTranslated(0, 1.0625, 0);
GenericRecipe recipe = AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(assemfac.assemblerModule[i].recipe);
if(recipe != null) {
ItemStack stack = recipe.getIcon();
stack.stackSize = 1;
if(stack.getItemSpriteNumber() == 0 && stack.getItem() instanceof ItemBlock) {
if(RenderBlocks.renderItemIn3d(Block.getBlockFromItem(stack.getItem()).getRenderType())) {
GL11.glTranslated(0, -0.0625, 0);
} else {
GL11.glTranslated(0, -0.125, 0);
GL11.glScaled(0.5, 0.5, 0.5);
}
} else {
GL11.glRotated(-90, 1, 0, 0);
GL11.glTranslated(0, -0.25, 0);
}
GL11.glScaled(1.25, 1.25, 1.25);
if(dummy == null || dummy.worldObj != tileEntity.getWorldObj()) dummy = new EntityItem(tileEntity.getWorldObj(), 0, 0, 0, stack);
dummy.setEntityItemStack(stack);
dummy.hoverStart = 0.0F;
RenderItem.renderInFrame = true;
RenderManager.instance.renderEntityWithPosYaw(dummy, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderItem.renderInFrame = false;
}
GL11.glPopMatrix();
}
RenderArcFurnace.fullbright(true);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_BLEND);
GL11.glAlphaFunc(GL11.GL_GREATER, 0);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
bindTexture(ResourceManager.assembly_factory_sparks_tex);
Tessellator tess = Tessellator.instance;
double wide = 0.1875D;
double narrow = 0.00D;
double length = 1.25D;
double uMin = ((tileEntity.getWorldObj().getTotalWorldTime() / 10D + interp)) % 10;
double uMax = uMin + 1;
double epsilon = 0.01D;
// renders two layers of sparks, one with regular UV and one with mirrored +0.5 offset
// render left and right of the blade with small offset to eliminate z-fighting
GL11.glPushMatrix(); if(arm2[3] <= -0.375D) {
GL11.glTranslated(0.5 + slide1, 1.0625D, -arm2[2] / 45D); // arm angle/45 is a seemingly good enough approximation
tess.startDrawingQuads();
tess.setColorRGBA_F(1F, 1F, 1F, 0F);
tess.addVertexWithUV(-epsilon, -wide, length, uMin + 0.5, 0);
tess.addVertexWithUV(-epsilon, wide, length, uMin + 0.5, 1);
tess.setColorRGBA_F(1F, 1F, 1F, 1F);
tess.addVertexWithUV(-epsilon, narrow, 0, uMax + 0.5, 1);
tess.addVertexWithUV(-epsilon, -narrow, 0, uMax + 0.5, 0);
tess.setColorRGBA_F(1F, 1F, 1F, 0F);
tess.addVertexWithUV(epsilon, -wide, length, uMin, 1);
tess.addVertexWithUV(epsilon, wide, length, uMin, 0);
tess.setColorRGBA_F(1F, 1F, 1F, 1F);
tess.addVertexWithUV(epsilon, narrow, 0, uMax, 0);
tess.addVertexWithUV(epsilon, -narrow, 0, uMax, 1);
tess.draw();
} GL11.glPopMatrix();
GL11.glPushMatrix(); if(arm4[3] <= -0.375D) {
GL11.glTranslated(-0.5 - slide2, 1.0625D, arm4[2] / 45D);
tess.startDrawingQuads();
tess.setColorRGBA_F(1F, 1F, 1F, 0F);
tess.addVertexWithUV(-epsilon, -wide, -length, uMin + 0.5, 0);
tess.addVertexWithUV(-epsilon, wide, -length, uMin + 0.5, 1);
tess.setColorRGBA_F(1F, 1F, 1F, 1F);
tess.addVertexWithUV(-epsilon, narrow, 0, uMax + 0.5, 1);
tess.addVertexWithUV(-epsilon, -narrow, 0, uMax + 0.5, 0);
tess.setNormal(-1, 0, 0);
tess.setColorRGBA_F(1F, 1F, 1F, 0F);
tess.addVertexWithUV(epsilon, -wide, -length, uMin, 1);
tess.addVertexWithUV(epsilon, wide, -length, uMin, 0);
tess.setColorRGBA_F(1F, 1F, 1F, 1F);
tess.addVertexWithUV(epsilon, narrow, 0, uMax, 0);
tess.addVertexWithUV(epsilon, -narrow, 0, uMax, 1);
tess.draw();
} GL11.glPopMatrix();
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_CULL_FACE);
RenderArcFurnace.fullbright(false);
}
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();
}
@Override
public Item getItemForRenderer() {
return Item.getItemFromBlock(ModBlocks.machine_assembly_factory);
}
@Override
public IItemRenderer getRenderer() {
return new ItemRenderBase() {
public void renderInventory() {
GL11.glTranslated(0, -1.5, 0);
GL11.glScaled(3, 3, 3);
}
public void renderCommonWithStack(ItemStack item) {
GL11.glScaled(0.75, 0.75, 0.75);
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.assembly_factory_tex);
ResourceManager.assembly_factory.renderAll();
GL11.glShadeModel(GL11.GL_FLAT);
}};
}
}

View File

@ -352,6 +352,7 @@ public class TileMappings {
put(TileEntityMachineAssembler.class, "tileentity_assembly_machine"); put(TileEntityMachineAssembler.class, "tileentity_assembly_machine");
put(TileEntityMachineAssemblyMachine.class, "tileentity_assemblymachine"); put(TileEntityMachineAssemblyMachine.class, "tileentity_assemblymachine");
put(TileEntityMachineAssemfac.class, "tileentity_assemfac"); put(TileEntityMachineAssemfac.class, "tileentity_assemfac");
put(TileEntityMachineAssemblyFactory.class, "tileentity_assemblyfactory");
put(TileEntityMachineChemplant.class, "tileentity_chemical_plant"); put(TileEntityMachineChemplant.class, "tileentity_chemical_plant");
put(TileEntityMachineChemicalPlant.class, "tileentity_chemicalplant"); put(TileEntityMachineChemicalPlant.class, "tileentity_chemicalplant");
put(TileEntityMachineChemfac.class, "tileentity_chemfac"); put(TileEntityMachineChemfac.class, "tileentity_chemfac");

View File

@ -266,12 +266,8 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
for(int i = 0; i < 4; i++) tanks[i].deserialize(buf); for(int i = 0; i < 4; i++) tanks[i].deserialize(buf);
boolean left = buf.readBoolean(); boolean left = buf.readBoolean();
boolean right = buf.readBoolean(); boolean right = buf.readBoolean();
if(left) { this.leftStack = left ? new MaterialStack(Mats.matById.get(buf.readInt()), buf.readInt()) : null;
this.leftStack = new MaterialStack(Mats.matById.get(buf.readInt()), buf.readInt()); this.rightStack = right ? new MaterialStack(Mats.matById.get(buf.readInt()), buf.readInt()) : null;
}
if(right) {
this.rightStack = new MaterialStack(Mats.matById.get(buf.readInt()), buf.readInt());
}
this.lastSelectedGUI = buf.readInt(); this.lastSelectedGUI = buf.readInt();
} }

View File

@ -0,0 +1,692 @@
package com.hbm.tileentity.machine;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.interfaces.IControlReceiver;
import com.hbm.interfaces.NotableComments;
import com.hbm.inventory.UpgradeManagerNT;
import com.hbm.inventory.container.ContainerMachineAssemblyFactory;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIMachineAssemblyFactory;
import com.hbm.inventory.recipes.AssemblyMachineRecipes;
import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemMachineUpgrade;
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
import com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
import com.hbm.module.machine.ModuleMachineAssembler;
import com.hbm.sound.AudioWrapper;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.IUpgradeInfoProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.tileentity.TileEntityProxyDyn.IProxyDelegateProvider;
import com.hbm.util.BobMathUtil;
import com.hbm.util.fauxpointtwelve.DirPos;
import com.hbm.util.i18n.I18nUtil;
import api.hbm.energymk2.IEnergyReceiverMK2;
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
// TODO: make a base class because 90% of this is just copy pasted from the chemfac
@NotableComments
public class TileEntityMachineAssemblyFactory extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2, IUpgradeInfoProvider, IControlReceiver, IGUIProvider, IProxyDelegateProvider {
public FluidTank[] allTanks;
public FluidTank[] inputTanks;
public FluidTank[] outputTanks;
public FluidTank water;
public FluidTank lps;
public long power;
public long maxPower = 1_000_000;
public boolean[] didProcess = new boolean[4];
public boolean frame = false;
private AudioWrapper audio;
public TragicYuri[] animations;
public ModuleMachineAssembler[] assemblerModule;
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(this);
protected DelegateAssemblyFactoy delegate = new DelegateAssemblyFactoy();
public TileEntityMachineAssemblyFactory() {
super(60);
animations = new TragicYuri[2];
for(int i = 0; i < animations.length; i++) animations[i] = new TragicYuri(i);
this.inputTanks = new FluidTank[4];
this.outputTanks = new FluidTank[4];
for(int i = 0; i < 4; i++) {
this.inputTanks[i] = new FluidTank(Fluids.NONE, 4_000);
this.outputTanks[i] = new FluidTank(Fluids.NONE, 4_000);
}
this.water = new FluidTank(Fluids.WATER, 4_000);
this.lps = new FluidTank(Fluids.SPENTSTEAM, 4_000);
this.allTanks = new FluidTank[this.inputTanks.length + this.outputTanks.length + 2];
for(int i = 0; i < inputTanks.length; i++) this.allTanks[i] = this.inputTanks[i];
for(int i = 0; i < outputTanks.length; i++) this.allTanks[i + this.inputTanks.length] = this.outputTanks[i];
this.allTanks[this.allTanks.length - 2] = this.water;
this.allTanks[this.allTanks.length - 1] = this.lps;
this.assemblerModule = new ModuleMachineAssembler[4];
for(int i = 0; i < 4; i++) this.assemblerModule[i] = new ModuleMachineAssembler(i, this, slots)
.itemInput(5 + i * 14).itemOutput(17 + i * 14)
.fluidInput(inputTanks[i]).fluidOutput(outputTanks[i]);
}
@Override
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
for(int k = 0; k < 4; k++) if(i == 17 + k * 14) return true;
for(int k = 0; k < 4; k++) if(this.assemblerModule[k].isSlotClogged(i)) return true;
return false;
}
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack) {
if(slot == 0) return true; // battery
for(int i = 0; i < 4; i++) if(slot == 4 + i * 14 && stack.getItem() == ModItems.blueprints) return true;
if(slot >= 1 && slot <= 3 && stack.getItem() instanceof ItemMachineUpgrade) return true; // upgrades
for(int i = 0; i < 4; i++) if(this.assemblerModule[i].isItemValid(slot, stack)) return true; // recipe input crap
return false;
}
@Override
public int[] getAccessibleSlotsFromSide(int side) {
return new int[] {
5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59
}; // ho boy, a big fucking array of hand-written values, surely this isn't gonna bite me in the ass some day
}
@Override
public String getName() {
return "container.machineAssemblyFactory";
}
@Override
public void updateEntity() {
if(maxPower <= 0) this.maxPower = 10_000_000;
if(!worldObj.isRemote) {
long nextMaxPower = 0;
for(int i = 0; i < 4; i++) {
GenericRecipe recipe = AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(assemblerModule[i].recipe);
if(recipe != null) {
nextMaxPower += recipe.power * 100;
}
}
this.maxPower = nextMaxPower;
this.maxPower = BobMathUtil.max(this.power, this.maxPower, 1_000_000);
this.power = Library.chargeTEFromItems(slots, 0, power, maxPower);
upgradeManager.checkSlots(slots, 1, 3);
for(DirPos pos : getConPos()) {
this.trySubscribe(worldObj, pos);
for(FluidTank tank : inputTanks) if(tank.getTankType() != Fluids.NONE) this.trySubscribe(tank.getTankType(), worldObj, pos);
for(FluidTank tank : outputTanks) if(tank.getFill() > 0) this.tryProvide(tank, worldObj, pos);
}
for(DirPos pos : getCoolPos()) {
delegate.trySubscribe(worldObj, pos);
delegate.trySubscribe(water.getTankType(), worldObj, pos);
delegate.tryProvide(lps, worldObj, pos);
}
double speed = 1D;
double pow = 1D;
speed += Math.min(upgradeManager.getLevel(UpgradeType.SPEED), 3) / 3D;
speed += Math.min(upgradeManager.getLevel(UpgradeType.OVERDRIVE), 3);
pow -= Math.min(upgradeManager.getLevel(UpgradeType.POWER), 3) * 0.25D;
pow += Math.min(upgradeManager.getLevel(UpgradeType.SPEED), 3) * 1D;
pow += Math.min(upgradeManager.getLevel(UpgradeType.OVERDRIVE), 3) * 10D / 3D;
boolean markDirty = false;
for(int i = 0; i < 4; i++) {
this.assemblerModule[i].update(speed * 2D, pow * 2D, canCool(), slots[4 + i * 14]);
this.didProcess[i] = this.assemblerModule[i].didProcess;
markDirty |= this.assemblerModule[i].markDirty;
if(this.assemblerModule[i].didProcess) {
this.water.setFill(this.water.getFill() - 100);
this.lps.setFill(this.lps.getFill() + 100);
}
}
if(markDirty) this.markDirty();
this.networkPackNT(100);
} else {
if((didProcess[0] ||didProcess[1] ||didProcess[2] ||didProcess[3]) && MainRegistry.proxy.me().getDistance(xCoord , yCoord, zCoord) < 50) {
if(audio == null) {
audio = createAudioLoop();
audio.startSound();
} else if(!audio.isPlaying()) {
audio = rebootAudio(audio);
}
audio.keepAlive();
audio.updatePitch(0.75F);
audio.updateVolume(this.getVolume(0.5F));
} else {
if(audio != null) {
audio.stopSound();
audio = null;
}
}
for(TragicYuri animation : animations) animation.update(didProcess[0] ||didProcess[1] ||didProcess[2] ||didProcess[3]);
if(worldObj.getTotalWorldTime() % 20 == 0) {
frame = !worldObj.getBlock(xCoord, yCoord + 3, zCoord).isAir(worldObj, xCoord, yCoord + 3, zCoord);
}
}
}
@Override public AudioWrapper createAudioLoop() {
return MainRegistry.proxy.getLoopedSound("hbm:block.motor", xCoord, yCoord, zCoord, 0.5F, 15F, 0.75F, 20);
}
@Override public void onChunkUnload() {
if(audio != null) { audio.stopSound(); audio = null; }
}
@Override public void invalidate() {
super.invalidate();
if(audio != null) { audio.stopSound(); audio = null; }
}
public boolean canCool() {
return water.getFill() >= 100 && lps.getFill() <= lps.getMaxFill() - 100;
}
public DirPos[] getConPos() {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
return new DirPos[] {
new DirPos(xCoord + 3, yCoord, zCoord - 2, Library.POS_X),
new DirPos(xCoord + 3, yCoord, zCoord + 0, Library.POS_X),
new DirPos(xCoord + 3, yCoord, zCoord + 2, Library.POS_X),
new DirPos(xCoord - 3, yCoord, zCoord - 2, Library.NEG_X),
new DirPos(xCoord - 3, yCoord, zCoord + 0, Library.NEG_X),
new DirPos(xCoord - 3, yCoord, zCoord + 2, Library.NEG_X),
new DirPos(xCoord - 2, yCoord, zCoord + 3, Library.POS_Z),
new DirPos(xCoord + 0, yCoord, zCoord + 3, Library.POS_Z),
new DirPos(xCoord + 2, yCoord, zCoord + 3, Library.POS_Z),
new DirPos(xCoord - 2, yCoord, zCoord - 3, Library.NEG_Z),
new DirPos(xCoord + 0, yCoord, zCoord - 3, Library.NEG_Z),
new DirPos(xCoord + 2, yCoord, zCoord - 3, Library.NEG_Z),
new DirPos(xCoord + dir.offsetX + rot.offsetX * 3, yCoord, zCoord + dir.offsetZ + rot.offsetZ * 3, rot),
new DirPos(xCoord - dir.offsetX + rot.offsetX * 3, yCoord, zCoord - dir.offsetZ + rot.offsetZ * 3, rot),
new DirPos(xCoord + dir.offsetX - rot.offsetX * 3, yCoord, zCoord + dir.offsetZ - rot.offsetZ * 3, rot.getOpposite()),
new DirPos(xCoord - dir.offsetX - rot.offsetX * 3, yCoord, zCoord - dir.offsetZ - rot.offsetZ * 3, rot.getOpposite()),
};
}
public DirPos[] getCoolPos() {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
return new DirPos[] {
new DirPos(xCoord + rot.offsetX + dir.offsetX * 3, yCoord, zCoord + rot.offsetZ + dir.offsetZ * 3, dir),
new DirPos(xCoord - rot.offsetX + dir.offsetX * 3, yCoord, zCoord - rot.offsetZ + dir.offsetZ * 3, dir),
new DirPos(xCoord + rot.offsetX - dir.offsetX * 3, yCoord, zCoord + rot.offsetZ - dir.offsetZ * 3, dir.getOpposite()),
new DirPos(xCoord - rot.offsetX - dir.offsetX * 3, yCoord, zCoord - rot.offsetZ - dir.offsetZ * 3, dir.getOpposite()),
};
}
@Override
public void serialize(ByteBuf buf) {
super.serialize(buf);
for(FluidTank tank : inputTanks) tank.serialize(buf);
for(FluidTank tank : outputTanks) tank.serialize(buf);
water.serialize(buf);
lps.serialize(buf);
buf.writeLong(power);
buf.writeLong(maxPower);
for(boolean b : didProcess) buf.writeBoolean(b);
for(int i = 0; i < 4; i++) this.assemblerModule[i].serialize(buf);
}
@Override
public void deserialize(ByteBuf buf) {
super.deserialize(buf);
for(FluidTank tank : inputTanks) tank.deserialize(buf);
for(FluidTank tank : outputTanks) tank.deserialize(buf);
water.deserialize(buf);
lps.deserialize(buf);
this.power = buf.readLong();
this.maxPower = buf.readLong();
for(int i = 0; i < 4; i++) this.didProcess[i] = buf.readBoolean();
for(int i = 0; i < 4; i++) this.assemblerModule[i].deserialize(buf);
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
for(int i = 0; i < inputTanks.length; i++) this.inputTanks[i].readFromNBT(nbt, "i" + i);
for(int i = 0; i < outputTanks.length; i++) this.outputTanks[i].readFromNBT(nbt, "i" + i);
this.water.readFromNBT(nbt, "w");
this.lps.readFromNBT(nbt, "s");
this.power = nbt.getLong("power");
this.maxPower = nbt.getLong("maxPower");
for(int i = 0; i < 4; i++) this.assemblerModule[i].readFromNBT(nbt);
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
for(int i = 0; i < inputTanks.length; i++) this.inputTanks[i].writeToNBT(nbt, "i" + i);
for(int i = 0; i < outputTanks.length; i++) this.outputTanks[i].writeToNBT(nbt, "i" + i);
this.water.writeToNBT(nbt, "w");
this.lps.writeToNBT(nbt, "s");
nbt.setLong("power", power);
nbt.setLong("maxPower", maxPower);
for(int i = 0; i < 4; i++) this.assemblerModule[i].writeToNBT(nbt);
}
@Override public long getPower() { return power; }
@Override public void setPower(long power) { this.power = power; }
@Override public long getMaxPower() { return maxPower; }
@Override public FluidTank[] getReceivingTanks() { return inputTanks; }
@Override public FluidTank[] getSendingTanks() { return outputTanks; }
@Override public FluidTank[] getAllTanks() { return allTanks; }
@Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerMachineAssemblyFactory(player.inventory, this); }
@Override @SideOnly(Side.CLIENT) public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIMachineAssemblyFactory(player.inventory, this); }
@Override public boolean hasPermission(EntityPlayer player) { return this.isUseableByPlayer(player); }
@Override
public void receiveControl(NBTTagCompound data) {
if(data.hasKey("index") && data.hasKey("selection")) {
int index = data.getInteger("index");
String selection = data.getString("selection");
if(index >= 0 && index < 4) {
this.assemblerModule[index].recipe = selection;
this.markChanged();
}
}
}
AxisAlignedBB bb = null;
@Override
public AxisAlignedBB getRenderBoundingBox() {
if(bb == null) bb = AxisAlignedBB.getBoundingBox(xCoord - 2, yCoord, zCoord - 2, xCoord + 3, yCoord + 3, zCoord + 3);
return bb;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
@Override
public boolean canProvideInfo(UpgradeType type, int level, boolean extendedInfo) {
return type == UpgradeType.SPEED || type == UpgradeType.POWER || type == UpgradeType.OVERDRIVE;
}
@Override
public void provideInfo(UpgradeType type, int level, List<String> info, boolean extendedInfo) {
info.add(IUpgradeInfoProvider.getStandardLabel(ModBlocks.machine_chemical_factory));
if(type == UpgradeType.SPEED) {
info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(KEY_SPEED, "+" + (level * 100 / 3) + "%"));
info.add(EnumChatFormatting.RED + I18nUtil.resolveKey(KEY_CONSUMPTION, "+" + (level * 50) + "%"));
}
if(type == UpgradeType.POWER) {
info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(KEY_CONSUMPTION, "-" + (level * 25) + "%"));
}
if(type == UpgradeType.OVERDRIVE) {
info.add((BobMathUtil.getBlink() ? EnumChatFormatting.RED : EnumChatFormatting.DARK_GRAY) + "YES");
}
}
@Override
public HashMap<UpgradeType, Integer> getValidUpgrades() {
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
upgrades.put(UpgradeType.SPEED, 3);
upgrades.put(UpgradeType.POWER, 3);
upgrades.put(UpgradeType.OVERDRIVE, 3);
return upgrades;
}
public DirPos[] coolantLine;
@Override // carelessly copy pasted from TileEntityMachineChemicalFactory
public Object getDelegateForPosition(int x, int y, int z) {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
if(coolantLine == null) coolantLine = new DirPos[] {
new DirPos(xCoord + rot.offsetX + dir.offsetX * 2, yCoord, zCoord + rot.offsetZ + dir.offsetZ * 2, dir),
new DirPos(xCoord - rot.offsetX + dir.offsetX * 2, yCoord, zCoord - rot.offsetZ + dir.offsetZ * 2, dir),
new DirPos(xCoord + rot.offsetX - dir.offsetX * 2, yCoord, zCoord + rot.offsetZ - dir.offsetZ * 2, dir.getOpposite()),
new DirPos(xCoord - rot.offsetX - dir.offsetX * 2, yCoord, zCoord - rot.offsetZ - dir.offsetZ * 2, dir.getOpposite()),
};
for(DirPos pos : coolantLine) if(pos.compare(x, y, z)) return this.delegate; // this actually fucking works
return null;
}
public class DelegateAssemblyFactoy implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2 { // scumware
@Override public long getPower() { return TileEntityMachineAssemblyFactory.this.getPower(); }
@Override public void setPower(long power) { TileEntityMachineAssemblyFactory.this.setPower(power); }
@Override public long getMaxPower() { return TileEntityMachineAssemblyFactory.this.getMaxPower(); }
@Override public boolean isLoaded() { return TileEntityMachineAssemblyFactory.this.isLoaded(); }
@Override public FluidTank[] getReceivingTanks() { return new FluidTank[] {TileEntityMachineAssemblyFactory.this.water}; }
@Override public FluidTank[] getSendingTanks() { return new FluidTank[] {TileEntityMachineAssemblyFactory.this.lps}; }
@Override public FluidTank[] getAllTanks() { return TileEntityMachineAssemblyFactory.this.getAllTanks(); }
}
/**
* Carriage consisting of two arms - a striker and a saw
* Movement of both arms is inverted, one pedestal can only be serviced by one arm at a time
*
* @author hbm
*/
public class TragicYuri {
public AssemblerArm striker;
public AssemblerArm saw;
Random rand = new Random();
YuriState state = YuriState.WORKING;
double slider = 0;
double prevSlider = 0;
boolean direction = false;
int timeUntilReposition;
public TragicYuri(int group) {
striker = new AssemblerArm( group == 0 ? 0 : 3);
saw = new AssemblerArm( group == 0 ? 1 : 2).yepThatsASaw();
timeUntilReposition = 140 + rand.nextInt(161);
}
public void update(boolean working) {
this.prevSlider = this.slider;
// one of the arms must do something. doesn't matter which or what position the carriage is in
if(didProcess[striker.recipeIndex] || didProcess[saw.recipeIndex]) switch(state) {
case WORKING: {
timeUntilReposition--;
if(timeUntilReposition <= 0) {
state = YuriState.RETIRING;
}
} break;
case RETIRING: {
if(striker.state == ArmState.WAIT && saw.state == ArmState.WAIT) { // only progress as soon as both arms are done moving
state = YuriState.SLIDING;
direction = !direction;
if(!muffled) MainRegistry.proxy.playSoundClient(xCoord, yCoord, zCoord, "hbm:block.assemblerStart", getVolume(0.25F), 1.25F + worldObj.rand.nextFloat() * 0.25F);
}
} break;
case SLIDING: {
double sliderSpeed = 1D / 10D; // 10 ticks for transit
if(direction) {
slider += sliderSpeed;
if(slider >= 1) {
slider = 1;
state = YuriState.WORKING;
}
} else {
slider -= sliderSpeed;
if(slider <= 0) {
slider = 0;
state = YuriState.WORKING;
}
}
if(state == YuriState.WORKING) timeUntilReposition = 140 + rand.nextInt(161); // 7 to 15 seconds
} break;
}
striker.updateArm();
saw.updateArm();
}
public double getSlider(float interp) {
return this.prevSlider + (this.slider - this.prevSlider) * interp;
}
// there's a ton of way to make this more optimized/readable/professional/scrungular but i don't care i am happy this crap works at all
public class AssemblerArm { // more fucking nesting!!!11
public double[] angles = new double[4];
public double[] prevAngles = new double[4];
public double[] targetAngles = new double[4];
public double[] speed = new double[4];
public double sawAngle;
public double prevSawAngle;
public int recipeIndex; // the index of which pedestal is serviced, assuming the carriage is at default position
ArmState state = ArmState.REPOSITION;
int actionDelay = 0;
boolean saw = false;
public AssemblerArm(int index) {
this.recipeIndex = index;
this.resetSpeed();
this.chooseNewArmPoistion();
}
public AssemblerArm yepThatsASaw() { this.saw = true; this.chooseNewArmPoistion(); return this; }
private void resetSpeed() {
speed[0] = 15; //Pivot
speed[1] = 15; //Arm
speed[2] = 15; //Piston
speed[3] = saw ? 0.125 : 0.5; //Striker
}
public void updateArm() {
resetSpeed();
for(int i = 0; i < angles.length; i++) {
prevAngles[i] = angles[i];
}
prevSawAngle = sawAngle;
int serviceIndex = recipeIndex;
if(slider > 0.5) serviceIndex += (serviceIndex % 2 == 0 ? 1 : -1); // if the carriage has moved, swap the indices so they match up with the serviced pedestal
if(!didProcess[serviceIndex]) state = ArmState.RETIRE;
if(state == ArmState.CUT || state == ArmState.EXTEND) {
this.sawAngle += 45D;
}
if(actionDelay > 0) {
actionDelay--;
return;
}
switch(state) {
// Move. If done moving, set a delay and progress to EXTEND
case REPOSITION: {
if(move()) {
actionDelay = 2;
state = ArmState.EXTEND;
targetAngles[3] = saw ? -0.375D : -0.75D;
}
} break;
case EXTEND:
if(move()) {
if(saw) {
state = ArmState.CUT;
targetAngles[2] = -targetAngles[2];
if(!muffled) MainRegistry.proxy.playSoundClient(xCoord, yCoord, zCoord, "hbm:block.assemblerCut", getVolume(0.5F), 1F + rand.nextFloat() * 0.25F);
} else {
state = ArmState.RETRACT;
targetAngles[3] = 0D;
if(!muffled) MainRegistry.proxy.playSoundClient(xCoord, yCoord, zCoord, "hbm:block.assemblerStrike", getVolume(0.5F), 1F);
}
}
break;
case CUT: {
speed[2] = Math.abs(targetAngles[2] / 20D);
if(move()) {
state = ArmState.RETRACT;
targetAngles[3] = 0D;
}
} break;
case RETRACT:
if(move()) {
actionDelay = 2 + rand.nextInt(5);
chooseNewArmPoistion();
state = TragicYuri.this.state == YuriState.RETIRING ? ArmState.RETIRE : ArmState.REPOSITION;
}
break;
case RETIRE: {
this.targetAngles[0] = 0;
this.targetAngles[1] = 0;
this.targetAngles[2] = 0;
this.targetAngles[3] = 0;
if(move()) {
actionDelay = 2 + rand.nextInt(5);
chooseNewArmPoistion();
state = ArmState.WAIT;
}
} break;
case WAIT: {
if(TragicYuri.this.state == YuriState.WORKING) this.state = ArmState.REPOSITION;
} break;
}
}
public void chooseNewArmPoistion() {
double[][] pos = !saw ? new double[][] {
// striker
{10, 10, -10},
{15, 15, -15},
{25, 10, -15},
{30, 0, -10},
{-10, 10, 0},
{-20, 30, -15}
} : new double[][] {
// saw
{-15, 15, -10},
{-15, 15, -15},
{-15, 15, 10},
{-15, 15, 15},
{-15, 15, 2},
{-15, 15, -2}
};
int chosen = rand.nextInt(pos.length);
this.targetAngles[0] = pos[chosen][0];
this.targetAngles[1] = pos[chosen][1];
this.targetAngles[2] = pos[chosen][2];
}
private boolean move() {
boolean didMove = false;
for(int i = 0; i < angles.length; i++) {
if(angles[i] == targetAngles[i])
continue;
didMove = true;
double angle = angles[i];
double target = targetAngles[i];
double turn = speed[i];
double delta = Math.abs(angle - target);
if(delta <= turn) {
angles[i] = targetAngles[i];
continue;
}
if(angle < target) {
angles[i] += turn;
} else {
angles[i] -= turn;
}
}
return !didMove;
}
public double[] getPositions(float interp) {
return new double[] {
BobMathUtil.interp(this.prevAngles[0], this.angles[0], interp),
BobMathUtil.interp(this.prevAngles[1], this.angles[1], interp),
BobMathUtil.interp(this.prevAngles[2], this.angles[2], interp),
BobMathUtil.interp(this.prevAngles[3], this.angles[3], interp),
BobMathUtil.interp(this.prevSawAngle, this.sawAngle, interp)
};
}
}
}
/*
* Arms cycle through REPOSITION -> EXTEND -> CUT (if saw) -> RETRACT
* If transit is planned, the carriage's state will change to RETIRING
* If the carriage is RETIRING, each arm will enter RETIRE state after RETRACT
* Once the arm has returned to null position, it changes to WAIT
* If both arms WAIT, the carriage switches to SLIDING
* Once transit is done, carriage returns to WORKING
* If the carriage is WORKING, any arm that is in the WAIT state will return to REPOSITION
*/
public static enum YuriState {
WORKING,
RETIRING, // waiting for arms to enter WAITING state
SLIDING // transit to next position
}
public static enum ArmState {
REPOSITION,
EXTEND,
CUT,
RETRACT,
RETIRE, // return to null position for carriage transit
WAIT // either waiting for or in the middle of carriage transit
}
}

View File

@ -31,6 +31,7 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
@Deprecated
public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase implements IFluidStandardTransceiver, IUpgradeInfoProvider, IFluidCopiable { public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase implements IFluidStandardTransceiver, IUpgradeInfoProvider, IFluidCopiable {
public AssemblerArm[] arms; public AssemblerArm[] arms;

View File

@ -145,14 +145,6 @@ public class TileEntityMachineChemicalFactory extends TileEntityMachineBase impl
this.power = Library.chargeTEFromItems(slots, 0, power, maxPower); this.power = Library.chargeTEFromItems(slots, 0, power, maxPower);
upgradeManager.checkSlots(slots, 1, 3); upgradeManager.checkSlots(slots, 1, 3);
inputTanks[0].loadTank(10, 13, slots);
inputTanks[1].loadTank(11, 14, slots);
inputTanks[2].loadTank(12, 15, slots);
outputTanks[0].unloadTank(16, 19, slots);
outputTanks[1].unloadTank(17, 20, slots);
outputTanks[2].unloadTank(18, 21, slots);
for(DirPos pos : getConPos()) { for(DirPos pos : getConPos()) {
this.trySubscribe(worldObj, pos); this.trySubscribe(worldObj, pos);
@ -188,6 +180,7 @@ public class TileEntityMachineChemicalFactory extends TileEntityMachineBase impl
} }
} }
// internal fluid sharing logic
for(FluidTank in : inputTanks) if(in.getTankType() != Fluids.NONE) for(FluidTank out : outputTanks) { // up to 144 iterations, but most of them are NOP anyway for(FluidTank in : inputTanks) if(in.getTankType() != Fluids.NONE) for(FluidTank out : outputTanks) { // up to 144 iterations, but most of them are NOP anyway
if(out.getTankType() == Fluids.NONE) continue; if(out.getTankType() == Fluids.NONE) continue;
if(out.getTankType() != in.getTankType()) continue; if(out.getTankType() != in.getTankType()) continue;

View File

@ -5,6 +5,7 @@ import java.util.*;
import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.generic.BlockDepth;
import com.hbm.blocks.generic.BlockBedrockOreTE.TileEntityBedrockOre; import com.hbm.blocks.generic.BlockBedrockOreTE.TileEntityBedrockOre;
import com.hbm.blocks.network.CraneInserter; import com.hbm.blocks.network.CraneInserter;
import com.hbm.entity.item.EntityMovingItem; import com.hbm.entity.item.EntityMovingItem;
@ -270,7 +271,12 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
break; break;
} }
if(shouldIgnoreBlock(b, x, y ,z)) continue; // if hitting depth rock, turn off the drill
if(b instanceof BlockDepth) {
this.enableDrill = false;
}
if(shouldIgnoreBlock(b, x, y, z)) continue;
ignoreAll = false; ignoreAll = false;

View File

@ -29,7 +29,7 @@ public class TileEntityMachineSchrabidiumTransmutator extends TileEntityMachineB
public long power = 0; public long power = 0;
public int process = 0; public int process = 0;
public static final long maxPower = 5000000; public static final long maxPower = 5000000;
public static final int processSpeed = 600; public static final int processSpeed = 6000;
private AudioWrapper audio; private AudioWrapper audio;

View File

@ -346,7 +346,7 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem
* All movement related stuff has to be repeated on the client, but only for the client's player * All movement related stuff has to be repeated on the client, but only for the client's player
* Otherwise this could lead to desync since the motion is never sent form the server * Otherwise this could lead to desync since the motion is never sent form the server
*/ */
if(tank.getFill() > 0 && !MainRegistry.proxy.me().capabilities.isCreativeMode) { if(wasOn && !MainRegistry.proxy.me().capabilities.isCreativeMode) {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10).getRotation(ForgeDirection.UP); ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10).getRotation(ForgeDirection.UP);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP); ForgeDirection rot = dir.getRotation(ForgeDirection.UP);

View File

@ -90,9 +90,9 @@ public class TileEntityMachineWoodBurner extends TileEntityMachineBase implement
if(type == EnumAshType.COAL) ashLevelCoal += burn; if(type == EnumAshType.COAL) ashLevelCoal += burn;
if(type == EnumAshType.MISC) ashLevelMisc += burn; if(type == EnumAshType.MISC) ashLevelMisc += burn;
int threshold = 2000; int threshold = 2000;
if(processAsh(ashLevelWood, EnumAshType.WOOD, threshold)) ashLevelWood -= threshold; while(processAsh(ashLevelWood, EnumAshType.WOOD, threshold)) ashLevelWood -= threshold;
if(processAsh(ashLevelCoal, EnumAshType.COAL, threshold)) ashLevelCoal -= threshold; while(processAsh(ashLevelCoal, EnumAshType.COAL, threshold)) ashLevelCoal -= threshold;
if(processAsh(ashLevelMisc, EnumAshType.MISC, threshold)) ashLevelMisc -= threshold; while(processAsh(ashLevelMisc, EnumAshType.MISC, threshold)) ashLevelMisc -= threshold;
this.maxBurnTime = this.burnTime = burn; this.maxBurnTime = this.burnTime = burn;
ItemStack container = slots[0].getItem().getContainerItem(slots[0]); ItemStack container = slots[0].getItem().getContainerItem(slots[0]);

View File

@ -1,10 +1,14 @@
package com.hbm.tileentity.machine.albion; package com.hbm.tileentity.machine.albion;
import java.util.List;
import com.hbm.inventory.container.ContainerPADetector; import com.hbm.inventory.container.ContainerPADetector;
import com.hbm.inventory.gui.GUIPADetector; import com.hbm.inventory.gui.GUIPADetector;
import com.hbm.inventory.recipes.ParticleAcceleratorRecipes; import com.hbm.inventory.recipes.ParticleAcceleratorRecipes;
import com.hbm.inventory.recipes.ParticleAcceleratorRecipes.ParticleAcceleratorRecipe; import com.hbm.inventory.recipes.ParticleAcceleratorRecipes.ParticleAcceleratorRecipe;
import com.hbm.items.ModItems;
import com.hbm.lib.Library; import com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.machine.albion.TileEntityPASource.PAState; import com.hbm.tileentity.machine.albion.TileEntityPASource.PAState;
import com.hbm.tileentity.machine.albion.TileEntityPASource.Particle; import com.hbm.tileentity.machine.albion.TileEntityPASource.Particle;
@ -142,6 +146,12 @@ public class TileEntityPADetector extends TileEntityCooledBase implements IGUIPr
} }
} }
} }
if((recipe.output1 != null && recipe.output1.getItem() == ModItems.particle_digamma) || (recipe.output2 != null && recipe.output2.getItem() == ModItems.particle_digamma)) {
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5).expand(100, 50, 100));
for(EntityPlayer player : players) player.triggerAchievement(MainRegistry.achOmega12);
}
particle.crash(PAState.SUCCESS); particle.crash(PAState.SUCCESS);
return; return;
} }

View File

@ -101,13 +101,10 @@ public class TileEntityMassStorage extends TileEntityCrateBase implements IBufPa
} }
public boolean quickInsert(ItemStack stack) { public boolean quickInsert(ItemStack stack) {
if (!canInsert(stack)) if(!canInsert(stack)) return false;
return false;
int remaining = getCapacity() - getStockpile();
if (remaining < stack.stackSize) int remaining = getCapacity() - getStockpile();
return false; if(remaining < stack.stackSize) return false;
this.stack += stack.stackSize; this.stack += stack.stackSize;
stack.stackSize = 0; stack.stackSize = 0;
@ -117,15 +114,12 @@ public class TileEntityMassStorage extends TileEntityCrateBase implements IBufPa
} }
public ItemStack quickExtract() { public ItemStack quickExtract() {
if (!output) { if(!output) return null;
return null;
}
int amount = getType().getMaxStackSize(); int amount = getType().getMaxStackSize();
if (getStockpile() < amount) if(getStockpile() < amount) return null;
return null;
ItemStack result = slots[1].copy(); ItemStack result = slots[1].copy();
result.stackSize = amount; result.stackSize = amount;
this.stack -= amount; this.stack -= amount;
@ -138,18 +132,17 @@ public class TileEntityMassStorage extends TileEntityCrateBase implements IBufPa
public int getTotalStockpile() { public int getTotalStockpile() {
ItemStack type = getType(); ItemStack type = getType();
if (type == null) if(type == null) return 0;
return 0;
int result = getStockpile(); int result = getStockpile();
ItemStack inStack = slots[0]; ItemStack inStack = slots[0];
if (inStack != null && ItemStackUtil.areStacksCompatible(type, inStack)) { if(inStack != null && ItemStackUtil.areStacksCompatible(type, inStack)) {
result += inStack.stackSize; result += inStack.stackSize;
} }
ItemStack outStack = slots[2]; ItemStack outStack = slots[2];
if (outStack != null && ItemStackUtil.areStacksCompatible(type, outStack)) { if(outStack != null && ItemStackUtil.areStacksCompatible(type, outStack)) {
result += outStack.stackSize; result += outStack.stackSize;
} }
@ -170,9 +163,7 @@ public class TileEntityMassStorage extends TileEntityCrateBase implements IBufPa
private int changeTotalStockpile(int amount, boolean actually, int sign) { private int changeTotalStockpile(int amount, boolean actually, int sign) {
ItemStack type = getType(); ItemStack type = getType();
if(type == null) return amount;
if (type == null)
return amount;
int stockpileAvail = sign > 0 ? getCapacity() - getStockpile() : getStockpile(); int stockpileAvail = sign > 0 ? getCapacity() - getStockpile() : getStockpile();
@ -186,21 +177,21 @@ public class TileEntityMassStorage extends TileEntityCrateBase implements IBufPa
int inputAvail = 0; int inputAvail = 0;
ItemStack inStack = slots[0]; ItemStack inStack = slots[0];
if (inStack != null && ItemStackUtil.areStacksCompatible(type, inStack)) { if(inStack != null && ItemStackUtil.areStacksCompatible(type, inStack)) {
inputAvail = sign > 0 ? inStack.getMaxStackSize() - inStack.stackSize : inStack.stackSize; inputAvail = sign > 0 ? inStack.getMaxStackSize() - inStack.stackSize : inStack.stackSize;
} else if (inStack == null) { } else if(inStack == null) {
inputAvail = sign > 0 ? type.getMaxStackSize() : 0; inputAvail = sign > 0 ? type.getMaxStackSize() : 0;
} }
if (amount > 0 && inputAvail > 0) { if(amount > 0 && inputAvail > 0) {
int depositInput = Math.min(amount, inputAvail); int depositInput = Math.min(amount, inputAvail);
if (actually) { if(actually) {
if (slots[0] == null) { // Only possible with sign == +1 if(slots[0] == null) { // Only possible with sign == +1
slots[0] = slots[1].copy(); slots[0] = slots[1].copy();
slots[0].stackSize = 0; slots[0].stackSize = 0;
} }
slots[0].stackSize += sign * depositInput; slots[0].stackSize += sign * depositInput;
if (slots[0].stackSize == 0) { if(slots[0].stackSize == 0) {
slots[0] = null; slots[0] = null;
} }
} }
@ -209,28 +200,28 @@ public class TileEntityMassStorage extends TileEntityCrateBase implements IBufPa
int outputAvail = 0; int outputAvail = 0;
ItemStack outStack = slots[2]; ItemStack outStack = slots[2];
if (outStack != null && ItemStackUtil.areStacksCompatible(type, outStack)) { if(outStack != null && ItemStackUtil.areStacksCompatible(type, outStack)) {
outputAvail = sign > 0 ? outStack.getMaxStackSize() - outStack.stackSize : outStack.stackSize; outputAvail = sign > 0 ? outStack.getMaxStackSize() - outStack.stackSize : outStack.stackSize;
} else if (outStack == null) { } else if(outStack == null) {
outputAvail = sign > 0 ? type.getMaxStackSize() : 0; outputAvail = sign > 0 ? type.getMaxStackSize() : 0;
} }
if (amount > 0 && outputAvail > 0) { if(amount > 0 && outputAvail > 0) {
int depositOutput = Math.min(amount, outputAvail); int depositOutput = Math.min(amount, outputAvail);
if (actually) { if(actually) {
if (slots[2] == null) { // Only possible with sign == +1 if(slots[2] == null) { // Only possible with sign == +1
slots[2] = slots[1].copy(); slots[2] = slots[1].copy();
slots[2].stackSize = 0; slots[2].stackSize = 0;
} }
slots[2].stackSize += sign * depositOutput; slots[2].stackSize += sign * depositOutput;
if (slots[2].stackSize == 0) { if(slots[2].stackSize == 0) {
slots[2] = null; slots[2] = null;
} }
} }
amount -= depositOutput; amount -= depositOutput;
} }
if (actually) { if(actually) {
this.markDirty(); this.markDirty();
} }

Some files were not shown because too many files have changed in this diff Show More