Merge remote-tracking branch 'upstream/master' into Optimization

# Conflicts:
#	src/main/java/com/hbm/tileentity/TileEntityMachineBase.java
#	src/main/java/com/hbm/tileentity/machine/TileEntityHeaterElectric.java
#	src/main/java/com/hbm/tileentity/machine/TileEntityMachineSolderingStation.java
#	src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java
#	src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityCraneConsole.java
#	src/main/java/com/hbm/tileentity/network/TileEntityCraneGrabber.java
This commit is contained in:
BallOfEnergy 2024-10-10 19:41:23 -05:00
commit 88f5ac1cf1
334 changed files with 49564 additions and 35724 deletions

33
.gitignore vendored
View File

@ -1,25 +1,28 @@
# eclipse
eclipse
bin
*.launch
.settings
.metadata
.classpath
.project
/eclipse
/bin
/*.launch
/.settings
/.metadata
/.classpath
/.project
# idea
out
*.ipr
*.iws
*.iml
.idea
/out
/*.ipr
/*.iws
/*.iml
/.idea
# gradle
build
.gradle
/build
/.gradle
# vscode
/.vscode
# other
run
/run
# CurseForge configuration
/curseforge.properties

View File

@ -93,6 +93,9 @@ If you want to make some changes to the mod, follow this guide:
* Click **Add Standard VM**; in the JRE home, navigate to the directory where the JDK is installed, then click finish and select it.
10. Code!
## Contributing animations
Weapon animations in NTM are stored in JSON files, which are used alongside OBJ models to produce high quality animations with reasonable filesizes. Import/Export Blender addons are available for versions 2.79, 3.2, and 4.0 in `tools`, and they should function reasonably well in newer versions as well. See the comments in the header of the export scripts for usage instructions.
## Compatibility notice
NTM has certain behaviors intended to fix vanilla code or to increase compatibility in certain cases where it otherwise would not be possible. These behaviors have the potential of not playing well with other mods, and while no such cases are currently known, here's a list of them.

View File

@ -1,16 +1,25 @@
## Changed
* The ambient radiation generator's functionality and recipe have been disabled as it is being deprecated
* The pyrolysis oven is now compatible with overdrive upgrades
* Steel walls and corners no longer use TESRs for rendering, making them more performant at large scale and fixing any oddities regarding their rendering
* Steel walls and corners can now be rotated using the screwdriver (right click for clockwise, shift click for counter-clockwise)
* Steel walls and corners now use new textures as well as slightly cleaner models
* Steel corner bounding boxes now closely match their model
* Updated russian and chinese localization
* The fine soot recipe in the pyrolysis oven now only needs 4 tar
* Overdrive upgrades now use hard plastic/fullerite instead of lithium crystals
* Machines now only send their sync packets once a second instead of once per tick if the values haven't changed, reducing network traffic by a considerable amount
* Tom's explosion no longer causes any block updates on the millions of blocks it deletes which hopefully fixes a majority of the lag caused by the crater
* Overdrive upgrades now increase power usage in pyrolysis ovens (equivalent to 2 speed upgrades per level)
* Due to the increased maximum demand with overdrives + speed upgrades, the energy buffer for the pyrolysis oven has been increased tenfold
* Updated basalt textures
* Scaffold blocks can now be placed horizontally
* Updated the shredder's textures
* The strand caster will now cast its remaining buffer after 10 seconds of inactivity, even if the buffer is not full enough for a batch of 9
* The soldering station now has a toggle for the "refuse to do recipes with no fluid if fluid is present" behavior
* Recipes using the ore dictionary "oreThorium232" are now also generated for "oreThorium"
## Fixed
* Fixed crash caused by the pyrolysis oven on servers
* Due this type of issue happening constantly, the GUI provider system no longer uses any client-only code
* Fixed small black bar rendering under the arrow box of NEI universal handlers when using the NH NEI fork
* Fixed desh screwdrivers not being usable for picking locks
* Possibly fixed an issue caused by MouseTweaks (in combination with other mods) duplicating click input (I can't replicate the issue so I can at best guess)
* Fixed pyrolysis ovens not being able to operate due to the output buffer being full, despite the buffer being a different type
* Fixed a vanilla bug in the standard block renderer causing boxduct bends to have incorrect UV on the -Z and +X sides
* The conveyor grabber should no longer skip over items when used in long lines
* Fixed a potential crash regarding crucibles
* Fixed compatibility with EndlessIDs, biome changes should no longer crash the game
* Fixed GL state leak caused by fluid tanks, causing some tile entities to be rendered without face culling
* Fixed a bug where using too many PWR heatsinks would cause an overflow, making the heat capacity negative
* Fixed landmines generating into the floor on superflat worlds
* All NTM type explosions are no longer affected by difficulty setting, preventing them from dealing damage in peaceful mode
* There are a few instances of vanilla explosions still being used, those will be phased out in the future
* Fixed tutorial presentations triggering when hitting F1 not just in the inventory but also when looking at the block in question

View File

@ -20,6 +20,15 @@ credits=HbMinecraft,\
\ Pashtet (russian localization),\
\ Bismarck (chinese localization),\
\ Creeper-banner (chinese localization),\
\ 5467864 (chinese localization),\
\ eeeeee0a (chinese localization),\
\ hz0909adc (chinese localization),\
\ LSKLW (chinese localization),\
\ R-Kaenbyou (chinese localization),\
\ scp-000000000 (chinese localization),\
\ UnnameTokiko (chinese localization),\
\ Herobrine 457985 (chinese localization),\
\ xxwinhere (chinese localization),\
\ Maksymisio (polish localization)\
\ el3ctro4ndre (italian localization),\
\ Pu-238 (Tom impact effects),\
@ -39,6 +48,7 @@ credits=HbMinecraft,\
\ Voxelstice (OpenComputers integration, turbine spinup),\
\ BallOfEnergy1 (OpenComputers integration),\
\ sdddddf80 (recipe configs, chinese localization, custom machine holograms),\
\ Abel1502 (optimization, crate upgrade recipes, strand caster improvements),\
\ SuperCraftAlex (tooltips)\
\ Ice-Arrow (research reactor tweaks),\
\ 245tt (anvil GUI improvements),\

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
package com.hbm.blocks.generic;
import java.util.ArrayList;
import java.util.Locale;
import java.util.Random;
@ -7,15 +8,22 @@ import com.hbm.blocks.BlockEnumMulti;
import com.hbm.blocks.ModBlocks;
import com.hbm.items.ModItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockOreBasalt extends BlockEnumMulti {
protected IIcon[] topIcons;
public BlockOreBasalt() {
super(Material.rock, EnumBasaltOreType.class, true, true);
@ -47,11 +55,6 @@ public class BlockOreBasalt extends BlockEnumMulti {
return super.getItemDropped(meta, rand, fortune);
}
@Override
public int damageDropped(int meta) {
return 0;
}
@Override
public void onEntityWalking(World world, int x, int y, int z, Entity entity) {
int meta = world.getBlockMetadata(x, y, z);
@ -76,4 +79,31 @@ public class BlockOreBasalt extends BlockEnumMulti {
if(meta == EnumBasaltOreType.ASBESTOS.ordinal()) world.setBlock(x, y, z, ModBlocks.gas_asbestos);
super.dropBlockAsItemWithChance(world, x, y, z, meta, chance, fortune);
}
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
return ModBlocks.getDropsWithoutDamage(world, this, metadata, fortune);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg) {
super.registerBlockIcons(reg);
Enum[] enums = theEnum.getEnumConstants();
this.topIcons = new IIcon[enums.length];
for(int i = 0; i < topIcons.length; i++) {
Enum num = enums[i];
this.topIcons[i] = reg.registerIcon(this.getTextureMultiName(num) + "_top");
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
if(side <= 1) return this.topIcons[meta % this.topIcons.length];
return super.getIcon(side, meta);
}
}

View File

@ -16,6 +16,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockScaffold extends BlockMulti {
@ -59,22 +60,34 @@ public class BlockScaffold extends BlockMulti {
public IIcon getIcon(int side, int meta) {
return this.icons[this.damageDropped(meta)];
}
@Override
public int onBlockPlaced(World world, int x, int y, int z, int side, float fx, float fy, float fz, int meta) {
return side;
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
ForgeDirection placed = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
int meta = stack.getItemDamage();
if(i % 2 == 0) {
world.setBlockMetadataWithNotify(x, y, z, meta, 2);
if(placed == ForgeDirection.UP || placed == ForgeDirection.DOWN) {
int rot = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
if(rot % 2 == 0) {
world.setBlockMetadataWithNotify(x, y, z, meta, 2);
} else {
world.setBlockMetadataWithNotify(x, y, z, meta + 8, 2);
}
} else if(placed == ForgeDirection.NORTH || placed == ForgeDirection.SOUTH) {
world.setBlockMetadataWithNotify(x, y, z, meta + 4, 2);
} else {
world.setBlockMetadataWithNotify(x, y, z, meta + 8, 2);
world.setBlockMetadataWithNotify(x, y, z, meta + 12, 2);
}
}
@Override
public int damageDropped(int meta) {
return rectify(meta) & 7;
return rectify(meta);
}
@Override
@ -83,27 +96,24 @@ public class BlockScaffold extends BlockMulti {
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) {
int te = p_149719_1_.getBlockMetadata(p_149719_2_, p_149719_3_, p_149719_4_);
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z);
float f = 0.0625F;
if((te & 8) != 0)
if(meta >= 12) {
this.setBlockBounds(0.0F, 2 * f, 0.0F, 1.0F, 14 * f, 1.0F);
} else if(meta >= 8) {
this.setBlockBounds(2 * f, 0.0F, 0.0F, 14 * f, 1.0F, 1.0F);
else
} else if(meta >= 4) {
this.setBlockBounds(0.0F, 2 * f, 0.0F, 1.0F, 14 * f, 1.0F);
} else {
this.setBlockBounds(0.0F, 0.0F, 2 * f, 1.0F, 1.0F, 14 * f);
}
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
int te = world.getBlockMetadata(x, y, z);
float f = 0.0625F;
if((te & 8) != 0)
this.setBlockBounds(2 * f, 0.0F, 0.0F, 14 * f, 1.0F, 1.0F);
else
this.setBlockBounds(0.0F, 0.0F, 2 * f, 1.0F, 1.0F, 14 * f);
setBlockBoundsBasedOnState(world, x, y, z);
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
}
}

View File

@ -1,270 +0,0 @@
package com.hbm.blocks.generic;
import com.hbm.lib.Library;
import com.hbm.lib.RefStrings;
import com.hbm.util.I18nUtil;
import static com.hbm.blocks.generic.BlockScaffoldDynamic.TileEntityScaffoldDynamic.*;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.ILookOverlay;
import com.hbm.items.ModItems;
import com.hbm.items.tool.ItemBlowtorch;
import api.hbm.block.IToolable;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTool;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
public class BlockScaffoldDynamic extends BlockContainer implements IToolable, ILookOverlay {
@SideOnly(Side.CLIENT) public IIcon iconPoleTop;
@SideOnly(Side.CLIENT) public IIcon iconPoleSide;
@SideOnly(Side.CLIENT) public IIcon iconGrateTop;
@SideOnly(Side.CLIENT) public IIcon iconGrateSide;
@SideOnly(Side.CLIENT) public IIcon iconBarTop;
@SideOnly(Side.CLIENT) public IIcon iconBarSide;
public static int renderMode;
public BlockScaffoldDynamic() {
super(Material.iron);
}
public static int renderIDScaffold = RenderingRegistry.getNextAvailableRenderId();
@Override public int getRenderType(){ return renderIDScaffold; }
@Override public boolean isOpaqueCube() { return false; }
@Override public boolean renderAsNormalBlock() { return false; }
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityScaffoldDynamic();
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
if(renderMode == 0) return side == 0 || side == 1 ? iconPoleTop : iconPoleSide;
if(renderMode == 1) return side == 0 || side == 1 ? iconGrateTop : iconGrateSide;
if(renderMode == 2) return side == 0 || side == 1 ? iconBarTop : iconBarSide;
return this.blockIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg) {
super.registerBlockIcons(reg);
this.iconPoleTop = reg.registerIcon(RefStrings.MODID + ":scaffold_pole_top");
this.iconPoleSide = reg.registerIcon(RefStrings.MODID + ":scaffold_pole_side");
this.iconGrateTop = reg.registerIcon(RefStrings.MODID + ":scaffold_grate_top");
this.iconGrateSide = reg.registerIcon(RefStrings.MODID + ":scaffold_grate_side");
this.iconBarTop = reg.registerIcon(RefStrings.MODID + ":scaffold_bar_top");
this.iconBarSide = reg.registerIcon(RefStrings.MODID + ":scaffold_bar_side");
}
@Override
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
TileEntityScaffoldDynamic tile = (TileEntityScaffoldDynamic) world.getTileEntity(x, y, z);
if(tool == ToolType.SCREWDRIVER) {
tile.locked = !tile.locked;
tile.markDirty();
world.markBlockForUpdate(x, y, z);
return true;
}
if(tool != ToolType.TORCH) return false;
int part = getPartFromCoord(fX, fY, fZ);
if(part != 0 && tile.canToggle(part)) {
tile.toggle(part);
tile.markDirty();
world.markBlockForUpdate(x, y, z);
return true;
}
return false;
}
public static int getPartFromCoord(float fX, float fY, float fZ) {
if(fX < 0.25 && fZ < 0.25) return POLE_NX_NZ;
if(fX > 0.75 && fZ < 0.25) return POLE_PX_NZ;
if(fX > 0.75 && fZ > 0.75) return POLE_PX_PZ;
if(fX < 0.25 && fZ > 0.75) return POLE_NX_PZ;
if(fY == 0 && fX < 0.25) return BAR_LOWER_NEG_X;
if(fY == 0 && fX > 0.75) return BAR_LOWER_POS_X;
if(fY == 0 && fZ < 0.25) return BAR_LOWER_NEG_Z;
if(fY == 0 && fZ > 0.75) return BAR_LOWER_POS_Z;
if(fY == 1 && fX < 0.25) return BAR_UPPER_NEG_X;
if(fY == 1 && fX > 0.75) return BAR_UPPER_POS_X;
if(fY == 1 && fZ < 0.25) return BAR_UPPER_NEG_Z;
if(fY == 1 && fZ > 0.75) return BAR_UPPER_POS_Z;
if(fY < 0.125) return GRATE_LOWER;
if(fY > 0.875) return GRATE_UPPER;
if(fX == 0 && fY < 0.5) return BAR_LOWER_NEG_X;
if(fX == 1 && fY < 0.5) return BAR_LOWER_POS_X;
if(fZ == 0 && fY < 0.5) return BAR_LOWER_NEG_Z;
if(fZ == 1 && fY < 0.5) return BAR_LOWER_POS_Z;
if(fX == 0 && fY > 0.5) return BAR_UPPER_NEG_X;
if(fX == 1 && fY > 0.5) return BAR_UPPER_POS_X;
if(fZ == 0 && fY > 0.5) return BAR_UPPER_NEG_Z;
if(fZ == 1 && fY > 0.5) return BAR_UPPER_POS_Z;
return 0;
}
//ttoo lazy to make an itemblock just to provide this in the one method that needs it
public static float lastFX;
public static float lastFY;
public static float lastFZ;
@Override
public int onBlockPlaced(World world, int x, int y, int z, int side, float fX, float fY, float fZ, int meta) {
lastFX = fX;
lastFY = fY;
lastFZ = fZ;
if(side == Library.POS_X.ordinal()) lastFX = 0;
if(side == Library.NEG_X.ordinal()) lastFX = 1;
if(side == Library.POS_Z.ordinal()) lastFZ = 0;
if(side == Library.NEG_Z.ordinal()) lastFZ = 1;
return side;
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
TileEntityScaffoldDynamic tile = (TileEntityScaffoldDynamic) world.getTileEntity(x, y, z);
// DEFAUL: POLES
if(stack.getItemDamage() == 0) {
if(lastFX < 0.5 && lastFZ < 0.5) tile.toggle(tile.POLE_NX_NZ);
if(lastFX >= 0.5 && lastFZ < 0.5) tile.toggle(tile.POLE_PX_NZ);
if(lastFX < 0.5 && lastFZ >= 0.5) tile.toggle(tile.POLE_NX_PZ);
if(lastFX >= 0.5 && lastFZ >= 0.5) tile.toggle(tile.POLE_PX_PZ);
}
}
public static class TileEntityScaffoldDynamic extends TileEntity {
public int composite;
public int prevComposite;
public boolean locked;
public static final int BAR_LOWER_POS_X = (1 << 0);
public static final int BAR_LOWER_NEG_X = (1 << 1);
public static final int BAR_LOWER_POS_Z = (1 << 2);
public static final int BAR_LOWER_NEG_Z = (1 << 3);
public static final int BAR_UPPER_POS_X = (1 << 4);
public static final int BAR_UPPER_NEG_X = (1 << 5);
public static final int BAR_UPPER_POS_Z = (1 << 6);
public static final int BAR_UPPER_NEG_Z = (1 << 7);
public static final int POLE_PX_PZ = (1 << 8);
public static final int POLE_PX_NZ = (1 << 9);
public static final int POLE_NX_PZ = (1 << 10);
public static final int POLE_NX_NZ = (1 << 11);
public static final int GRATE_LOWER = (1 << 12);
public static final int GRATE_UPPER = (1 << 13);
public boolean canToggle(int part) { return !locked && (composite ^ part) != 0; }
public void toggle(int part) { this.composite ^= part; System.out.println("" + this.composite); }
public boolean has(int part) { return (this.composite & part) != 0; }
@Override
public void updateEntity() { }
@Override
public Packet getDescriptionPacket() {
NBTTagCompound nbt = new NBTTagCompound();
this.writeToNBT(nbt);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
this.readFromNBT(pkt.func_148857_g());
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.composite = nbt.getInteger("c");
this.prevComposite = nbt.getInteger("p");
this.locked = nbt.getBoolean("l");
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setInteger("c", composite);
nbt.setInteger("p", prevComposite);
nbt.setBoolean("l", locked);
}
}
@Override
public void printHook(Pre event, World world, int x, int y, int z) {
Minecraft mc = Minecraft.getMinecraft();
EntityPlayer player = mc.thePlayer;
ItemStack held = player.getHeldItem();
boolean holdsBlowtorch = held != null && held.getItem() instanceof ItemBlowtorch;
boolean holdScrewdriver = held != null && (held.getItem() == ModItems.screwdriver || held.getItem() == ModItems.screwdriver_desh);
MovingObjectPosition mop = mc.objectMouseOver;
if(mop != null && mop.typeOfHit == mop.typeOfHit.BLOCK) {
float fX = (float) (mop.hitVec.xCoord - x);
float fY = (float) (mop.hitVec.yCoord - y);
float fZ = (float) (mop.hitVec.zCoord - z);
TileEntityScaffoldDynamic tile = (TileEntityScaffoldDynamic) world.getTileEntity(x, y, z);
if(tile != null && tile.locked && (holdsBlowtorch || holdScrewdriver)) {
List<String> text = new ArrayList();
text.add(EnumChatFormatting.RED + "Locked!");
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(this.getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
return;
}
if(holdsBlowtorch) {
String name = null;
int part = getPartFromCoord(fX, fY, fZ);
if(part <= (1 << 3)) name = "Lower Vertical Bar";
else if(part <= (1 << 7)) name = "Upper Vertical Bar";
else if(part <= (1 << 10)) name = "Pole";
else if(part <= (1 << 13)) name = "Grate";
if(name != null) {
List<String> text = new ArrayList();
text.add("Toggle:");
text.add(name);
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(this.getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
}
}
}
}
}

View File

@ -1,5 +1,6 @@
package com.hbm.blocks.generic;
import java.util.ArrayList;
import java.util.Random;
import com.hbm.blocks.BlockEnumMulti;
@ -10,6 +11,7 @@ import com.hbm.items.ModItems;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@ -45,11 +47,6 @@ public class BlockStalagmite extends BlockEnumMulti {
return null;
}
@Override
public int damageDropped(int meta) {
return 0;
}
public static int getMetaFromResource(int meta) {
return meta;
@ -75,4 +72,10 @@ public class BlockStalagmite extends BlockEnumMulti {
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
return null;
}
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
return ModBlocks.getDropsWithoutDamage(world, this, metadata, fortune);
}
}

View File

@ -0,0 +1,60 @@
package com.hbm.blocks.machine;
import com.hbm.blocks.BlockDummyable;
import com.hbm.tileentity.TileEntityProxyCombo;
import com.hbm.tileentity.machine.TileEntityMachineRotaryFurnace;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class MachineRotaryFurnace extends BlockDummyable {
public MachineRotaryFurnace(Material mat) {
super(mat);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
if(meta >= 12) return new TileEntityMachineRotaryFurnace();
if(meta >= 6) return new TileEntityProxyCombo().inventory().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[] {4, 0, 1, 1, 2, 2};
}
@Override
public int getOffset() {
return 1;
}
@Override
protected 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 * o;
z += dir.offsetZ * o;
ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN);
//back
for(int i = -2; i <= 2; i++) {
this.makeExtra(world, x - dir.offsetX + rot.offsetX * i, y, z - dir.offsetZ + rot.offsetZ * i);
}
//side fluid
this.makeExtra(world, x + dir.offsetX - rot.offsetX * 2, y, z + dir.offsetZ - rot.offsetZ * 2);
//exhaust
this.makeExtra(world, x + rot.offsetX, y + 4, z + rot.offsetZ);
//solid fuel
this.makeExtra(world, x + dir.offsetX + rot.offsetX, y, z + dir.offsetZ + rot.offsetZ);
}
}

View File

@ -4,14 +4,16 @@ import com.hbm.blocks.BlockDummyable;
import com.hbm.handler.MultiblockHandlerXR;
import com.hbm.tileentity.machine.rbmk.TileEntityCraneConsole;
import api.hbm.block.IToolable;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class RBMKCraneConsole extends BlockDummyable {
public class RBMKCraneConsole extends BlockDummyable implements IToolable {
public RBMKCraneConsole() {
super(Material.iron);
@ -72,4 +74,20 @@ public class RBMKCraneConsole extends BlockDummyable {
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
}
@Override
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
if(tool == ToolType.SCREWDRIVER) {
if(world.isRemote) return true;
int[] pos = findCore(world, x, y, z);
TileEntityCraneConsole tile = (TileEntityCraneConsole) world.getTileEntity(pos[0], pos[1], pos[2]);
tile.cycleCraneRotation();
tile.markDirty();
return true;
}
return false;
}
}

View File

@ -2,6 +2,7 @@ package com.hbm.crafting;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.BlockEnums.EnumStoneType;
import com.hbm.inventory.material.MaterialShapes;
import com.hbm.items.ItemEnums.EnumCokeType;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemRTGPelletDepleted.DepletedRTGMaterial;
@ -106,31 +107,31 @@ public class MineralRecipes {
addBillet(ModItems.billet_cobalt, ModItems.ingot_cobalt, ModItems.nugget_cobalt);
addBillet(ModItems.billet_co60, ModItems.ingot_co60, ModItems.nugget_co60);
addBillet(ModItems.billet_sr90, ModItems.ingot_sr90, ModItems.nugget_sr90, SR90.allNuggets());
addBillet(ModItems.billet_uranium, ModItems.ingot_uranium, ModItems.nugget_uranium, U.allNuggets());
addBillet(ModItems.billet_u233, ModItems.ingot_u233, ModItems.nugget_u233, U233.allNuggets());
addBillet(ModItems.billet_u235, ModItems.ingot_u235, ModItems.nugget_u235, U235.allNuggets());
addBillet(ModItems.billet_u238, ModItems.ingot_u238, ModItems.nugget_u238, U238.allNuggets());
addBillet(ModItems.billet_th232, ModItems.ingot_th232, ModItems.nugget_th232, TH232.allNuggets());
addBillet(ModItems.billet_plutonium, ModItems.ingot_plutonium, ModItems.nugget_plutonium, PU.allNuggets());
addBillet(ModItems.billet_pu238, ModItems.ingot_pu238, ModItems.nugget_pu238, PU238.allNuggets());
addBillet(ModItems.billet_pu239, ModItems.ingot_pu239, ModItems.nugget_pu239, PU239.allNuggets());
addBillet(ModItems.billet_pu240, ModItems.ingot_pu240, ModItems.nugget_pu240, PU240.allNuggets());
addBillet(ModItems.billet_pu241, ModItems.ingot_pu241, ModItems.nugget_pu241, PU241.allNuggets());
addBillet(ModItems.billet_sr90, ModItems.ingot_sr90, ModItems.nugget_sr90, SR90.all(MaterialShapes.NUGGET));
addBillet(ModItems.billet_uranium, ModItems.ingot_uranium, ModItems.nugget_uranium, U.all(MaterialShapes.NUGGET));
addBillet(ModItems.billet_u233, ModItems.ingot_u233, ModItems.nugget_u233, U233.all(MaterialShapes.NUGGET));
addBillet(ModItems.billet_u235, ModItems.ingot_u235, ModItems.nugget_u235, U235.all(MaterialShapes.NUGGET));
addBillet(ModItems.billet_u238, ModItems.ingot_u238, ModItems.nugget_u238, U238.all(MaterialShapes.NUGGET));
addBillet(ModItems.billet_th232, ModItems.ingot_th232, ModItems.nugget_th232, TH232.all(MaterialShapes.NUGGET));
addBillet(ModItems.billet_plutonium, ModItems.ingot_plutonium, ModItems.nugget_plutonium, PU.all(MaterialShapes.NUGGET));
addBillet(ModItems.billet_pu238, ModItems.ingot_pu238, ModItems.nugget_pu238, PU238.all(MaterialShapes.NUGGET));
addBillet(ModItems.billet_pu239, ModItems.ingot_pu239, ModItems.nugget_pu239, PU239.all(MaterialShapes.NUGGET));
addBillet(ModItems.billet_pu240, ModItems.ingot_pu240, ModItems.nugget_pu240, PU240.all(MaterialShapes.NUGGET));
addBillet(ModItems.billet_pu241, ModItems.ingot_pu241, ModItems.nugget_pu241, PU241.all(MaterialShapes.NUGGET));
addBillet(ModItems.billet_pu_mix, ModItems.ingot_pu_mix, ModItems.nugget_pu_mix);
addBillet(ModItems.billet_am241, ModItems.ingot_am241, ModItems.nugget_am241, AM241.allNuggets());
addBillet(ModItems.billet_am242, ModItems.ingot_am242, ModItems.nugget_am242, AM242.allNuggets());
addBillet(ModItems.billet_am241, ModItems.ingot_am241, ModItems.nugget_am241, AM241.all(MaterialShapes.NUGGET));
addBillet(ModItems.billet_am242, ModItems.ingot_am242, ModItems.nugget_am242, AM242.all(MaterialShapes.NUGGET));
addBillet(ModItems.billet_am_mix, ModItems.ingot_am_mix, ModItems.nugget_am_mix);
addBillet(ModItems.billet_neptunium, ModItems.ingot_neptunium, ModItems.nugget_neptunium, NP237.allNuggets());
addBillet(ModItems.billet_polonium, ModItems.ingot_polonium, ModItems.nugget_polonium, PO210.allNuggets());
addBillet(ModItems.billet_technetium, ModItems.ingot_technetium, ModItems.nugget_technetium, TC99.allNuggets());
addBillet(ModItems.billet_au198, ModItems.ingot_au198, ModItems.nugget_au198, AU198.allNuggets());
addBillet(ModItems.billet_pb209, ModItems.ingot_pb209, ModItems.nugget_pb209, PB209.allNuggets()); //and so forth
addBillet(ModItems.billet_ra226, ModItems.ingot_ra226, ModItems.nugget_ra226, RA226.allNuggets());
addBillet(ModItems.billet_actinium, ModItems.ingot_actinium, ModItems.nugget_actinium, AC227.allNuggets());
addBillet(ModItems.billet_neptunium, ModItems.ingot_neptunium, ModItems.nugget_neptunium, NP237.all(MaterialShapes.NUGGET));
addBillet(ModItems.billet_polonium, ModItems.ingot_polonium, ModItems.nugget_polonium, PO210.all(MaterialShapes.NUGGET));
addBillet(ModItems.billet_technetium, ModItems.ingot_technetium, ModItems.nugget_technetium, TC99.all(MaterialShapes.NUGGET));
addBillet(ModItems.billet_au198, ModItems.ingot_au198, ModItems.nugget_au198, AU198.all(MaterialShapes.NUGGET));
addBillet(ModItems.billet_pb209, ModItems.ingot_pb209, ModItems.nugget_pb209, PB209.all(MaterialShapes.NUGGET)); //and so forth
addBillet(ModItems.billet_ra226, ModItems.ingot_ra226, ModItems.nugget_ra226, RA226.all(MaterialShapes.NUGGET));
addBillet(ModItems.billet_actinium, ModItems.ingot_actinium, ModItems.nugget_actinium, AC227.all(MaterialShapes.NUGGET));
addBillet(ModItems.billet_schrabidium, ModItems.ingot_schrabidium, ModItems.nugget_schrabidium, SA326.nugget());
addBillet(ModItems.billet_solinium, ModItems.ingot_solinium, ModItems.nugget_solinium, SA327.nugget());
addBillet(ModItems.billet_gh336, ModItems.ingot_gh336, ModItems.nugget_gh336, GH336.allNuggets());
addBillet(ModItems.billet_gh336, ModItems.ingot_gh336, ModItems.nugget_gh336, GH336.all(MaterialShapes.NUGGET));
addBillet(ModItems.billet_uranium_fuel, ModItems.ingot_uranium_fuel, ModItems.nugget_uranium_fuel);
addBillet(ModItems.billet_thorium_fuel, ModItems.ingot_thorium_fuel, ModItems.nugget_thorium_fuel);
addBillet(ModItems.billet_plutonium_fuel, ModItems.ingot_plutonium_fuel, ModItems.nugget_plutonium_fuel);

View File

@ -4,6 +4,7 @@ import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.OreDictManager;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.material.Mats;
import static com.hbm.inventory.OreDictManager.*;
@ -12,6 +13,7 @@ import com.hbm.items.food.ItemConserve.EnumFoodType;
import com.hbm.items.machine.ItemCircuit.EnumCircuitType;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.GunB92Cell;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.main.CraftingManager;
import net.minecraft.init.Blocks;
@ -26,6 +28,29 @@ import net.minecraft.item.ItemStack;
public class WeaponRecipes {
public static void register() {
//SEDNA Parts
CraftingManager.addRecipeAuto(new ItemStack(ModItems.part_stock, 1, Mats.MAT_WOOD.id), new Object[] { "WWW", " W", 'W', KEY_PLANKS });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.part_grip, 1, Mats.MAT_WOOD.id), new Object[] { "W ", " W", " W", 'W', KEY_PLANKS });
//SEDNA Guns
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_pepperbox, 1), new Object[] { "IIW", " C", 'I', IRON.ingot(), 'W', KEY_PLANKS, 'C', CU.ingot() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_light_revolver, 1), new Object[] { "BRM", " G", 'B', STEEL.lightBarrel(), 'R', STEEL.lightReceiver(), 'M', GUNMETAL.mechanism(), 'G', WOOD.grip() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_henry, 1), new Object[] { "BRP", "BMS", 'B', STEEL.lightBarrel(), 'R', GUNMETAL.lightReceiver(), 'M', GUNMETAL.mechanism(), 'S', WOOD.stock(), 'P', GUNMETAL.plate() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_greasegun, 1), new Object[] { "BRS", "SMG", 'B', STEEL.lightBarrel(), 'R', STEEL.lightReceiver(), 'S', STEEL.bolt(), 'M', GUNMETAL.mechanism(), 'G', STEEL.grip() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_maresleg, 1), new Object[] { "BRM", "BGS", 'B', STEEL.lightBarrel(), 'R', STEEL.lightReceiver(), 'M', GUNMETAL.mechanism(), 'G', STEEL.bolt(), 'S', WOOD.stock() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_flaregun, 1), new Object[] { "BRM", " G", 'B', STEEL.heavyBarrel(), 'R', STEEL.lightReceiver(), 'M', GUNMETAL.mechanism(), 'G', STEEL.grip() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_heavy_revolver, 1), new Object[] { "BRM", " G", 'B', DURA.lightBarrel(), 'R', DURA.lightReceiver(), 'M', GUNMETAL.mechanism(), 'G', WOOD.grip() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_carbine, 1), new Object[] { "BRM", "G S", 'B', DURA.lightBarrel(), 'R', DURA.lightReceiver(), 'M', GUNMETAL.mechanism(), 'G', WOOD.grip(), 'S', WOOD.stock() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_am180, 1), new Object[] { "BBR", "GMS", 'B', DURA.lightBarrel(), 'R', DURA.lightReceiver(), 'M', GUNMETAL.mechanism(), 'G', WOOD.grip(), 'S', WOOD.stock() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_liberator, 1), new Object[] { "BB ", "BBM", "G G", 'B', DURA.lightBarrel(), 'M', GUNMETAL.mechanism(), 'G', WOOD.grip() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_congolake, 1), new Object[] { "BM ", "BRS", "G ", 'B', DURA.heavyBarrel(), 'M', GUNMETAL.mechanism(), 'R', DURA.lightReceiver(), 'S', WOOD.stock(), 'G', WOOD.grip() });
//SEDNA Ammo
CraftingManager.addRecipeAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.STONE, 6), new Object[] { "C", "P", "G", 'C', KEY_COBBLESTONE, 'P', Items.paper, 'G', Items.gunpowder });
CraftingManager.addRecipeAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.STONE_AP, 6), new Object[] { "C", "P", "G", 'C', Items.flint, 'P', Items.paper, 'G', Items.gunpowder });
CraftingManager.addRecipeAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.STONE_SHOT, 6), new Object[] { "C", "P", "G", 'C', Blocks.gravel, 'P', Items.paper, 'G', Items.gunpowder });
CraftingManager.addRecipeAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.STONE_IRON, 6), new Object[] { "C", "P", "G", 'C', IRON.ingot(), 'P', Items.paper, 'G', Items.gunpowder });
//Missiles
CraftingManager.addShapelessAuto(new ItemStack(ModItems.missile_taint, 1), new Object[] { ModItems.missile_assembly, ModItems.bucket_mud, ModItems.powder_spark_mix, ModItems.powder_magic });
@ -75,7 +100,6 @@ public class WeaponRecipes {
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_karl, 1), new Object[] { "SSW", " MW", 'S', STEEL.shell(), 'W', ALLOY.plate(), 'M', ModItems.mechanism_launcher_2 });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_quadro, 1), new Object[] { "SSS", "SSS", "CM ", 'S', STEEL.pipe(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BASIC), 'M', ModItems.mechanism_launcher_2 });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_hk69, 1), new Object[] { "SSI", " MB", 'S', STEEL.shell(), 'I', IRON.ingot(), 'M', ModItems.mechanism_launcher_1, 'B', STEEL.bolt() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_congolake, 1), new Object[] { "HHR", "WLW", 'H', AL.shell(), 'R', ModItems.mechanism_rifle_1, 'W', KEY_LOG, 'L', ModItems.mechanism_launcher_1 });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_stinger, 1), new Object[] { "SSW", "CMW", 'S', STEEL.plate(), 'W', TI.plate(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'M', ModItems.mechanism_launcher_2 });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_revolver, 1), new Object[] { "SSM", " RW", 'S', STEEL.plate(), 'W', KEY_PLANKS, 'R', AL.wireFine(), 'M', ModItems.mechanism_revolver_1 });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_revolver_saturnite, 1), new Object[] { "SSM", " RW", 'S', BIGMT.plate(), 'W', KEY_PLANKS, 'R', W.wireFine(), 'M', ModItems.mechanism_revolver_2 });

View File

@ -0,0 +1,41 @@
package com.hbm.crafting.handlers;
import com.hbm.blocks.generic.BlockStorageCrate;
import com.hbm.blocks.machine.BlockMassStorage;
import net.minecraft.block.Block;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.ShapedOreRecipe;
/**
* Handles upgrading storage crates and mass storage blocks, preserving their contents.
*
* Note: this assumes the input and the output items store their inventory in the same format
* in the NBT
*/
public class ContainerUpgradeCraftingHandler extends ShapedOreRecipe {
public ContainerUpgradeCraftingHandler(ItemStack result, Object... items) {
super(result, items);
}
@Override
public ItemStack getCraftingResult(InventoryCrafting inventoryCrafting) {
ItemStack source = getFirstContainer(inventoryCrafting);
ItemStack result = super.getCraftingResult(inventoryCrafting);
result.setTagCompound(source.getTagCompound());
return result;
}
private static ItemStack getFirstContainer(InventoryCrafting inventoryCrafting) {
for(int i = 0; i < 9; ++i) {
ItemStack itemstack = inventoryCrafting.getStackInRowAndColumn(i % 3, i / 3);
if(itemstack == null) continue;
Block block = Block.getBlockFromItem(itemstack.getItem());
if(block == null) continue;
if(block instanceof BlockStorageCrate || block instanceof BlockMassStorage) return itemstack;
}
return null;
}
}

View File

@ -8,18 +8,16 @@ import net.minecraft.item.Item;
public class WeaponTab extends CreativeTabs {
public WeaponTab(int p_i1853_1_, String p_i1853_2_) {
super(p_i1853_1_, p_i1853_2_);
public WeaponTab(int index, String name) {
super(index, name);
}
@Override
public Item getTabIconItem() {
if(ModItems.gun_lever_action != null)
{
return ModItems.gun_lever_action;
if(ModItems.gun_maresleg != null) {
return ModItems.gun_maresleg;
}
return Items.iron_pickaxe;
}
}

View File

@ -1,16 +1,28 @@
package com.hbm.entity.projectile;
import com.hbm.items.weapon.sedna.BulletConfig;
import com.hbm.util.BobMathUtil;
import com.hbm.util.EntityDamageUtil;
import com.hbm.util.TrackerUtil;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.util.ForgeDirection;
public class EntityBulletBaseMK4 extends EntityThrowableInterp {
public BulletConfig config;
//used for rendering tracers
public double velocity;
public double prevVelocity;
public float damage;
public int ricochets = 0;
public EntityBulletBaseMK4(World world) {
super(world);
@ -18,11 +30,13 @@ public class EntityBulletBaseMK4 extends EntityThrowableInterp {
this.setSize(0.5F, 0.5F);
}
public EntityBulletBaseMK4(EntityLivingBase entity, BulletConfig config, float baseDamage, float spreadMod, double sideOffset, double heightOffset, double frontOffset) {
public EntityBulletBaseMK4(EntityLivingBase entity, BulletConfig config, float baseDamage, float gunSpread, double sideOffset, double heightOffset, double frontOffset) {
this(entity.worldObj);
this.thrower = entity;
this.config = config;
this.setBulletConfig(config);
this.damage = baseDamage * this.config.damageMult;
this.setLocationAndAngles(thrower.posX, thrower.posY + thrower.getEyeHeight(), thrower.posZ, thrower.rotationYaw, thrower.rotationPitch);
@ -40,7 +54,7 @@ public class EntityBulletBaseMK4 extends EntityThrowableInterp {
this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
this.motionY = (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI));
this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, 1.0F, this.config.spread * spreadMod);
this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, 1.0F, this.config.spread + gunSpread);
}
@Override
@ -50,6 +64,7 @@ public class EntityBulletBaseMK4 extends EntityThrowableInterp {
}
public void setBulletConfig(BulletConfig config) {
this.config = config;
this.dataWatcher.updateObject(3, config.id);
}
@ -69,16 +84,115 @@ public class EntityBulletBaseMK4 extends EntityThrowableInterp {
return;
}
this.prevPosX = posX;
this.prevPosY = posY;
this.prevPosZ = posZ;
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
super.onUpdate();
double dX = this.posX - this.prevPosX;
double dY = this.posY - this.prevPosY;
double dZ = this.posZ - this.prevPosZ;
this.prevVelocity = this.velocity;
this.velocity = Math.sqrt(dX * dX + dY * dY + dZ * dZ);
if(!this.onGround && velocity > 0) {
float hyp = MathHelper.sqrt_double(dX * dX + dZ * dZ);
this.rotationYaw = (float) (Math.atan2(dX, dZ) * 180.0D / Math.PI);
for(this.rotationPitch = (float) (Math.atan2(dY, (double) hyp) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F);
while(this.rotationPitch - this.prevRotationPitch >= 180.0F) this.prevRotationPitch += 360.0F;
while(this.rotationYaw - this.prevRotationYaw < -180.0F) this.prevRotationYaw -= 360.0F;
while(this.rotationYaw - this.prevRotationYaw >= 180.0F) this.prevRotationYaw += 360.0F;
}
if(!worldObj.isRemote && this.ticksExisted > config.expires) this.setDead();
if(this.config.onUpdate != null) this.config.onUpdate.accept(this);
}
@Override
public void setDead() {
super.setDead();
//send a teleport on collision so that the bullets are forced to move even if their lifetime is only 1 tick, letting them render
if(worldObj instanceof WorldServer) TrackerUtil.sendTeleport((WorldServer) worldObj, this);
}
@Override
protected void onImpact(MovingObjectPosition mop) {
this.setDead();
if(!worldObj.isRemote) {
if(this.config.onImpact != null) this.config.onImpact.accept(this, mop);
if(this.isDead) return;
if(mop.typeOfHit == mop.typeOfHit.BLOCK) {
ForgeDirection dir = ForgeDirection.getOrientation(mop.sideHit);
Vec3 face = Vec3.createVectorHelper(dir.offsetX, dir.offsetY, dir.offsetZ);
Vec3 vel = Vec3.createVectorHelper(motionX, motionY, motionZ).normalize();
double angle = Math.abs(BobMathUtil.getCrossAngle(vel, face) - 90);
if(angle <= config.ricochetAngle) {
this.ricochets++;
if(this.ricochets > this.config.maxRicochetCount) {
this.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
this.setDead();
}
switch(mop.sideHit) {
case 0: case 1: motionY *= -1; break;
case 2: case 3: motionZ *= -1; break;
case 4: case 5: motionX *= -1; break;
}
worldObj.playSoundAtEntity(this, "hbm:weapon.ricochet", 0.25F, 1.0F);
this.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
//send a teleport so the ricochet is more accurate instead of the interp smoothing fucking everything up
if(worldObj instanceof WorldServer) TrackerUtil.sendTeleport((WorldServer) worldObj, this);
return;
} else {
this.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
this.setDead();
}
}
if(mop.typeOfHit == mop.typeOfHit.ENTITY) {
Entity entity = mop.entityHit;
if(!entity.isEntityAlive()) return;
DamageSource damageCalc = this.config.getDamage(this, getThrower(), false);
if(!(entity instanceof EntityLivingBase)) {
entity.attackEntityFrom(damageCalc, this.damage);
return;
}
EntityLivingBase living = (EntityLivingBase) entity;
float prevHealth = living.getHealth();
if(this.config.armorPiercingPercent == 0) {
EntityDamageUtil.attackEntityFromIgnoreIFrame(entity, damageCalc, this.damage);
} else {
DamageSource damagePiercing = this.config.getDamage(this, getThrower(), true);
EntityDamageUtil.attackArmorPiercing(living, damageCalc, damagePiercing, this.damage, this.config.armorPiercingPercent);
}
float newHealth = living.getHealth();
if(this.config.damageFalloffByPen) this.damage -= Math.max(prevHealth - newHealth, 0);
if(!this.doesPenetrate() || this.damage < 0) {
this.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
this.setDead();
}
}
}
}
@Override protected double headingForceMult() { return 1D; }
@ -86,4 +200,9 @@ public class EntityBulletBaseMK4 extends EntityThrowableInterp {
@Override protected double motionMult() { return this.config.velocity; }
@Override protected float getAirDrag() { return 1F; }
@Override protected float getWaterDrag() { return 1F; }
@Override public boolean doesImpactEntities() { return this.config.impactsEntities; }
@Override public boolean doesPenetrate() { return this.config.doesPenetrate; }
@Override public boolean isSpectral() { return this.config.isSpectral; }
@Override public int selfDamageDelay() { return this.config.selfDamageDelay; }
}

View File

@ -235,21 +235,11 @@ public abstract class EntityThrowableNT extends Entity implements IProjectile {
float hyp = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
for(this.rotationPitch = (float) (Math.atan2(this.motionY, (double) hyp) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) {
;
}
for(this.rotationPitch = (float) (Math.atan2(this.motionY, (double) hyp) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F);
while(this.rotationPitch - this.prevRotationPitch >= 180.0F) {
this.prevRotationPitch += 360.0F;
}
while(this.rotationYaw - this.prevRotationYaw < -180.0F) {
this.prevRotationYaw -= 360.0F;
}
while(this.rotationYaw - this.prevRotationYaw >= 180.0F) {
this.prevRotationYaw += 360.0F;
}
while(this.rotationPitch - this.prevRotationPitch >= 180.0F) this.prevRotationPitch += 360.0F;
while(this.rotationYaw - this.prevRotationYaw < -180.0F) this.prevRotationYaw -= 360.0F;
while(this.rotationYaw - this.prevRotationYaw >= 180.0F) this.prevRotationYaw += 360.0F;
this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;

View File

@ -21,6 +21,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.ChunkPosition;
@ -156,7 +157,7 @@ public class ExplosionNT extends Explosion {
currentZ /= d9;
double d10 = (double) this.worldObj.getBlockDensity(vec3, entity.boundingBox);
double d11 = (1.0D - d4) * d10;
entity.attackEntityFrom(DamageSource.setExplosionSource(this), (float) ((int) ((d11 * d11 + d11) / 2.0D * 8.0D * (double) this.explosionSize + 1.0D)));
entity.attackEntityFrom(setExplosionSource(this), (float) ((int) ((d11 * d11 + d11) / 2.0D * 8.0D * (double) this.explosionSize + 1.0D)));
double d8 = EnchantmentProtection.func_92092_a(entity, d11);
entity.motionX += currentX * d8;
entity.motionY += currentY * d8;
@ -173,6 +174,12 @@ public class ExplosionNT extends Explosion {
}
}
public static DamageSource setExplosionSource(Explosion explosion) {
return explosion != null && explosion.getExplosivePlacedBy() != null ?
(new EntityDamageSource("explosion.player", explosion.getExplosivePlacedBy())).setExplosion() :
(new DamageSource("explosion")).setExplosion();
}
public void doExplosionB(boolean p_77279_1_) {
if(!has(ExAttrib.NOSOUND))

View File

@ -106,14 +106,14 @@ public class ExplosionTom {
while(y > threshold) {
if(y == 0)
break;
if(y == 0) break;
if(y <= craterFloor) {
if(worldObj.rand.nextInt(499) < 1) {
worldObj.setBlock(pX, y, pZ, ModBlocks.ore_tektite_osmiridium);
worldObj.setBlock(pX, y, pZ, ModBlocks.ore_tektite_osmiridium, 0, 2);
} else {
worldObj.setBlock(pX, y, pZ, ModBlocks.tektite);
worldObj.setBlock(pX, y, pZ, ModBlocks.tektite, 0, 2);
}
} else {
@ -130,7 +130,7 @@ public class ExplosionTom {
}
}
}
worldObj.setBlockToAir(pX, y, pZ);
worldObj.setBlock(pX, y, pZ, Blocks.air, 0, 2);
}
} else {
for(int i = -2; i < 3; i++) {

View File

@ -13,7 +13,9 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSource;
import net.minecraft.util.Vec3;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.event.ForgeEventFactory;
@ -86,8 +88,8 @@ public class EntityProcessorCross implements IEntityProcessor {
}
double knockback = (1.0D - distanceScaled) * density;
entity.attackEntityFrom(DamageSource.setExplosionSource(explosion.compat), (float) ((int) ((knockback * knockback + knockback) / 2.0D * 8.0D * size + 1.0D)));
entity.attackEntityFrom(setExplosionSource(explosion.compat), calculateDamage(distanceScaled, density, knockback, size));
double enchKnockback = EnchantmentProtection.func_92092_a(entity, knockback);
entity.motionX += deltaX * enchKnockback;
@ -108,6 +110,16 @@ public class EntityProcessorCross implements IEntityProcessor {
return affectedPlayers;
}
public float calculateDamage(double distanceScaled, double density, double knockback, float size) {
return (float) ((int) ((knockback * knockback + knockback) / 2.0D * 8.0D * size + 1.0D));
}
public static DamageSource setExplosionSource(Explosion explosion) {
return explosion != null && explosion.getExplosivePlacedBy() != null ?
(new EntityDamageSource("explosion.player", explosion.getExplosivePlacedBy())).setExplosion() :
(new DamageSource("explosion")).setExplosion();
}
public EntityProcessorCross withRangeMod(float mod) {
range = new IEntityRangeMutator() {
@Override

View File

@ -0,0 +1,15 @@
package com.hbm.explosion.vanillant.standard;
public class EntityProcessorCrossSmooth extends EntityProcessorCross {
protected float fixedDamage;
public EntityProcessorCrossSmooth(double nodeDist, float fixedDamage) {
super(nodeDist);
this.fixedDamage = fixedDamage;
}
public float calculateDamage(double distanceScaled, double density, double knockback, float size) {
return (float) (fixedDamage * (1 - distanceScaled));
}
}

View File

@ -13,7 +13,9 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSource;
import net.minecraft.util.Vec3;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraftforge.event.ForgeEventFactory;
@ -67,7 +69,7 @@ public class EntityProcessorStandard implements IEntityProcessor {
double density = world.getBlockDensity(vec3, entity.boundingBox);
double knockback = (1.0D - distanceScaled) * density;
entity.attackEntityFrom(DamageSource.setExplosionSource(explosion.compat), (float) ((int) ((knockback * knockback + knockback) / 2.0D * 8.0D * size + 1.0D)));
entity.attackEntityFrom(setExplosionSource(explosion.compat), calculateDamage(distanceScaled, density, knockback, size));
double enchKnockback = EnchantmentProtection.func_92092_a(entity, knockback);
entity.motionX += deltaX * enchKnockback;
@ -88,6 +90,16 @@ public class EntityProcessorStandard implements IEntityProcessor {
return affectedPlayers;
}
public float calculateDamage(double distanceScaled, double density, double knockback, float size) {
return (float) ((int) ((knockback * knockback + knockback) / 2.0D * 8.0D * size + 1.0D));
}
public static DamageSource setExplosionSource(Explosion explosion) {
return explosion != null && explosion.getExplosivePlacedBy() != null ?
(new EntityDamageSource("explosion.player", explosion.getExplosivePlacedBy())).setExplosion() :
(new DamageSource("explosion")).setExplosion();
}
public EntityProcessorStandard withRangeMod(float mod) {
range = new IEntityRangeMutator() {
@Override

View File

@ -30,9 +30,9 @@ public class CasingEjector implements Cloneable {
private static int nextId = 0;
private Vec3 posOffset = Vec3.createVectorHelper(0, 0, 0);
private Vec3 initialMotion = Vec3.createVectorHelper(0, 0, 0);
private int casingAmount = 1;
private boolean afterReload = false;
private int delay = 0;
@Deprecated private int casingAmount = 1;
@Deprecated private boolean afterReload = false;
@Deprecated private int delay = 0;
private float randomYaw = 0F;
private float randomPitch = 0F;
@ -61,17 +61,17 @@ public class CasingEjector implements Cloneable {
return this;
}
public CasingEjector setAmount(int am) {
@Deprecated public CasingEjector setAmount(int am) {
this.casingAmount = am;
return this;
}
public CasingEjector setAfterReload() {
@Deprecated public CasingEjector setAfterReload() {
this.afterReload = true;
return this;
}
public CasingEjector setDelay(int delay) {
@Deprecated public CasingEjector setDelay(int delay) {
this.delay = delay;
return this;
}
@ -94,7 +94,7 @@ public class CasingEjector implements Cloneable {
@SideOnly(Side.CLIENT)
public void spawnCasing(TextureManager textureManager, SpentCasing config, World world, double x, double y, double z, float pitch, float yaw, boolean crouched) {
Vec3 rotatedMotionVec = rotateVector(getMotion(), pitch + (float) rand.nextGaussian() * getPitchFactor(), yaw + (float) rand.nextGaussian() * getPitchFactor(), getPitchFactor(), getPitchFactor());
ParticleSpentCasing casing = new ParticleSpentCasing(textureManager, world, x, y, z, rotatedMotionVec.xCoord, rotatedMotionVec.yCoord, rotatedMotionVec.zCoord, (float) (getPitchFactor() * rand.nextGaussian()), (float) (getYawFactor() * rand.nextGaussian()), config);
ParticleSpentCasing casing = new ParticleSpentCasing(textureManager, world, x, y, z, rotatedMotionVec.xCoord, rotatedMotionVec.yCoord, rotatedMotionVec.zCoord, (float) (getPitchFactor() * rand.nextGaussian()), (float) (getYawFactor() * rand.nextGaussian()), config, false, 0, 0, 0);
offsetCasing(casing, getOffset(), pitch, yaw, crouched);

View File

@ -70,13 +70,13 @@ public class Gun12GaugeFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL_TRANSLATE", new BusAnimationSequence()
.addKeyframePosition(0, 0, -2, 100)
.addKeyframePosition(0, 0, 0, 200)
.addPos(0, 0, -2, 100)
.addPos(0, 0, 0, 200)
)
.addBus("PUMP", new BusAnimationSequence()
.addKeyframePosition(0, 0, 0, 450)
.addKeyframePosition(0, 0, -1.8, 200)
.addKeyframePosition(0, 0, 0, 200)
.addPos(0, 0, 0, 450)
.addPos(0, 0, -1.8, 200)
.addPos(0, 0, 0, 200)
)
);

View File

@ -49,16 +49,16 @@ public class Gun20GaugeFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("LEVER_ROTATE", new BusAnimationSequence()
.addKeyframePosition(0, 0, 0, 250)
.addKeyframePosition(0, 0, 45, 500)
.addKeyframePosition(0, 0, 0, 500)
.addPos(0, 0, 0, 250)
.addPos(0, 0, 45, 500)
.addPos(0, 0, 0, 500)
)
.addBus("LEVER_RECOIL", new BusAnimationSequence()
.addKeyframePosition(0.5, 0, 0, 50)
.addKeyframePosition(0, 0, 0, 50)
.addKeyframePosition(0, 0, 0, 150)
.addKeyframePosition(0, -0.5, 0, 500)
.addKeyframePosition(0, 0, 0, 500)
.addPos(0.5, 0, 0, 50)
.addPos(0, 0, 0, 50)
.addPos(0, 0, 0, 150)
.addPos(0, -0.5, 0, 500)
.addPos(0, 0, 0, 500)
)
);

View File

@ -80,12 +80,12 @@ public class Gun45ACPFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("SLIDE", new BusAnimationSequence()
.addKeyframePosition(0, 0, 0, 10)// Wait for hammer
.addKeyframePosition(0, 0, -3.5, 40)// Slide back
.addKeyframePosition(0, 0, 0, 40))// Return
.addPos(0, 0, 0, 10)// Wait for hammer
.addPos(0, 0, -3.5, 40)// Slide back
.addPos(0, 0, 0, 40))// Return
.addBus("HAMMER", new BusAnimationSequence()
.addKeyframePosition(15, 0, 0, 10)
.addKeyframePosition(0, 0, 0, 40)));
.addPos(15, 0, 0, 10)
.addPos(0, 0, 0, 40)));
return config;
}

View File

@ -123,25 +123,25 @@ public class Gun4GaugeFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("SAUER_RECOIL", new BusAnimationSequence()
.addKeyframePosition(0.5, 0, 0, 50)
.addKeyframePosition(0, 0, 0, 50)
.addPos(0.5, 0, 0, 50)
.addPos(0, 0, 0, 50)
)
.addBus("SAUER_TILT", new BusAnimationSequence()
.addKeyframePosition(0.0, 0, 0, 200) // do nothing for 200ms
.addKeyframePosition(0, 0, 30, 150) //tilt forward
.addKeyframePosition(45, 0, 30, 150) //tilt sideways
.addKeyframePosition(45, 0, 30, 200) //do nothing for 200ms (eject)
.addKeyframePosition(0, 0, 30, 150) //restore sideways
.addKeyframePosition(0, 0, 0, 150) //restore forward
.addPos(0.0, 0, 0, 200) // do nothing for 200ms
.addPos(0, 0, 30, 150) //tilt forward
.addPos(45, 0, 30, 150) //tilt sideways
.addPos(45, 0, 30, 200) //do nothing for 200ms (eject)
.addPos(0, 0, 30, 150) //restore sideways
.addPos(0, 0, 0, 150) //restore forward
)
.addBus("SAUER_COCK", new BusAnimationSequence()
.addKeyframePosition(0, 0, 0, 500) //do nothing for 500ms
.addKeyframePosition(1, 0, 0, 100) //pull back lever for 100ms
.addKeyframePosition(0, 0, 0, 100) //release lever for 100ms
.addPos(0, 0, 0, 500) //do nothing for 500ms
.addPos(1, 0, 0, 100) //pull back lever for 100ms
.addPos(0, 0, 0, 100) //release lever for 100ms
)
.addBus("SAUER_SHELL_EJECT", new BusAnimationSequence()
.addKeyframePosition(0, 0, 0, 500) //do nothing for 500ms
.addKeyframePosition(0, 0, 1, 500) //FLING!
.addPos(0, 0, 0, 500) //do nothing for 500ms
.addPos(0, 0, 1, 500) //FLING!
)
);

View File

@ -137,20 +137,20 @@ public class Gun50BMGFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframePosition(1, 0, 0, 25)
.addKeyframePosition(0, 0, 0, 75)
.addPos(1, 0, 0, 25)
.addPos(0, 0, 0, 75)
)
);
config.animations.put(AnimType.RELOAD, new BusAnimation()
.addBus("TILT", new BusAnimationSequence()
.addKeyframePosition(1, 0, 0, 125)
.addKeyframePosition(1, 0, 0, 750)
.addKeyframePosition(0, 0, 0, 125)
.addPos(1, 0, 0, 125)
.addPos(1, 0, 0, 750)
.addPos(0, 0, 0, 125)
)
.addBus("MAG", new BusAnimationSequence()
.addKeyframePosition(0, 0, 1, 200)
.addKeyframePosition(1, 0, 1, 200)
.addKeyframePosition(0, 0, 0, 200)
.addPos(0, 0, 1, 200)
.addPos(1, 0, 1, 200)
.addPos(0, 0, 0, 200)
)
);
@ -190,8 +190,8 @@ public class Gun50BMGFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframePosition(1, 0, 0, 25)
.addKeyframePosition(0, 0, 0, 75)
.addPos(1, 0, 0, 25)
.addPos(0, 0, 0, 75)
)
);
@ -237,10 +237,10 @@ public class Gun50BMGFactory {
config.animations.put(AnimType.CYCLE,
new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframePosition(-0.45, 0.15, 0, 40) // Moves back and raise slightly
.addKeyframePosition(0, 0, 0, 75)) // Then forward again
.addBus("EJECT", new BusAnimationSequence().addKeyframePosition(0, 0, 0, 30) // Wait
.addKeyframePosition(50, 0, 0, 120))); // Fly // out
.addPos(-0.45, 0.15, 0, 40) // Moves back and raise slightly
.addPos(0, 0, 0, 75)) // Then forward again
.addBus("EJECT", new BusAnimationSequence().addPos(0, 0, 0, 30) // Wait
.addPos(50, 0, 0, 120))); // Fly // out
config.ejector = EJECTOR_SNIPER;
return config;

View File

@ -92,8 +92,8 @@ public class Gun556mmFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframePosition(0.5, 0, 0, 25)
.addKeyframePosition(0, 0, 0, 75)
.addPos(0.5, 0, 0, 25)
.addPos(0, 0, 0, 75)
)
);

View File

@ -47,25 +47,25 @@ public class Gun75BoltFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframePosition(1, 0, 0, 25)
.addKeyframePosition(0, 0, 0, 75)
.addPos(1, 0, 0, 25)
.addPos(0, 0, 0, 75)
)
.addBus("EJECT", new BusAnimationSequence()
.addKeyframePosition(0, 0, 0, 25)
.addKeyframePosition(0, 0, 1, 75)
.addPos(0, 0, 0, 25)
.addPos(0, 0, 1, 75)
)
);
config.animations.put(AnimType.RELOAD, new BusAnimation()
.addBus("TILT", new BusAnimationSequence()
.addKeyframePosition(1, 0, 0, 250)
.addKeyframePosition(1, 0, 0, 1500)
.addKeyframePosition(0, 0, 0, 250)
.addPos(1, 0, 0, 250)
.addPos(1, 0, 0, 1500)
.addPos(0, 0, 0, 250)
)
.addBus("MAG", new BusAnimationSequence()
.addKeyframePosition(0, 0, 1, 500)
.addKeyframePosition(1, 0, 1, 500)
.addKeyframePosition(0, 0, 0, 500)
.addPos(0, 0, 1, 500)
.addPos(1, 0, 1, 500)
.addPos(0, 0, 0, 500)
)
);

View File

@ -57,15 +57,15 @@ public class Gun762mmFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframePosition(1, 0, 0, 25)
.addKeyframePosition(0, 0, 0, 75)
.addPos(1, 0, 0, 25)
.addPos(0, 0, 0, 75)
)
);
config.animations.put(AnimType.RELOAD, new BusAnimation()
.addBus("MAG", new BusAnimationSequence()
.addKeyframePosition(0, -1, 0, 500)
.addKeyframePosition(0, 0, 0, 500)
.addPos(0, -1, 0, 500)
.addPos(0, 0, 0, 500)
)
);
@ -176,19 +176,19 @@ public class Gun762mmFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframePosition(1, 0, 0, 25)
.addKeyframePosition(0, 0, 0, 75)
.addPos(1, 0, 0, 25)
.addPos(0, 0, 0, 75)
)
.addBus("LEVER_PULL", new BusAnimationSequence()
.addKeyframePosition(0, 0, 0, 375) //wait out recoil and lever flick
.addKeyframePosition(-1, 0, 0, 375) //pull back bolt
.addKeyframePosition(0, 0, 0, 375) //release bolt
.addPos(0, 0, 0, 375) //wait out recoil and lever flick
.addPos(-1, 0, 0, 375) //pull back bolt
.addPos(0, 0, 0, 375) //release bolt
)
.addBus("LEVER_ROTATE", new BusAnimationSequence()
.addKeyframePosition(0, 0, 0, 250) //wait out recoil
.addKeyframePosition(1, 0, 0, 125) //flick up lever in 125ms
.addKeyframePosition(1, 0, 0, 750) //pull action
.addKeyframePosition(0, 0, 0, 125) //flick down lever again
.addPos(0, 0, 0, 250) //wait out recoil
.addPos(1, 0, 0, 125) //flick up lever in 125ms
.addPos(1, 0, 0, 750) //pull action
.addPos(0, 0, 0, 125) //flick down lever again
)
);
@ -215,19 +215,19 @@ public class Gun762mmFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframePosition(1, 0, 0, 25)
.addKeyframePosition(0, 0, 0, 75)
.addPos(1, 0, 0, 25)
.addPos(0, 0, 0, 75)
)
.addBus("LEVER_PULL", new BusAnimationSequence()
.addKeyframePosition(0, 0, 0, 375) //wait out recoil and lever flick
.addKeyframePosition(-1, 0, 0, 375) //pull back bolt
.addKeyframePosition(0, 0, 0, 375) //release bolt
.addPos(0, 0, 0, 375) //wait out recoil and lever flick
.addPos(-1, 0, 0, 375) //pull back bolt
.addPos(0, 0, 0, 375) //release bolt
)
.addBus("LEVER_ROTATE", new BusAnimationSequence()
.addKeyframePosition(0, 0, 0, 250) //wait out recoil
.addKeyframePosition(1, 0, 0, 125) //flick up lever in 125ms
.addKeyframePosition(1, 0, 0, 750) //pull action
.addKeyframePosition(0, 0, 0, 125) //flick down lever again
.addPos(0, 0, 0, 250) //wait out recoil
.addPos(1, 0, 0, 125) //flick up lever in 125ms
.addPos(1, 0, 0, 750) //pull action
.addPos(0, 0, 0, 125) //flick down lever again
)
);
@ -258,19 +258,19 @@ public class Gun762mmFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframePosition(1, 0, 0, 25)
.addKeyframePosition(0, 0, 0, 75)
.addPos(1, 0, 0, 25)
.addPos(0, 0, 0, 75)
)
.addBus("LEVER_PULL", new BusAnimationSequence()
.addKeyframePosition(0, 0, 0, 375) //wait out recoil and lever flick
.addKeyframePosition(-1, 0, 0, 375) //pull back bolt
.addKeyframePosition(0, 0, 0, 375) //release bolt
.addPos(0, 0, 0, 375) //wait out recoil and lever flick
.addPos(-1, 0, 0, 375) //pull back bolt
.addPos(0, 0, 0, 375) //release bolt
)
.addBus("LEVER_ROTATE", new BusAnimationSequence()
.addKeyframePosition(0, 0, 0, 250) //wait out recoil
.addKeyframePosition(1, 0, 0, 125) //flick up lever in 125ms
.addKeyframePosition(1, 0, 0, 750) //pull action
.addKeyframePosition(0, 0, 0, 125) //flick down lever again
.addPos(0, 0, 0, 250) //wait out recoil
.addPos(1, 0, 0, 125) //flick up lever in 125ms
.addPos(1, 0, 0, 750) //pull action
.addPos(0, 0, 0, 125) //flick down lever again
)
);

View File

@ -41,8 +41,8 @@ public class GunGaussFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframePosition(1, 0, 0, 25)
.addKeyframePosition(0, 0, 0, 75)
.addPos(1, 0, 0, 25)
.addPos(0, 0, 0, 75)
)
);

View File

@ -82,23 +82,23 @@ public class GunRocketFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("QUADRO_RECOIL", new BusAnimationSequence()
.addKeyframePosition(0, 0, -0.5, 50)
.addKeyframePosition(0, 0, 0, 50)
.addPos(0, 0, -0.5, 50)
.addPos(0, 0, 0, 50)
)
);
config.animations.put(AnimType.RELOAD, new BusAnimation()
.addBus("QUADRO_RELOAD_ROTATE", new BusAnimationSequence()
.addKeyframePosition(0, 0, 60, 750)
.addKeyframePosition(0, 0, 60, 3500)
.addKeyframePosition(0, 0, 0, 750)
.addPos(0, 0, 60, 750)
.addPos(0, 0, 60, 3500)
.addPos(0, 0, 0, 750)
)
.addBus("QUADRO_RELOAD_PUSH", new BusAnimationSequence()
.addKeyframePosition(-1, -1, 0, 0)
.addKeyframePosition(-1, -1, 0, 750)
.addKeyframePosition(-1, 0, 0, 500)
.addKeyframePosition(0, 0, 0, 3000)
.addKeyframePosition(0, 0, 0, 750)
.addPos(-1, -1, 0, 0)
.addPos(-1, -1, 0, 750)
.addPos(-1, 0, 0, 500)
.addPos(0, 0, 0, 3000)
.addPos(0, 0, 0, 750)
)
);

View File

@ -6,7 +6,7 @@ import com.hbm.inventory.recipes.ArcFurnaceRecipes;
public class ArcFurnaceFluidHandler extends NEIUniversalHandler {
public ArcFurnaceFluidHandler() {
super("Arc Furnace (Fluid)", ModBlocks.machine_arc_furnace, ArcFurnaceRecipes.getFluidRecipes());
super(ModBlocks.machine_arc_furnace.getLocalizedName(), ModBlocks.machine_arc_furnace, ArcFurnaceRecipes.getFluidRecipes());
}
@Override

View File

@ -6,7 +6,7 @@ import com.hbm.inventory.recipes.ArcFurnaceRecipes;
public class ArcFurnaceSolidHandler extends NEIUniversalHandler {
public ArcFurnaceSolidHandler() {
super("Arc Furnace (Solid)", ModBlocks.machine_arc_furnace, ArcFurnaceRecipes.getSolidRecipes());
super(ModBlocks.machine_arc_furnace.getLocalizedName(), ModBlocks.machine_arc_furnace, ArcFurnaceRecipes.getSolidRecipes());
}
@Override

View File

@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack;
public class ArcWelderHandler extends NEIUniversalHandler {
public ArcWelderHandler() {
super("Arc Welder", ModBlocks.machine_arc_welder, ArcWelderRecipes.getRecipes());
super(ModBlocks.machine_arc_welder.getLocalizedName(), ModBlocks.machine_arc_welder, ArcWelderRecipes.getRecipes());
}
@Override

View File

@ -17,7 +17,7 @@ import net.minecraft.item.ItemStack;
public class AshpitHandler extends NEIUniversalHandler {
public AshpitHandler() {
super("Ashpit", ModBlocks.machine_ashpit, getRecipes());
super(ModBlocks.machine_ashpit.getLocalizedName(), ModBlocks.machine_ashpit, getRecipes());
}
@Override

View File

@ -13,7 +13,7 @@ import com.hbm.items.machine.ItemFluidIcon;
public class BoilingHandler extends NEIUniversalHandler {
public BoilingHandler() {
super("Boiler", ModBlocks.machine_boiler, generateRecipes());
super(ModBlocks.machine_boiler.getLocalizedName(), ModBlocks.machine_boiler, generateRecipes());
}
@Override

View File

@ -9,7 +9,7 @@ import com.hbm.inventory.recipes.CokerRecipes;
public class CokingHandler extends NEIUniversalHandler {
public CokingHandler() {
super("Coking", ModBlocks.machine_coker, CokerRecipes.getRecipes());
super(ModBlocks.machine_coker.getLocalizedName(), ModBlocks.machine_coker, CokerRecipes.getRecipes());
}
@Override

View File

@ -9,7 +9,7 @@ import com.hbm.inventory.recipes.CombinationRecipes;
public class CombinationHandler extends NEIUniversalHandler {
public CombinationHandler() {
super("Combination Furnace", ModBlocks.furnace_combination, CombinationRecipes.getRecipes());
super(ModBlocks.furnace_combination.getLocalizedName(), ModBlocks.furnace_combination, CombinationRecipes.getRecipes());
}
@Override

View File

@ -9,7 +9,7 @@ import com.hbm.inventory.recipes.ElectrolyserFluidRecipes;
public class ElectrolyserFluidHandler extends NEIUniversalHandler {
public ElectrolyserFluidHandler() {
super("Electrolysis", ModBlocks.machine_electrolyser, ElectrolyserFluidRecipes.getRecipes());
super(ModBlocks.machine_electrolyser.getLocalizedName(), ModBlocks.machine_electrolyser, ElectrolyserFluidRecipes.getRecipes());
}
@Override

View File

@ -9,7 +9,7 @@ import com.hbm.inventory.recipes.ElectrolyserMetalRecipes;
public class ElectrolyserMetalHandler extends NEIUniversalHandler {
public ElectrolyserMetalHandler() {
super("Electrolysis", ModBlocks.machine_electrolyser, ElectrolyserMetalRecipes.getRecipes());
super(ModBlocks.machine_electrolyser.getLocalizedName(), ModBlocks.machine_electrolyser, ElectrolyserMetalRecipes.getRecipes());
}
@Override

View File

@ -9,7 +9,7 @@ import com.hbm.inventory.recipes.ExposureChamberRecipes;
public class ExposureChamberHandler extends NEIUniversalHandler {
public ExposureChamberHandler() {
super("Exposure Chamber", ModBlocks.machine_exposure_chamber, ExposureChamberRecipes.getRecipes());
super(ModBlocks.machine_exposure_chamber.getLocalizedName(), ModBlocks.machine_exposure_chamber, ExposureChamberRecipes.getRecipes());
}
@Override

View File

@ -6,7 +6,7 @@ import com.hbm.inventory.recipes.FractionRecipes;
public class FractioningHandler extends NEIUniversalHandler {
public FractioningHandler() {
super("Fractioning", ModBlocks.machine_fraction_tower, FractionRecipes.getFractionRecipesForNEI());
super(ModBlocks.machine_fraction_tower.getLocalizedName(), ModBlocks.machine_fraction_tower, FractionRecipes.getFractionRecipesForNEI());
}
@Override

View File

@ -6,7 +6,7 @@ import com.hbm.inventory.recipes.LiquefactionRecipes;
public class LiquefactionHandler extends NEIUniversalHandler {
public LiquefactionHandler() {
super("Liquefaction", ModBlocks.machine_liquefactor, LiquefactionRecipes.getRecipes());
super(ModBlocks.machine_liquefactor.getLocalizedName(), ModBlocks.machine_liquefactor, LiquefactionRecipes.getRecipes());
}
@Override

View File

@ -9,7 +9,7 @@ import com.hbm.inventory.recipes.MixerRecipes;
public class MixerHandler extends NEIUniversalHandler {
public MixerHandler() {
super("Mixer", ModBlocks.machine_mixer, MixerRecipes.getRecipes());
super(ModBlocks.machine_mixer.getLocalizedName(), ModBlocks.machine_mixer, MixerRecipes.getRecipes());
}
@Override

View File

@ -9,7 +9,7 @@ import com.hbm.inventory.recipes.OutgasserRecipes;
public class OutgasserHandler extends NEIUniversalHandler {
public OutgasserHandler() {
super("Irradiation", ModBlocks.rbmk_outgasser, OutgasserRecipes.getRecipes());
super(ModBlocks.rbmk_outgasser.getLocalizedName(), ModBlocks.rbmk_outgasser, OutgasserRecipes.getRecipes());
}
@Override

View File

@ -9,7 +9,7 @@ import com.hbm.inventory.recipes.PyroOvenRecipes;
public class PyroHandler extends NEIUniversalHandler {
public PyroHandler() {
super("Pyrolysis", ModBlocks.machine_pyrooven, PyroOvenRecipes.getRecipes());
super(ModBlocks.machine_pyrooven.getLocalizedName(), ModBlocks.machine_pyrooven, PyroOvenRecipes.getRecipes());
}
@Override

View File

@ -0,0 +1,62 @@
package com.hbm.handler.nei;
import java.awt.Rectangle;
import java.util.Locale;
import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.gui.GUIMachineRotaryFurnace;
import com.hbm.inventory.recipes.RotaryFurnaceRecipes;
import com.hbm.inventory.recipes.RotaryFurnaceRecipes.RotaryFurnaceRecipe;
import com.hbm.items.machine.ItemScraps;
import com.hbm.util.I18nUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.item.ItemStack;
public class RotaryFurnaceHandler extends NEIUniversalHandler {
public RotaryFurnaceHandler() {
super(ModBlocks.machine_rotary_furnace.getLocalizedName(), ModBlocks.machine_rotary_furnace, RotaryFurnaceRecipes.getRecipes());
}
@Override
public String getKey() {
return "ntmRotaryFurnace";
}
@Override
public void loadTransferRects() {
super.loadTransferRects();
transferRectsGui.add(new RecipeTransferRect(new Rectangle(58, 19, 32, 10), "ntmRotaryFurnace"));
guiGui.add(GUIMachineRotaryFurnace.class);
RecipeTransferRectHandler.registerRectsToGuis(guiGui, transferRectsGui);
}
@Override
public void drawExtras(int recipe) {
RecipeSet rec = (RecipeSet) this.arecipes.get(recipe);
Object[] original = (Object[]) rec.originalInputInstance;
ItemStack output = rec.output[0].item;
outer: for(RotaryFurnaceRecipe arc : RotaryFurnaceRecipes.recipes) {
if(ItemStack.areItemStacksEqual(ItemScraps.create(arc.output, true), output) && arc.ingredients.length == original.length - (arc.fluid == null ? 0 : 1)) {
for(int i = 0; i < rec.input.length - (arc.fluid == null ? 0 : 1); i++) {
if(arc.ingredients[i] != original[i]) continue outer;
}
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
String duration = String.format(Locale.US, "%,d", arc.duration) + " ticks";
String consumption = I18nUtil.resolveKey(Fluids.STEAM.getUnlocalizedName()) + ": " + String.format(Locale.US, "%,d", arc.steam) + " mB/t";
int side = 160;
fontRenderer.drawString(duration, side - fontRenderer.getStringWidth(duration), 43, 0x404040);
fontRenderer.drawString(consumption, side - fontRenderer.getStringWidth(consumption), 55, 0x404040);
return;
}
}
}
}

View File

@ -6,7 +6,7 @@ import com.hbm.tileentity.machine.TileEntitySawmill;
public class SawmillHandler extends NEIUniversalHandler {
public SawmillHandler() {
super("Sawmill", ModBlocks.machine_sawmill, TileEntitySawmill.getRecipes());
super(ModBlocks.machine_sawmill.getLocalizedName(), ModBlocks.machine_sawmill, TileEntitySawmill.getRecipes());
}
@Override

View File

@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack;
public class SolderingStationHandler extends NEIUniversalHandler {
public SolderingStationHandler() {
super("Soldering Station", ModBlocks.machine_soldering_station, SolderingRecipes.getRecipes());
super(ModBlocks.machine_soldering_station.getLocalizedName(), ModBlocks.machine_soldering_station, SolderingRecipes.getRecipes());
}
@Override

View File

@ -6,7 +6,7 @@ import com.hbm.inventory.recipes.SolidificationRecipes;
public class SolidificationHandler extends NEIUniversalHandler {
public SolidificationHandler() {
super("Solidification", ModBlocks.machine_solidifier, SolidificationRecipes.getRecipes());
super(ModBlocks.machine_solidifier.getLocalizedName(), ModBlocks.machine_solidifier, SolidificationRecipes.getRecipes());
}
@Override

View File

@ -6,7 +6,7 @@ import com.hbm.tileentity.machine.TileEntityReactorZirnox;
public class ZirnoxRecipeHandler extends NEIUniversalHandler {
public ZirnoxRecipeHandler() {
super("ZIRNOX", ModBlocks.reactor_zirnox, TileEntityReactorZirnox.fuelMap);
super(ModBlocks.reactor_zirnox.getLocalizedName(), ModBlocks.reactor_zirnox, TileEntityReactorZirnox.fuelMap);
}
@Override

View File

@ -499,8 +499,8 @@ public class HazardRegistry {
/*
* Blacklist
*/
for(String ore : TH232.ores()) HazardSystem.blacklist(ore);
for(String ore : U.ores()) HazardSystem.blacklist(ore);
for(String ore : TH232.all(MaterialShapes.ORE)) HazardSystem.blacklist(ore);
for(String ore : U.all(MaterialShapes.ORE)) HazardSystem.blacklist(ore);
/*
@ -524,7 +524,7 @@ public class HazardRegistry {
};
for(MaterialShapes shape : MaterialShapes.allShapes) {
for(String prefix : shape.prefixes) {
if(!shape.noAutogen) for(String prefix : shape.prefixes) {
for(Object[] o : data) {
HazardSystem.register(prefix + o[0], new HazardData().setMutex(0b1).addEntry(new HazardEntry(RADIATION, (float) o[1] * shape.q(1) / MaterialShapes.INGOT.q(1))));
}

View File

@ -9,7 +9,7 @@ import java.util.List;
import static com.hbm.items.ModItems.*;
import static com.hbm.blocks.ModBlocks.*;
import static com.hbm.inventory.OreDictManager.DictFrame.*;
import static com.hbm.inventory.OreNames.*;
import static com.hbm.inventory.material.MaterialShapes.*;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.generic.BlockOreBasalt.EnumBasaltOreType;
@ -108,6 +108,8 @@ public class OreDictManager {
/*
* VANILLA
*/
public static final DictFrame WOOD = new DictFrame("Wood");
public static final DictFrame BONE = new DictFrame("Bone");
public static final DictFrame COAL = new DictFrame("Coal");
public static final DictFrame IRON = new DictFrame("Iron");
public static final DictFrame GOLD = new DictFrame("Gold");
@ -205,6 +207,8 @@ public class OreDictManager {
public static final DictFrame CMB = new DictFrame("CMBSteel");
public static final DictFrame DESH = new DictFrame("WorkersAlloy");
public static final DictFrame STAR = new DictFrame("Starmetal");
public static final DictFrame GUNMETAL = new DictFrame("GunMetal");
public static final DictFrame WEAPONSTEEL = new DictFrame("WeaponSteel");
public static final DictFrame BIGMT = new DictFrame("Saturnite");
public static final DictFrame FERRO = new DictFrame("Ferrouranium");
public static final DictFrame EUPH = new DictFrame("Euphemium");
@ -409,6 +413,8 @@ public class OreDictManager {
CMB .ingot(ingot_combine_steel) .dust(powder_combine_steel) .plate(plate_combine_steel) .block(block_combine_steel);
DESH .nugget(nugget_desh) .ingot(ingot_desh) .dust(powder_desh) .block(block_desh);
STAR .ingot(ingot_starmetal) .block(block_starmetal);
GUNMETAL .ingot(ingot_gunmetal) .plate(plate_gunmetal);
WEAPONSTEEL .ingot(ingot_weaponsteel) .plate(plate_weaponsteel);
BIGMT .ingot(ingot_saturnite) .plate(plate_saturnite);
FERRO .ingot(ingot_ferrouranium);
EUPH .nugget(nugget_euphemium) .ingot(ingot_euphemium) .dust(powder_euphemium) .block(block_euphemium);
@ -548,6 +554,14 @@ public class OreDictManager {
}
if(mat.shapes.contains(MaterialShapes.FRAGMENT)) for(String name : mat.names) OreDictionary.registerOre(MaterialShapes.FRAGMENT.name() + name, new ItemStack(ModItems.bedrock_ore_fragment, 1, mat.id));
if(mat.shapes.contains(MaterialShapes.WIRE)) for(String name : mat.names) OreDictionary.registerOre(MaterialShapes.WIRE.name() + name, new ItemStack(ModItems.wire_fine, 1, mat.id));
if(mat.shapes.contains(MaterialShapes.LIGHTBARREL)) for(String name : mat.names) OreDictionary.registerOre(MaterialShapes.LIGHTBARREL.name() + name, new ItemStack(ModItems.part_barrel_light, 1, mat.id));
if(mat.shapes.contains(MaterialShapes.HEAVYBARREL)) for(String name : mat.names) OreDictionary.registerOre(MaterialShapes.HEAVYBARREL.name() + name, new ItemStack(ModItems.part_barrel_heavy, 1, mat.id));
if(mat.shapes.contains(MaterialShapes.LIGHTRECEIVER)) for(String name : mat.names) OreDictionary.registerOre(MaterialShapes.LIGHTRECEIVER.name() + name, new ItemStack(ModItems.part_receiver_light, 1, mat.id));
if(mat.shapes.contains(MaterialShapes.HEAVYRECEIVER)) for(String name : mat.names) OreDictionary.registerOre(MaterialShapes.HEAVYRECEIVER.name() + name, new ItemStack(ModItems.part_receiver_heavy, 1, mat.id));
if(mat.shapes.contains(MaterialShapes.MECHANISM)) for(String name : mat.names) OreDictionary.registerOre(MaterialShapes.MECHANISM.name() + name, new ItemStack(ModItems.part_mechanism, 1, mat.id));
if(mat.shapes.contains(MaterialShapes.STOCK)) for(String name : mat.names) OreDictionary.registerOre(MaterialShapes.STOCK.name() + name, new ItemStack(ModItems.part_stock, 1, mat.id));
if(mat.shapes.contains(MaterialShapes.GRIP)) for(String name : mat.names) OreDictionary.registerOre(MaterialShapes.GRIP.name() + name, new ItemStack(ModItems.part_grip, 1, mat.id));
}
for(EnumBedrockOre ore : EnumBedrockOre.values()) {
@ -669,8 +683,8 @@ public class OreDictManager {
ANY_RUBBER.addPrefix(INGOT, true);
ANY_PLASTIC.addPrefix(INGOT, true).addPrefix(DUST, true).addPrefix(BLOCK, true);
ANY_HARDPLASTIC.addPrefix(INGOT, true);
ANY_RESISTANTALLOY.addPrefix(INGOT, true).addPrefix(DUST, true).addPrefix(PLATECAST, true).addPrefix(PLATEWELDED, true).addPrefix(HEAVY_COMPONENT, true).addPrefix(BLOCK, true);
ANY_BISMOIDBRONZE.addPrefix(INGOT, true).addPrefix(PLATECAST, true);
ANY_RESISTANTALLOY.addPrefix(INGOT, true).addPrefix(DUST, true).addPrefix(CASTPLATE, true).addPrefix(WELDEDPLATE, true).addPrefix(HEAVY_COMPONENT, true).addPrefix(BLOCK, true);
ANY_BISMOIDBRONZE.addPrefix(INGOT, true).addPrefix(CASTPLATE, true);
ANY_TAR.addPrefix(ANY, false);
}
@ -737,44 +751,35 @@ public class OreDictManager {
/*
* Quick access methods to grab ore names for recipes.
*/
public String any() { return ANY + mats[0]; }
public String nugget() { return NUGGET + mats[0]; }
public String tiny() { return TINY + mats[0]; }
public String bolt() { return BOLT + mats[0]; }
public String ingot() { return INGOT + mats[0]; }
public String dustTiny() { return DUSTTINY + mats[0]; }
public String dust() { return DUST + mats[0]; }
public String gem() { return GEM + mats[0]; }
public String crystal() { return CRYSTAL + mats[0]; }
public String plate() { return PLATE + mats[0]; }
public String plateCast() { return PLATECAST + mats[0]; }
public String plateWelded() { return PLATEWELDED + mats[0]; }
public String heavyComp() { return HEAVY_COMPONENT + mats[0]; }
public String wireFine() { return WIRE + mats[0]; }
public String wireDense() { return WIREDENSE + mats[0]; }
public String shell() { return SHELL + mats[0]; }
public String pipe() { return PIPE + mats[0]; }
public String billet() { return BILLET + mats[0]; }
public String block() { return BLOCK + mats[0]; }
public String ore() { return ORE + mats[0]; }
public String fragment() { return FRAGMENT + mats[0]; }
public String[] anys() { return appendToAll(ANY); }
public String[] nuggets() { return appendToAll(NUGGET); }
public String[] tinys() { return appendToAll(TINY); }
public String[] allNuggets() { return appendToAll(NUGGET, TINY); }
public String[] ingots() { return appendToAll(INGOT); }
public String[] dustTinys() { return appendToAll(DUSTTINY); }
public String[] dusts() { return appendToAll(DUST); }
public String[] gems() { return appendToAll(GEM); }
public String[] crystals() { return appendToAll(CRYSTAL); }
public String[] plates() { return appendToAll(PLATE); }
public String[] plateCasts() { return appendToAll(PLATECAST); }
public String[] shells() { return appendToAll(SHELL); }
public String[] pipes() { return appendToAll(PIPE); }
public String[] billets() { return appendToAll(BILLET); }
public String[] blocks() { return appendToAll(BLOCK); }
public String[] ores() { return appendToAll(ORE); }
public String[] fragments() { return appendToAll(FRAGMENT); }
public String any() { return ANY.name() + mats[0]; }
public String nugget() { return NUGGET.name() + mats[0]; }
public String tiny() { return TINY.name() + mats[0]; }
public String bolt() { return BOLT.name() + mats[0]; }
public String ingot() { return INGOT.name() + mats[0]; }
public String dustTiny() { return DUSTTINY.name() + mats[0]; }
public String dust() { return DUST.name() + mats[0]; }
public String gem() { return GEM.name() + mats[0]; }
public String crystal() { return CRYSTAL.name() + mats[0]; }
public String plate() { return PLATE.name() + mats[0]; }
public String plateCast() { return CASTPLATE.name() + mats[0]; }
public String plateWelded() { return WELDEDPLATE.name() + mats[0]; }
public String heavyComp() { return HEAVY_COMPONENT.name() + mats[0]; }
public String wireFine() { return WIRE.name() + mats[0]; }
public String wireDense() { return DENSEWIRE.name() + mats[0]; }
public String shell() { return SHELL.name() + mats[0]; }
public String pipe() { return PIPE.name() + mats[0]; }
public String billet() { return BILLET.name() + mats[0]; }
public String block() { return BLOCK.name() + mats[0]; }
public String ore() { return ORE.name() + mats[0]; }
public String fragment() { return FRAGMENT.name() + mats[0]; }
public String lightBarrel() { return LIGHTBARREL.name() + mats[0]; }
public String heavyBarrel() { return HEAVYBARREL.name() + mats[0]; }
public String lightReceiver() { return LIGHTRECEIVER.name() + mats[0]; }
public String heavyReceiver() { return HEAVYRECEIVER.name() + mats[0]; }
public String mechanism() { return MECHANISM.name() + mats[0]; }
public String stock() { return STOCK.name() + mats[0]; }
public String grip() { return GRIP.name() + mats[0]; }
public String[] all(MaterialShapes shape) { return appendToAll(shape.prefixes); }
/** Returns cast (triple) plates if 528 mode is enabled or normal plates if not */
public String plate528() { return GeneralConfig.enable528 ? plateCast() : plate(); }
@ -868,7 +873,7 @@ public class OreDictManager {
}
public DictFrame plateCast(Object... plate) {
hazMult = HazardRegistry.plateCast;
return makeObject(PLATECAST, plate);
return makeObject(CASTPLATE, plate);
}
public DictFrame billet(Object... billet) {
hazMult = HazardRegistry.billet;
@ -888,8 +893,9 @@ public class OreDictManager {
return makeObject(ORENETHER, oreNether);
}
public DictFrame makeObject(String tag, Object... objects) {
public DictFrame makeObject(MaterialShapes shape, Object... objects) {
String tag = shape.name();
for(Object o : objects) {
if(o instanceof Item) registerStack(tag, new ItemStack((Item) o));
if(o instanceof Block) registerStack(tag, new ItemStack((Block) o));
@ -974,8 +980,9 @@ public class OreDictManager {
* @param prefix The prefix of both the input and result of the reregistration
* @return
*/
public DictGroup addPrefix(String prefix, boolean inputPrefix) {
public DictGroup addPrefix(MaterialShapes shape, boolean inputPrefix) {
String prefix = shape.name();
String group = prefix + groupName;
for(String name : names) {
@ -998,24 +1005,24 @@ public class OreDictManager {
return this;
}
public String any() { return ANY + groupName; }
public String nugget() { return NUGGET + groupName; }
public String tiny() { return TINY + groupName; }
public String bolt() { return BOLT + groupName; }
public String ingot() { return INGOT + groupName; }
public String dustTiny() { return DUSTTINY + groupName; }
public String dust() { return DUST + groupName; }
public String gem() { return GEM + groupName; }
public String crystal() { return CRYSTAL + groupName; }
public String plate() { return PLATE + groupName; }
public String plateCast() { return PLATECAST + groupName; }
public String plateWelded() { return PLATEWELDED + groupName; }
public String heavyComp() { return HEAVY_COMPONENT + groupName; }
public String wireFine() { return WIRE + groupName; }
public String wireDense() { return WIREDENSE + groupName; }
public String billet() { return BILLET + groupName; }
public String block() { return BLOCK + groupName; }
public String ore() { return ORE + groupName; }
public String any() { return ANY.name() + groupName; }
public String nugget() { return NUGGET.name() + groupName; }
public String tiny() { return TINY.name() + groupName; }
public String bolt() { return BOLT.name() + groupName; }
public String ingot() { return INGOT.name() + groupName; }
public String dustTiny() { return DUSTTINY .name() + groupName; }
public String dust() { return DUST.name() + groupName; }
public String gem() { return GEM.name() + groupName; }
public String crystal() { return CRYSTAL.name() + groupName; }
public String plate() { return PLATE.name() + groupName; }
public String plateCast() { return CASTPLATE.name() + groupName; }
public String plateWelded() { return WELDEDPLATE.name() + groupName; }
public String heavyComp() { return HEAVY_COMPONENT.name() + groupName; }
public String wireFine() { return WIRE.name() + groupName; }
public String wireDense() { return DENSEWIRE.name() + groupName; }
public String billet() { return BILLET.name() + groupName; }
public String block() { return BLOCK.name() + groupName; }
public String ore() { return ORE.name() + groupName; }
}
private static void addReRegistration(String original, String additional) {

View File

@ -1,34 +0,0 @@
package com.hbm.inventory;
public class OreNames {
/*
* PREFIXES
*/
public static final String ANY = "any";
public static final String NUGGET = "nugget";
public static final String TINY = "tiny";
public static final String FRAGMENT = "bedrockorefragment";
public static final String BOLT = "bolt";
public static final String INGOT = "ingot";
public static final String DUSTTINY = "dustTiny";
public static final String DUST = "dust";
public static final String GEM = "gem";
public static final String CRYSTAL = "crystal";
public static final String PLATE = "plate";
public static final String PLATECAST = "plateTriple"; //cast plates are solid plates made from 3 ingots, turns out that's literally just a GT triple plate
public static final String PLATEWELDED = "plateSextuple";
public static final String SHELL = "shell";
public static final String PIPE = "ntmpipe";
public static final String WIRE = "wireFine";
public static final String WIREDENSE = "wireDense";
public static final String BILLET = "billet";
public static final String BLOCK = "block";
public static final String ORE = "ore";
public static final String ORENETHER = "oreNether";
public static final String HEAVY_COMPONENT = "componentHeavy";
public static final String[] prefixes = new String[] {
ANY, NUGGET, TINY, FRAGMENT, BOLT, INGOT, DUSTTINY, DUST, GEM, CRYSTAL, PLATE, PLATECAST, BILLET, BLOCK, ORE, ORENETHER, HEAVY_COMPONENT, WIRE, WIREDENSE
};
}

View File

@ -0,0 +1,75 @@
package com.hbm.inventory.container;
import com.hbm.items.machine.IItemFluidIdentifier;
import com.hbm.tileentity.machine.TileEntityMachineRotaryFurnace;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityFurnace;
public class ContainerMachineRotaryFurnace extends Container {
private TileEntityMachineRotaryFurnace furnace;
public ContainerMachineRotaryFurnace(InventoryPlayer invPlayer, TileEntityMachineRotaryFurnace tile) {
furnace = tile;
//Inputs
this.addSlotToContainer(new Slot(tile, 0, 8, 18));
this.addSlotToContainer(new Slot(tile, 1, 26, 18));
this.addSlotToContainer(new Slot(tile, 2, 44, 18));
//Fluid ID
this.addSlotToContainer(new Slot(tile, 3, 8, 54));
//Solid fuel
this.addSlotToContainer(new Slot(tile, 4, 44, 54));
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 104 + i * 18));
}
}
for(int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 162));
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
ItemStack rStack = null;
Slot slot = (Slot) this.inventorySlots.get(index);
if(slot != null && slot.getHasStack()) {
ItemStack stack = slot.getStack();
rStack = stack.copy();
if(index <= 4) {
if(!this.mergeItemStack(stack, 5, this.inventorySlots.size(), true)) return null;
} else {
if(TileEntityFurnace.isItemFuel(rStack)) {
if(!this.mergeItemStack(stack, 4, 5, false)) return null;
} else if(rStack.getItem() instanceof IItemFluidIdentifier) {
if(!this.mergeItemStack(stack, 3, 4, false)) return null;
} else {
if(!this.mergeItemStack(stack, 0, 3, false)) return null;
}
}
if(stack.stackSize == 0) {
slot.putStack((ItemStack) null);
} else {
slot.onSlotChanged();
}
}
return rStack;
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return furnace.isUseableByPlayer(player);
}
}

View File

@ -55,12 +55,12 @@ public class ContainerMachineShredder extends Container {
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18 + 56));
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18 + 67));
}
}
for(int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + 56));
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + 67));
}
}

View File

@ -13,6 +13,8 @@ import com.hbm.inventory.gui.GuiInfoContainer;
import com.hbm.items.ModItems;
import com.hbm.items.machine.IItemFluidIdentifier;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
@ -183,11 +185,11 @@ public class FluidTank {
* @param width
* @param height
*/
public void renderTank(int x, int y, double z, int width, int height) {
@SideOnly(Side.CLIENT) public void renderTank(int x, int y, double z, int width, int height) {
renderTank(x, y, z, width, height, 0);
}
public void renderTank(int x, int y, double z, int width, int height, int orientation) {
@SideOnly(Side.CLIENT) public void renderTank(int x, int y, double z, int width, int height, int orientation) {
GL11.glEnable(GL11.GL_BLEND);
@ -242,7 +244,7 @@ public class FluidTank {
GL11.glDisable(GL11.GL_BLEND);
}
public void renderTankInfo(GuiInfoContainer gui, int mouseX, int mouseY, int x, int y, int width, int height) {
@SideOnly(Side.CLIENT) public void renderTankInfo(GuiInfoContainer gui, int mouseX, int mouseY, int x, int y, int width, int height) {
if(x <= mouseX && x + width > mouseX && y < mouseY && y + height >= mouseY) {
List<String> list = new ArrayList();

View File

@ -0,0 +1,93 @@
package com.hbm.inventory.gui;
import java.awt.Color;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerMachineRotaryFurnace;
import com.hbm.inventory.material.Mats;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityMachineRotaryFurnace;
import com.hbm.util.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.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
public class GUIMachineRotaryFurnace extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_rotary_furnace.png");
private TileEntityMachineRotaryFurnace furnace;
public GUIMachineRotaryFurnace(InventoryPlayer playerInv, TileEntityMachineRotaryFurnace tile) {
super(new ContainerMachineRotaryFurnace(playerInv, tile));
this.furnace = tile;
this.xSize = 176;
this.ySize = 186;
}
@Override
public void drawScreen(int x, int y, float interp) {
super.drawScreen(x, y, interp);
furnace.tanks[0].renderTankInfo(this, x, y, guiLeft + 8, guiTop + 36, 52, 16);
furnace.tanks[1].renderTankInfo(this, x, y, guiLeft + 134, guiTop + 18, 16, 52);
furnace.tanks[2].renderTankInfo(this, x, y, guiLeft + 152, guiTop + 18, 16, 52);
if(furnace.output == null) {
this.drawCustomInfoStat(x, y, guiLeft + 98, guiTop + 18, 16, 52, x, y, EnumChatFormatting.RED + "Empty");
} else {
this.drawCustomInfoStat(x, y, guiLeft + 98, guiTop + 18, 16, 52, x, y,EnumChatFormatting.YELLOW +
I18nUtil.resolveKey(furnace.output.material.getUnlocalizedName()) + ": " + Mats.formatAmount(furnace.output.amount, Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)));
}
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.furnace.hasCustomInventoryName() ? this.furnace.getInventoryName() : I18n.format(this.furnace.getInventoryName());
this.fontRendererObj.drawString(name, (this.xSize - 54) / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float interp, int x, int y) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int p = (int) Math.ceil(furnace.progress * 33);
drawTexturedModalRect(guiLeft + 63, guiTop + 30, 176, 0, p, 10);
if(furnace.maxBurnTime > 0) {
int b = furnace.burnTime * 14 / furnace.maxBurnTime;
drawTexturedModalRect(guiLeft + 26, guiTop + 69 - b, 176, 24 - b, 14, b);
}
if(furnace.output != null) {
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
int hex = furnace.output.material.moltenColor;
int amount = furnace.output.amount * 52 / furnace.maxOutput;
Color color = new Color(hex);
GL11.glColor3f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F);
drawTexturedModalRect(guiLeft + 98, guiTop + 70 - amount, 176, 76 - amount, 16, amount);
GL11.glEnable(GL11.GL_BLEND);
GL11.glColor4f(1F, 1F, 1F, 0.3F);
drawTexturedModalRect(guiLeft + 98, guiTop + 70 - amount, 176, 76 - amount, 16, amount);
GL11.glDisable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glColor3f(255, 255, 255);
}
furnace.tanks[0].renderTank(guiLeft + 8, guiTop + 52, this.zLevel, 52, 16, 1);
furnace.tanks[1].renderTank(guiLeft + 134, guiTop + 70, this.zLevel, 16, 52);
furnace.tanks[2].renderTank(guiLeft + 152, guiTop + 70, this.zLevel, 16, 52);
}
}

View File

@ -21,7 +21,7 @@ public class GUIMachineShredder extends GuiInfoContainer {
diFurnace = tedf;
this.xSize = 176;
this.ySize = 222;
this.ySize = 233;
}
@Override

View File

@ -4,11 +4,16 @@ import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerMachineSolderingStation;
import com.hbm.lib.RefStrings;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toserver.NBTControlPacket;
import com.hbm.tileentity.machine.TileEntityMachineSolderingStation;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
public class GUIMachineSolderingStation extends GuiInfoContainer {
@ -32,6 +37,24 @@ public class GUIMachineSolderingStation extends GuiInfoContainer {
this.drawElectricityInfo(this, x, y, guiLeft + 152, guiTop + 18, 16, 52, solderer.getPower(), solderer.getMaxPower());
this.drawCustomInfoStat(x, y, guiLeft + 78, guiTop + 67, 8, 8, guiLeft + 78, guiTop + 67, this.getUpgradeInfo(solderer));
this.drawCustomInfoStat(x, y, guiLeft + 5, guiTop + 66, 10, 10, x, y,
"Recipe Collision Prevention: " + (solderer.collisionPrevention ? EnumChatFormatting.GREEN + "ON" : EnumChatFormatting.RED + "OFF"),
"Prevents no-fluid recipes from being processed",
"when fluid is present.");
}
@Override
protected void mouseClicked(int x, int y, int i) {
super.mouseClicked(x, y, i);
if(guiLeft + 5 <= x && guiLeft + 5 + 10 > x && guiTop + 66 < y && guiTop + 66 + 10 >= y) {
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
NBTTagCompound data = new NBTTagCompound();
data.setBoolean("collision", true);
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, solderer.xCoord, solderer.yCoord, solderer.zCoord));
}
}
@Override

View File

@ -68,7 +68,7 @@ public class MatDistribution extends SerializableRecipe {
registerOre(OreDictManager.COAL.ore(), MAT_CARBON, GEM.q(3), MAT_STONE, QUART.q(1));
registerOre(OreDictManager.GOLD.ore(), MAT_GOLD, INGOT.q(2), MAT_LEAD, NUGGET.q(3), MAT_STONE, QUART.q(1));
registerOre(OreDictManager.U.ore(), MAT_URANIUM, INGOT.q(2), MAT_LEAD, NUGGET.q(3), MAT_STONE, QUART.q(1));
registerOre(OreDictManager.TH232.ore(), MAT_THORIUM, INGOT.q(2), MAT_URANIUM, NUGGET.q(3), MAT_STONE, QUART.q(1));
for(String ore : OreDictManager.TH232.all(MaterialShapes.ORE)) registerOre(ore, MAT_THORIUM, INGOT.q(2), MAT_URANIUM, NUGGET.q(3), MAT_STONE, QUART.q(1));
registerOre(OreDictManager.CU.ore(), MAT_COPPER, INGOT.q(2), MAT_STONE, QUART.q(1));
registerOre(OreDictManager.PB.ore(), MAT_LEAD, INGOT.q(2), MAT_GOLD, NUGGET.q(1), MAT_STONE, QUART.q(1));
registerOre(OreDictManager.BE.ore(), MAT_BERYLLIUM, INGOT.q(2), MAT_STONE, QUART.q(1));

View File

@ -9,8 +9,13 @@ public class MaterialShapes {
public static final List<MaterialShapes> allShapes = new ArrayList();
public static final MaterialShapes ANY = new MaterialShapes(0).noAutogen();
public static final MaterialShapes ORE = new MaterialShapes(0, "ore", "oreNether").noAutogen();
public static final MaterialShapes ORENETHER = new MaterialShapes(0, "oreNether").noAutogen();
public static final MaterialShapes QUANTUM = new MaterialShapes(1); // 1/72 of an ingot, allows the ingot to be divisible through 2, 4, 6, 8, 9, 12, 24 and 36
public static final MaterialShapes NUGGET = new MaterialShapes(8, "nugget");
public static final MaterialShapes NUGGET = new MaterialShapes(8, "nugget", "tiny");
public static final MaterialShapes TINY = new MaterialShapes(8, "tiny").noAutogen();
public static final MaterialShapes FRAGMENT = new MaterialShapes(8, "bedrockorefragment");
public static final MaterialShapes DUSTTINY = new MaterialShapes(NUGGET.quantity, "dustTiny");
public static final MaterialShapes WIRE = new MaterialShapes(9, "wireFine");
@ -29,28 +34,37 @@ public class MaterialShapes {
public static final MaterialShapes QUART = new MaterialShapes(162);
public static final MaterialShapes BLOCK = new MaterialShapes(INGOT.quantity * 9, "block");
public static final MaterialShapes HEAVY_COMPONENT = new MaterialShapes(CASTPLATE.quantity * 256, "componentHeavy");
public static final MaterialShapes LIGHTBARREL = new MaterialShapes(INGOT.quantity * 3, "barrelLight");
public static final MaterialShapes HEAVYBARREL = new MaterialShapes(INGOT.quantity * 6, "barrelHeavy");
public static final MaterialShapes LIGHTRECEIVER = new MaterialShapes(INGOT.quantity * 4, "receiverLight");
public static final MaterialShapes HEAVYRECEIVER = new MaterialShapes(INGOT.quantity * 9, "receiverHeavy");
public static final MaterialShapes MECHANISM = new MaterialShapes(INGOT.quantity * 4, "gunMechanism");
public static final MaterialShapes STOCK = new MaterialShapes(INGOT.quantity * 4, "stock");
public static final MaterialShapes GRIP = new MaterialShapes(INGOT.quantity * 2, "grip");
public static void registerCompatShapes() {
if(Compat.isModLoaded(Compat.MOD_GT6)) {
new MaterialShapes(BLOCK.q(1), "blockDust");
new MaterialShapes(BLOCK.q(1), "blockGem");
new MaterialShapes(BLOCK.q(1), "blockIngot");
new MaterialShapes(BLOCK.q(1), "blockSolid");
new MaterialShapes(INGOT.q(9, 8), "crushed");
new MaterialShapes(INGOT.q(9, 72), "crushedTiny");
new MaterialShapes(INGOT.q(10, 8), "crushedPurified");
new MaterialShapes(INGOT.q(10, 72), "crushedPurifiedTiny");
new MaterialShapes(INGOT.q(11, 8), "crushedCentrifuged");
new MaterialShapes(INGOT.q(11, 72), "crushedCentrifugedTiny");
new MaterialShapes(INGOT.q(1, 4), "dustSmall");
new MaterialShapes(INGOT.q(1, 72), "dustDiv72");
new MaterialShapes(INGOT.q(10, 9), "dustImpure");
new MaterialShapes(INGOT.q(11, 9), "dustPure");
new MaterialShapes(INGOT.q(12, 9), "dustRefined");
new MaterialShapes(BLOCK.q(1), "blockDust").noAutogen();
new MaterialShapes(BLOCK.q(1), "blockGem").noAutogen();
new MaterialShapes(BLOCK.q(1), "blockIngot").noAutogen();
new MaterialShapes(BLOCK.q(1), "blockSolid").noAutogen();
new MaterialShapes(INGOT.q(9, 8), "crushed").noAutogen();
new MaterialShapes(INGOT.q(9, 72), "crushedTiny").noAutogen();
new MaterialShapes(INGOT.q(10, 8), "crushedPurified").noAutogen();
new MaterialShapes(INGOT.q(10, 72), "crushedPurifiedTiny").noAutogen();
new MaterialShapes(INGOT.q(11, 8), "crushedCentrifuged").noAutogen();
new MaterialShapes(INGOT.q(11, 72), "crushedCentrifugedTiny").noAutogen();
new MaterialShapes(INGOT.q(1, 4), "dustSmall").noAutogen();
new MaterialShapes(INGOT.q(1, 72), "dustDiv72").noAutogen();
new MaterialShapes(INGOT.q(10, 9), "dustImpure").noAutogen();
new MaterialShapes(INGOT.q(11, 9), "dustPure").noAutogen();
new MaterialShapes(INGOT.q(12, 9), "dustRefined").noAutogen();
}
}
public boolean noAutogen = false;
private int quantity;
public final String[] prefixes;
@ -65,6 +79,12 @@ public class MaterialShapes {
allShapes.add(this);
}
/** Disables recipe autogen for special cases like compatibility prefixes (TINY, ORENETHER), technical prefixes (ANY) or prefixes that have to be handled manually (ORE) */
public MaterialShapes noAutogen() {
this.noAutogen = true;
return this;
}
public int q(int amount) {
return this.quantity * amount;
}
@ -76,4 +96,8 @@ public class MaterialShapes {
public String name() {
return (prefixes != null && prefixes.length > 0) ? prefixes[0] : "unknown";
}
public String make(NTMMaterial mat) {
return this.name() + mat.names[0];
}
}

View File

@ -47,24 +47,26 @@ public class Mats {
public static final int _ES = 20_000;
//Vanilla and vanilla-like
public static final NTMMaterial MAT_STONE = makeSmeltable(_VS + 00, df("Stone"), 0x7F7F7F, 0x353535, 0x4D2F23).n();
public static final NTMMaterial MAT_CARBON = makeAdditive( 699, CARBON, 0x363636, 0x030303, 0x404040).setShapes(WIRE, INGOT, BLOCK).n();
public static final NTMMaterial MAT_COAL = makeNonSmeltable(600, COAL, 0x363636, 0x030303, 0x404040).setConversion(MAT_CARBON, 2, 1).setShapes(FRAGMENT).n();
public static final NTMMaterial MAT_LIGNITE = makeNonSmeltable(601, LIGNITE, 0x542D0F, 0x261508, 0x472913).setConversion(MAT_CARBON, 3, 1).setShapes(FRAGMENT).n();
public static final NTMMaterial MAT_COALCOKE = make( 610, COALCOKE) .setConversion(MAT_CARBON, 4, 3).n();
public static final NTMMaterial MAT_PETCOKE = make( 611, PETCOKE) .setConversion(MAT_CARBON, 4, 3).n();
public static final NTMMaterial MAT_LIGCOKE = make( 612, LIGCOKE) .setConversion(MAT_CARBON, 4, 3).n();
public static final NTMMaterial MAT_GRAPHITE = make( 620, GRAPHITE) .setConversion(MAT_CARBON, 1, 1).n();
public static final NTMMaterial MAT_DIAMOND = makeNonSmeltable(1430, DIAMOND, 0xFFFFFF, 0x1B7B6B, 0x8CF4E2).setConversion(MAT_CARBON, 1, 1).setShapes(FRAGMENT).n();
public static final NTMMaterial MAT_IRON = makeSmeltable(2600, IRON, 0xFFFFFF, 0x353535, 0xFFA259).setShapes(FRAGMENT, INGOT, DUST, PIPE, CASTPLATE, WELDEDPLATE, BLOCK).m();
public static final NTMMaterial MAT_GOLD = makeSmeltable(7900, GOLD, 0xFFFF8B, 0xC26E00, 0xE8D754).setShapes(FRAGMENT, WIRE, NUGGET, INGOT, DUST, DENSEWIRE, CASTPLATE, BLOCK).m();
public static final NTMMaterial MAT_REDSTONE = makeSmeltable(_VS + 01, REDSTONE, 0xE3260C, 0x700E06, 0xFF1000).setShapes(FRAGMENT).n();
public static final NTMMaterial MAT_OBSIDIAN = makeSmeltable(_VS + 02, df("Obsidian"), 0x3D234D).n();
public static final NTMMaterial MAT_HEMATITE = makeAdditive( 2601, HEMATITE, 0xDFB7AE, 0x5F372E, 0x6E463D).m();
public static final NTMMaterial MAT_WROUGHTIRON = makeSmeltable(2602, df("WroughtIron"), 0xFAAB89).m();
public static final NTMMaterial MAT_PIGIRON = makeSmeltable(2603, df("PigIron"), 0xFF8B59).m();
public static final NTMMaterial MAT_METEORICIRON = makeSmeltable(2604, df("MeteoricIron"), 0x715347).m();
public static final NTMMaterial MAT_MALACHITE = makeAdditive( 2901, MALACHITE, 0xA2F0C8, 0x227048, 0x61AF87).m();
public static final NTMMaterial MAT_WOOD = makeNonSmeltable(_VS + 03, WOOD, 0x896727, 0x281E0B, 0x896727).setShapes(STOCK, GRIP).n();
public static final NTMMaterial MAT_IVORY = makeNonSmeltable(_VS + 04, BONE, 0xFFFEEE, 0x797870, 0xEDEBCA).setShapes(GRIP).n();
public static final NTMMaterial MAT_STONE = makeSmeltable(_VS + 00, df("Stone"), 0x7F7F7F, 0x353535, 0x4D2F23).n();
public static final NTMMaterial MAT_CARBON = makeAdditive( 699, CARBON, 0x363636, 0x030303, 0x404040).setShapes(WIRE, INGOT, BLOCK).n();
public static final NTMMaterial MAT_COAL = makeNonSmeltable(600, COAL, 0x363636, 0x030303, 0x404040).setConversion(MAT_CARBON, 2, 1).setShapes(FRAGMENT).n();
public static final NTMMaterial MAT_LIGNITE = makeNonSmeltable(601, LIGNITE, 0x542D0F, 0x261508, 0x472913).setConversion(MAT_CARBON, 3, 1).setShapes(FRAGMENT).n();
public static final NTMMaterial MAT_COALCOKE = make( 610, COALCOKE) .setConversion(MAT_CARBON, 4, 3).n();
public static final NTMMaterial MAT_PETCOKE = make( 611, PETCOKE) .setConversion(MAT_CARBON, 4, 3).n();
public static final NTMMaterial MAT_LIGCOKE = make( 612, LIGCOKE) .setConversion(MAT_CARBON, 4, 3).n();
public static final NTMMaterial MAT_GRAPHITE = make( 620, GRAPHITE) .setConversion(MAT_CARBON, 1, 1).n();
public static final NTMMaterial MAT_DIAMOND = makeNonSmeltable(1430, DIAMOND, 0xFFFFFF, 0x1B7B6B, 0x8CF4E2).setConversion(MAT_CARBON, 1, 1).setShapes(FRAGMENT).n();
public static final NTMMaterial MAT_IRON = makeSmeltable(2600, IRON, 0xFFFFFF, 0x353535, 0xFFA259).setShapes(FRAGMENT, INGOT, DUST, PIPE, CASTPLATE, WELDEDPLATE, BLOCK).m();
public static final NTMMaterial MAT_GOLD = makeSmeltable(7900, GOLD, 0xFFFF8B, 0xC26E00, 0xE8D754).setShapes(FRAGMENT, WIRE, NUGGET, INGOT, DUST, DENSEWIRE, CASTPLATE, BLOCK).m();
public static final NTMMaterial MAT_REDSTONE = makeSmeltable(_VS + 01, REDSTONE, 0xE3260C, 0x700E06, 0xFF1000).setShapes(FRAGMENT).n();
public static final NTMMaterial MAT_OBSIDIAN = makeSmeltable(_VS + 02, df("Obsidian"), 0x3D234D).n();
public static final NTMMaterial MAT_HEMATITE = makeAdditive( 2601, HEMATITE, 0xDFB7AE, 0x5F372E, 0x6E463D).m();
public static final NTMMaterial MAT_WROUGHTIRON = makeSmeltable(2602, df("WroughtIron"), 0xFAAB89).m();
public static final NTMMaterial MAT_PIGIRON = makeSmeltable(2603, df("PigIron"), 0xFF8B59).m();
public static final NTMMaterial MAT_METEORICIRON = makeSmeltable(2604, df("MeteoricIron"), 0x715347).m();
public static final NTMMaterial MAT_MALACHITE = makeAdditive( 2901, MALACHITE, 0xA2F0C8, 0x227048, 0x61AF87).m();
//Radioactive
public static final NTMMaterial MAT_URANIUM = makeSmeltable(9200, U, 0xC1C7BD, 0x2B3227, 0x9AA196).setShapes(FRAGMENT, NUGGET, BILLET, INGOT, DUST, BLOCK).m();
@ -131,25 +133,27 @@ public class Mats {
public static final NTMMaterial MAT_OSMIRIDIUM = makeSmeltable(7699, OSMIRIDIUM, 0xDBE3EF, 0x7891BE, 0xACBDD9).setShapes(NUGGET, INGOT, CASTPLATE, WELDEDPLATE).m();
//Alloys
public static final NTMMaterial MAT_STEEL = makeSmeltable(_AS + 0, STEEL, 0xAFAFAF, 0x0F0F0F, 0x4A4A4A).setShapes(DUSTTINY, BOLT, WIRE, INGOT, DUST, PLATE, CASTPLATE, WELDEDPLATE, SHELL, PIPE, BLOCK, HEAVY_COMPONENT).m();
public static final NTMMaterial MAT_MINGRADE = makeSmeltable(_AS + 1, MINGRADE, 0xFFBA7D, 0xAF1700, 0xE44C0F).setShapes(WIRE, INGOT, DUST, BLOCK).m();
public static final NTMMaterial MAT_ALLOY = makeSmeltable(_AS + 2, ALLOY, 0xFF8330, 0x700000, 0xFF7318).setShapes(WIRE, INGOT, DUST, DENSEWIRE, PLATE, CASTPLATE, BLOCK, HEAVY_COMPONENT).m();
public static final NTMMaterial MAT_DURA = makeSmeltable(_AS + 3, DURA, 0x183039, 0x030B0B, 0x376373).setShapes(BOLT, INGOT, DUST, PIPE, BLOCK).m();
public static final NTMMaterial MAT_SATURN = makeSmeltable(_AS + 4, BIGMT, 0x4DA3AF, 0x00000C, 0x4DA3AF).setShapes(INGOT, DUST, PLATE, CASTPLATE, BLOCK).m();
public static final NTMMaterial MAT_DESH = makeSmeltable(_AS + 12, DESH, 0xFF6D6D, 0x720000, 0xF22929).setShapes(INGOT, DUST, CASTPLATE, BLOCK, HEAVY_COMPONENT).m();
public static final NTMMaterial MAT_STAR = makeSmeltable(_AS + 5, STAR, 0xCCCCEA, 0x11111A, 0xA5A5D3).setShapes(INGOT, DUST, DENSEWIRE, BLOCK).m();
public static final NTMMaterial MAT_FERRO = makeSmeltable(_AS + 7, FERRO, 0xB7B7C9, 0x101022, 0x6B6B8B).setShapes(INGOT).m();
public static final NTMMaterial MAT_TCALLOY = makeSmeltable(_AS + 6, TCALLOY, 0xD4D6D6, 0x323D3D, 0x9CA6A6).setShapes(INGOT, DUST, CASTPLATE, WELDEDPLATE, HEAVY_COMPONENT).m();
public static final NTMMaterial MAT_CDALLOY = makeSmeltable(_AS + 13, CDALLOY, 0xF7DF8F, 0x604308, 0xFBD368).setShapes(INGOT, CASTPLATE, WELDEDPLATE, HEAVY_COMPONENT).m();
public static final NTMMaterial MAT_BBRONZE = makeSmeltable(_AS + 16, BBRONZE, 0xE19A69, 0x485353, 0x987D65).setShapes(INGOT, CASTPLATE).m();
public static final NTMMaterial MAT_ABRONZE = makeSmeltable(_AS + 17, ABRONZE, 0xDB9462, 0x203331, 0x77644D).setShapes(INGOT, CASTPLATE).m();
public static final NTMMaterial MAT_BSCCO = makeSmeltable(_AS + 18, BSCCO, 0x767BF1, 0x000000, 0x5E62C0).setShapes(INGOT, DENSEWIRE).m();
public static final NTMMaterial MAT_MAGTUNG = makeSmeltable(_AS + 8, MAGTUNG, 0x22A2A2, 0x0F0F0F, 0x22A2A2).setShapes(WIRE, INGOT, DUST, DENSEWIRE, BLOCK).m();
public static final NTMMaterial MAT_CMB = makeSmeltable(_AS + 9, CMB, 0x6F6FB4, 0x000011, 0x6F6FB4).setShapes(INGOT, DUST, PLATE, CASTPLATE, WELDEDPLATE, BLOCK).m();
public static final NTMMaterial MAT_DNT = makeSmeltable(_AS + 15, DNT, 0x7582B9, 0x16000E, 0x455289).setShapes(INGOT, DUST, DENSEWIRE, BLOCK).m();
public static final NTMMaterial MAT_FLUX = makeAdditive(_AS + 10, df("Flux"), 0xF1E0BB, 0x6F6256, 0xDECCAD).setShapes(DUST).n();
public static final NTMMaterial MAT_SLAG = makeSmeltable(_AS + 11, SLAG, 0x554940, 0x34281F, 0x6C6562).setShapes(BLOCK).n();
public static final NTMMaterial MAT_MUD = makeSmeltable(_AS + 14, MUD, 0xBCB5A9, 0x481213, 0x96783B).setShapes(INGOT).n();
public static final NTMMaterial MAT_STEEL = makeSmeltable(_AS + 0, STEEL, 0xAFAFAF, 0x0F0F0F, 0x4A4A4A).setShapes(DUSTTINY, BOLT, WIRE, INGOT, DUST, PLATE, CASTPLATE, WELDEDPLATE, SHELL, PIPE, BLOCK, HEAVY_COMPONENT, LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, GRIP).m();
public static final NTMMaterial MAT_MINGRADE = makeSmeltable(_AS + 1, MINGRADE, 0xFFBA7D, 0xAF1700, 0xE44C0F).setShapes(WIRE, INGOT, DUST, BLOCK).m();
public static final NTMMaterial MAT_ALLOY = makeSmeltable(_AS + 2, ALLOY, 0xFF8330, 0x700000, 0xFF7318).setShapes(WIRE, INGOT, DUST, DENSEWIRE, PLATE, CASTPLATE, BLOCK, HEAVY_COMPONENT).m();
public static final NTMMaterial MAT_DURA = makeSmeltable(_AS + 3, DURA, 0x183039, 0x030B0B, 0x376373).setShapes(BOLT, INGOT, DUST, PIPE, BLOCK, LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, GRIP).m();
public static final NTMMaterial MAT_DESH = makeSmeltable(_AS + 12, DESH, 0xFF6D6D, 0x720000, 0xF22929).setShapes(INGOT, DUST, CASTPLATE, BLOCK, HEAVY_COMPONENT).m();
public static final NTMMaterial MAT_STAR = makeSmeltable(_AS + 5, STAR, 0xCCCCEA, 0x11111A, 0xA5A5D3).setShapes(INGOT, DUST, DENSEWIRE, BLOCK).m();
public static final NTMMaterial MAT_FERRO = makeSmeltable(_AS + 7, FERRO, 0xB7B7C9, 0x101022, 0x6B6B8B).setShapes(INGOT).m();
public static final NTMMaterial MAT_TCALLOY = makeSmeltable(_AS + 6, TCALLOY, 0xD4D6D6, 0x323D3D, 0x9CA6A6).setShapes(INGOT, DUST, CASTPLATE, WELDEDPLATE, HEAVY_COMPONENT).m();
public static final NTMMaterial MAT_CDALLOY = makeSmeltable(_AS + 13, CDALLOY, 0xF7DF8F, 0x604308, 0xFBD368).setShapes(INGOT, CASTPLATE, WELDEDPLATE, HEAVY_COMPONENT).m();
public static final NTMMaterial MAT_BBRONZE = makeSmeltable(_AS + 16, BBRONZE, 0xE19A69, 0x485353, 0x987D65).setShapes(INGOT, CASTPLATE).m();
public static final NTMMaterial MAT_ABRONZE = makeSmeltable(_AS + 17, ABRONZE, 0xDB9462, 0x203331, 0x77644D).setShapes(INGOT, CASTPLATE).m();
public static final NTMMaterial MAT_BSCCO = makeSmeltable(_AS + 18, BSCCO, 0x767BF1, 0x000000, 0x5E62C0).setShapes(INGOT, DENSEWIRE).m();
public static final NTMMaterial MAT_MAGTUNG = makeSmeltable(_AS + 8, MAGTUNG, 0x22A2A2, 0x0F0F0F, 0x22A2A2).setShapes(WIRE, INGOT, DUST, DENSEWIRE, BLOCK).m();
public static final NTMMaterial MAT_CMB = makeSmeltable(_AS + 9, CMB, 0x6F6FB4, 0x000011, 0x6F6FB4).setShapes(INGOT, DUST, PLATE, CASTPLATE, WELDEDPLATE, BLOCK).m();
public static final NTMMaterial MAT_DNT = makeSmeltable(_AS + 15, DNT, 0x7582B9, 0x16000E, 0x455289).setShapes(INGOT, DUST, DENSEWIRE, BLOCK).m();
public static final NTMMaterial MAT_FLUX = makeAdditive(_AS + 10, df("Flux"), 0xF1E0BB, 0x6F6256, 0xDECCAD).setShapes(DUST).n();
public static final NTMMaterial MAT_SLAG = makeSmeltable(_AS + 11, SLAG, 0x554940, 0x34281F, 0x6C6562).setShapes(BLOCK).n();
public static final NTMMaterial MAT_MUD = makeSmeltable(_AS + 14, MUD, 0xBCB5A9, 0x481213, 0x96783B).setShapes(INGOT).n();
public static final NTMMaterial MAT_GUNMETAL = makeSmeltable(_AS + 19, GUNMETAL, 0xFFEF3F, 0xAD3600, 0xF9C62C).setShapes(INGOT, LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, HEAVYRECEIVER, MECHANISM, STOCK, GRIP).n();
public static final NTMMaterial MAT_WEAPONSTEEL = makeSmeltable(_AS + 20, WEAPONSTEEL, 0xA0A0A0, 0x000000, 0x808080).setShapes(INGOT, LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, HEAVYRECEIVER, MECHANISM, STOCK, GRIP).n();
public static final NTMMaterial MAT_SATURN = makeSmeltable(_AS + 4, BIGMT, 0x3AC4DA, 0x09282C, 0x30A4B7).setShapes(INGOT, PLATE, CASTPLATE, BLOCK, LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, HEAVYRECEIVER, MECHANISM, STOCK, GRIP).m();
//Extension
public static final NTMMaterial MAT_RAREEARTH = makeNonSmeltable(_ES + 00, RAREEARTH, 0xC1BDBD, 0x384646, 0x7B7F7F).setShapes(FRAGMENT, INGOT).n();
@ -211,7 +215,7 @@ public class Mats {
List<MaterialStack> entries = materialEntries.get(new ComparableStack(stack).makeSingular());
if(entries != null) {
list.addAll(entries);
entries.forEach(x -> { if(x != null) list.add(x); });
}
if(stack.getItem() == ModItems.scraps) {

View File

@ -82,14 +82,16 @@ public class ArcFurnaceRecipes extends SerializableRecipe {
NTMMaterial convert = material.smeltsInto;
if(convert.smeltable == SmeltingBehavior.SMELTABLE) {
for(MaterialShapes shape : MaterialShapes.allShapes) {
String name = shape.name() + material.names[0];
if(!OreDictionary.getOres(name).isEmpty()) {
OreDictStack dict = new OreDictStack(name);
ArcFurnaceRecipe recipe = recipes.get(dict);
if(recipe == null) recipe = new ArcFurnaceRecipe();
if(recipe.fluidOutput == null) {
recipe.fluid(new MaterialStack(convert, (int) (shape.q(1) * out / in)));
recipes.put(dict, recipe);
if(!shape.noAutogen) {
String name = shape.name() + material.names[0];
if(!OreDictionary.getOres(name).isEmpty()) {
OreDictStack dict = new OreDictStack(name);
ArcFurnaceRecipe recipe = recipes.get(dict);
if(recipe == null) recipe = new ArcFurnaceRecipe();
if(recipe.fluidOutput == null) {
recipe.fluid(new MaterialStack(convert, (int) (shape.q(1) * out / in)));
recipes.put(dict, recipe);
}
}
}
}

View File

@ -362,8 +362,8 @@ public class AssemblerRecipes extends SerializableRecipe {
makeRecipe(new ComparableStack(ModItems.upgrade_overdrive_1, 1), new AStack[] {
new ComparableStack(ModItems.upgrade_speed_3, 1),
new ComparableStack(ModItems.upgrade_effect_3, 1),
new OreDictStack(DESH.ingot(), 16),
new ComparableStack(ModItems.crystal_lithium, 4),
new OreDictStack(BIGMT.ingot(), 16),
new OreDictStack(ANY_HARDPLASTIC.ingot(), 16),
new ComparableStack(ModItems.circuit, 16, EnumCircuitType.ADVANCED),
}, 200);
makeRecipe(new ComparableStack(ModItems.upgrade_overdrive_2, 1), new AStack[] {
@ -371,15 +371,15 @@ public class AssemblerRecipes extends SerializableRecipe {
new ComparableStack(ModItems.upgrade_speed_3, 1),
new ComparableStack(ModItems.upgrade_effect_3, 1),
new OreDictStack(BIGMT.ingot(), 16),
new ComparableStack(ModItems.crystal_lithium, 8),
new ComparableStack(ModItems.ingot_cft, 8),
new ComparableStack(ModItems.circuit, 16, EnumCircuitType.CAPACITOR_BOARD),
}, 300);
makeRecipe(new ComparableStack(ModItems.upgrade_overdrive_3, 1), new AStack[] {
new ComparableStack(ModItems.upgrade_overdrive_2, 1),
new ComparableStack(ModItems.upgrade_speed_3, 1),
new ComparableStack(ModItems.upgrade_effect_3, 1),
new OreDictStack(STAR.ingot(), 16),
new ComparableStack(ModItems.crystal_lithium, 16),
new OreDictStack(ANY_BISMOIDBRONZE.ingot(), 16),
new ComparableStack(ModItems.ingot_cft, 16),
new ComparableStack(ModItems.circuit, 16, EnumCircuitType.BISMOID),
}, 500);

View File

@ -15,10 +15,12 @@ import com.hbm.config.GeneralConfig;
import com.hbm.handler.imc.IMCCentrifuge;
import static com.hbm.inventory.OreDictManager.*;
import com.hbm.inventory.OreDictManager.DictFrame;
import com.hbm.inventory.OreDictManager;
import com.hbm.inventory.RecipesCommon;
import com.hbm.inventory.RecipesCommon.AStack;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.RecipesCommon.OreDictStack;
import com.hbm.inventory.material.MaterialShapes;
import com.hbm.inventory.recipes.loader.SerializableRecipe;
import com.hbm.items.ItemEnums.EnumAshType;
import com.hbm.items.ItemEnums.EnumChunkType;
@ -395,7 +397,7 @@ public class CentrifugeRecipes extends SerializableRecipe {
lbs ? new ItemStack(ModItems.nugget_ra226, 2) : new ItemStack(ModItems.nugget_ra226, 1),
new ItemStack(Blocks.gravel, 1) });
recipes.put(new OreDictStack(TH232.ore()), new ItemStack[] {
for(String ore : OreDictManager.TH232.all(MaterialShapes.ORE)) recipes.put(new OreDictStack(ore), new ItemStack[] {
new ItemStack(ModItems.powder_thorium, 1),
new ItemStack(ModItems.powder_thorium, 1),
new ItemStack(ModItems.powder_uranium, 1),

View File

@ -258,14 +258,15 @@ public class CrucibleRecipes extends SerializableRecipe {
NTMMaterial convert = material.smeltsInto;
if(convert.smeltable == SmeltingBehavior.SMELTABLE || convert.smeltable == SmeltingBehavior.ADDITIVE) for(MaterialShapes shape : MaterialShapes.allShapes) {
//TODO: buffer these
String name = shape.name() + material.names[0];
List<ItemStack> ores = OreDictionary.getOres(name);
if(!ores.isEmpty()) {
List<ItemStack> stacks = new ArrayList();
stacks.add(ItemScraps.create(new MaterialStack(convert, (int) (shape.q(1) * out / in)), true));
map.put(new OreDictStack(name), stacks);
if(!shape.noAutogen) {
String name = shape.make(material);
List<ItemStack> ores = OreDictionary.getOres(name);
if(!ores.isEmpty()) {
List<ItemStack> stacks = new ArrayList();
stacks.add(ItemScraps.create(new MaterialStack(convert, (int) (shape.q(1) * out / in)), true));
map.put(new OreDictStack(name), stacks);
}
}
}
}

View File

@ -13,11 +13,13 @@ import com.google.gson.stream.JsonWriter;
import com.hbm.blocks.ModBlocks;
import com.hbm.handler.imc.IMCCrystallizer;
import com.hbm.inventory.FluidStack;
import com.hbm.inventory.OreDictManager;
import com.hbm.inventory.RecipesCommon.AStack;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.RecipesCommon.OreDictStack;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.material.MaterialShapes;
import com.hbm.inventory.recipes.loader.SerializableRecipe;
import com.hbm.items.ItemEnums.EnumAshType;
import com.hbm.items.ItemEnums.EnumPlantType;
@ -63,7 +65,7 @@ public class CrystallizerRecipes extends SerializableRecipe {
registerRecipe(LAPIS.ore(), new CrystallizerRecipe(ModItems.crystal_lapis, baseTime));
registerRecipe(DIAMOND.ore(), new CrystallizerRecipe(ModItems.crystal_diamond, baseTime));
registerRecipe(U.ore(), new CrystallizerRecipe(ModItems.crystal_uranium, baseTime), sulfur);
registerRecipe(TH232.ore(), new CrystallizerRecipe(ModItems.crystal_thorium, baseTime), sulfur);
for(String ore : OreDictManager.TH232.all(MaterialShapes.ORE)) registerRecipe(ore, new CrystallizerRecipe(ModItems.crystal_thorium, baseTime), sulfur);
registerRecipe(PU.ore(), new CrystallizerRecipe(ModItems.crystal_plutonium, baseTime), sulfur);
registerRecipe(TI.ore(), new CrystallizerRecipe(ModItems.crystal_titanium, baseTime), sulfur);
registerRecipe(S.ore(), new CrystallizerRecipe(ModItems.crystal_sulfur, baseTime));

View File

@ -10,7 +10,6 @@ import static com.hbm.inventory.OreDictManager.*;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.stream.JsonWriter;
import com.hbm.inventory.OreNames;
import com.hbm.inventory.RecipesCommon.AStack;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.RecipesCommon.OreDictStack;
@ -19,6 +18,7 @@ import com.hbm.inventory.material.Mats;
import com.hbm.inventory.material.NTMMaterial;
import com.hbm.inventory.recipes.loader.SerializableRecipe;
import com.hbm.items.ItemEnums.EnumBriquetteType;
import com.hbm.items.ItemEnums.EnumCasingType;
import com.hbm.items.ItemEnums.EnumPages;
import com.hbm.items.ItemAmmoEnums.Ammo357Magnum;
import com.hbm.items.ItemAmmoEnums.Ammo556mm;
@ -73,22 +73,29 @@ public class PressRecipes extends SerializableRecipe {
makeRecipe(StampType.FLAT, new OreDictStack(LIGNITE.dust()), DictFrame.fromOne(ModItems.briquette, EnumBriquetteType.LIGNITE));
makeRecipe(StampType.FLAT, new ComparableStack(ModItems.powder_sawdust), DictFrame.fromOne(ModItems.briquette, EnumBriquetteType.WOOD));
makeRecipe(StampType.PLATE, new OreDictStack(IRON.ingot()), ModItems.plate_iron);
makeRecipe(StampType.PLATE, new OreDictStack(GOLD.ingot()), ModItems.plate_gold);
makeRecipe(StampType.PLATE, new OreDictStack(TI.ingot()), ModItems.plate_titanium);
makeRecipe(StampType.PLATE, new OreDictStack(AL.ingot()), ModItems.plate_aluminium);
makeRecipe(StampType.PLATE, new OreDictStack(STEEL.ingot()), ModItems.plate_steel);
makeRecipe(StampType.PLATE, new OreDictStack(PB.ingot()), ModItems.plate_lead);
makeRecipe(StampType.PLATE, new OreDictStack(CU.ingot()), ModItems.plate_copper);
makeRecipe(StampType.PLATE, new OreDictStack(ALLOY.ingot()), ModItems.plate_advanced_alloy);
makeRecipe(StampType.PLATE, new OreDictStack(SA326.ingot()), ModItems.plate_schrabidium);
makeRecipe(StampType.PLATE, new OreDictStack(CMB.ingot()), ModItems.plate_combine_steel);
makeRecipe(StampType.PLATE, new OreDictStack(BIGMT.ingot()), ModItems.plate_saturnite);
makeRecipe(StampType.PLATE, new OreDictStack(DURA.ingot()), ModItems.plate_dura_steel);
makeRecipe(StampType.PLATE, new OreDictStack(IRON.ingot()), ModItems.plate_iron);
makeRecipe(StampType.PLATE, new OreDictStack(GOLD.ingot()), ModItems.plate_gold);
makeRecipe(StampType.PLATE, new OreDictStack(TI.ingot()), ModItems.plate_titanium);
makeRecipe(StampType.PLATE, new OreDictStack(AL.ingot()), ModItems.plate_aluminium);
makeRecipe(StampType.PLATE, new OreDictStack(STEEL.ingot()), ModItems.plate_steel);
makeRecipe(StampType.PLATE, new OreDictStack(PB.ingot()), ModItems.plate_lead);
makeRecipe(StampType.PLATE, new OreDictStack(CU.ingot()), ModItems.plate_copper);
makeRecipe(StampType.PLATE, new OreDictStack(ALLOY.ingot()), ModItems.plate_advanced_alloy);
makeRecipe(StampType.PLATE, new OreDictStack(SA326.ingot()), ModItems.plate_schrabidium);
makeRecipe(StampType.PLATE, new OreDictStack(CMB.ingot()), ModItems.plate_combine_steel);
makeRecipe(StampType.PLATE, new OreDictStack(GUNMETAL.ingot()), ModItems.plate_gunmetal);
makeRecipe(StampType.PLATE, new OreDictStack(WEAPONSTEEL.ingot()), ModItems.plate_weaponsteel);
makeRecipe(StampType.PLATE, new OreDictStack(BIGMT.ingot()), ModItems.plate_saturnite);
makeRecipe(StampType.PLATE, new OreDictStack(DURA.ingot()), ModItems.plate_dura_steel);
makeRecipe(StampType.C9, new OreDictStack(GUNMETAL.plate()), DictFrame.fromOne(ModItems.casing, EnumCasingType.SMALL, 4));
makeRecipe(StampType.C50, new OreDictStack(GUNMETAL.plate()), DictFrame.fromOne(ModItems.casing, EnumCasingType.LARGE, 2));
makeRecipe(StampType.C9, new OreDictStack(WEAPONSTEEL.plate()), DictFrame.fromOne(ModItems.casing, EnumCasingType.SMALL_STEEL, 4));
makeRecipe(StampType.C50, new OreDictStack(WEAPONSTEEL.plate()), DictFrame.fromOne(ModItems.casing, EnumCasingType.LARGE_STEEL, 2));
for(NTMMaterial mat : Mats.orderedList) {
if(mat.shapes.contains(MaterialShapes.WIRE) && mat.shapes.contains(MaterialShapes.INGOT)) {
makeRecipe(StampType.WIRE, new OreDictStack(OreNames.INGOT + mat.names[0]), new ItemStack(ModItems.wire_fine, 8, mat.id));
makeRecipe(StampType.WIRE, new OreDictStack(MaterialShapes.INGOT.make(mat)), new ItemStack(ModItems.wire_fine, 8, mat.id));
}
}

View File

@ -92,7 +92,7 @@ public class PyroOvenRecipes extends SerializableRecipe {
.out(new FluidStack(Fluids.SYNGAS, 1_000)).out(new ItemStack(Items.coal, 1, 1)));
//soot from tar
recipes.add(new PyroOvenRecipe(40)
.out(new FluidStack(Fluids.HYDROGEN, 250)).in(new OreDictStack(ANY_TAR.any(), 8))
.out(new FluidStack(Fluids.HYDROGEN, 250)).in(new OreDictStack(ANY_TAR.any(), 4))
.out(new FluidStack(Fluids.CARBONDIOXIDE, 1_000)).out(DictFrame.fromOne(ModItems.powder_ash, EnumAshType.SOOT)));
//heavyoil from coal
recipes.add(new PyroOvenRecipe(100)

View File

@ -0,0 +1,188 @@
package com.hbm.inventory.recipes;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import static com.hbm.inventory.OreDictManager.*;
import static com.hbm.inventory.material.Mats.*;
import static com.hbm.inventory.material.MaterialShapes.*;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.stream.JsonWriter;
import com.hbm.inventory.FluidStack;
import com.hbm.inventory.RecipesCommon.AStack;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.RecipesCommon.OreDictStack;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.material.Mats;
import com.hbm.inventory.material.Mats.MaterialStack;
import com.hbm.inventory.recipes.loader.SerializableRecipe;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemFluidIcon;
import com.hbm.items.machine.ItemScraps;
import net.minecraft.item.ItemStack;
public class RotaryFurnaceRecipes extends SerializableRecipe {
public static List<RotaryFurnaceRecipe> recipes = new ArrayList();
@Override
public void registerDefaults() {
recipes.add(new RotaryFurnaceRecipe(new MaterialStack(MAT_STEEL, INGOT.q(1)), 100, 100, new OreDictStack(IRON.ingot()), new OreDictStack(COAL.gem())));
recipes.add(new RotaryFurnaceRecipe(new MaterialStack(MAT_STEEL, INGOT.q(1)), 100, 100, new OreDictStack(IRON.ingot()), new OreDictStack(ANY_COKE.gem())));
recipes.add(new RotaryFurnaceRecipe(new MaterialStack(MAT_STEEL, INGOT.q(2)), 100, 100, new OreDictStack(IRON.fragment(), 9), new OreDictStack(COAL.gem())));
recipes.add(new RotaryFurnaceRecipe(new MaterialStack(MAT_STEEL, INGOT.q(3)), 100, 100, new OreDictStack(IRON.fragment(), 9), new OreDictStack(ANY_COKE.gem())));
recipes.add(new RotaryFurnaceRecipe(new MaterialStack(MAT_STEEL, INGOT.q(4)), 200, 100, new OreDictStack(IRON.fragment(), 9), new OreDictStack(ANY_COKE.gem()), new ComparableStack(ModItems.powder_flux)));
recipes.add(new RotaryFurnaceRecipe(new MaterialStack(MAT_DESH, INGOT.q(1)), 100, 200, new FluidStack(Fluids.LIGHTOIL, 100), new ComparableStack(ModItems.powder_desh_ready)));
recipes.add(new RotaryFurnaceRecipe(new MaterialStack(MAT_SATURN, INGOT.q(2)), 200, 400, new FluidStack(Fluids.HEATINGOIL, 250), new OreDictStack(DURA.dust(), 2), new OreDictStack(CU.dust())));
recipes.add(new RotaryFurnaceRecipe(new MaterialStack(MAT_GUNMETAL, INGOT.q(4)), 200, 100, new OreDictStack(CU.ingot(), 3), new OreDictStack(AL.ingot(), 1)));
recipes.add(new RotaryFurnaceRecipe(new MaterialStack(MAT_WEAPONSTEEL, INGOT.q(1)), 200, 400, new FluidStack(Fluids.GAS_COKER, 100), new OreDictStack(STEEL.ingot(), 1), new ComparableStack(ModItems.powder_flux, 2)));
}
public static HashMap getRecipes() {
HashMap<Object, Object> recipes = new HashMap<Object, Object>();
for(RotaryFurnaceRecipe recipe : RotaryFurnaceRecipes.recipes) {
int size = recipe.ingredients.length + (recipe.fluid != null ? 1 : 0);
Object[] array = new Object[size];
for(int i = 0; i < recipe.ingredients.length; i++) {
array[i] = recipe.ingredients[i];
}
if(recipe.fluid != null) array[size - 1] = ItemFluidIcon.make(recipe.fluid);
recipes.put(array, ItemScraps.create(recipe.output, true));
}
return recipes;
}
public static RotaryFurnaceRecipe getRecipe(ItemStack... inputs) {
outer:
for(RotaryFurnaceRecipe recipe : recipes) {
List<AStack> recipeList = new ArrayList();
for(AStack ingredient : recipe.ingredients) recipeList.add(ingredient);
for(int i = 0; i < inputs.length; i++) {
ItemStack inputStack = inputs[i];
if(inputStack != null) {
boolean hasMatch = false;
Iterator<AStack> iterator = recipeList.iterator();
while(iterator.hasNext()) {
AStack recipeStack = iterator.next();
if(recipeStack.matchesRecipe(inputStack, true) && inputStack.stackSize >= recipeStack.stacksize) {
hasMatch = true;
recipeList.remove(recipeStack);
break;
}
}
if(!hasMatch) {
continue outer;
}
}
}
if(recipeList.isEmpty()) return recipe;
}
return null;
}
@Override
public String getFileName() {
return "hbmRotaryFurnace.json";
}
@Override
public Object getRecipeObject() {
return recipes;
}
@Override
public void deleteRecipes() {
recipes.clear();
}
@Override
public void readRecipe(JsonElement recipe) {
JsonObject obj = (JsonObject) recipe;
AStack[] inputs = this.readAStackArray(obj.get("inputs").getAsJsonArray());
FluidStack fluid = obj.has("fluid") ? this.readFluidStack(obj.get("fluid").getAsJsonArray()) : null;
JsonArray array = obj.get("output").getAsJsonArray();
MaterialStack stack = new MaterialStack(Mats.matByName.get(array.get(0).getAsString()), array.get(1).getAsInt());
int duration = obj.get("duration").getAsInt();
int steam = obj.get("steam").getAsInt();
recipes.add(new RotaryFurnaceRecipe(stack, duration, steam, fluid, inputs));
}
@Override
public void writeRecipe(Object obj, JsonWriter writer) throws IOException {
RotaryFurnaceRecipe recipe = (RotaryFurnaceRecipe) obj;
writer.name("inputs").beginArray();
for(AStack aStack : recipe.ingredients) {
this.writeAStack(aStack, writer);
}
writer.endArray();
if(recipe.fluid != null) {
writer.name("fluid");
this.writeFluidStack(recipe.fluid, writer);
}
writer.name("output").beginArray();
writer.setIndent("");
writer.value(recipe.output.material.names[0]).value(recipe.output.amount);
writer.endArray();
writer.setIndent(" ");
writer.name("duration").value(recipe.duration);
writer.name("steam").value(recipe.steam);
}
public static class RotaryFurnaceRecipe {
public AStack[] ingredients;
public FluidStack fluid;
public MaterialStack output;
public int duration;
public int steam;
public RotaryFurnaceRecipe(MaterialStack output, int duration, int steam, FluidStack fluid, AStack... ingredients) {
this.ingredients = ingredients;
this.fluid = fluid;
this.output = output;
this.duration = duration;
this.steam = steam;
}
public RotaryFurnaceRecipe(MaterialStack output, int duration, int steam, AStack... ingredients) {
this(output, duration, steam, null, ingredients);
}
}
}

View File

@ -20,6 +20,7 @@ import com.hbm.util.WeightedRandomObject;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraftforge.oredict.OreDictionary;
public class SILEXRecipes {
@ -642,6 +643,15 @@ public class SILEXRecipes {
recipes.put(new ComparableStack(ModItems.fluid_icon, 1, Fluids.FULLERENE.getID()),
new SILEXRecipe(1_000, 1_000, EnumWavelengths.UV).addOut(DictFrame.fromOne(ModItems.powder_ash, EnumAshType.FULLERENE), 1));
}
private static final HashMap<Item, Item> tinyWasteTranslation = new HashMap();
static {
tinyWasteTranslation.put(ModItems.nuclear_waste_short_tiny, ModItems.nuclear_waste_short);
tinyWasteTranslation.put(ModItems.nuclear_waste_long_tiny, ModItems.nuclear_waste_long);
tinyWasteTranslation.put(ModItems.nuclear_waste_short_depleted_tiny, ModItems.nuclear_waste_short_depleted);
tinyWasteTranslation.put(ModItems.nuclear_waste_long_depleted_tiny, ModItems.nuclear_waste_long_depleted);
}
public static SILEXRecipe getOutput(ItemStack stack) {
@ -656,11 +666,27 @@ public class SILEXRecipes {
String[] dictKeys = comp.getDictKeys();
for(String key : dictKeys) {
String translation = translateDict(key);
if(recipes.containsKey(translation))
return recipes.get(translation);
}
if(tinyWasteTranslation.containsKey(comp.item)) {
SILEXRecipe result = getOutput(new ItemStack(tinyWasteTranslation.get(comp.item), comp.stacksize, comp.meta));
if(result != null) {
// This way it rounds down if somehow the recipe's fluid produced is not divisible by 900
int fluidProduced = (result.fluidProduced / 900) * 100;
SILEXRecipe tinyVersion = new SILEXRecipe(fluidProduced, result.fluidConsumed, result.laserStrength);
// Shared ownership shouldn't be an issue since the resulting recipe isn't modified by the caller
tinyVersion.outputs = result.outputs;
// TODO: Cache? Might break saving recipes, IDK
// recipes.put(comp, tinyVersion);
return tinyVersion;
}
}
return null;
}

View File

@ -6,7 +6,6 @@ import java.util.List;
import com.hbm.blocks.ModBlocks;
import com.hbm.config.GeneralConfig;
import com.hbm.inventory.OreDictManager;
import com.hbm.inventory.OreNames;
import com.hbm.inventory.OreDictManager.DictFrame;
import static com.hbm.inventory.OreDictManager.*;
@ -110,8 +109,8 @@ public class AnvilRecipes {
new ItemStack(ModItems.stamp_titanium_flat),
new ItemStack(ModItems.stamp_obsidian_flat)
}));
smithingRecipes.add(new AnvilSmithingMold(8, new OreDictStack(STEEL.shell()), new OreDictStack(OreNames.SHELL)));
smithingRecipes.add(new AnvilSmithingMold(9, new OreDictStack(STEEL.pipe()), new OreDictStack(OreNames.PIPE)));
smithingRecipes.add(new AnvilSmithingMold(8, new OreDictStack(STEEL.shell()), new OreDictStack(MaterialShapes.SHELL.name())));
smithingRecipes.add(new AnvilSmithingMold(9, new OreDictStack(STEEL.pipe()), new OreDictStack(MaterialShapes.PIPE.name())));
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(12, new OreDictStack(IRON.block()), new OreDictStack("block")));
@ -152,7 +151,7 @@ public class AnvilRecipes {
for(NTMMaterial mat : Mats.orderedList) {
if(mat.shapes.contains(MaterialShapes.WIRE) && mat.shapes.contains(MaterialShapes.INGOT)) {
constructionRecipes.add(new AnvilConstructionRecipe(new OreDictStack(OreNames.INGOT + mat.names[0]), new AnvilOutput(new ItemStack(ModItems.wire_fine, 8, mat.id))).setTier(4));
constructionRecipes.add(new AnvilConstructionRecipe(new OreDictStack(MaterialShapes.INGOT.name() + mat.names[0]), new AnvilOutput(new ItemStack(ModItems.wire_fine, 8, mat.id))).setTier(4));
}
}
@ -307,6 +306,14 @@ public class AnvilRecipes {
new OreDictStack(KEY_BRICK, 16)
}, new AnvilOutput(new ItemStack(ModBlocks.furnace_combination))).setTier(2));
constructionRecipes.add(new AnvilConstructionRecipe(
new AStack[] {
new ComparableStack(Blocks.stonebrick, 8),
new ComparableStack(ModItems.ingot_firebrick, 16),
new OreDictStack(IRON.ingot(), 4),
new OreDictStack(CU.plate(), 8),
}, new AnvilOutput(new ItemStack(ModBlocks.machine_rotary_furnace))).setTier(2));
constructionRecipes.add(new AnvilConstructionRecipe(
new AStack[] {
new OreDictStack(KEY_PLANKS, 16),
@ -562,6 +569,14 @@ public class AnvilRecipes {
}
public static void registerConstructionAmmo() {
constructionRecipes.add(new AnvilConstructionRecipe(new AStack[]{new ComparableStack(ModItems.mold_base), new OreDictStack(STEEL.ingot(), 4)}, new AnvilOutput(new ItemStack(ModItems.mold, 1, 22))).setTier(2));
constructionRecipes.add(new AnvilConstructionRecipe(new AStack[]{new ComparableStack(ModItems.mold_base), new OreDictStack(STEEL.ingot(), 4)}, new AnvilOutput(new ItemStack(ModItems.mold, 1, 23))).setTier(2));
constructionRecipes.add(new AnvilConstructionRecipe(new AStack[]{new ComparableStack(ModItems.mold_base), new OreDictStack(STEEL.ingot(), 4)}, new AnvilOutput(new ItemStack(ModItems.mold, 1, 24))).setTier(2));
constructionRecipes.add(new AnvilConstructionRecipe(new AStack[]{new ComparableStack(ModItems.mold_base), new OreDictStack(STEEL.ingot(), 4)}, new AnvilOutput(new ItemStack(ModItems.mold, 1, 25))).setTier(2));
constructionRecipes.add(new AnvilConstructionRecipe(new AStack[]{new ComparableStack(ModItems.mold_base), new OreDictStack(STEEL.ingot(), 4)}, new AnvilOutput(new ItemStack(ModItems.mold, 1, 26))).setTier(2));
constructionRecipes.add(new AnvilConstructionRecipe(new AStack[]{new ComparableStack(ModItems.mold_base), new OreDictStack(STEEL.ingot(), 4)}, new AnvilOutput(new ItemStack(ModItems.mold, 1, 27))).setTier(2));
constructionRecipes.add(new AnvilConstructionRecipe(new AStack[]{new ComparableStack(ModItems.mold_base), new OreDictStack(STEEL.ingot(), 4)}, new AnvilOutput(new ItemStack(ModItems.mold, 1, 28))).setTier(2));
constructionRecipes.add(new AnvilConstructionRecipe(new OreDictStack(CU.plate()), new AnvilOutput(new ItemStack(ModItems.casing_357))).setTier(1));
constructionRecipes.add(new AnvilConstructionRecipe(new OreDictStack(CU.plate()), new AnvilOutput(new ItemStack(ModItems.casing_44))).setTier(1));

View File

@ -2,10 +2,10 @@ package com.hbm.inventory.recipes.anvil;
import java.util.List;
import com.hbm.inventory.OreNames;
import com.hbm.inventory.RecipesCommon.AStack;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.RecipesCommon.OreDictStack;
import com.hbm.inventory.material.MaterialShapes;
import com.hbm.items.ModItems;
import com.hbm.util.ItemStackUtil;
@ -34,7 +34,7 @@ public class AnvilSmithingMold extends AnvilSmithingRecipe {
for(String name : names) {
for(String otherPrefix : OreNames.prefixes) {
for(MaterialShapes shape : MaterialShapes.allShapes) for(String otherPrefix : shape.prefixes) {
if(otherPrefix.length() > matchesPrefix.name.length() && name.startsWith(otherPrefix)) {
return false; //ignore if there's a longer prefix that matches (i.e. a more accurate match)
}

View File

@ -37,6 +37,8 @@ public abstract class SerializableRecipe {
public static final Gson gson = new Gson();
public static List<SerializableRecipe> recipeHandlers = new ArrayList();
public boolean modified = false;
/*
* INIT
*/
@ -69,6 +71,7 @@ public abstract class SerializableRecipe {
recipeHandlers.add(new ElectrolyserFluidRecipes());
recipeHandlers.add(new ElectrolyserMetalRecipes());
recipeHandlers.add(new ArcWelderRecipes());
recipeHandlers.add(new RotaryFurnaceRecipes());
recipeHandlers.add(new ExposureChamberRecipes());
recipeHandlers.add(new AssemblerRecipes());
@ -100,6 +103,7 @@ public abstract class SerializableRecipe {
if(recFile.exists() && recFile.isFile()) {
MainRegistry.logger.info("Reading recipe file " + recFile.getName());
recipe.readRecipeFile(recFile);
recipe.modified = true;
} else {
MainRegistry.logger.info("No recipe file found, registering defaults for " + recipe.getFileName());
recipe.registerDefaults();
@ -107,6 +111,7 @@ public abstract class SerializableRecipe {
File recTemplate = new File(recDir.getAbsolutePath() + File.separatorChar + "_" + recipe.getFileName());
MainRegistry.logger.info("Writing template file " + recTemplate.getName());
recipe.writeTemplateFile(recTemplate);
recipe.modified = false;
}
recipe.registerPost();

View File

@ -98,7 +98,7 @@ public class ItemPoolsPile {
//makeshift gun
new ItemPool(POOL_PILE_MAKESHIFT_GUN) {{ this.pool = new WeightedRandomChestContent[] { weighted(ModItems.gun_lever_action, 0, 1, 1, 10) }; }};
new ItemPool(POOL_PILE_MAKESHIFT_WRENCH) {{ this.pool = new WeightedRandomChestContent[] { weighted(ModItems.wrench, 0, 1, 1, 10) }; }};
new ItemPool(POOL_PILE_MAKESHIFT_PLATES) {{ this.pool = new WeightedRandomChestContent[] { weighted(ModItems.plate_combine_steel, 0, 1, 1, 10) }; }};
new ItemPool(POOL_PILE_MAKESHIFT_PLATES) {{ this.pool = new WeightedRandomChestContent[] { weighted(ModItems.plate_steel, 0, 1, 1, 10) }; }};
new ItemPool(POOL_PILE_MAKESHIFT_WIRE) {{ this.pool = new WeightedRandomChestContent[] { weighted(ModItems.wire_fine, Mats.MAT_ALUMINIUM.id, 1, 1, 10) }; }};
new ItemPool(POOL_PILE_NUKE_STORAGE) {{

View File

@ -51,23 +51,27 @@ public class ItemCustomLore extends Item {
if(this == ModItems.undefined) {
if(player.worldObj.rand.nextInt(10) == 0) {
list.add(EnumChatFormatting.DARK_RED + "UNDEFINED");
} else {
Random rand = new Random(System.currentTimeMillis() / 500);
if(setSize == 0)
setSize = Item.itemRegistry.getKeys().size();
int r = rand.nextInt(setSize);
Item item = Item.getItemById(r);
if(item != null) {
list.add(new ItemStack(item).getDisplayName());
try {
if(player.worldObj.rand.nextInt(10) == 0) {
list.add(EnumChatFormatting.DARK_RED + "UNDEFINED");
} else {
list.add(EnumChatFormatting.RED + "ERROR #" + r);
Random rand = new Random(System.currentTimeMillis() / 500);
if(setSize == 0)
setSize = Item.itemRegistry.getKeys().size();
int r = rand.nextInt(setSize);
Item item = Item.getItemById(r);
if(item != null) {
list.add(new ItemStack(item).getDisplayName());
} else {
list.add(EnumChatFormatting.RED + "ERROR #" + r);
}
}
} catch(Exception ex) {
list.add(EnumChatFormatting.DARK_RED + "UNDEFINED");
}
}
}

View File

@ -79,4 +79,8 @@ public class ItemEnums {
public static enum EnumSecretType {
CANISTER, CONTROLLER
}
public static enum EnumCasingType {
SMALL, LARGE, SMALL_STEEL, LARGE_STEEL, SHOTSHELL, BUCKSHOT
}
}

View File

@ -191,6 +191,10 @@ public class ModItems {
public static Item nugget_tetraneutronium;
public static Item powder_tetraneutronium;
public static Item ingot_starmetal;
public static Item ingot_gunmetal;
public static Item plate_gunmetal;
public static Item ingot_weaponsteel;
public static Item plate_weaponsteel;
public static Item ingot_saturnite;
public static Item plate_saturnite;
public static Item ingot_ferrouranium;
@ -640,6 +644,8 @@ public class ModItems {
public static Item assembly_nuke;
public static Item assembly_luna;
public static Item casing;
public static Item folly_shell;
public static Item folly_bullet;
public static Item folly_bullet_nuclear;
@ -768,6 +774,13 @@ public class ModItems {
public static Item heavy_component;
public static Item wire_fine;
public static Item wire_dense;
public static Item part_barrel_light;
public static Item part_barrel_heavy;
public static Item part_receiver_light;
public static Item part_receiver_heavy;
public static Item part_mechanism;
public static Item part_stock;
public static Item part_grip;
public static Item part_lithium;
public static Item part_beryllium;
@ -1519,7 +1532,6 @@ public class ModItems {
public static Item gun_panzerschreck;
public static Item gun_quadro;
public static Item gun_hk69;
public static Item gun_congolake;
public static Item gun_stinger;
public static Item gun_skystinger;
public static Item gun_revolver;
@ -1612,6 +1624,21 @@ public class ModItems {
public static Item gun_debug;
public static Item ammo_debug;
public static Item gun_pepperbox;
public static Item gun_light_revolver;
public static Item gun_light_revolver_dani;
public static Item gun_henry;
public static Item gun_greasegun;
public static Item gun_maresleg;
public static Item gun_flaregun;
public static Item gun_heavy_revolver;
public static Item gun_carbine;
public static Item gun_am180;
public static Item gun_liberator;
public static Item gun_congolake;
public static Item ammo_standard;
public static Item crucible;
@ -2616,6 +2643,10 @@ public class ModItems {
nugget_dineutronium = new ItemCustomLore().setUnlocalizedName("nugget_dineutronium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":nugget_dineutronium");
powder_dineutronium = new ItemCustomLore().setUnlocalizedName("powder_dineutronium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_dineutronium");
ingot_starmetal = new ItemStarmetal().setUnlocalizedName("ingot_starmetal").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_starmetal");
ingot_gunmetal = new Item().setUnlocalizedName("ingot_gunmetal").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_gunmetal");
plate_gunmetal = new Item().setUnlocalizedName("plate_gunmetal").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":plate_gunmetal");
ingot_weaponsteel = new Item().setUnlocalizedName("ingot_weaponsteel").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_gunsteel");
plate_weaponsteel = new Item().setUnlocalizedName("plate_weaponsteel").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":plate_gunsteel");
ingot_saturnite = new ItemCustomLore().setRarity(EnumRarity.rare).setUnlocalizedName("ingot_saturnite").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_saturnite");
plate_saturnite = new ItemCustomLore().setRarity(EnumRarity.rare).setUnlocalizedName("plate_saturnite").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":plate_saturnite");
ingot_ferrouranium = new ItemCustomLore().setUnlocalizedName("ingot_ferrouranium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_ferrouranium");
@ -3054,6 +3085,7 @@ public class ModItems {
folly_bullet = new Item().setUnlocalizedName("folly_bullet").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":folly_bullet");
folly_bullet_nuclear = new Item().setUnlocalizedName("folly_bullet_nuclear").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":folly_bullet_nuclear");
folly_bullet_du = new Item().setUnlocalizedName("folly_bullet_du").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":folly_bullet_du");
casing = new ItemEnumMulti(ItemEnums.EnumCasingType.class, true, true).setUnlocalizedName("casing").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":casing");
wiring_red_copper = new ItemWiring().setUnlocalizedName("wiring_red_copper").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":wiring_red_copper");
@ -3193,6 +3225,14 @@ public class ModItems {
.aot(Mats.MAT_CARBON, "wire_carbon").aot(Mats.MAT_SCHRABIDIUM, "wire_schrabidium")
.aot(Mats.MAT_MAGTUNG, "wire_magnetized_tungsten").setUnlocalizedName("wire_fine").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":wire_fine");
wire_dense = new ItemAutogen(MaterialShapes.DENSEWIRE).setUnlocalizedName("wire_dense").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":wire_dense");
part_barrel_light = new ItemAutogen(MaterialShapes.LIGHTBARREL).setUnlocalizedName("part_barrel_light").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":part_barrel_light");
part_barrel_heavy = new ItemAutogen(MaterialShapes.HEAVYBARREL).setUnlocalizedName("part_barrel_heavy").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":part_barrel_heavy");
part_receiver_light = new ItemAutogen(MaterialShapes.LIGHTRECEIVER).setUnlocalizedName("part_receiver_light").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":part_receiver_light");
part_receiver_heavy = new ItemAutogen(MaterialShapes.HEAVYRECEIVER).setUnlocalizedName("part_receiver_heavy").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":part_receiver_heavy");
part_mechanism = new ItemAutogen(MaterialShapes.MECHANISM).setUnlocalizedName("part_mechanism").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":part_mechanism");
part_stock = new ItemAutogen(MaterialShapes.STOCK).setUnlocalizedName("part_stock").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":part_stock");
part_grip = new ItemAutogen(MaterialShapes.GRIP).setUnlocalizedName("part_grip").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":part_grip");
part_lithium = new Item().setUnlocalizedName("part_lithium").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":part_lithium");
part_beryllium = new Item().setUnlocalizedName("part_beryllium").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":part_beryllium");
@ -4070,7 +4110,7 @@ public class ModItems {
gun_panzerschreck = new ItemGunBase(GunRocketFactory.getPanzConfig()).setUnlocalizedName("gun_panzerschreck").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_panzerschreck");
gun_quadro = new ItemGunBase(GunRocketFactory.getQuadroConfig()).setUnlocalizedName("gun_quadro").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_quadro");
gun_hk69 = new ItemGunBase(GunGrenadeFactory.getHK69Config()).setUnlocalizedName("gun_hk69").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_hk69");
gun_congolake = new ItemGunBase(GunGrenadeFactory.getCongoConfig()).setUnlocalizedName("gun_congolake").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_congolake");
//gun_congolake = new ItemGunBase(GunGrenadeFactory.getCongoConfig()).setUnlocalizedName("gun_congolake").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_congolake");
gun_stinger = new ItemGunBase(GunRocketHomingFactory.getStingerConfig()).setUnlocalizedName("gun_stinger").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_stinger");
gun_skystinger = new ItemGunBase(GunRocketHomingFactory.getSkyStingerConfig()).setUnlocalizedName("gun_skystinger").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_skystinger");
gun_revolver = new ItemGunBase(Gun357MagnumFactory.getRevolverConfig()).setUnlocalizedName("gun_revolver").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_revolver");
@ -5581,6 +5621,8 @@ public class ModItems {
GameRegistry.registerItem(ingot_desh, ingot_desh.getUnlocalizedName());
GameRegistry.registerItem(ingot_ferrouranium, ingot_ferrouranium.getUnlocalizedName());
GameRegistry.registerItem(ingot_starmetal, ingot_starmetal.getUnlocalizedName());
GameRegistry.registerItem(ingot_gunmetal, ingot_gunmetal.getUnlocalizedName());
GameRegistry.registerItem(ingot_weaponsteel, ingot_weaponsteel.getUnlocalizedName());
GameRegistry.registerItem(ingot_saturnite, ingot_saturnite.getUnlocalizedName());
GameRegistry.registerItem(ingot_euphemium, ingot_euphemium.getUnlocalizedName());
GameRegistry.registerItem(ingot_dineutronium, ingot_dineutronium.getUnlocalizedName());
@ -5948,6 +5990,8 @@ public class ModItems {
GameRegistry.registerItem(plate_schrabidium, plate_schrabidium.getUnlocalizedName());
GameRegistry.registerItem(plate_combine_steel, plate_combine_steel.getUnlocalizedName());
GameRegistry.registerItem(plate_mixed, plate_mixed.getUnlocalizedName());
GameRegistry.registerItem(plate_gunmetal, plate_gunmetal.getUnlocalizedName());
GameRegistry.registerItem(plate_weaponsteel, plate_weaponsteel.getUnlocalizedName());
GameRegistry.registerItem(plate_saturnite, plate_saturnite.getUnlocalizedName());
GameRegistry.registerItem(plate_paa, plate_paa.getUnlocalizedName());
GameRegistry.registerItem(plate_polymer, plate_polymer.getUnlocalizedName());
@ -6014,15 +6058,9 @@ public class ModItems {
GameRegistry.registerItem(motor_desh, motor_desh.getUnlocalizedName());
GameRegistry.registerItem(motor_bismuth, motor_bismuth.getUnlocalizedName());
GameRegistry.registerItem(centrifuge_element, centrifuge_element.getUnlocalizedName());
//GameRegistry.registerItem(centrifuge_tower, centrifuge_tower.getUnlocalizedName());
//GameRegistry.registerItem(magnet_dee, magnet_dee.getUnlocalizedName());
GameRegistry.registerItem(magnet_circular, magnet_circular.getUnlocalizedName());
//GameRegistry.registerItem(cyclotron_tower, cyclotron_tower.getUnlocalizedName());
GameRegistry.registerItem(reactor_core, reactor_core.getUnlocalizedName());
GameRegistry.registerItem(rtg_unit, rtg_unit.getUnlocalizedName());
//GameRegistry.registerItem(thermo_unit_empty, thermo_unit_empty.getUnlocalizedName());
//GameRegistry.registerItem(thermo_unit_endo, thermo_unit_endo.getUnlocalizedName());
//GameRegistry.registerItem(thermo_unit_exo, thermo_unit_exo.getUnlocalizedName());
GameRegistry.registerItem(levitation_unit, levitation_unit.getUnlocalizedName());
GameRegistry.registerItem(pipes_steel, pipes_steel.getUnlocalizedName());
GameRegistry.registerItem(drill_titanium, drill_titanium.getUnlocalizedName());
@ -6037,6 +6075,13 @@ public class ModItems {
GameRegistry.registerItem(parts_legendary, parts_legendary.getUnlocalizedName());
GameRegistry.registerItem(gear_large, gear_large.getUnlocalizedName());
GameRegistry.registerItem(sawblade, sawblade.getUnlocalizedName());
GameRegistry.registerItem(part_barrel_light, part_barrel_light.getUnlocalizedName());
GameRegistry.registerItem(part_barrel_heavy, part_barrel_heavy.getUnlocalizedName());
GameRegistry.registerItem(part_receiver_light, part_receiver_light.getUnlocalizedName());
GameRegistry.registerItem(part_receiver_heavy, part_receiver_heavy.getUnlocalizedName());
GameRegistry.registerItem(part_mechanism, part_mechanism.getUnlocalizedName());
GameRegistry.registerItem(part_stock, part_stock.getUnlocalizedName());
GameRegistry.registerItem(part_grip, part_grip.getUnlocalizedName());
//Plant Products
GameRegistry.registerItem(plant_item, plant_item.getUnlocalizedName());
@ -6136,6 +6181,8 @@ public class ModItems {
GameRegistry.registerItem(casing_50, casing_50.getUnlocalizedName());
GameRegistry.registerItem(casing_buckshot, casing_buckshot.getUnlocalizedName());
GameRegistry.registerItem(casing, casing.getUnlocalizedName());
//Bullet Assemblies
GameRegistry.registerItem(assembly_iron, assembly_iron.getUnlocalizedName());
GameRegistry.registerItem(assembly_steel, assembly_steel.getUnlocalizedName());
@ -6950,7 +6997,6 @@ public class ModItems {
GameRegistry.registerItem(gun_panzerschreck, gun_panzerschreck.getUnlocalizedName());
GameRegistry.registerItem(gun_quadro, gun_quadro.getUnlocalizedName());
GameRegistry.registerItem(gun_hk69, gun_hk69.getUnlocalizedName());
GameRegistry.registerItem(gun_congolake, gun_congolake.getUnlocalizedName());
GameRegistry.registerItem(gun_stinger, gun_stinger.getUnlocalizedName());
GameRegistry.registerItem(gun_fatman, gun_fatman.getUnlocalizedName());
GameRegistry.registerItem(gun_proto, gun_proto.getUnlocalizedName());
@ -7010,6 +7056,21 @@ public class ModItems {
GameRegistry.registerItem(gun_debug, gun_debug.getUnlocalizedName());
GameRegistry.registerItem(ammo_debug, ammo_debug.getUnlocalizedName());
GameRegistry.registerItem(gun_pepperbox, gun_pepperbox.getUnlocalizedName());
GameRegistry.registerItem(gun_light_revolver, gun_light_revolver.getUnlocalizedName());
GameRegistry.registerItem(gun_light_revolver_dani, gun_light_revolver_dani.getUnlocalizedName());
GameRegistry.registerItem(gun_henry, gun_henry.getUnlocalizedName());
GameRegistry.registerItem(gun_greasegun, gun_greasegun.getUnlocalizedName());
GameRegistry.registerItem(gun_maresleg, gun_maresleg.getUnlocalizedName());
GameRegistry.registerItem(gun_flaregun, gun_flaregun.getUnlocalizedName());
GameRegistry.registerItem(gun_heavy_revolver, gun_heavy_revolver.getUnlocalizedName());
GameRegistry.registerItem(gun_carbine, gun_carbine.getUnlocalizedName());
GameRegistry.registerItem(gun_am180, gun_am180.getUnlocalizedName());
GameRegistry.registerItem(gun_liberator, gun_liberator.getUnlocalizedName());
GameRegistry.registerItem(gun_congolake, gun_congolake.getUnlocalizedName());
GameRegistry.registerItem(ammo_standard, ammo_standard.getUnlocalizedName());
//Ammo
GameRegistry.registerItem(gun_b92_ammo, gun_b92_ammo.getUnlocalizedName());
GameRegistry.registerItem(gun_xvl1456_ammo, gun_xvl1456_ammo.getUnlocalizedName());

View File

@ -80,6 +80,14 @@ public class ItemMold extends Item {
registerMold(new MoldSingle( 16, S, "c9", new ItemStack(ModItems.casing_9), Mats.MAT_COPPER, MaterialShapes.PLATE.q(1)));
registerMold(new MoldSingle( 17, S, "c50", new ItemStack(ModItems.casing_50), Mats.MAT_COPPER, MaterialShapes.PLATE.q(1)));
registerMold(new MoldSingle( 18, S, "cbuckshot", new ItemStack(ModItems.casing_buckshot), Mats.MAT_COPPER, MaterialShapes.PLATE.q(1)));
registerMold(new MoldShape( 22, S, "barrel_light", MaterialShapes.LIGHTBARREL));
registerMold(new MoldShape( 23, S, "barrel_heavy", MaterialShapes.HEAVYBARREL));
registerMold(new MoldShape( 24, S, "receiver_light", MaterialShapes.LIGHTRECEIVER));
registerMold(new MoldShape( 25, S, "receiver_heavy", MaterialShapes.HEAVYRECEIVER));
registerMold(new MoldShape( 26, S, "mechanism", MaterialShapes.MECHANISM));
registerMold(new MoldShape( 27, S, "stock", MaterialShapes.STOCK));
registerMold(new MoldShape( 28, S, "grip", MaterialShapes.GRIP));
}
public void registerMold(Mold mold) {

View File

@ -38,7 +38,7 @@ public class ItemBedrockOreBase extends Item {
for(BedrockOreType type : BedrockOreType.values()) {
double amount = this.getOreAmount(stack, type);
String typeName = StatCollector.translateToLocalFormatted("item.bedrock_ore.type." + type.suffix + ".name");
list.add(typeName + ": " + ((int) (amount * 100)) / 100D + " (" + ItemOreDensityScanner.translateDensity(amount) + EnumChatFormatting.RESET + ")");
list.add(typeName + ": " + ((int) (amount * 100)) / 100D + " (" + StatCollector.translateToLocalFormatted(ItemOreDensityScanner.translateDensity(amount)) + EnumChatFormatting.RESET + ")");
}
}

View File

@ -127,7 +127,7 @@ public class ItemBoltgun extends Item implements IAnimatedItem {
public BusAnimation getAnimation(NBTTagCompound data, ItemStack stack) {
return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframePosition(1, 0, 1, 50)
.addKeyframePosition(0, 0, 1, 100));
.addPos(1, 0, 1, 50)
.addPos(0, 0, 1, 100));
}
}

View File

@ -22,16 +22,16 @@ public class ItemCoilgun extends ItemGunBase {
if(type == AnimType.CYCLE) {
return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframePosition(1, 0, 0, 100)
.addKeyframePosition(0, 0, 0, 200));
.addPos(1, 0, 0, 100)
.addPos(0, 0, 0, 200));
}
if(type == AnimType.RELOAD) {
return new BusAnimation()
.addBus("RELOAD", new BusAnimationSequence()
.addKeyframePosition(1, 0, 0, 250)
.addKeyframePosition(1, 0, 0, 500)
.addKeyframePosition(0, 0, 0, 250));
.addPos(1, 0, 0, 250)
.addPos(1, 0, 0, 500)
.addPos(0, 0, 0, 250));
}
GunConfiguration config = ((ItemGunBase) stack.getItem()).mainConfig;

View File

@ -69,54 +69,54 @@ public class ItemGunBio extends ItemGunBase {
lastShot = System.currentTimeMillis();
return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframePosition(0, 0, 0, 50)
.addKeyframePosition(0, 0, -3, 50)
.addKeyframePosition(0, 0, 0, 250)
.addPos(0, 0, 0, 50)
.addPos(0, 0, -3, 50)
.addPos(0, 0, 0, 250)
)
.addBus("HAMMER", new BusAnimationSequence()
.addKeyframePosition(0, 0, 1, 50)
.addKeyframePosition(0, 0, 1, 300)
.addKeyframePosition(0, 0, 0, 200)
.addPos(0, 0, 1, 50)
.addPos(0, 0, 1, 300)
.addPos(0, 0, 0, 200)
)
.addBus("DRUM", new BusAnimationSequence()
.addKeyframePosition(0, 0, 1, 50)
.addPos(0, 0, 1, 50)
);
}
if(type == AnimType.RELOAD) {
return new BusAnimation()
.addBus("LATCH", new BusAnimationSequence()
.addKeyframePosition(0, 0, 90, 300)
.addKeyframePosition(0, 0, 90, 2000)
.addKeyframePosition(0, 0, 0, 150)
.addPos(0, 0, 90, 300)
.addPos(0, 0, 90, 2000)
.addPos(0, 0, 0, 150)
)
.addBus("FRONT", new BusAnimationSequence()
.addKeyframePosition(0, 0, 0, 200)
.addKeyframePosition(0, 0, 45, 150)
.addKeyframePosition(0, 0, 45, 2000)
.addKeyframePosition(0, 0, 0, 75)
.addPos(0, 0, 0, 200)
.addPos(0, 0, 45, 150)
.addPos(0, 0, 45, 2000)
.addPos(0, 0, 0, 75)
)
.addBus("RELOAD_ROT", new BusAnimationSequence()
.addKeyframePosition(0, 0, 0, 300)
.addKeyframePosition(60, 0, 0, 500)
.addKeyframePosition(60, 0, 0, 500)
.addKeyframePosition(0, -90, -90, 0)
.addKeyframePosition(0, -90, -90, 600)
.addKeyframePosition(0, 0, 0, 300)
.addKeyframePosition(0, 0, 0, 100)
.addKeyframePosition(-45, 0, 0, 50)
.addKeyframePosition(-45, 0, 0, 100)
.addKeyframePosition(0, 0, 0, 300)
.addPos(0, 0, 0, 300)
.addPos(60, 0, 0, 500)
.addPos(60, 0, 0, 500)
.addPos(0, -90, -90, 0)
.addPos(0, -90, -90, 600)
.addPos(0, 0, 0, 300)
.addPos(0, 0, 0, 100)
.addPos(-45, 0, 0, 50)
.addPos(-45, 0, 0, 100)
.addPos(0, 0, 0, 300)
)
.addBus("RELOAD_MOVE", new BusAnimationSequence()
.addKeyframePosition(0, 0, 0, 300)
.addKeyframePosition(0, -15, 0, 1000)
.addKeyframePosition(0, 0, 0, 450)
.addPos(0, 0, 0, 300)
.addPos(0, -15, 0, 1000)
.addPos(0, 0, 0, 450)
)
.addBus("DRUM_PUSH", new BusAnimationSequence()
.addKeyframePosition(0, 0, 0, 1600)
.addKeyframePosition(0, 0, -5, 0)
.addKeyframePosition(0, 0, 0, 300)
.addPos(0, 0, 0, 1600)
.addPos(0, 0, -5, 0)
.addPos(0, 0, 0, 300)
);
}

View File

@ -64,7 +64,7 @@ public class ItemGunPip extends ItemGunBase {
if(type == AnimType.EQUIP) {
return new BusAnimation()
.addBus("ROTATE", new BusAnimationSequence()
.addKeyframePosition(-360, 0, 0, 350)
.addPos(-360, 0, 0, 350)
);
}
@ -73,17 +73,17 @@ public class ItemGunPip extends ItemGunBase {
int s = 1;
return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframePosition(0, 0, 0, 50 * s)
.addKeyframePosition(0, 0, -3, 50 * s)
.addKeyframePosition(0, 0, 0, 250 * s)
.addPos(0, 0, 0, 50 * s)
.addPos(0, 0, -3, 50 * s)
.addPos(0, 0, 0, 250 * s)
)
.addBus("HAMMER", new BusAnimationSequence()
.addKeyframePosition(0, 0, 1, 50 * s)
.addKeyframePosition(0, 0, 1, 300 * s)
.addKeyframePosition(0, 0, 0, 200 * s)
.addPos(0, 0, 1, 50 * s)
.addPos(0, 0, 1, 300 * s)
.addPos(0, 0, 0, 200 * s)
)
.addBus("DRUM", new BusAnimationSequence()
.addKeyframePosition(0, 0, 1, 50 * s)
.addPos(0, 0, 1, 50 * s)
);
}
@ -91,44 +91,44 @@ public class ItemGunPip extends ItemGunBase {
int s = 1;
return new BusAnimation()
.addBus("RELAOD_TILT", new BusAnimationSequence()
.addKeyframePosition(-15, 0, 0, 100 * s)
.addKeyframePosition(65, 0, 0, 100 * s) //200
.addKeyframePosition(45, 0, 0, 50 * s) //250
.addKeyframePosition(0, 0, 0, 200 * s) //450
.addKeyframePosition(0, 0, 0, 1450 * s) //1900
.addKeyframePosition(-80, 0, 0, 100 * s) //2000
.addKeyframePosition(-80, 0, 0, 100 * s) //2100
.addKeyframePosition(0, 0, 0, 200 * s) //2300
.addPos(-15, 0, 0, 100 * s)
.addPos(65, 0, 0, 100 * s) //200
.addPos(45, 0, 0, 50 * s) //250
.addPos(0, 0, 0, 200 * s) //450
.addPos(0, 0, 0, 1450 * s) //1900
.addPos(-80, 0, 0, 100 * s) //2000
.addPos(-80, 0, 0, 100 * s) //2100
.addPos(0, 0, 0, 200 * s) //2300
)
.addBus("RELOAD_CYLINDER", new BusAnimationSequence()
.addKeyframePosition(0, 0, 0, 200 * s)
.addKeyframePosition(90, 0, 0, 100 * s) //300
.addKeyframePosition(90, 0, 0, 1700 * s) //2000
.addKeyframePosition(0, 0, 0, 70 * s) //2100
.addPos(0, 0, 0, 200 * s)
.addPos(90, 0, 0, 100 * s) //300
.addPos(90, 0, 0, 1700 * s) //2000
.addPos(0, 0, 0, 70 * s) //2100
)
.addBus("RELOAD_LIFT", new BusAnimationSequence()
.addKeyframePosition(0, 0, 0, 350 * s)
.addKeyframePosition(-45, 0, 0, 250 * s) //600
.addKeyframePosition(-45, 0, 0, 350 * s) //950
.addKeyframePosition(-15, 0, 0, 200 * s) //1150
.addKeyframePosition(-15, 0, 0, 1050 * s) //2200
.addKeyframePosition(0, 0, 0, 100 * s) //2300
.addPos(0, 0, 0, 350 * s)
.addPos(-45, 0, 0, 250 * s) //600
.addPos(-45, 0, 0, 350 * s) //950
.addPos(-15, 0, 0, 200 * s) //1150
.addPos(-15, 0, 0, 1050 * s) //2200
.addPos(0, 0, 0, 100 * s) //2300
)
.addBus("RELOAD_JOLT", new BusAnimationSequence()
.addKeyframePosition(0, 0, 0, 600 * s)
.addKeyframePosition(2, 0, 0, 50 * s) //650
.addKeyframePosition(0, 0, 0, 100 * s) //750
.addPos(0, 0, 0, 600 * s)
.addPos(2, 0, 0, 50 * s) //650
.addPos(0, 0, 0, 100 * s) //750
)
.addBus("RELOAD_BULLETS", new BusAnimationSequence()
.addKeyframePosition(0, 0, 0, 650 * s)
.addKeyframePosition(10, 0, 0, 300 * s) //950
.addKeyframePosition(10, 0, 0, 200 * s) //1150
.addKeyframePosition(0, 0, 0, 700 * s) //1850
.addPos(0, 0, 0, 650 * s)
.addPos(10, 0, 0, 300 * s) //950
.addPos(10, 0, 0, 200 * s) //1150
.addPos(0, 0, 0, 700 * s) //1850
)
.addBus("RELOAD_BULLETS_CON", new BusAnimationSequence()
.addKeyframePosition(1, 0, 0, 0 * s)
.addKeyframePosition(1, 0, 0, 950 * s)
.addKeyframePosition(0, 0, 0, 1 * s)
.addPos(1, 0, 0, 0 * s)
.addPos(1, 0, 0, 950 * s)
.addPos(0, 0, 0, 1 * s)
);
}

View File

@ -2,10 +2,21 @@ package com.hbm.items.weapon.sedna;
import java.util.ArrayList;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import com.hbm.entity.projectile.EntityBulletBaseMK4;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.lib.ModDamageSource;
import com.hbm.particle.SpentCasing;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSourceIndirect;
import net.minecraft.util.MovingObjectPosition;
public class BulletConfig {
@ -14,32 +25,89 @@ public class BulletConfig {
public final int id;
public ComparableStack ammo;
/** How much ammo is added to a standard mag when loading one item */
public int ammoReloadCount = 1;
public float velocity = 5F;
public float velocity = 10F;
public float spread = 0F;
public float wear = 1F;
public int projectilesMin = 1;
public int projectilesMax = 1;
public float damageMult = 1.0F;
public float armorPiercingPercent = 0.0F;
public float headshotMult = 1.0F;
public String damageType = ModDamageSource.s_bullet;
public boolean dmgProj = true;
public boolean dmgFire = false;
public boolean dmgExplosion = false;
public boolean dmgBypass = false;
public float ricochetAngle = 5F;
public int maxRicochetCount = 2;
/** Whether damage dealt to an entity is subtracted from the projectile's damage on penetration */
public boolean damageFalloffByPen = true;
public Consumer<EntityBulletBaseMK4> onUpdate;
public BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> onImpact;
public double gravity = 0;
public int expires = 100;
public int expires = 30;
public boolean impactsEntities = true;
public boolean doesPenetrate = false;
/** Whether projectiles ignore blocks entirely */
public boolean isSpectral = false;
public int selfDamageDelay = 2;
public boolean renderRotations = true;
public SpentCasing casing;
public BiConsumer<EntityBulletBaseMK4, Float> renderer;
public BulletConfig() {
this.id = configs.size();
configs.add(this);
}
public BulletConfig setItem(Item ammo) { this.ammo = new ComparableStack(ammo); return this; }
public BulletConfig setReloadCount(int ammoReloadCount) { this.ammoReloadCount = ammoReloadCount; return this; }
public BulletConfig setVel(float velocity) { this.velocity = velocity; return this; }
public BulletConfig setSpread(float spread) { this.spread = spread; return this; }
public BulletConfig setWear(float wear) { this.wear = wear; return this; }
public BulletConfig setProjectiles(int min, int max) { this.projectilesMin = min; this.projectilesMax = max; return this; }
public BulletConfig setDamage(float damageMult) { this.damageMult = damageMult; return this; }
public BulletConfig setHeadshot(float headshotMult) { this.headshotMult = headshotMult; return this; }
public BulletConfig setGrav(double gravity) { this.gravity = gravity; return this; }
public BulletConfig setLife(int expires) { this.expires = expires; return this; }
public BulletConfig setItem(Item ammo) { this.ammo = new ComparableStack(ammo); return this; }
public BulletConfig setItem(EnumAmmo ammo) { this.ammo = new ComparableStack(ModItems.ammo_standard, 1, ammo.ordinal()); return this; }
public BulletConfig setReloadCount(int ammoReloadCount) { this.ammoReloadCount = ammoReloadCount; return this; }
public BulletConfig setVel(float velocity) { this.velocity = velocity; return this; }
public BulletConfig setSpread(float spread) { this.spread = spread; return this; }
public BulletConfig setWear(float wear) { this.wear = wear; return this; }
public BulletConfig setProjectiles(int min, int max) { this.projectilesMin = min; this.projectilesMax = max; return this; }
public BulletConfig setDamage(float damageMult) { this.damageMult = damageMult; return this; }
public BulletConfig setArmorPiercing(float armorPiercingPercent) { this.armorPiercingPercent = armorPiercingPercent; return this; }
public BulletConfig setHeadshot(float headshotMult) { this.headshotMult = headshotMult; return this; }
public BulletConfig setDamageType(String type) { this.damageType = type; return this; }
public BulletConfig setupDamageClass(boolean proj, boolean fire, boolean explosion, boolean bypass) { this.dmgProj = proj; this.dmgFire = fire; this.dmgExplosion = explosion; this.dmgBypass = bypass; return this; }
public BulletConfig setRicochetAngle(float angle) { this.ricochetAngle = angle; return this; }
public BulletConfig setRicochetCount(int count) { this.maxRicochetCount = count; return this; }
public BulletConfig setDamageFalloutByPen(boolean falloff) { this.damageFalloffByPen = falloff; return this; }
public BulletConfig setGrav(double gravity) { this.gravity = gravity; return this; }
public BulletConfig setLife(int expires) { this.expires = expires; return this; }
public BulletConfig setImpactsEntities(boolean impact) { this.impactsEntities = impact; return this; }
public BulletConfig setDoesPenetrate(boolean pen) { this.doesPenetrate = pen; return this; }
public BulletConfig setSpectral(boolean spectral) { this.isSpectral = spectral; return this; }
public BulletConfig setSelfDamageDelay(int delay) { this.selfDamageDelay = delay; return this; }
public BulletConfig setRenderRotations(boolean rot) { this.renderRotations = rot; return this; }
public BulletConfig setCasing(SpentCasing casing) { this.casing = casing; return this; }
public BulletConfig setRenderer(BiConsumer<EntityBulletBaseMK4, Float> renderer) { this.renderer = renderer; return this; }
public BulletConfig setOnUpdate(Consumer<EntityBulletBaseMK4> lambda) { this.onUpdate = lambda; return this; }
public BulletConfig setOnImpact(BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> lambda) { this.onImpact = lambda; return this; }
public DamageSource getDamage(EntityBulletBaseMK4 bullet, EntityLivingBase shooter, boolean bypass) {
DamageSource dmg;
if(shooter != null) dmg = new EntityDamageSourceIndirect(damageType, bullet, shooter);
else dmg = new DamageSource(damageType);
if(this.dmgProj) dmg.setProjectile();
if(this.dmgFire) dmg.setFireDamage();
if(this.dmgExplosion) dmg.setExplosion();
if(this.dmgBypass || bypass) dmg.setDamageBypassesArmor();
return dmg;
}
}

View File

@ -1,9 +1,15 @@
package com.hbm.items.weapon.sedna;
import java.util.ArrayList;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.SmokeNode;
import com.hbm.items.weapon.sedna.factory.GunStateDecider;
import com.hbm.items.weapon.sedna.factory.Lego;
import com.hbm.items.weapon.sedna.hud.IHUDComponent;
import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.HbmAnimations.AnimType;
@ -17,11 +23,16 @@ import net.minecraft.item.ItemStack;
* */
public class GunConfig {
public List<SmokeNode> smokeNodes = new ArrayList();
public static final String O_RECEIVERS = "O_RECEIVERS";
public static final String F_DURABILITY = "F_DURABILITY";
public static final String I_DRAWDURATION = "I_DRAWDURATION";
public static final String I_INSPECTDURATION = "I_INSPECTDURATION";
public static final String O_CROSSHAIR = "O_CROSSHAIR";
public static final String B_RELOADANIMATIONSEQUENTIAL = "B_RELOADANIMATIONSEQUENTIAL";
public static final String CON_SMOKE = "CON_SMOKE";
public static final String CON_ORCHESTRA = "CON_ORCHESTRA";
public static final String CON_ONPRESSPRIMARY = "CON_ONPRESSPRIMARY";
public static final String CON_ONPRESSSECONDARY = "CON_ONPRESSSECONDARY";
public static final String CON_ONPRESSTERTIARY = "CON_ONPRESSTERTIARY";
@ -32,6 +43,7 @@ public class GunConfig {
public static final String CON_ONRELEASERELOAD = "CON_ONRELEASERELOAD";
public static final String CON_DECIDER = "CON_DECIDER";
public static final String FUN_ANIMNATIONS = "FUN_ANIMNATIONS";
public static final String O_HUDCOMPONENTS = "O_HUDCOMPONENTS";
/* FIELDS */
@ -39,8 +51,13 @@ public class GunConfig {
protected Receiver[] receivers_DNA;
protected float durability_DNA;
protected int drawDuration_DNA = 0;
protected int inspectDuration_DNA = 0;
protected Crosshair crosshair_DNA;
protected boolean reloadAnimationsSequential_DNA;
/** Handles smoke clientside */
protected BiConsumer<ItemStack, LambdaContext> smokeHandler_DNA;
/** This piece only triggers during reloads, playing sounds depending on the reload's progress making reload sounds easier and synced to animations */
protected BiConsumer<ItemStack, LambdaContext> orchestra_DNA;
/** Lambda functions for clicking shit */
protected BiConsumer<ItemStack, LambdaContext> onPressPrimary_DNA;
protected BiConsumer<ItemStack, LambdaContext> onPressSecondary_DNA;
@ -55,14 +72,18 @@ public class GunConfig {
protected BiConsumer<ItemStack, LambdaContext> decider_DNA;
/** Lambda that returns the relevant animation for the given params */
protected BiFunction<ItemStack, AnimType, BusAnimation> animations_DNA;
protected IHUDComponent[] hudComponents_DNA;
/* GETTERS */
public Receiver[] getReceivers(ItemStack stack) { return WeaponUpgradeManager.eval(receivers_DNA, stack, O_RECEIVERS, this); }
public float getDurability(ItemStack stack) { return WeaponUpgradeManager.eval(durability_DNA, stack, F_DURABILITY, this); }
public int getDrawDuration(ItemStack stack) { return WeaponUpgradeManager.eval(drawDuration_DNA, stack, I_DRAWDURATION, this); }
public Crosshair getCrosshair(ItemStack stack) { return WeaponUpgradeManager.eval(crosshair_DNA, stack, O_CROSSHAIR, this); }
public boolean getReloadAnimSequential(ItemStack stack) { return WeaponUpgradeManager.eval(reloadAnimationsSequential_DNA, stack, B_RELOADANIMATIONSEQUENTIAL, this); }
public Receiver[] getReceivers(ItemStack stack) { return WeaponUpgradeManager.eval(receivers_DNA, stack, O_RECEIVERS, this); }
public float getDurability(ItemStack stack) { return WeaponUpgradeManager.eval(durability_DNA, stack, F_DURABILITY, this); }
public int getDrawDuration(ItemStack stack) { return WeaponUpgradeManager.eval(drawDuration_DNA, stack, I_DRAWDURATION, this); }
public int getInspectDuration(ItemStack stack) { return WeaponUpgradeManager.eval(inspectDuration_DNA, stack, I_INSPECTDURATION, this); }
public Crosshair getCrosshair(ItemStack stack) { return WeaponUpgradeManager.eval(crosshair_DNA, stack, O_CROSSHAIR, this); }
public boolean getReloadAnimSequential(ItemStack stack) { return WeaponUpgradeManager.eval(reloadAnimationsSequential_DNA, stack, B_RELOADANIMATIONSEQUENTIAL, this); }
public BiConsumer<ItemStack, LambdaContext> getSmokeHandler(ItemStack stack) { return WeaponUpgradeManager.eval(smokeHandler_DNA, stack, CON_SMOKE, this); }
public BiConsumer<ItemStack, LambdaContext> getOrchestra(ItemStack stack) { return WeaponUpgradeManager.eval(this.orchestra_DNA, stack, CON_ORCHESTRA, this); }
public BiConsumer<ItemStack, LambdaContext> getPressPrimary(ItemStack stack) { return WeaponUpgradeManager.eval(this.onPressPrimary_DNA, stack, CON_ONPRESSPRIMARY, this); }
public BiConsumer<ItemStack, LambdaContext> getPressSecondary(ItemStack stack) { return WeaponUpgradeManager.eval(this.onPressSecondary_DNA, stack, CON_ONPRESSSECONDARY, this); }
@ -77,13 +98,19 @@ public class GunConfig {
public BiConsumer<ItemStack, LambdaContext> getDecider(ItemStack stack) { return WeaponUpgradeManager.eval(this.decider_DNA, stack, CON_DECIDER, this); }
public BiFunction<ItemStack, AnimType, BusAnimation> getAnims(ItemStack stack) { return WeaponUpgradeManager.eval(this.animations_DNA, stack, FUN_ANIMNATIONS, this); }
public IHUDComponent[] getHUDComponents(ItemStack stack) { return WeaponUpgradeManager.eval(this.hudComponents_DNA, stack, O_HUDCOMPONENTS, this); }
/* SETTERS */
public GunConfig rec(Receiver... receivers) { this.receivers_DNA = receivers; 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 inspect(int inspect) { this.inspectDuration_DNA = inspect; return this; }
public GunConfig crosshair(Crosshair crosshair) { this.crosshair_DNA = crosshair; return this; }
public GunConfig reloadSequential(boolean flag) { this.reloadAnimationsSequential_DNA = flag; 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; }
//press
public GunConfig pp(BiConsumer<ItemStack, LambdaContext> lambda) { this.onPressPrimary_DNA = lambda; return this; }
@ -100,6 +127,17 @@ public class GunConfig {
//decider
public GunConfig decider(BiConsumer<ItemStack, LambdaContext> lambda) { this.decider_DNA = lambda; return this; }
//anims
public GunConfig anim(BiFunction<ItemStack, AnimType, BusAnimation> lambda) { this.animations_DNA = lambda; return this; }
//client
public GunConfig anim(BiFunction<ItemStack, AnimType, BusAnimation> lambda) { this.animations_DNA = lambda; 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,
* reload on R, aiming on MMB and the standard decider which includes jamming and auto fire handling*/
public GunConfig setupStandardConfiguration() {
this.pp(Lego.LAMBDA_STANDARD_CLICK_PRIMARY);
this.pr(Lego.LAMBDA_STANDARD_RELOAD);
this.pt(Lego.LAMBDA_TOGGLE_AIM);
this.decider(GunStateDecider.LAMBDA_STANDARD_DECIDER);
return this;
}
}

View File

@ -1,16 +1,22 @@
package com.hbm.items.weapon.sedna;
import java.util.function.BiConsumer;
import com.hbm.handler.CasingEjector;
import com.hbm.handler.HbmKeybinds.EnumKeybind;
import com.hbm.interfaces.IItemHUD;
import com.hbm.items.IEquipReceiver;
import com.hbm.items.IKeybindReceiver;
import com.hbm.items.weapon.sedna.hud.IHUDComponent;
import com.hbm.main.MainRegistry;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.packet.toclient.GunAnimationPacket;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.render.util.RenderScreenOverlay;
import com.hbm.util.EnumUtil;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
@ -27,30 +33,46 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipReceiver, IItemHUD {
public static final String O_GUNCONFIG = "O_GUNCONFIG";
/** Timestamp for rendering smoke nodes and muzzle flashes */
public long[] lastShot;
/** [0;1] randomized every shot for various rendering applications */
public double shotRand = 0D;
public static float recoilVertical = 0;
public static float recoilHorizontal = 0;
public static float offsetVertical = 0;
public static float offsetHorizontal = 0;
public static final String O_GUNCONFIG = "O_GUNCONFIG_";
public static final String KEY_DRAWN = "drawn";
public static final String KEY_AIMING = "aiming";
public static final String KEY_TIMER = "timer";
public static final String KEY_STATE = "state";
public static final String KEY_PRIMARY = "mouse1";
public static final String KEY_SECONDARY = "mouse2";
public static final String KEY_TERTIARY = "mouse3";
public static final String KEY_RELOAD = "reload";
public static final String KEY_WEAR = "wear_";
public static final String KEY_TIMER = "timer_";
public static final String KEY_STATE = "state_";
public static final String KEY_PRIMARY = "mouse1_";
public static final String KEY_SECONDARY = "mouse2_";
public static final String KEY_TERTIARY = "mouse3_";
public static final String KEY_RELOAD = "reload_";
public static final String KEY_LASTANIM = "lastanim_";
public static final String KEY_ANIMTIMER = "animtimer_";
public static float prevAimingProgress;
public static float aimingProgress;
/** NEVER ACCESS DIRECTLY - USE GETTER */
private GunConfig config_DNA;
private GunConfig[] configs_DNA;
public GunConfig getConfig(ItemStack stack) {
return WeaponUpgradeManager.eval(config_DNA, stack, O_GUNCONFIG, this);
public GunConfig getConfig(ItemStack stack, int index) {
GunConfig cfg = configs_DNA[index];
return WeaponUpgradeManager.eval(cfg, stack, O_GUNCONFIG + index, this);
}
public ItemGunBaseNT(GunConfig cfg) {
public ItemGunBaseNT(GunConfig... cfg) {
this.setMaxStackSize(1);
this.config_DNA = cfg;
this.configs_DNA = cfg;
this.lastShot = new long[cfg.length];
this.setCreativeTab(MainRegistry.weaponTab);
}
public static enum GunState {
@ -58,7 +80,8 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei
IDLE, //gun can be fired or reloaded
WINDUP, //fire button is down, added delay before fire
COOLDOWN, //gun has been fired, cooldown
RELOADING //gun is currently reloading
RELOADING, //gun is currently reloading
JAMMED, //gun is jammed, either after reloading or while firing
}
@Override
@ -69,29 +92,48 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei
@Override
public void handleKeybind(EntityPlayer player, ItemStack stack, EnumKeybind keybind, boolean newState) {
GunConfig config = getConfig(stack);
LambdaContext ctx = new LambdaContext(config, player);
if(keybind == EnumKeybind.GUN_PRIMARY && newState && !getPrimary(stack)) { if(config.getPressPrimary(stack) != null) config.getPressPrimary(stack).accept(stack, ctx); this.setPrimary(stack, newState); return; }
if(keybind == EnumKeybind.GUN_PRIMARY && !newState && getPrimary(stack)) { if(config.getReleasePrimary(stack) != null) config.getReleasePrimary(stack).accept(stack, ctx); this.setPrimary(stack, newState); return; }
if(keybind == EnumKeybind.GUN_SECONDARY && newState && !getSecondary(stack)) { if(config.getPressSecondary(stack) != null) config.getPressSecondary(stack).accept(stack, ctx); this.setSecondary(stack, newState); return; }
if(keybind == EnumKeybind.GUN_SECONDARY && !newState && getSecondary(stack)) { if(config.getReleaseSecondary(stack) != null) config.getReleaseSecondary(stack).accept(stack, ctx); this.setSecondary(stack, newState); return; }
if(keybind == EnumKeybind.GUN_TERTIARY && newState && !getTertiary(stack)) { if(config.getPressTertiary(stack) != null) config.getPressTertiary(stack).accept(stack, ctx); this.setTertiary(stack, newState); return; }
if(keybind == EnumKeybind.GUN_TERTIARY && !newState && getTertiary(stack)) { if(config.getReleaseTertiary(stack) != null) config.getReleaseTertiary(stack).accept(stack, ctx); this.setTertiary(stack, newState); return; }
if(keybind == EnumKeybind.RELOAD && newState && !getReloadKey(stack)) { if(config.getPressReload(stack) != null) config.getPressReload(stack).accept(stack, ctx); this.setReloadKey(stack, newState); return; }
if(keybind == EnumKeybind.RELOAD && !newState && getReloadKey(stack)) { if(config.getReleaseReload(stack) != null) config.getReleaseReload(stack).accept(stack, ctx); this.setReloadKey(stack, newState); return; }
int configs = this.configs_DNA.length;
for(int i = 0; i < configs; i++) {
GunConfig config = getConfig(stack, i);
LambdaContext ctx = new LambdaContext(config, player, i);
if(keybind == EnumKeybind.GUN_PRIMARY && newState && !getPrimary(stack, i)) { if(config.getPressPrimary(stack) != null) config.getPressPrimary(stack).accept(stack, ctx); this.setPrimary(stack, i, newState); continue; }
if(keybind == EnumKeybind.GUN_PRIMARY && !newState && getPrimary(stack, i)) { if(config.getReleasePrimary(stack) != null) config.getReleasePrimary(stack).accept(stack, ctx); this.setPrimary(stack, i, newState); continue; }
if(keybind == EnumKeybind.GUN_SECONDARY && newState && !getSecondary(stack, i)) { if(config.getPressSecondary(stack) != null) config.getPressSecondary(stack).accept(stack, ctx); this.setSecondary(stack, i, newState); continue; }
if(keybind == EnumKeybind.GUN_SECONDARY && !newState && getSecondary(stack, i)) { if(config.getReleaseSecondary(stack) != null) config.getReleaseSecondary(stack).accept(stack, ctx); this.setSecondary(stack, i, newState); continue; }
if(keybind == EnumKeybind.GUN_TERTIARY && newState && !getTertiary(stack, i)) { if(config.getPressTertiary(stack) != null) config.getPressTertiary(stack).accept(stack, ctx); this.setTertiary(stack, i, newState); continue; }
if(keybind == EnumKeybind.GUN_TERTIARY && !newState && getTertiary(stack, i)) { if(config.getReleaseTertiary(stack) != null) config.getReleaseTertiary(stack).accept(stack, ctx); this.setTertiary(stack, i, newState); continue; }
if(keybind == EnumKeybind.RELOAD && newState && !getReloadKey(stack, i)) { if(config.getPressReload(stack) != null) config.getPressReload(stack).accept(stack, ctx); this.setReloadKey(stack, i, newState); continue; }
if(keybind == EnumKeybind.RELOAD && !newState && getReloadKey(stack, i)) { if(config.getReleaseReload(stack) != null) config.getReleaseReload(stack).accept(stack, ctx); this.setReloadKey(stack, i, newState); continue; }
}
}
@Override
public void onEquip(EntityPlayer player, ItemStack stack) {
if(player instanceof EntityPlayerMP) PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(AnimType.EQUIP.ordinal()), (EntityPlayerMP) player);
for(int i = 0; i < this.configs_DNA.length; i++) playAnimation(player, stack, AnimType.EQUIP, i);
}
public static void playAnimation(EntityPlayer player, ItemStack stack, AnimType type, int index) {
if(player instanceof EntityPlayerMP) {
PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(type.ordinal(), 0, index), (EntityPlayerMP) player);
setLastAnim(stack, index, type);
setAnimTimer(stack, index, 0);
}
}
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean isHeld) {
if(!(entity instanceof EntityPlayer)) return;
EntityPlayer player = (EntityPlayer) entity;
EntityPlayer player = entity instanceof EntityPlayer ? (EntityPlayer) entity : null;
int confNo = this.configs_DNA.length;
GunConfig[] configs = new GunConfig[confNo];
LambdaContext[] ctx = new LambdaContext[confNo];
for(int i = 0; i < confNo; i++) {
configs[i] = this.getConfig(stack, i);
ctx[i] = new LambdaContext(configs[i], player, i);
}
if(world.isRemote) {
@ -103,66 +145,103 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei
offset.rotateAroundY(-entity.rotationYaw / 180F * (float) Math.PI);
world.spawnParticle("flame", entity.posX + offset.xCoord, entity.posY + entity.getEyeHeight() + offset.yCoord, entity.posZ + offset.zCoord, 0, 0, 0);*/
/// AIMING ///
prevAimingProgress = aimingProgress;
boolean aiming = this.getIsAiming(stack);
float aimSpeed = 0.25F;
if(aiming && aimingProgress < 1F) aimingProgress += aimSpeed;
if(!aiming && aimingProgress > 0F) aimingProgress -= aimSpeed;
aimingProgress = MathHelper.clamp_float(aimingProgress, 0F, 1F);
/// SMOKE NODES ///
for(int i = 0; i < confNo; i++) if(configs[i].getSmokeHandler(stack) != null) {
configs[i].getSmokeHandler(stack).accept(stack, ctx[i]);
}
}
return;
}
GunConfig config = this.getConfig(stack);
/// RESET WHEN NOT EQUIPPED ///
if(!isHeld) {
this.setState(stack, GunState.DRAWING);
this.setTimer(stack, config.getDrawDuration(stack));
for(int i = 0; i < confNo; i++) {
GunState current = this.getState(stack, i);
if(current != GunState.JAMMED) {
this.setState(stack, i, GunState.DRAWING);
this.setTimer(stack, i, configs[i].getDrawDuration(stack));
}
}
this.setIsAiming(stack, false);
return;
}
int timer = this.getTimer(stack);
if(timer > 0) this.setTimer(stack, timer - 1);
if(timer <= 1) nextState(player, stack);
for(int i = 0; i < confNo; i++) {
BiConsumer<ItemStack, LambdaContext> orchestra = configs[i].getOrchestra(stack);
if(orchestra != null) orchestra.accept(stack, ctx[i]);
setAnimTimer(stack, i, getAnimTimer(stack, i) + 1);
/// STTATE MACHINE ///
int timer = this.getTimer(stack, i);
if(timer > 0) this.setTimer(stack, i, timer - 1);
if(timer <= 1) configs[i].getDecider(stack).accept(stack, ctx[i]);
}
}
public void nextState(EntityPlayer player, ItemStack stack) {
GunConfig cfg = this.getConfig(stack);
cfg.getDecider(stack).accept(stack, new LambdaContext(cfg, player));
public static void trySpawnCasing(Entity entity, CasingEjector ejector, BulletConfig bullet, ItemStack stack) {
if(ejector == null) return; //abort if the gun can't eject bullets at all
if(bullet == null) return; //abort if there's no valid bullet cfg
if(bullet.casing == null) return; //abort if the bullet is caseless
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "casing");
data.setFloat("pitch", (float) Math.toRadians(entity.rotationPitch));
data.setFloat("yaw", (float) Math.toRadians(entity.rotationYaw));
data.setBoolean("crouched", entity.isSneaking());
data.setString("name", bullet.casing.getName());
data.setInteger("ej", ejector.getId());
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 50));
}
// GUN DRAWN //
public static boolean getIsDrawn(ItemStack stack) { return getValueBool(stack, KEY_DRAWN); }
public static void setIsDrawn(ItemStack stack, boolean value) { setValueBool(stack, KEY_DRAWN, value); }
// GUN STATE TIMER //
public static int getTimer(ItemStack stack) { return getValueInt(stack, KEY_TIMER); }
public static void setTimer(ItemStack stack, int value) { setValueInt(stack, KEY_TIMER, value); }
public static int getTimer(ItemStack stack, int index) { return getValueInt(stack, KEY_TIMER + index); }
public static void setTimer(ItemStack stack, int index, int value) { setValueInt(stack, KEY_TIMER + index, value); }
// GUN STATE //
public static GunState getState(ItemStack stack) { return EnumUtil.grabEnumSafely(GunState.class, getValueByte(stack, KEY_STATE)); }
public static void setState(ItemStack stack, GunState value) { setValueByte(stack, KEY_STATE, (byte) value.ordinal()); }
public static GunState getState(ItemStack stack, int index) { return EnumUtil.grabEnumSafely(GunState.class, getValueByte(stack, KEY_STATE + index)); }
public static void setState(ItemStack stack, int index, GunState value) { setValueByte(stack, KEY_STATE + index, (byte) value.ordinal()); }
// GUN AIMING //
public static boolean getIsAiming(ItemStack stack) { return getValueBool(stack, KEY_AIMING); }
public static void setIsAiming(ItemStack stack, boolean value) { setValueBool(stack, KEY_AIMING, value); }
// GUN AIMING //
public static float getWear(ItemStack stack, int index) { return getValueFloat(stack, KEY_WEAR + index); }
public static void setWear(ItemStack stack, int index, float value) { setValueFloat(stack, KEY_WEAR + index, value); }
// ANIM TRACKING //
public static AnimType getLastAnim(ItemStack stack, int index) { return EnumUtil.grabEnumSafely(AnimType.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 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); }
// BUTTON STATES //
public static boolean getPrimary(ItemStack stack) { return getValueBool(stack, KEY_PRIMARY); }
public static void setPrimary(ItemStack stack, boolean value) { setValueBool(stack, KEY_PRIMARY, value); }
public static boolean getSecondary(ItemStack stack) { return getValueBool(stack, KEY_SECONDARY); }
public static void setSecondary(ItemStack stack, boolean value) { setValueBool(stack, KEY_SECONDARY, value); }
public static boolean getTertiary(ItemStack stack) { return getValueBool(stack, KEY_TERTIARY); }
public static void setTertiary(ItemStack stack, boolean value) { setValueBool(stack, KEY_TERTIARY, value); }
public static boolean getReloadKey(ItemStack stack) { return getValueBool(stack, KEY_RELOAD); }
public static void setReloadKey(ItemStack stack, boolean value) { setValueBool(stack, KEY_RELOAD, value); }
public static boolean getPrimary(ItemStack stack, int index) { return getValueBool(stack, KEY_PRIMARY + index); }
public static void setPrimary(ItemStack stack, int index, boolean value) { setValueBool(stack, KEY_PRIMARY + index, value); }
public static boolean getSecondary(ItemStack stack, int index) { return getValueBool(stack, KEY_SECONDARY + index); }
public static void setSecondary(ItemStack stack, int index, boolean value) { setValueBool(stack, KEY_SECONDARY + index, value); }
public static boolean getTertiary(ItemStack stack, int index) { return getValueBool(stack, KEY_TERTIARY + index); }
public static void setTertiary(ItemStack stack, int index, boolean value) { setValueBool(stack, KEY_TERTIARY + index, value); }
public static boolean getReloadKey(ItemStack stack, int index) { return getValueBool(stack, KEY_RELOAD + index); }
public static void setReloadKey(ItemStack stack, int index, boolean value) { setValueBool(stack, KEY_RELOAD + index, value); }
/// UTIL ///
public static int getValueInt(ItemStack stack, String name) { if(stack.hasTagCompound()) return stack.getTagCompound().getInteger(name); return 0; }
public static void setValueInt(ItemStack stack, String name, int value) { if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound(); stack.getTagCompound().setInteger(name, value); }
public static float getValueFloat(ItemStack stack, String name) { if(stack.hasTagCompound()) return stack.getTagCompound().getFloat(name); return 0; }
public static void setValueFloat(ItemStack stack, String name, float value) { if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound(); stack.getTagCompound().setFloat(name, value); }
public static byte getValueByte(ItemStack stack, String name) { if(stack.hasTagCompound()) return stack.getTagCompound().getByte(name); return 0; }
public static void setValueByte(ItemStack stack, String name, byte value) { if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound(); stack.getTagCompound().setByte(name, value); }
@ -173,21 +252,48 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei
public static class LambdaContext {
public final GunConfig config;
public final EntityPlayer player;
public final int configIndex;
public LambdaContext(GunConfig config, EntityPlayer player) {
public LambdaContext(GunConfig config, EntityPlayer player, int configIndex) {
this.config = config;
this.player = player;
this.configIndex = configIndex;
}
}
@Override
@SideOnly(Side.CLIENT)
public void renderHUD(Pre event, ElementType type, EntityPlayer player, ItemStack stack) {
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
if(type == ElementType.CROSSHAIRS) {
event.setCanceled(true);
if(aimingProgress >= 1F) return;
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
RenderScreenOverlay.renderCustomCrosshairs(event.resolution, Minecraft.getMinecraft().ingameGUI, gun.getConfig(stack).getCrosshair(stack));
RenderScreenOverlay.renderCustomCrosshairs(event.resolution, Minecraft.getMinecraft().ingameGUI, gun.getConfig(stack, 0).getCrosshair(stack));
}
int confNo = this.configs_DNA.length;
for(int i = 0; i < confNo; i++) {
IHUDComponent[] components = gun.getConfig(stack, i).getHUDComponents(stack);
if(components != null) for(IHUDComponent component : components) {
int bottomOffset = 0;
component.renderHUDComponent(event, type, player, stack, bottomOffset, i);
bottomOffset += component.getComponentHeight(player, stack);
}
}
}
public static class SmokeNode {
public double forward = 0D;
public double side = 0D;
public double lift = 0D;
public double alpha;
public double width = 1D;
public SmokeNode(double alpha) { this.alpha = alpha; }
}
}

View File

@ -3,11 +3,11 @@ package com.hbm.items.weapon.sedna;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import com.hbm.handler.CasingEjector;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.mags.IMagazine;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Vec3;
/**
* Receivers are the gun's "moving parts", i.e. they determine things like base damage, spread, the ejector and the magazine. Think of this class like the
@ -17,16 +17,27 @@ import net.minecraft.item.ItemStack;
*/
public class Receiver {
public static final String F_BASEDAMAGE = "F_BASEDAMAGE";
public static final String I_DELAYAFTERFIRE = "I_DELAYAFTERFIRE";
public static final String I_ROUNDSPERCYCLE = "I_ROUNDSPERCYCLE";
public static final String F_SPREADMOD = "F_SPREADMOD";
public static final String B_REFIREONHOLD = "B_REFIREONHOLD";
public static final String O_EJECTOR = "O_EJECTOR";
public static final String I_RELOADDURATION = "I_RELOADDURATION";
public static final String O_MAGAZINE = "O_MAGAZINE";
public static final String FUN_CANFIRE = "FUN_CANFIRE";
public static final String CON_ONFIRE = "CON_ONFIRE";
public static final String F_BASEDAMAGE = "F_BASEDAMAGE";
public static final String I_DELAYAFTERFIRE = "I_DELAYAFTERFIRE";
public static final String I_DELAYAFTERDRYFIRE = "I_DELAYAFTERDRYFIRE";
public static final String I_ROUNDSPERCYCLE = "I_ROUNDSPERCYCLE";
public static final String F_SPREADMOD = "F_SPREADMOD";
public static final String B_REFIREONHOLD = "B_REFIREONHOLD";
public static final String B_DOESDRYFIRE = "B_DOESDRYFIRE";
public static final String B_EJECTONFIRE = "B_EJECTONFIRE";
public static final String I_RELOADBEGINDURATION = "I_RELOADBEGINDURATION";
public static final String I_RELOADCYCLEDURATION = "I_RELOADCYCLEDURATION";
public static final String I_RELOADENDDURATION = "I_RELOADENDDURATION";
public static final String I_RELOADCOCKONEMPTY = "I_RELOADCOCKONEMPTY";
public static final String I_JAMDURATION = "I_JAMDURATION";
public static final String S_FIRESOUND = "S_FIRESOUND";
public static final String F_FIREVOLUME = "F_FIREVOLUME";
public static final String F_FIREPITCH = "F_FIREPITCH";
public static final String O_MAGAZINE = "O_MAGAZINE";
public static final String O_PROJECTILEOFFSET = "O_PROJECTILEOFFSET";
public static final String FUN_CANFIRE = "FUN_CANFIRE";
public static final String CON_ONFIRE = "CON_ONFIRE";
public static final String CON_ONRECOIL = "CON_ONRECOIL";
public Receiver(int index) {
this.index = index;
@ -35,38 +46,82 @@ public class Receiver {
protected int index;
protected float baseDamage_DNA;
protected int delayAfterFire_DNA;
protected int delayAfterDryFire_DNA;
protected int roundsPerCycle_DNA = 1;
protected float spreadMod_DNA = 1F;
protected float spreadModExtra_DNA = 0F;
protected boolean refireOnHold_DNA = false;
protected CasingEjector ejector_DNA = null;
protected int reloadDuration_DNA;
protected boolean doesDryFire_DNA = true;
protected boolean ejectOnFire_DNA = true;
protected int reloadBeginDuration_DNA;
protected int reloadCycleDuration_DNA;
protected int reloadEndDuration_DNA;
protected int reloadCockOnEmpty_DNA;
protected int jamDuration_DNA = 0;
protected String fireSound_DNA;
protected float fireVolume_DNA = 1.0F;
protected float firePitch_DNA = 1.0F;
protected IMagazine magazine_DNA;
protected Vec3 projectileOffset_DNA = Vec3.createVectorHelper(0, 0, 0);
protected BiFunction<ItemStack, LambdaContext, Boolean> canFire_DNA;
protected BiConsumer<ItemStack, LambdaContext> onFire_DNA;
protected BiConsumer<ItemStack, LambdaContext> onRecoil_DNA;
/* GETTERS */
public float getBaseDamage(ItemStack stack) { return WeaponUpgradeManager.eval(this.baseDamage_DNA, stack, F_BASEDAMAGE, this); }
public int getDelayAfterFire(ItemStack stack) { return WeaponUpgradeManager.eval(this.delayAfterFire_DNA, stack, I_DELAYAFTERFIRE, this); }
public int getRoundsPerCycle(ItemStack stack) { return WeaponUpgradeManager.eval(this.roundsPerCycle_DNA, stack, I_ROUNDSPERCYCLE, this); }
public float getSpreadMod(ItemStack stack) { return WeaponUpgradeManager.eval(this.spreadMod_DNA, stack, F_SPREADMOD, this); }
public boolean getRefireOnHold(ItemStack stack) { return WeaponUpgradeManager.eval(this.refireOnHold_DNA, stack, B_REFIREONHOLD, this); }
public CasingEjector getEjector(ItemStack stack) { return WeaponUpgradeManager.eval(this.ejector_DNA, stack, O_EJECTOR, this); }
public int getReloadDuration(ItemStack stack) { return WeaponUpgradeManager.eval(this.reloadDuration_DNA, stack, I_RELOADDURATION, this); }
public IMagazine getMagazine(ItemStack stack) { return WeaponUpgradeManager.eval(this.magazine_DNA, stack, O_MAGAZINE, this); }
public float getBaseDamage(ItemStack stack) { return WeaponUpgradeManager.eval(this.baseDamage_DNA, stack, F_BASEDAMAGE, this); }
public int getDelayAfterFire(ItemStack stack) { return WeaponUpgradeManager.eval(this.delayAfterFire_DNA, stack, I_DELAYAFTERFIRE, this); }
public int getDelayAfterDryFire(ItemStack stack) { return WeaponUpgradeManager.eval(this.delayAfterDryFire_DNA, stack, I_DELAYAFTERDRYFIRE, this); }
public int getRoundsPerCycle(ItemStack stack) { return WeaponUpgradeManager.eval(this.roundsPerCycle_DNA, stack, I_ROUNDSPERCYCLE, this); }
public float getGunSpread(ItemStack stack) { return WeaponUpgradeManager.eval(this.spreadModExtra_DNA, stack, F_SPREADMOD, this); }
public boolean getRefireOnHold(ItemStack stack) { return WeaponUpgradeManager.eval(this.refireOnHold_DNA, stack, B_REFIREONHOLD, this); }
public boolean getDoesDryFire(ItemStack stack) { return WeaponUpgradeManager.eval(this.doesDryFire_DNA, stack, B_DOESDRYFIRE, this); }
public boolean getEjectOnFire(ItemStack stack) { return WeaponUpgradeManager.eval(this.ejectOnFire_DNA, stack, B_EJECTONFIRE, this); }
public int getReloadBeginDuration(ItemStack stack) { return WeaponUpgradeManager.eval(this.reloadBeginDuration_DNA, stack, I_RELOADBEGINDURATION, this); }
public int getReloadCycleDuration(ItemStack stack) { return WeaponUpgradeManager.eval(this.reloadCycleDuration_DNA, stack, I_RELOADCYCLEDURATION, this); }
public int getReloadEndDuration(ItemStack stack) { return WeaponUpgradeManager.eval(this.reloadEndDuration_DNA, stack, I_RELOADENDDURATION, this); }
public int getReloadCockOnEmpty(ItemStack stack) { return WeaponUpgradeManager.eval(this.reloadCockOnEmpty_DNA, stack, I_RELOADCOCKONEMPTY, this); }
public int getJamDuration(ItemStack stack) { return WeaponUpgradeManager.eval(this.jamDuration_DNA, stack, I_JAMDURATION, this); }
public String getFireSound(ItemStack stack) { return WeaponUpgradeManager.eval(this.fireSound_DNA, stack, S_FIRESOUND, this); }
public float getFireVolume(ItemStack stack) { return WeaponUpgradeManager.eval(this.fireVolume_DNA, stack, F_FIREVOLUME, this); }
public float getFirePitch(ItemStack stack) { return WeaponUpgradeManager.eval(this.firePitch_DNA, stack, F_FIREPITCH, this); }
public IMagazine getMagazine(ItemStack stack) { return WeaponUpgradeManager.eval(this.magazine_DNA, stack, O_MAGAZINE, this); }
public Vec3 getProjectileOffset(ItemStack stack) { return WeaponUpgradeManager.eval(this.projectileOffset_DNA, stack, O_PROJECTILEOFFSET, this); }
public BiFunction<ItemStack, LambdaContext, Boolean> getCanFire(ItemStack stack) { return WeaponUpgradeManager.eval(this.canFire_DNA, stack, FUN_CANFIRE, this); }
public BiConsumer<ItemStack, LambdaContext> getOnFire(ItemStack stack) { return WeaponUpgradeManager.eval(this.onFire_DNA, stack, CON_ONFIRE, this); }
public BiConsumer<ItemStack, LambdaContext> getRecoil(ItemStack stack) { return WeaponUpgradeManager.eval(this.onRecoil_DNA, stack, CON_ONRECOIL, this); }
/* SETTERS */
public Receiver dmg(float dmg) { this.baseDamage_DNA = dmg; return this; }
public Receiver delay(int delay) { this.delayAfterFire_DNA = delay; return this; }
public Receiver rounds(int rounds) { this.roundsPerCycle_DNA = rounds; return this; }
public Receiver spread(int spread) { this.spreadMod_DNA = spread; return this; }
public Receiver auto(boolean auto) { this.refireOnHold_DNA = auto; return this; }
public Receiver burst(CasingEjector ejector) { this.ejector_DNA = ejector; return this; }
public Receiver reload(int delay) { this.reloadDuration_DNA = delay; return this; }
public Receiver mag(IMagazine magazine) { this.magazine_DNA = magazine; return this; }
public Receiver dmg(float dmg) { this.baseDamage_DNA = dmg; return this; }
public Receiver delay(int delay) { this.delayAfterFire_DNA = this.delayAfterDryFire_DNA = delay; return this; }
public Receiver dry(int delay) { this.delayAfterDryFire_DNA = delay; return this; }
public Receiver rounds(int rounds) { this.roundsPerCycle_DNA = rounds; return this; }
public Receiver spread(float spread) { this.spreadModExtra_DNA = spread; return this; }
public Receiver auto(boolean auto) { this.refireOnHold_DNA = auto; return this; }
public Receiver dryfire(boolean dryfire) { this.doesDryFire_DNA = dryfire; return this; }
public Receiver ejectOnFire(boolean eject) { this.ejectOnFire_DNA = eject; return this; }
public Receiver mag(IMagazine magazine) { this.magazine_DNA = magazine; return this; }
public Receiver offset(double f, double u, double s) { this.projectileOffset_DNA = Vec3.createVectorHelper(f, u, s); return this; }
public Receiver jam(int jam) { this.jamDuration_DNA = jam; return this; }
public Receiver reload(int delay) {
return reload(delay, delay, 0, 0);
}
public Receiver reload(int begin, int cycle, int end, int cock) {
this.reloadBeginDuration_DNA = begin;
this.reloadCycleDuration_DNA = cycle;
this.reloadEndDuration_DNA = end;
this.reloadCockOnEmpty_DNA = cock;
return this;
}
public Receiver canFire(BiFunction<ItemStack, LambdaContext, Boolean> lambda) { this.canFire_DNA = lambda; return this; }
public Receiver fire(BiConsumer<ItemStack, LambdaContext> lambda) { this.onFire_DNA = lambda; return this; }
public Receiver recoil(BiConsumer<ItemStack, LambdaContext> lambda) { this.onRecoil_DNA = lambda; return this; }
public Receiver sound(String sound, float volume, float pitch) {
this.fireSound_DNA = sound;
this.fireVolume_DNA = volume;
this.firePitch_DNA = pitch;
return this;
}
}

View File

@ -10,13 +10,18 @@ import net.minecraft.item.ItemStack;
*/
public class WeaponUpgradeManager {
//TODO: add caching so this doesn't have to run 15 times per single action
public static ItemStack[] getUpgrades(ItemStack stack) {
return null; // TBI
}
/** Scrapes all upgrades, iterates over them and evaluates the given value. The parent (i.e. holder of the base value)
* is passed for context (so upgrades can differentiate primary and secondary receivers for example) */
* is passed for context (so upgrades can differentiate primary and secondary receivers for example). Passing a null
* stack causes the base value to be returned. */
public static <T> T eval(T base, ItemStack stack, String key, Object parent) {
if(stack == null) return base;
ItemStack[] upgrades = getUpgrades(stack);
if(upgrades != null) for(ItemStack upgradeStack : upgrades) {

View File

@ -1,35 +1,71 @@
package com.hbm.items.weapon.sedna.factory;
import com.hbm.items.ItemEnumMulti;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.BulletConfig;
import com.hbm.items.weapon.sedna.Crosshair;
import com.hbm.items.weapon.sedna.GunConfig;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.Receiver;
import com.hbm.items.weapon.sedna.mags.MagazineRevolverDrum;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType;
import net.minecraft.item.Item;
public class GunFactory {
public static BulletConfig ammo_debug;
public static BulletConfig ammo_debug_buckshot;
public static SpentCasing CASING44 = new SpentCasing(CasingType.STRAIGHT).setScale(1.5F, 1.0F, 1.5F).setBounceMotion(0.01F, 0.05F).setColor(SpentCasing.COLOR_CASE_44);
public static void init() {
/// AMMO ITEMS ///
ModItems.ammo_debug = new Item().setUnlocalizedName("ammo_debug").setTextureName(RefStrings.MODID + ":ammo_45");
BulletConfig ammo_debug = new BulletConfig().setItem(ModItems.ammo_debug).setSpread(0.01F);
ModItems.ammo_standard = new ItemEnumMulti(EnumAmmo.class, true, true).setUnlocalizedName("ammo_standard").setTextureName(RefStrings.MODID + ":ammo_standard");
/// BULLLET CFGS ///
ammo_debug = new BulletConfig().setItem(ModItems.ammo_debug).setSpread(0.01F).setRicochetAngle(45).setCasing(CASING44.clone().register("DEBUG0"));
ammo_debug_buckshot = new BulletConfig().setItem(ModItems.ammo_12gauge).setSpread(0.1F).setRicochetAngle(45).setProjectiles(6, 6).setCasing(CASING44.clone().register("DEBUG1"));
/// GUNS ///
ModItems.gun_debug = new ItemGunBaseNT(new GunConfig()
.dura(600).draw(15).crosshair(Crosshair.L_CLASSIC)
.dura(600F).draw(15).inspect(23).crosshair(Crosshair.L_CLASSIC).smoke(Lego.LAMBDA_STANDARD_SMOKE).orchestra(Orchestras.DEBUG_ORCHESTRA)
.rec(new Receiver(0)
.dmg(10F).delay(12).mag(new MagazineRevolverDrum(0, 6).addConfigs(ammo_debug))
.canFire(Lego.LAMBDA_DEBUG_CAN_FIRE).fire(Lego.LAMBDA_DEBUG_FIRE))
.pr(Lego.LAMBDA_STANDARD_RELOAD)
.pp(Lego.LAMBDA_STANDARD_FIRE)
.pt(Lego.LAMBDA_TOGGLE_AIM)
.dmg(10F).delay(14).reload(46).jam(23).sound("hbm:weapon.44Shoot", 1.0F, 1.0F)
.mag(new MagazineFullReload(0, 12).addConfigs(ammo_debug, ammo_debug_buckshot))
.offset(0.75, -0.0625, -0.3125D)
.canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE))
.pp(Lego.LAMBDA_STANDARD_CLICK_PRIMARY) .pr(Lego.LAMBDA_STANDARD_RELOAD) .pt(Lego.LAMBDA_TOGGLE_AIM)
.decider(GunStateDecider.LAMBDA_STANDARD_DECIDER)
.anim(Lego.LAMBDA_DEBUG_ANIMS)
).setUnlocalizedName("gun_debug").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_darter");
).setUnlocalizedName("gun_debug").setTextureName(RefStrings.MODID + ":gun_darter");
XFactoryBlackPowder.init();
XFactory357.init();
XFactory44.init();
XFactory9mm.init();
XFactory12ga.init();
XFactory40mm.init();
XFactory762mm.init();
XFactory22lr.init();
/// PROXY BULLSHIT ///
MainRegistry.proxy.registerGunCfg();
}
public static enum EnumAmmo {
STONE, STONE_AP, STONE_IRON, STONE_SHOT,
M357_SP, M357_FMJ, M357_JHP, M357_AP, M357_EXPRESS,
M44_SP, M44_FMJ, M44_JHP, M44_AP, M44_EXPRESS,
P22_SP, P22_FMJ, P22_JHP, P22_AP,
P9_SP, P9_FMJ, P9_JHP, P9_AP,
G12_BP, G12_BP_MAGNUM, G12_BP_SLUG, G12,
R762_SP, R762_FMJ, R762_JHP, R762_AP, R762_DU,
G40_FLARE, G40,
}
}

View File

@ -0,0 +1,83 @@
package com.hbm.items.weapon.sedna.factory;
import static com.hbm.items.weapon.sedna.factory.GunFactory.*;
import static com.hbm.items.weapon.sedna.factory.XFactory12ga.*;
import static com.hbm.items.weapon.sedna.factory.XFactory22lr.*;
import static com.hbm.items.weapon.sedna.factory.XFactory357.*;
import static com.hbm.items.weapon.sedna.factory.XFactory40mm.*;
import static com.hbm.items.weapon.sedna.factory.XFactory44.*;
import static com.hbm.items.weapon.sedna.factory.XFactory762mm.*;
import static com.hbm.items.weapon.sedna.factory.XFactory9mm.*;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.render.item.weapon.sedna.*;
import net.minecraftforge.client.MinecraftForgeClient;
public class GunFactoryClient {
public static void init() {
//GUNS
MinecraftForgeClient.registerItemRenderer(ModItems.gun_debug, new ItemRenderDebug());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_pepperbox, new ItemRenderPepperbox());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_light_revolver, new ItemRenderAtlas());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_light_revolver_dani, new ItemRenderDANI());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_henry, new ItemRenderHenry());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_greasegun, new ItemRenderGreasegun());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_maresleg, new ItemRenderMaresleg());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_flaregun, new ItemRenderFlaregun());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_heavy_revolver, new ItemRenderHeavyRevolver());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_carbine, new ItemRenderCarbine());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_am180, new ItemRenderAm180());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_liberator, new ItemRenderLiberator());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_congolake, new ItemRenderCongoLake());
//PROJECTILES
ammo_debug.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
ammo_debug_buckshot.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
m357_sp.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
m357_fmj.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
m357_jhp.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
m357_ap.setRenderer(LegoClient.RENDER_AP_BULLET);
m357_express.setRenderer(LegoClient.RENDER_EXPRESS_BULLET);
m44_sp.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
m44_fmj.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
m44_jhp.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
m44_ap.setRenderer(LegoClient.RENDER_AP_BULLET);
m44_express.setRenderer(LegoClient.RENDER_EXPRESS_BULLET);
p9_sp.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
p9_fmj.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
p9_jhp.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
p9_ap.setRenderer(LegoClient.RENDER_AP_BULLET);
g12_bp.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
g12_bp_magnum.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
g12_bp_slug.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
g12.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
r762_sp.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
r762_fmj.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
r762_jhp.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
r762_ap.setRenderer(LegoClient.RENDER_AP_BULLET);
r762_du.setRenderer(LegoClient.RENDER_DU_BULLET);
p22_sp.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
p22_fmj.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
p22_jhp.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
p22_ap.setRenderer(LegoClient.RENDER_AP_BULLET);
g40_flare.setRenderer(LegoClient.RENDER_FLARE);
g40.setRenderer(LegoClient.RENDER_GRENADE);
//HUDS
((ItemGunBaseNT) ModItems.gun_debug) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_pepperbox) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_light_revolver) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_henry) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_greasegun) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_maresleg) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_flaregun) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_heavy_revolver) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_carbine) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_am180) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_liberator) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_congolake) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_light_revolver_dani).getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY_MIRROR, LegoClient.HUD_COMPONENT_AMMO_MIRROR);
((ItemGunBaseNT) ModItems.gun_light_revolver_dani).getConfig(null, 1).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
}
}

View File

@ -6,8 +6,10 @@ import java.util.function.BooleanSupplier;
import com.hbm.items.weapon.sedna.GunConfig;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.Receiver;
import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.GunState;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@ -20,50 +22,82 @@ public class GunStateDecider {
* It supports draw delays as well as semi and auto fire
*/
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_DECIDER = (stack, ctx) -> {
GunState lastState = ItemGunBaseNT.getState(stack);
deciderStandardFinishDraw(stack, lastState);
deciderStandardReload(stack, ctx, lastState, 0);
deciderAutoRefire(stack, ctx, lastState, 0, () -> { return ItemGunBaseNT.getPrimary(stack); });
int index = ctx.configIndex;
GunState lastState = ItemGunBaseNT.getState(stack, index);
deciderStandardFinishDraw(stack, lastState, index);
deciderStandardClearJam(stack, lastState, index);
deciderStandardReload(stack, ctx, lastState, 0, index);
deciderAutoRefire(stack, ctx, lastState, 0, index, () -> { return ItemGunBaseNT.getPrimary(stack, index); });
};
/** Transitions the gun from DRAWING to IDLE */
public static void deciderStandardFinishDraw(ItemStack stack, GunState lastState) {
public static void deciderStandardFinishDraw(ItemStack stack, GunState lastState, int index) {
//transition to idle
if(lastState == GunState.DRAWING) {
ItemGunBaseNT.setState(stack, GunState.IDLE);
ItemGunBaseNT.setTimer(stack, 0);
ItemGunBaseNT.setState(stack, index, GunState.IDLE);
ItemGunBaseNT.setTimer(stack, index, 0);
}
}
/** Transitions the gun from DRAWING to IDLE */
public static void deciderStandardClearJam(ItemStack stack, GunState lastState, int index) {
//transition to idle
if(lastState == GunState.JAMMED) {
ItemGunBaseNT.setState(stack, index, GunState.IDLE);
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 */
public static void deciderStandardReload(ItemStack stack, LambdaContext ctx, GunState lastState, int recIndex) {
public static void deciderStandardReload(ItemStack stack, LambdaContext ctx, GunState lastState, int recIndex, int gunIndex) {
if(lastState == GunState.RELOADING) {
EntityPlayer player = ctx.player;
GunConfig cfg = ctx.config;
Receiver rec = cfg.getReceivers(stack)[recIndex];
IMagazine mag = rec.getMagazine(stack);
rec.getMagazine(stack).reloadAction(stack, player);
mag.reloadAction(stack, player);
//if after reloading the gun can still reload, assume a tube mag and resume reloading
if(cfg.getReceivers(stack)[recIndex].getMagazine(stack).canReload(stack, player)) {
ItemGunBaseNT.setState(stack, GunState.RELOADING);
ItemGunBaseNT.setTimer(stack, cfg.getReceivers(stack)[recIndex].getReloadDuration(stack));
if(mag.canReload(stack, player)) {
ItemGunBaseNT.setState(stack, gunIndex, GunState.RELOADING);
ItemGunBaseNT.setTimer(stack, gunIndex, rec.getReloadCycleDuration(stack));
ItemGunBaseNT.playAnimation(player, stack, AnimType.RELOAD_CYCLE, gunIndex);
//if no more reloading can be done, go idle
} else {
ItemGunBaseNT.setState(stack, GunState.IDLE);
ItemGunBaseNT.setTimer(stack, 0);
if(getStandardJamChance(stack, cfg, gunIndex) > player.getRNG().nextFloat()) {
ItemGunBaseNT.setState(stack, gunIndex, GunState.JAMMED);
ItemGunBaseNT.setTimer(stack, gunIndex, rec.getJamDuration(stack));
ItemGunBaseNT.playAnimation(player, stack, AnimType.JAMMED, gunIndex);
} else {
ItemGunBaseNT.setState(stack, gunIndex, GunState.DRAWING);
int duration = rec.getReloadEndDuration(stack) + (mag.getAmountBeforeReload(stack) <= 0 ? rec.getReloadCockOnEmpty(stack) : 0);
ItemGunBaseNT.setTimer(stack, gunIndex, duration);
ItemGunBaseNT.playAnimation(player, stack, AnimType.RELOAD_END, gunIndex);
}
}
mag.setAmountAfterReload(stack, mag.getAmount(stack));
}
}
public static float getStandardJamChance(ItemStack stack, GunConfig config, int index) {
float percent = (float) ItemGunBaseNT.getWear(stack, index) / config.getDurability(stack);
if(percent < 0.66F) return 0F;
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 */
public static void deciderAutoRefire(ItemStack stack, LambdaContext ctx, GunState lastState, int recIndex, BooleanSupplier refireCondition) {
public static void deciderAutoRefire(ItemStack stack, LambdaContext ctx, GunState lastState, int recIndex, int gunIndex, BooleanSupplier refireCondition) {
if(lastState == GunState.COOLDOWN) {
EntityPlayer player = ctx.player;
GunConfig cfg = ctx.config;
Receiver rec = cfg.getReceivers(stack)[recIndex];
@ -72,17 +106,26 @@ public class GunStateDecider {
//if there's a bullet loaded, fire again
if(rec.getCanFire(stack).apply(stack, ctx)) {
rec.getOnFire(stack).accept(stack, ctx);
ItemGunBaseNT.setState(stack, GunState.COOLDOWN);
ItemGunBaseNT.setTimer(stack, rec.getDelayAfterFire(stack));
ItemGunBaseNT.setState(stack, gunIndex, GunState.COOLDOWN);
ItemGunBaseNT.setTimer(stack, gunIndex, rec.getDelayAfterFire(stack));
player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, rec.getFireSound(stack), rec.getFireVolume(stack), rec.getFirePitch(stack));
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);
//if not, revert to idle
} else if(rec.getDoesDryFire(stack)) {
ItemGunBaseNT.setState(stack, gunIndex, GunState.DRAWING);
ItemGunBaseNT.setTimer(stack, gunIndex, rec.getDelayAfterDryFire(stack));
ItemGunBaseNT.playAnimation(player, stack, AnimType.CYCLE_DRY, gunIndex);
} else {
ItemGunBaseNT.setState(stack, GunState.IDLE);
ItemGunBaseNT.setTimer(stack, 0);
ItemGunBaseNT.setState(stack, gunIndex, GunState.IDLE);
ItemGunBaseNT.setTimer(stack, gunIndex, 0);
}
//if not, go idle
} else {
ItemGunBaseNT.setState(stack, GunState.IDLE);
ItemGunBaseNT.setTimer(stack, 0);
ItemGunBaseNT.setState(stack, gunIndex, GunState.IDLE);
ItemGunBaseNT.setTimer(stack, gunIndex, 0);
}
}
}

View File

@ -1,23 +1,31 @@
package com.hbm.items.weapon.sedna.factory;
import java.util.List;
import java.util.Random;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import com.hbm.entity.projectile.EntityBulletBaseMK4;
import com.hbm.explosion.vanillant.ExplosionVNT;
import com.hbm.explosion.vanillant.standard.EntityProcessorCrossSmooth;
import com.hbm.explosion.vanillant.standard.ExplosionEffectStandard;
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
import com.hbm.items.weapon.sedna.BulletConfig;
import com.hbm.items.weapon.sedna.GunConfig;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.GunState;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.SmokeNode;
import com.hbm.items.weapon.sedna.Receiver;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toclient.GunAnimationPacket;
import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
/**
* "LEGO" - i.e. standardized building blocks which can be used to set up gun configs easily.
@ -26,27 +34,106 @@ import net.minecraft.item.ItemStack;
*/
public class Lego {
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. */
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_RELOAD = (stack, ctx) -> {
if(ItemGunBaseNT.getState(stack) == GunState.IDLE && ctx.config.getReceivers(stack)[0].getMagazine(stack).canReload(stack, ctx.player)) {
ItemGunBaseNT.setState(stack, GunState.RELOADING);
ItemGunBaseNT.setTimer(stack, ctx.config.getReceivers(stack)[0].getReloadDuration(stack));
EntityPlayer player = ctx.player;
Receiver rec = ctx.config.getReceivers(stack)[0];
GunState state = ItemGunBaseNT.getState(stack, ctx.configIndex);
if(state == GunState.IDLE) {
ItemGunBaseNT.setIsAiming(stack, false);
IMagazine mag = rec.getMagazine(stack);
if(mag.canReload(stack, ctx.player)) {
mag.setAmountBeforeReload(stack, mag.getAmount(stack));
ItemGunBaseNT.setState(stack, ctx.configIndex, GunState.RELOADING);
ItemGunBaseNT.setTimer(stack, ctx.configIndex, rec.getReloadBeginDuration(stack));
ItemGunBaseNT.playAnimation(player, stack, AnimType.RELOAD, ctx.configIndex);
} else {
ItemGunBaseNT.playAnimation(player, stack, AnimType.INSPECT, ctx.configIndex);
}
}
};
/**
* If IDLE and ammo is loaded, fire and set to JUST_FIRED. */
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_FIRE = (stack, ctx) -> {
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_CLICK_PRIMARY = (stack, ctx) -> {
EntityPlayer player = ctx.player;
Receiver rec = ctx.config.getReceivers(stack)[0];
int index = ctx.configIndex;
GunState state = ItemGunBaseNT.getState(stack, index);
if(ItemGunBaseNT.getState(stack) == GunState.IDLE && ctx.config.getReceivers(stack)[0].getCanFire(stack).apply(stack, ctx)) {
ItemGunBaseNT.setState(stack, GunState.COOLDOWN);
ItemGunBaseNT.setTimer(stack, ctx.config.getReceivers(stack)[0].getDelayAfterFire(stack));
ctx.config.getReceivers(stack)[0].getOnFire(stack).accept(stack, ctx);
if(state == GunState.IDLE) {
if(rec.getCanFire(stack).apply(stack, ctx)) {
rec.getOnFire(stack).accept(stack, ctx);
player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, rec.getFireSound(stack), rec.getFireVolume(stack), rec.getFirePitch(stack));
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);
ItemGunBaseNT.setState(stack, index, GunState.COOLDOWN);
ItemGunBaseNT.setTimer(stack, index, rec.getDelayAfterFire(stack));
} else {
if(rec.getDoesDryFire(stack)) {
ItemGunBaseNT.playAnimation(player, stack, AnimType.CYCLE_DRY, index);
ItemGunBaseNT.setState(stack, index, GunState.DRAWING);
ItemGunBaseNT.setTimer(stack, index, rec.getDelayAfterDryFire(stack));
}
}
}
};
/** Toggles isAiming. Used by keybinds. */
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_RECOIL = (stack, ctx) -> {
//ItemGunBaseNT.recoilVertical += 10;
//ItemGunBaseNT.recoilHorizontal += ctx.player.getRNG().nextGaussian() * 1.5;
};
/** Default smoke. */
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_SMOKE = (stack, ctx) -> {
handleStandardSmoke(ctx.player, stack, 2000, 0.025D, 1.15D, ctx.configIndex);
};
public static void handleStandardSmoke(EntityPlayer player, ItemStack stack, int smokeDuration, double alphaDecay, double widthGrowth, int index) {
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
long lastShot = gun.lastShot[index];
List<SmokeNode> smokeNodes = gun.getConfig(stack, index).smokeNodes;
boolean smoking = lastShot + smokeDuration > System.currentTimeMillis();
if(!smoking && !smokeNodes.isEmpty()) smokeNodes.clear();
if(smoking) {
Vec3 prev = Vec3.createVectorHelper(-player.motionX, -player.motionY, -player.motionZ);
prev.rotateAroundY((float) (player.rotationYaw * Math.PI / 180D));
double accel = 15D;
double side = (player.rotationYaw - player.prevRotationYawHead) * 0.1D;
double waggle = 0.025D;
for(SmokeNode node : smokeNodes) {
node.forward += -prev.zCoord * accel + player.worldObj.rand.nextGaussian() * waggle;
node.lift += prev.yCoord + 1.5D;
node.side += prev.xCoord * accel + player.worldObj.rand.nextGaussian() * waggle + side;
if(node.alpha > 0) node.alpha -= alphaDecay;
node.width *= widthGrowth;
}
double alpha = (System.currentTimeMillis() - lastShot) / (double) smokeDuration;
alpha = (1 - alpha) * 0.5D;
if(gun.getState(stack, index) == GunState.RELOADING || smokeNodes.size() == 0) alpha = 0;
smokeNodes.add(new SmokeNode(alpha));
}
}
/** Toggles isAiming. Used by keybinds. */
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_TOGGLE_AIM = (stack, ctx) -> { ItemGunBaseNT.setIsAiming(stack, !ItemGunBaseNT.getIsAiming(stack)); };
@ -59,44 +146,82 @@ public class Lego {
/** JUMPER - bypasses mag testing and just allows constant fire */
public static BiFunction<ItemStack, LambdaContext, Boolean> LAMBDA_DEBUG_CAN_FIRE = (stack, ctx) -> { return true; };
/** simply plays a sound to indicate that the keybind has triggered */
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_DEBUG_FIRE = (stack, ctx) -> {
/** Spawns an EntityBulletBaseMK4 with the loaded bulletcfg */
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_FIRE = (stack, ctx) -> {
EntityPlayer player = ctx.player;
if(player instanceof EntityPlayerMP) PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(AnimType.CYCLE.ordinal()), (EntityPlayerMP) player);
int index = ctx.configIndex;
ItemGunBaseNT.playAnimation(player, stack, AnimType.CYCLE, ctx.configIndex);
double sideOffset = ItemGunBaseNT.getIsAiming(stack) ? 0 : -0.2D;
float aim = ItemGunBaseNT.getIsAiming(stack) ? 0.25F : 1F;
Receiver primary = ctx.config.getReceivers(stack)[0];
IMagazine mag = primary.getMagazine(stack);
BulletConfig config = (BulletConfig) mag.getType(stack);
EntityBulletBaseMK4 mk4 = new EntityBulletBaseMK4(player, (BulletConfig) primary.getMagazine(stack).getType(stack), primary.getBaseDamage(stack), primary.getSpreadMod(stack) * aim, sideOffset, -0.1, 0.75);
player.worldObj.spawnEntityInWorld(mk4);
player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:weapon.shotgunShoot", 1F, 1F);
Vec3 offset = primary.getProjectileOffset(stack);
double forwardOffset = offset.xCoord;
double heightOffset = offset.yCoord;
double sideOffset = ItemGunBaseNT.getIsAiming(stack) ? 0 : offset.zCoord;
/*forwardOffset = 1;
heightOffset = -0.0625 * 1.5;
sideOffset = -0.1875D;*/
int projectiles = config.projectilesMin;
if(config.projectilesMax > config.projectilesMin) projectiles += player.getRNG().nextInt(config.projectilesMax - config.projectilesMin + 1);
for(int i = 0; i < projectiles; i++) {
float damage = primary.getBaseDamage(stack) * getStandardWearDamage(stack, ctx.config, index);
float spread = primary.getGunSpread(stack) * aim + getStandardWearSpread(stack, ctx.config, index) * 0.125F;
EntityBulletBaseMK4 mk4 = new EntityBulletBaseMK4(player, config, damage, spread, sideOffset, heightOffset, forwardOffset);
player.worldObj.spawnEntityInWorld(mk4);
}
mag.setAmount(stack, mag.getAmount(stack) - 1);
ItemGunBaseNT.setWear(stack, index, Math.min(ItemGunBaseNT.getWear(stack, index) + config.wear, ctx.config.getDurability(stack)));
};
/** No reload, simply play inspect animation */
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_DEBUG_RELOAD = (stack, ctx) -> {
EntityPlayer player = ctx.player;
if(player instanceof EntityPlayerMP) PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(AnimType.INSPECT.ordinal()), (EntityPlayerMP) player);
};
public static float getStandardWearSpread(ItemStack stack, GunConfig config, int index) {
float percent = (float) ItemGunBaseNT.getWear(stack, index) / config.getDurability(stack);
if(percent < 0.5F) return 0F;
return (percent - 0.5F) * 2F;
}
public static float getStandardWearDamage(ItemStack stack, GunConfig config, int index) {
float percent = (float) ItemGunBaseNT.getWear(stack, index) / config.getDurability(stack);
if(percent < 0.75F) return 1F;
return 1F - (percent - 0.75F) * 2F;
}
public static void standardExplode(EntityBulletBaseMK4 bullet, MovingObjectPosition mop, float range) {
ExplosionVNT vnt = new ExplosionVNT(bullet.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, range);
vnt.setEntityProcessor(new EntityProcessorCrossSmooth(1, bullet.damage));
vnt.setPlayerProcessor(new PlayerProcessorStandard());
vnt.setSFX(new ExplosionEffectStandard());
vnt.explode();
}
/** anims for the DEBUG revolver, mostly a copy of the li'lpip but with some fixes regarding the cylinder movement */
public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_DEBUG_ANIMS = (stack, type) -> {
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_DEBUG_ANIMS = (stack, type) -> {
switch(type) {
case CYCLE:
return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence().addKeyframePosition(0, 0, 0, 50).addKeyframePosition(0, 0, -3, 50).addKeyframePosition(0, 0, 0, 250))
.addBus("HAMMER", new BusAnimationSequence().addKeyframePosition(0, 0, 1, 50).addKeyframePosition(0, 0, 1, 300 + 100).addKeyframePosition(0, 0, 0, 200))
.addBus("DRUM", new BusAnimationSequence().addKeyframePosition(0, 0, 0, 350 + 100).addKeyframePosition(0, 0, 1, 200));
case CYCLE_EMPTY: break;
case ALT_CYCLE: break;
case EQUIP: return new BusAnimation().addBus("ROTATE", new BusAnimationSequence().addKeyframePosition(-360, 0, 0, 350));
case RELOAD: break;
case RELOAD_CYCLE: break;
case RELOAD_EMPTY: break;
case RELOAD_END: break;
case SPINDOWN: break;
case SPINUP: break;
case INSPECT: break;
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("HAMMER", new BusAnimationSequence().addPos(0, 0, 1, 50).addPos(0, 0, 1, 400).addPos(0, 0, 0, 200))
.addBus("DRUM", new BusAnimationSequence().addPos(0, 0, 0, 450).addPos(0, 0, 1, 200));
case CYCLE_DRY: return new BusAnimation()
.addBus("HAMMER", new BusAnimationSequence().addPos(0, 0, 1, 50).addPos(0, 0, 1, 300 + 100).addPos(0, 0, 0, 200))
.addBus("DRUM", new BusAnimationSequence().addPos(0, 0, 0, 450).addPos(0, 0, 1, 200));
case EQUIP: return new BusAnimation().addBus("ROTATE", new BusAnimationSequence().addPos(-360, 0, 0, 350));
case RELOAD: return new BusAnimation()
.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, 1450).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, 1700).addPos(0, 0, 0, 70))
.addBus("RELOAD_LIFT", new BusAnimationSequence().addPos(0, 0, 0, 350).addPos(-45, 0, 0, 250).addPos(-45, 0, 0, 350).addPos(-15, 0, 0, 200).addPos(-15, 0, 0, 1050).addPos(0, 0, 0, 100))
.addBus("RELOAD_JOLT", new BusAnimationSequence().addPos(0, 0, 0, 600).addPos(2, 0, 0, 50).addPos(0, 0, 0, 100))
.addBus("RELOAD_BULLETS", new BusAnimationSequence().addPos(0, 0, 0, 650).addPos(10, 0, 0, 300).addPos(10, 0, 0, 200).addPos(0, 0, 0, 700))
.addBus("RELOAD_BULLETS_CON", new BusAnimationSequence().addPos(1, 0, 0, 0).addPos(1, 0, 0, 950).addPos(0, 0, 0, 1 ) );
case INSPECT: //if(ANIM_RAND.nextBoolean()) return new BusAnimation().addBus("ROTATE", new BusAnimationSequence().addPos(-360 * 5, 0, 0, 350 * 5));
case JAMMED: return new BusAnimation()
.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));
}
return null;

View File

@ -0,0 +1,162 @@
package com.hbm.items.weapon.sedna.factory;
import java.util.function.BiConsumer;
import org.lwjgl.opengl.GL11;
import com.hbm.entity.projectile.EntityBulletBaseMK4;
import com.hbm.items.weapon.sedna.hud.HUDComponentAmmoCounter;
import com.hbm.items.weapon.sedna.hud.HUDComponentDurabilityBar;
import com.hbm.lib.RefStrings;
import com.hbm.main.ResourceManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
public class LegoClient {
public static HUDComponentDurabilityBar HUD_COMPONENT_DURABILITY = new HUDComponentDurabilityBar();
public static HUDComponentDurabilityBar HUD_COMPONENT_DURABILITY_MIRROR = new HUDComponentDurabilityBar(true);
public static HUDComponentAmmoCounter HUD_COMPONENT_AMMO = new HUDComponentAmmoCounter(0);
public static HUDComponentAmmoCounter HUD_COMPONENT_AMMO_MIRROR = new HUDComponentAmmoCounter(0, true);
public static BiConsumer<EntityBulletBaseMK4, Float> RENDER_STANDARD_BULLET = (bullet, interp) -> {
double length = bullet.prevVelocity + (bullet.velocity - bullet.prevVelocity) * interp;
if(length <= 0) return;
renderBulletStandard(Tessellator.instance, 0xFFBF00, 0xFFFFFF, length, false);
};
public static BiConsumer<EntityBulletBaseMK4, Float> RENDER_AP_BULLET = (bullet, interp) -> {
double length = bullet.prevVelocity + (bullet.velocity - bullet.prevVelocity) * interp;
if(length <= 0) return;
renderBulletStandard(Tessellator.instance, 0xFF6A00, 0xFFE28D, length, false);
};
public static BiConsumer<EntityBulletBaseMK4, Float> RENDER_EXPRESS_BULLET = (bullet, interp) -> {
double length = bullet.prevVelocity + (bullet.velocity - bullet.prevVelocity) * interp;
if(length <= 0) return;
renderBulletStandard(Tessellator.instance, 0x9E082E, 0xFF8A79, length, false);
};
public static BiConsumer<EntityBulletBaseMK4, Float> RENDER_DU_BULLET = (bullet, interp) -> {
double length = bullet.prevVelocity + (bullet.velocity - bullet.prevVelocity) * interp;
if(length <= 0) return;
renderBulletStandard(Tessellator.instance, 0x5CCD41, 0xE9FF8D, length, false);
};
public static BiConsumer<EntityBulletBaseMK4, Float> RENDER_TRACER_BULLET = (bullet, interp) -> {
double length = bullet.prevVelocity + (bullet.velocity - bullet.prevVelocity) * interp;
if(length <= 0) return;
renderBulletStandard(Tessellator.instance, 0x9E082E, 0xFF8A79, length, true);
};
public static void renderBulletStandard(Tessellator tess, int dark, int light, double length, boolean fullbright) { renderBulletStandard(tess, dark, light, length, 0.03125D, 0.03125D * 0.25D, fullbright); }
public static void renderBulletStandard(Tessellator tess, int dark, int light, double length, double widthF, double widthB, boolean fullbright) {
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glColor4f(1F, 1F, 1F, 1F);
tess.startDrawingQuads();
if(fullbright) tess.setBrightness(240);
tess.setNormal(0F, 1F, 0F);
tess.setColorOpaque_I(dark);
tess.addVertex(length, widthB, -widthB); tess.addVertex(length, widthB, widthB);
tess.setColorOpaque_I(light);
tess.addVertex(0, widthF, widthF); tess.addVertex(0, widthF, -widthF);
tess.setColorOpaque_I(dark);
tess.addVertex(length, -widthB, -widthB); tess.addVertex(length, -widthB, widthB);
tess.setColorOpaque_I(light);
tess.addVertex(0, -widthF, widthF); tess.addVertex(0, -widthF, -widthF);
tess.setColorOpaque_I(dark);
tess.addVertex(length, -widthB, widthB); tess.addVertex(length, widthB, widthB);
tess.setColorOpaque_I(light);
tess.addVertex(0, widthF, widthF); tess.addVertex(0, -widthF, widthF);
tess.setColorOpaque_I(dark);
tess.addVertex(length, -widthB, -widthB); tess.addVertex(length, widthB, -widthB);
tess.setColorOpaque_I(light);
tess.addVertex(0, widthF, -widthF); tess.addVertex(0, -widthF, -widthF);
tess.setColorOpaque_I(dark);
tess.addVertex(length, widthB, widthB); tess.addVertex(length, widthB, -widthB);
tess.addVertex(length, -widthB, -widthB); tess.addVertex(length, -widthB, widthB);
tess.setColorOpaque_I(light);
tess.addVertex(0, widthF, widthF); tess.addVertex(0, widthF, -widthF);
tess.addVertex(0, -widthF, -widthF); tess.addVertex(0, -widthF, widthF);
tess.draw();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
private static final ResourceLocation flare = new ResourceLocation(RefStrings.MODID + ":textures/particle/flare.png");
public static BiConsumer<EntityBulletBaseMK4, Float> RENDER_FLARE = (bullet, interp) -> {
if(bullet.ticksExisted < 2) return;
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
GL11.glAlphaFunc(GL11.GL_GREATER, 0);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glDepthMask(false);
RenderHelper.disableStandardItemLighting();
Minecraft.getMinecraft().getTextureManager().bindTexture(flare);
Tessellator tess = Tessellator.instance;
tess.startDrawingQuads();
float f1 = ActiveRenderInfo.rotationX;
float f2 = ActiveRenderInfo.rotationZ;
float f3 = ActiveRenderInfo.rotationYZ;
float f4 = ActiveRenderInfo.rotationXY;
float f5 = ActiveRenderInfo.rotationXZ;
double posX = 0;
double posY = 0;
double posZ = 0;
double scale = Math.min(5, (bullet.ticksExisted + interp - 2) * 0.5) * (0.8 + bullet.worldObj.rand.nextDouble() * 0.4);
tess.setColorRGBA_F(1F, 0.5F, 0.5F, 0.5F);
tess.addVertexWithUV((double) (posX - f1 * scale - f3 * scale), (double) (posY - f5 * scale), (double) (posZ - f2 * scale - f4 * scale), 1, 1);
tess.addVertexWithUV((double) (posX - f1 * scale + f3 * scale), (double) (posY + f5 * scale), (double) (posZ - f2 * scale + f4 * scale), 1, 0);
tess.addVertexWithUV((double) (posX + f1 * scale + f3 * scale), (double) (posY + f5 * scale), (double) (posZ + f2 * scale + f4 * scale), 0, 0);
tess.addVertexWithUV((double) (posX + f1 * scale - f3 * scale), (double) (posY - f5 * scale), (double) (posZ + f2 * scale - f4 * scale), 0, 1);
scale *= 0.5D;
tess.setColorRGBA_F(1F, 1F, 1F, 0.75F);
tess.addVertexWithUV((double) (posX - f1 * scale - f3 * scale), (double) (posY - f5 * scale), (double) (posZ - f2 * scale - f4 * scale), 1, 1);
tess.addVertexWithUV((double) (posX - f1 * scale + f3 * scale), (double) (posY + f5 * scale), (double) (posZ - f2 * scale + f4 * scale), 1, 0);
tess.addVertexWithUV((double) (posX + f1 * scale + f3 * scale), (double) (posY + f5 * scale), (double) (posZ + f2 * scale + f4 * scale), 0, 0);
tess.addVertexWithUV((double) (posX + f1 * scale - f3 * scale), (double) (posY - f5 * scale), (double) (posZ + f2 * scale - f4 * scale), 0, 1);
tess.draw();
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_ALPHA_TEST);
RenderHelper.enableStandardItemLighting();
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
};
public static BiConsumer<EntityBulletBaseMK4, Float> RENDER_GRENADE = (bullet, interp) -> {
GL11.glScalef(0.25F, 0.25F, 0.25F);
GL11.glRotated(90, 0, 0, 1);
GL11.glShadeModel(GL11.GL_SMOOTH);
Minecraft.getMinecraft().getTextureManager().bindTexture(ResourceManager.grenade_tex);
ResourceManager.projectiles.renderPart("Grenade");
GL11.glShadeModel(GL11.GL_FLAT);
};
}

View File

@ -0,0 +1,422 @@
package com.hbm.items.weapon.sedna.factory;
import java.util.function.BiConsumer;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.Receiver;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.particle.SpentCasing;
import com.hbm.particle.helper.CasingCreator;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/** Orchestras are server-side components that run along client-side animations.
* The orchestra only knows what animation is or was playing and how long it started, but not if it is still active.
* Orchestras are useful for things like playing server-side sound, spawning casings or sending particle packets.*/
public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> DEBUG_ORCHESTRA = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
if(type == AnimType.RELOAD) {
if(timer == 3) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F);
if(timer == 10) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallRemove", 1F, 1F);
if(timer == 34) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
if(timer == 40) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 1F);
if(timer == 16) {
Receiver rec = ctx.config.getReceivers(stack)[0];
IMagazine mag = rec.getMagazine(stack);
SpentCasing casing = mag.getCasing(stack);
for(int i = 0; i < mag.getCapacity(stack); i++) CasingCreator.composeEffect(player.worldObj, player, 0.25, -0.125, -0.125, -0.05, 0, 0, 0.01, casing.getName());
}
}
if(type == AnimType.CYCLE) {
if(timer == 11) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F);
}
if(type == AnimType.CYCLE_DRY) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.dryFireClick", 1F, 1F);
if(timer == 11) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F);
}
if(type == AnimType.INSPECT) {
if(timer == 3) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F);
if(timer == 16) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 1F);
}
};
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_PEPPERBOX = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
if(type == AnimType.RELOAD) {
if(timer == 24) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
if(timer == 55) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverSpin", 1F, 1F);
}
if(type == AnimType.CYCLE) {
if(timer == 21) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 0.6F);
}
if(type == AnimType.CYCLE_DRY) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.dryFireClick", 1F, 0.8F);
if(timer == 11) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 0.6F);
}
if(type == AnimType.INSPECT) {
if(timer == 3) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverSpin", 1F, 1F);
}
if(type == AnimType.JAMMED) {
if(timer == 28) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.dryFireClick", 1F, 0.75F);
if(timer == 45) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.dryFireClick", 1F, 0.6F);
}
};
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_ATLAS = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
if(type == AnimType.RELOAD) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallRemove", 1F, 1F);
if(timer == 36) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
if(timer == 44) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 1F);
}
if(type == AnimType.CYCLE) {
if(timer == 14) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 0.9F);
}
if(type == AnimType.CYCLE_DRY) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.dryFireClick", 1F, 1F);
if(timer == 14) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 0.9F);
}
if(type == AnimType.INSPECT) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallRemove", 1F, 1F);
if(timer == 24) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 1F);
}
if(type == AnimType.JAMMED) {
if(timer == 12) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallRemove", 1F, 1F);
if(timer == 34) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 1F);
}
};
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_DANI = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
if(type == AnimType.RELOAD) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallRemove", 1F, 1F);
if(timer == 36) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
if(timer == 44) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 1F);
}
if(type == AnimType.CYCLE) {
if(timer == 9) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 0.9F);
}
if(type == AnimType.CYCLE_DRY) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.dryFireClick", 1F, 1F);
if(timer == 9) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 0.9F);
}
if(type == AnimType.INSPECT) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallRemove", 1F, 1F);
if(timer == 24) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 1F);
}
if(type == AnimType.JAMMED) {
if(timer == 12) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallRemove", 1F, 1F);
if(timer == 34) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 1F);
}
};
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_HENRY = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
if(type == AnimType.RELOAD) {
if(timer == 8) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallRemove", 1F, 1F);
if(timer == 16) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
}
if(type == AnimType.RELOAD_CYCLE) {
if(timer == 0) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
}
if(type == AnimType.RELOAD_END) {
if(timer == 0) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallRemove", 1F, 0.9F);
if(timer == 12 && ctx.config.getReceivers(stack)[0].getMagazine(stack).getAmountBeforeReload(stack) <= 0) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.leverCock", 1F, 1F);
}
if(type == AnimType.JAMMED) {
if(timer == 0) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallRemove", 1F, 0.9F);
if(timer == 12) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.leverCock", 1F, 1F);
if(timer == 36) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.leverCock", 1F, 1F);
if(timer == 44) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.leverCock", 1F, 1F);
}
if(type == AnimType.CYCLE) {
if(timer == 14) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack);
CasingCreator.composeEffect(player.worldObj, player, 0.5, -0.125, aiming ? -0.125 : -0.375D, 0, 0.12, -0.12, 0.01, casing.getName(), true, 60, 0.5D, 20);
}
if(timer == 12) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.leverCock", 1F, 1F);
}
if(type == AnimType.CYCLE_DRY) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.dryFireClick", 1F, 1F);
if(timer == 12) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.leverCock", 1F, 1F);
}
};
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_GREASEGUN = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
if(type == AnimType.EQUIP) {
if(timer == 5) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.openLatch", 1F, 1F);
}
if(type == AnimType.CYCLE) {
if(timer == 2) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack);
CasingCreator.composeEffect(player.worldObj, player, 0.55, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, 0.18, -0.12, 0.01, casing.getName());
}
}
if(type == AnimType.CYCLE_DRY) {
if(timer == 0) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.dryFireClick", 1F, 0.8F);
if(timer == 11) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.pistolCock", 1F, 0.8F);
}
if(type == AnimType.RELOAD) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magRemove", 1F, 1F);
if(timer == 24) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magInsert", 1F, 1F);
if(timer == 36) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.pistolCock", 1F, 0.8F);
}
if(type == AnimType.INSPECT) {
if(timer == 5) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 0.8F);
if(timer == 26) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallInsert", 1F, 1.25F);
}
if(type == AnimType.JAMMED) {
if(timer == 11) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.pistolCock", 1F, 0.8F);
if(timer == 26) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.pistolCock", 1F, 0.8F);
}
};
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_MARESLEG = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
if(type == AnimType.RELOAD) {
if(timer == 8) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 0.8F);
if(timer == 16) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.shotgunReload", 1F, 1F);
}
if(type == AnimType.RELOAD_CYCLE) {
if(timer == 0) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.shotgunReload", 1F, 1F);
}
if(type == AnimType.RELOAD_END) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 0.7F);
}
if(type == AnimType.JAMMED) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 0.7F);
if(timer == 17) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.leverCock", 1F, 0.8F);
if(timer == 29) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.leverCock", 1F, 0.8F);
}
if(type == AnimType.CYCLE) {
if(timer == 14) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack);
CasingCreator.composeEffect(player.worldObj, player, 0.3125, -0.125, aiming ? -0.125 : -0.375D, 0, 0.18, -0.12, 0.01, casing.getName(), true, 60, 0.5D, 20);
}
if(timer == 8) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.leverCock", 1F, 0.8F);
}
if(type == AnimType.CYCLE_DRY) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.dryFireClick", 1F, 1F);
if(timer == 8) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.leverCock", 1F, 0.8F);
}
};
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_FLAREGUN = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
if(type == AnimType.RELOAD) {
if(timer == 0) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallRemove", 1F, 0.8F);
if(timer == 4) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack);
CasingCreator.composeEffect(player.worldObj, player, 0.625, -0.125, aiming ? -0.125 : -0.375D, -0.12, 0.18, 0, 0.01, casing.getName(), true, 60, 0.5D, 20);
}
if(timer == 16) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.insertCanister", 1F, 1F);
if(timer == 24) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
}
if(type == AnimType.JAMMED) {
if(timer == 10) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallRemove", 1F, 0.8F);
if(timer == 29) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
}
if(type == AnimType.CYCLE) {
if(timer == 12) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F);
}
if(type == AnimType.CYCLE_DRY) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.dryFireClick", 1F, 1F);
if(timer == 12) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F);
}
};
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_NOPIP = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
if(type == AnimType.RELOAD) {
if(timer == 3) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F);
if(timer == 10) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallRemove", 1F, 1F);
if(timer == 34) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
if(timer == 40) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 1F);
if(timer == 16) {
Receiver rec = ctx.config.getReceivers(stack)[0];
IMagazine mag = rec.getMagazine(stack);
SpentCasing casing = mag.getCasing(stack);
for(int i = 0; i < mag.getCapacity(stack); i++) CasingCreator.composeEffect(player.worldObj, player, 0.25, -0.125, -0.125, -0.05, 0, 0, 0.01, casing.getName());
}
}
if(type == AnimType.CYCLE) {
if(timer == 11) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F);
}
if(type == AnimType.CYCLE_DRY) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.dryFireClick", 1F, 1F);
if(timer == 11) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F);
}
if(type == AnimType.INSPECT) {
if(timer == 3) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F);
if(timer == 16) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 1F);
}
};
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_CARBIBE = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
if(type == AnimType.CYCLE) {
if(timer == 2) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack);
CasingCreator.composeEffect(player.worldObj, player, 0.3125, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, 0.18, -0.06, 0.01, casing.getName(), true, 60, 0.5D, 20);
}
}
if(type == AnimType.CYCLE_DRY) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.dryFireClick", 1F, 1F);
if(timer == 8) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.pistolCock", 1F, 0.8F);
}
if(type == AnimType.RELOAD) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magRemove", 1F, 1F);
if(timer == 26) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magInsert", 1F, 1F);
}
if(type == AnimType.RELOAD_END) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.pistolCock", 1F, 0.8F);
}
if(type == AnimType.JAMMED) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.pistolCock", 1F, 0.8F);
if(timer == 31) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.pistolCock", 1F, 0.8F);
}
if(type == AnimType.INSPECT) {
if(timer == 6) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 1F);
if(timer == 30) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 0.9F);
}
};
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_AM180 = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
if(type == AnimType.CYCLE) {
if(timer == 0) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack);
CasingCreator.composeEffect(player.worldObj, player, 0.4375, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, -0.06, 0, 0.01, casing.getName());
}
}
if(type == AnimType.CYCLE_DRY) {
if(timer == 0) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.dryFireClick", 1F, 1F);
if(timer == 6) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.pistolCock", 1F, 0.9F);
}
if(type == AnimType.RELOAD) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magRemove", 1F, 1F);
if(timer == 20) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.impact", 0.25F, 1F);
if(timer == 32) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magInsert", 1F, 1F);
if(timer == 40) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.pistolCock", 1F, 0.9F);
}
if(type == AnimType.JAMMED) {
if(timer == 15) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.pistolCock", 1F, 0.8F);
}
if(type == AnimType.INSPECT) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magRemove", 1F, 1F);
if(timer == 35) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magInsert", 1F, 1F);
}
};
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_LIBERATOR = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
if(type == AnimType.RELOAD) {
if(timer == 0) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 0.75F);
if(timer == 4) {
IMagazine mag = ctx.config.getReceivers(stack)[0].getMagazine(stack);
int toEject = mag.getAmountAfterReload(stack) - mag.getAmount(stack);
SpentCasing casing = mag.getCasing(stack);
for(int i = 0; i < toEject; i++) CasingCreator.composeEffect(player.worldObj, player, 0.625, -0.1875, -0.375D, -0.12, 0.18, 0, 0.01, casing.getName(), true, 60, 0.5D, 20);
}
if(timer == 15) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
}
if(type == AnimType.RELOAD_CYCLE) {
if(timer == 5) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
}
if(type == AnimType.RELOAD_END) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 0.9F);
}
if(type == AnimType.JAMMED) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 0.9F);
if(timer == 12) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 0.75F);
if(timer == 26) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 0.9F);
}
if(type == AnimType.CYCLE_DRY) {
if(timer == 0) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.dryFireClick", 1F, 1F);
}
if(type == AnimType.INSPECT) {
if(timer == 0) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 0.75F);
IMagazine mag = ctx.config.getReceivers(stack)[0].getMagazine(stack);
int toEject = mag.getAmountAfterReload(stack) - mag.getAmount(stack);
if(timer == 4 && toEject <= 0) {
SpentCasing casing = mag.getCasing(stack);
for(int i = 0; i < toEject; i++) CasingCreator.composeEffect(player.worldObj, player, 0.625, -0.1875, -0.375D, -0.12, 0.18, 0, 0.01, casing.getName(), true, 60, 0.5D, 20);
mag.setAmountAfterReload(stack, 0);
}
if(timer == 20) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 0.9F);
}
};
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_CONGOLAKE = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
if(type == AnimType.CYCLE) {
if(timer == 15) {
IMagazine mag = ctx.config.getReceivers(stack)[0].getMagazine(stack);
SpentCasing casing = mag.getCasing(stack);
CasingCreator.composeEffect(player.worldObj, player, 0.625, aiming ? -0.0625 : -0.25, aiming ? 0 : -0.375D, 0, 0.18, 0.12, 0.01, casing.getName(), true, 60, 0.5D, 20);
}
}
if(type == AnimType.RELOAD || type == AnimType.RELOAD_CYCLE) {
if(timer == 0) player.worldObj.playSoundAtEntity(player, "hbm:weapon.glReload", 1F, 1F);
}
if(type == AnimType.INSPECT) {
if(timer == 9) player.worldObj.playSoundAtEntity(player, "hbm:weapon.glOpen", 1F, 1F);
if(timer == 27) player.worldObj.playSoundAtEntity(player, "hbm:weapon.glClose", 1F, 1F);
}
};
}

View File

@ -0,0 +1,200 @@
package com.hbm.items.weapon.sedna.factory;
import java.util.function.BiFunction;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.BulletConfig;
import com.hbm.items.weapon.sedna.Crosshair;
import com.hbm.items.weapon.sedna.GunConfig;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.Receiver;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.mags.MagazineSingleReload;
import com.hbm.lib.RefStrings;
import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.item.ItemStack;
public class XFactory12ga {
public static BulletConfig g12_bp;
public static BulletConfig g12_bp_magnum;
public static BulletConfig g12_bp_slug;
public static BulletConfig g12;
public static void init() {
g12_bp = new BulletConfig().setItem(EnumAmmo.G12_BP).setProjectiles(8, 8).setSpread(0.05F).setRicochetAngle(15).setCasing(new SpentCasing(CasingType.STRAIGHT).setColor(SpentCasing.COLOR_CASE_BRASS).setScale(1.5F).register("12GA_BP"));
g12_bp_magnum = new BulletConfig().setItem(EnumAmmo.G12_BP_MAGNUM).setProjectiles(4, 4).setSpread(0.05F).setRicochetAngle(25).setCasing(new SpentCasing(CasingType.STRAIGHT).setColor(SpentCasing.COLOR_CASE_BRASS).setScale(1.5F).register("12GA_BP_MAGNUM"));
g12_bp_slug = new BulletConfig().setItem(EnumAmmo.G12_BP_SLUG).setSpread(0.01F).setRicochetAngle(5).setCasing(new SpentCasing(CasingType.STRAIGHT).setColor(SpentCasing.COLOR_CASE_BRASS).setScale(1.5F).register("12GA_BP_SLUG"));
g12 = new BulletConfig().setItem(EnumAmmo.G12).setProjectiles(8, 8).setSpread(0.05F).setRicochetAngle(15).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0xB52B2B, SpentCasing.COLOR_CASE_BRASS).setScale(0.75F).register("12GA"));
ModItems.gun_maresleg = new ItemGunBaseNT(new GunConfig()
.dura(600).draw(20).inspect(39).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0)
.dmg(12F).delay(20).reload(22, 10, 13, 0).jam(24).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.mag(new MagazineSingleReload(0, 6).addConfigs(g12_bp, g12_bp_magnum, g12_bp_slug, g12))
.offset(0.75, -0.0625, -0.1875D)
.canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE).recoil(Lego.LAMBDA_STANDARD_RECOIL))
.setupStandardConfiguration()
.anim(LAMBDA_MARESLEG_ANIMS).orchestra(Orchestras.ORCHESTRA_MARESLEG)
).setUnlocalizedName("gun_maresleg").setTextureName(RefStrings.MODID + ":gun_darter");
ModItems.gun_liberator = new ItemGunBaseNT(new GunConfig()
.dura(200).draw(20).inspect(21).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0)
.dmg(12F).delay(20).rounds(4).reload(25, 15, 7, 0).jam(45).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.mag(new MagazineSingleReload(0, 4).addConfigs(g12_bp, g12_bp_magnum, g12_bp_slug, g12))
.offset(0.75, -0.0625, -0.1875D)
.canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE).recoil(Lego.LAMBDA_STANDARD_RECOIL))
.setupStandardConfiguration()
.anim(LAMBDA_LIBERATOR_ANIMS).orchestra(Orchestras.ORCHESTRA_LIBERATOR)
).setUnlocalizedName("gun_liberator").setTextureName(RefStrings.MODID + ":gun_darter");
}
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_MARESLEG_ANIMS = (stack, type) -> {
switch(type) {
case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(-60, 0, 0, 0).addPos(0, 0, -3, 500, IType.SIN_DOWN));
case CYCLE: return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, 0, 50).addPos(0, 0, -1, 50).addPos(0, 0, 0, 250))
.addBus("SIGHT", new BusAnimationSequence().addPos(35, 0, 0, 100, IType.SIN_DOWN).addPos(0, 0, 0, 100, IType.SIN_FULL))
.addBus("LEVER", new BusAnimationSequence().addPos(0, 0, 0, 600).addPos(-85, 0, 0, 200).addPos(0, 0, 0, 200))
.addBus("TURN", new BusAnimationSequence().addPos(0, 0, 0, 600).addPos(0, 0, 45, 200, IType.SIN_DOWN).addPos(0, 0, 0, 200, IType.SIN_UP))
.addBus("HAMMER", new BusAnimationSequence().addPos(30, 0, 0, 50).addPos(30, 0, 0, 550).addPos(0, 0, 0, 200));
case CYCLE_DRY: return new BusAnimation()
.addBus("LEVER", new BusAnimationSequence().addPos(0, 0, 0, 600).addPos(-90, 0, 0, 200).addPos(0, 0, 0, 200))
.addBus("TURN", new BusAnimationSequence().addPos(0, 0, 0, 600).addPos(0, 0, 45, 200, IType.SIN_DOWN).addPos(0, 0, 0, 200, IType.SIN_UP))
.addBus("HAMMER", new BusAnimationSequence().addPos(30, 0, 0, 50).addPos(30, 0, 0, 550).addPos(0, 0, 0, 200));
case RELOAD:
boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack) <= 0;
return new BusAnimation()
.addBus("LIFT", new BusAnimationSequence().addPos(30, 0, 0, 400, IType.SIN_FULL))
.addBus("LEVER", new BusAnimationSequence().addPos(0, 0, 0, 400).addPos(-85, 0, 0, 200))
.addBus("SHELL", new BusAnimationSequence().addPos(0, 0, 0, 600).addPos(0, 0.25, -3, 0).addPos(0, empty ? 0.25 : 0.125, -1.5, 150, IType.SIN_UP).addPos(0, empty ? 0.25 : -0.25, 0, 150, IType.SIN_DOWN))
.addBus("FLAG", new BusAnimationSequence().addPos(0, 0, 0, empty ? 900 : 0).addPos(1, 1, 1, 0));
case RELOAD_CYCLE: return new BusAnimation()
.addBus("LIFT", new BusAnimationSequence().addPos(30, 0, 0, 0))
.addBus("LEVER", new BusAnimationSequence().addPos(-85, 0, 0, 0))
.addBus("SHELL", new BusAnimationSequence().addPos(0, 0.25, -3, 0).addPos(0, 0.125, -1.5, 150, IType.SIN_UP).addPos(0, -0.125, 0, 150, IType.SIN_DOWN))
.addBus("FLAG", new BusAnimationSequence().addPos(1, 1, 1, 0));
case RELOAD_END: return new BusAnimation()
.addBus("LIFT", new BusAnimationSequence().addPos(30, 0, 0, 0).addPos(30, 0, 0, 250).addPos(0, 0, 0, 400, IType.SIN_FULL))
.addBus("LEVER", new BusAnimationSequence().addPos(-85, 0, 0, 0).addPos(0, 0, 0, 200))
.addBus("FLAG", new BusAnimationSequence().addPos(1, 1, 1, 0));
case JAMMED: return new BusAnimation()
.addBus("LIFT", new BusAnimationSequence().addPos(30, 0, 0, 0).addPos(30, 0, 0, 250).addPos(0, 0, 0, 400, IType.SIN_FULL))
.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("TURN", new BusAnimationSequence().addPos(0, 0, 0, 850).addPos(0, 0, 45, 200, IType.SIN_DOWN).addPos(0, 0, 45, 800).addPos(0, 0, 0, 200, IType.SIN_UP))
.addBus("FLAG", new BusAnimationSequence().addPos(1, 1, 1, 0));
case INSPECT: return new BusAnimation()
.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));
}
return null;
};
/** This fucking sucks */
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_LIBERATOR_ANIMS = (stack, type) -> {
int ammo = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack);
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 CYCLE: return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, -2.5, 50, IType.SIN_DOWN).addPos(0, 0, 0, 350, IType.SIN_FULL));
case CYCLE_DRY: return new BusAnimation();
case RELOAD: if(ammo == 0) return new BusAnimation()
.addBus("LATCH", new BusAnimationSequence().addPos(15, 0, 0, 100))
.addBus("BREAK", new BusAnimationSequence().addPos(0, 0, 0, 100).addPos(60, 0, 0, 350, IType.SIN_DOWN))
.addBus("SHELL1", new BusAnimationSequence().addPos(2, -4, -2, 0).addPos(2, -4, -2, 400).addPos(0, 0, -2, 450, IType.SIN_FULL).addPos(0, 0, 0, 50, IType.SIN_UP))
.addBus("SHELL2", new BusAnimationSequence().addPos(2, -4, -2, 0))
.addBus("SHELL3", new BusAnimationSequence().addPos(2, -4, -2, 0))
.addBus("SHELL4", new BusAnimationSequence().addPos(2, -4, -2, 0));
if(ammo == 1) return new BusAnimation()
.addBus("LATCH", new BusAnimationSequence().addPos(15, 0, 0, 100))
.addBus("BREAK", new BusAnimationSequence().addPos(0, 0, 0, 100).addPos(60, 0, 0, 350, IType.SIN_DOWN))
.addBus("SHELL1", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus("SHELL2", new BusAnimationSequence().addPos(2, -4, -2, 0).addPos(2, -4, -2, 400).addPos(0, 0, -2, 450, IType.SIN_FULL).addPos(0, 0, 0, 50, IType.SIN_UP))
.addBus("SHELL3", new BusAnimationSequence().addPos(2, -4, -2, 0))
.addBus("SHELL4", new BusAnimationSequence().addPos(2, -4, -2, 0));
if(ammo == 2) return new BusAnimation()
.addBus("LATCH", new BusAnimationSequence().addPos(15, 0, 0, 100))
.addBus("BREAK", new BusAnimationSequence().addPos(0, 0, 0, 100).addPos(60, 0, 0, 350, IType.SIN_DOWN))
.addBus("SHELL1", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus("SHELL2", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus("SHELL3", new BusAnimationSequence().addPos(2, -4, -2, 0).addPos(2, -4, -2, 400).addPos(0, 0, -2, 450, IType.SIN_FULL).addPos(0, 0, 0, 50, IType.SIN_UP))
.addBus("SHELL4", new BusAnimationSequence().addPos(2, -4, -2, 0));
if(ammo == 3) return new BusAnimation()
.addBus("LATCH", new BusAnimationSequence().addPos(15, 0, 0, 100))
.addBus("BREAK", new BusAnimationSequence().addPos(0, 0, 0, 100).addPos(60, 0, 0, 350, IType.SIN_DOWN))
.addBus("SHELL1", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus("SHELL2", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus("SHELL3", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus("SHELL4", new BusAnimationSequence().addPos(2, -4, -2, 0).addPos(2, -4, -2, 400).addPos(0, 0, -2, 450, IType.SIN_FULL).addPos(0, 0, 0, 50, IType.SIN_UP));
case RELOAD_CYCLE:
if(ammo == 0) return new BusAnimation()
.addBus("LATCH", new BusAnimationSequence().addPos(15, 0, 0, 0))
.addBus("BREAK", new BusAnimationSequence().addPos(60, 0, 0, 0))
.addBus("SHELL1", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus("SHELL2", new BusAnimationSequence().addPos(2, -4, -2, 0).addPos(0, 0, -2, 450, IType.SIN_FULL).addPos(0, 0, 0, 50, IType.SIN_UP))
.addBus("SHELL3", new BusAnimationSequence().addPos(2, -4, -2, 0))
.addBus("SHELL4", new BusAnimationSequence().addPos(2, -4, -2, 0));
if(ammo == 1) return new BusAnimation()
.addBus("LATCH", new BusAnimationSequence().addPos(15, 0, 0, 0))
.addBus("BREAK", new BusAnimationSequence().addPos(60, 0, 0, 0))
.addBus("SHELL1", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus("SHELL2", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus("SHELL3", new BusAnimationSequence().addPos(2, -4, -2, 0).addPos(0, 0, -2, 450, IType.SIN_FULL).addPos(0, 0, 0, 50, IType.SIN_UP))
.addBus("SHELL4", new BusAnimationSequence().addPos(2, -4, -2, 0));
if(ammo == 2) return new BusAnimation()
.addBus("LATCH", new BusAnimationSequence().addPos(15, 0, 0, 0))
.addBus("BREAK", new BusAnimationSequence().addPos(60, 0, 0, 0))
.addBus("SHELL1", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus("SHELL2", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus("SHELL3", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus("SHELL4", new BusAnimationSequence().addPos(2, -4, -2, 0).addPos(0, 0, -2, 450, IType.SIN_FULL).addPos(0, 0, 0, 50, IType.SIN_UP));
return null;
case RELOAD_END: return new BusAnimation()
.addBus("LATCH", new BusAnimationSequence().addPos(15, 0, 0, 0).addPos(15, 0, 0, 250).addPos(0, 0, 0, 50))
.addBus("BREAK", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 250, IType.SIN_UP))
.addBus(ammo >= 0 ? "SHELL1" : "NULL", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus(ammo >= 1 ? "SHELL2" : "NULL", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus(ammo >= 2 ? "SHELL3" : "NULL", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus(ammo >= 3 ? "SHELL4" : "NULL", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus(ammo < 0 ? "SHELL1" : "NULL", new BusAnimationSequence().addPos(2, -8, -2, 0))
.addBus(ammo < 1 ? "SHELL2" : "NULL", new BusAnimationSequence().addPos(2, -8, -2, 0))
.addBus(ammo < 2 ? "SHELL3" : "NULL", new BusAnimationSequence().addPos(2, -8, -2, 0))
.addBus(ammo < 3 ? "SHELL4" : "NULL", new BusAnimationSequence().addPos(2, -8, -2, 0));
case JAMMED: return new BusAnimation()
.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(ammo >= 0 ? "SHELL1" : "NULL", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus(ammo >= 1 ? "SHELL2" : "NULL", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus(ammo >= 2 ? "SHELL3" : "NULL", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus(ammo >= 3 ? "SHELL4" : "NULL", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus(ammo < 0 ? "SHELL1" : "NULL", new BusAnimationSequence().addPos(2, -8, -2, 0))
.addBus(ammo < 1 ? "SHELL2" : "NULL", new BusAnimationSequence().addPos(2, -8, -2, 0))
.addBus(ammo < 2 ? "SHELL3" : "NULL", new BusAnimationSequence().addPos(2, -8, -2, 0))
.addBus(ammo < 3 ? "SHELL4" : "NULL", new BusAnimationSequence().addPos(2, -8, -2, 0));
case INSPECT: return new BusAnimation()
.addBus("LATCH", new BusAnimationSequence().addPos(15, 0, 0, 100).addPos(15, 0, 0, 1100).addPos(0, 0, 0, 50))
.addBus("BREAK", new BusAnimationSequence().addPos(0, 0, 0, 100).addPos(60, 0, 0, 350, IType.SIN_DOWN).addPos(60, 0, 0, 500).addPos(0, 0, 0, 250, IType.SIN_UP))
.addBus(ammo > 0 ? "SHELL1" : "NULL", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus(ammo > 1 ? "SHELL2" : "NULL", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus(ammo > 2 ? "SHELL3" : "NULL", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus(ammo > 3 ? "SHELL4" : "NULL", new BusAnimationSequence().addPos(0, 0, 0, 0))
.addBus(ammo < 1 ? "SHELL1" : "NULL", new BusAnimationSequence().addPos(2, -8, -2, 0))
.addBus(ammo < 2 ? "SHELL2" : "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));
}
return null;
};
}

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