Merge branch 'HbmMods:master' into Optimization

This commit is contained in:
BallOfEnergy 2024-11-04 21:17:12 -06:00 committed by GitHub
commit 354860c610
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
55 changed files with 12803 additions and 4598 deletions

View File

@ -47,6 +47,10 @@
* Removed legacy wire items
* Removed random ore, along with its configs
* DFC emitters are now only 95% efficient instead of 98%
* Oily coal has been removed from worldgen, it no longer spawns in new chunks
* Existing oily coal can be mined risk-free
* Reeds rendering into water can now be toggled with the RENDER_REEDS client config
* This option is usually enabled by default, unless Angelica is installed
## Fixed
* The conveyor grabber should no longer skip over items when used in long lines

View File

@ -146,8 +146,8 @@ public class ModBlocks {
public static Block ore_bedrock_oil;
public static Block ore_lignite;
public static Block ore_asbestos;
public static Block ore_coal_oil;
public static Block ore_coal_oil_burning;
@Deprecated public static Block ore_coal_oil;
@Deprecated public static Block ore_coal_oil_burning;
public static Block ore_tikite;
@ -1008,6 +1008,7 @@ public class ModBlocks {
public static Block machine_press;
public static Block machine_epress;
public static Block machine_conveyor_press;
public static Block machine_ammo_press;
public static Block machine_siren;
@ -2179,6 +2180,7 @@ public class ModBlocks {
machine_press = new MachinePress(Material.iron).setBlockName("machine_press").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_press");
machine_epress = new MachineEPress(Material.iron).setBlockName("machine_epress").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_epress");
machine_conveyor_press = new MachineConveyorPress(Material.iron).setBlockName("machine_conveyor_press").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_ammo_press = new MachineAmmoPress().setBlockName("machine_ammo_press").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
reactor_research = new ReactorResearch(Material.iron).setBlockName("machine_reactor_small").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_reactor_small");
reactor_zirnox = new ReactorZirnox(Material.iron).setBlockName("machine_zirnox").setHardness(5.0F).setResistance(100.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
zirnox_destroyed = new ZirnoxDestroyed(Material.iron).setBlockName("zirnox_destroyed").setHardness(100.0F).setResistance(800.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
@ -2959,6 +2961,7 @@ public class ModBlocks {
GameRegistry.registerBlock(machine_press, machine_press.getUnlocalizedName());
GameRegistry.registerBlock(machine_epress, machine_epress.getUnlocalizedName());
register(machine_conveyor_press);
register(machine_ammo_press);
register(pump_steam);
register(pump_electric);
register(heater_firebox);

View File

@ -3,20 +3,12 @@ package com.hbm.blocks.generic;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.items.tool.ItemToolAbility;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemTool;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.util.Vec3;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockCoalOil extends Block {
@ -24,19 +16,6 @@ public class BlockCoalOil extends Block {
super(mat);
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block b) {
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
Block n = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
if(n == ModBlocks.ore_coal_oil_burning || n == ModBlocks.balefire || n == Blocks.fire || n.getMaterial() == Material.lava) {
world.scheduleBlockUpdate(x, y, z, this, world.rand.nextInt(20) + 2);
}
}
}
@Override
public void updateTick(World world, int x, int y, int z, Random rand) {
world.setBlock(x, y, z, ModBlocks.ore_coal_oil_burning);
@ -51,58 +30,4 @@ public class BlockCoalOil extends Block {
public int quantityDropped(Random rand) {
return 2 + rand.nextInt(2);
}
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) {
if(doesToolIgnite(player)) {
if(world.rand.nextInt(10) == 0)
world.setBlock(x, y, z, Blocks.fire);
}
}
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) {
if(!world.isRemote)
return;
if(doesToolIgnite(player)) {
Random rand = world.rand;
for(int i = 0; i < 15; i++) {
Vec3 vec = Vec3.createVectorHelper(1, 0, 0);
vec.rotateAroundZ((float)(Math.PI * rand.nextDouble() * 2D));
vec.rotateAroundY((float)(Math.PI * rand.nextDouble() * 2D));
double dX = vec.xCoord;
double dY = vec.yCoord;
double dZ = vec.zCoord;
if(Math.abs(dX) > 1)
dX /= Math.abs(dX);
if(Math.abs(dY) > 1)
dY /= Math.abs(dY);
if(Math.abs(dX) > 1)
dZ /= Math.abs(dZ);
world.spawnParticle("flame", x + 0.5 + dX * 0.75, y + 0.5 + dY * 0.75, z + 0.5 + dZ * 0.75, 0.0, 0.0, 0.0);
}
}
}
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion) {
world.setBlock(x, y, z, Blocks.fire);
}
private boolean doesToolIgnite(EntityPlayer player) {
if(player.getHeldItem() == null)
return false;
if(!(player.getHeldItem().getItem() instanceof ItemTool || player.getHeldItem().getItem() instanceof ItemToolAbility))
return false;
ItemTool tool = (ItemTool) player.getHeldItem().getItem();
return tool.func_150913_i() != ToolMaterial.WOOD;
}
}

View File

@ -103,7 +103,7 @@ public class BlockOutgas extends BlockOre {
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
if(onNeighbour) {
if(onNeighbour && world.rand.nextInt(3) == 0) {
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {

View File

@ -1,7 +1,6 @@
package com.hbm.blocks.generic;
import java.util.ArrayList;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.items.ModItems;

View File

@ -0,0 +1,36 @@
package com.hbm.blocks.machine;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.machine.TileEntityMachineAmmoPress;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class MachineAmmoPress extends BlockContainer {
public MachineAmmoPress() {
super(Material.iron);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityMachineAmmoPress();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if(world.isRemote) {
return true;
} else if(!player.isSneaking()) {
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
return true;
} else {
return false;
}
}
}

View File

@ -15,6 +15,7 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.stream.JsonWriter;
import com.hbm.main.MainRegistry;
import com.hbm.util.Compat;
// https://youtube.com/shorts/XTHZWqZt_AI
public class ClientConfig {
@ -36,6 +37,7 @@ public class ClientConfig {
public static ConfigWrapper<Boolean> RENDER_CABLE_HANG = new ConfigWrapper(true);
public static ConfigWrapper<Boolean> NUKE_HUD_FLASH = new ConfigWrapper(true);
public static ConfigWrapper<Boolean> NUKE_HUD_SHAKE = new ConfigWrapper(true);
public static ConfigWrapper<Boolean> RENDER_REEDS = new ConfigWrapper(!Compat.isModLoaded(Compat.MOD_ANG));
private static void initDefaults() {
configMap.put("GEIGER_OFFSET_HORIZONTAL", GEIGER_OFFSET_HORIZONTAL);
@ -51,6 +53,7 @@ public class ClientConfig {
configMap.put("RENDER_CABLE_HANG", RENDER_CABLE_HANG);
configMap.put("NUKE_HUD_FLASH", NUKE_HUD_FLASH);
configMap.put("NUKE_HUD_SHAKE", NUKE_HUD_SHAKE);
configMap.put("RENDER_REEDS", RENDER_REEDS);
}
/** Initializes defaults, then reads the config file if it exists, then writes the config file. */

View File

@ -24,7 +24,6 @@ public class WorldConfig {
public static int rareSpawn = 6;
public static int lithiumSpawn = 6;
public static int cinnebarSpawn = 1;
public static int oilcoalSpawn = 128;
public static int gassshaleSpawn = 5;
public static int gasbubbleSpawn = 12;
public static int explosivebubbleSpawn = 0;
@ -141,7 +140,6 @@ public class WorldConfig {
asbestosSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.12_asbestosSpawnRate", "Amount of asbestos ore veins per chunk", 2);
lithiumSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.13_lithiumSpawnRate", "Amount of schist lithium ore veins per chunk", 6);
rareSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.14_rareEarthSpawnRate", "Amount of rare earth ore veins per chunk", 6);
oilcoalSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.15_oilCoalSpawnRate", "Spawns an oily coal vein every nTH chunk", 128);
gassshaleSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.16_gasShaleSpawnRate", "Amount of oil shale veins per chunk", 5);
gasbubbleSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.17_gasBubbleSpawnRate", "Spawns a gas bubble every nTH chunk", 12);
cinnebarSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.18_cinnebarSpawnRate", "Amount of cinnebar ore veins per chunk", 1);

View File

@ -86,9 +86,7 @@ public class EntityMappings {
addEntity(EntityGrenadeASchrab.class, "entity_grenade_aschrab", 500);
addEntity(EntityFalloutRain.class, "entity_fallout", 1000);
addEntity(EntityEMPBlast.class, "entity_emp_blast", 1000);
addEntity(EntityPlasmaBeam.class, "entity_immolator_beam", 1000);
addEntity(EntityLN2.class, "entity_LN2", 1000);
addEntity(EntityNightmareBlast.class, "entity_ominous_bullet", 1000);
addEntity(EntityGrenadePulse.class, "entity_grenade_pulse", 1000);
addEntity(EntityLaserBeam.class, "entity_laser_beam", 1000);
addEntity(EntityMinerBeam.class, "entity_miner_beam", 1000);
@ -150,6 +148,7 @@ public class EntityMappings {
addEntity(EntityFallingNuke.class, "entity_falling_bomb", 1000);
addEntity(EntityBulletBaseNT.class, "entity_bullet_mk3", 250, false);
addEntity(EntityBulletBaseMK4.class, "entity_bullet_mk4", 250, false);
addEntity(EntityBulletBeamBase.class, "entity_beam_mk4", 250, false);
addEntity(EntityMinerRocket.class, "entity_miner_lander", 1000);
addEntity(EntityFogFX.class, "entity_nuclear_fog", 1000);
addEntity(EntityDuchessGambit.class, "entity_duchessgambit", 1000);

View File

@ -0,0 +1,193 @@
package com.hbm.entity.projectile;
import java.util.List;
import com.hbm.items.weapon.sedna.BulletConfig;
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public class EntityBulletBeamBase extends Entity implements IEntityAdditionalSpawnData {
protected EntityLivingBase thrower;
public BulletConfig config;
public float damage;
public double headingX;
public double headingY;
public double headingZ;
public double beamLength;
public EntityBulletBeamBase(World world) {
super(world);
this.ignoreFrustumCheck = true;
this.renderDistanceWeight = 10.0D;
this.setSize(0.5F, 0.5F);
}
public EntityBulletBeamBase(EntityLivingBase entity, BulletConfig config, float baseDamage, float angularInaccuracy, double sideOffset, double heightOffset, double frontOffset) {
this(entity.worldObj);
this.thrower = entity;
this.setBulletConfig(config);
this.damage = baseDamage * this.config.damageMult;
this.setLocationAndAngles(thrower.posX, thrower.posY + thrower.getEyeHeight(), thrower.posZ, thrower.rotationYaw + (float) rand.nextGaussian() * angularInaccuracy, thrower.rotationPitch + (float) rand.nextGaussian() * angularInaccuracy);
Vec3 offset = Vec3.createVectorHelper(sideOffset, heightOffset, frontOffset);
offset.rotateAroundX(-this.rotationPitch / 180F * (float) Math.PI);
offset.rotateAroundY(-this.rotationYaw / 180F * (float) Math.PI);
this.posX += offset.xCoord;
this.posY += offset.yCoord;
this.posZ += offset.zCoord;
this.setPosition(this.posX, this.posY, this.posZ);
this.headingX = (double) (-MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI));
this.headingZ = (double) (MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI));
this.headingY = (double) (-MathHelper.sin((this.rotationPitch) / 180.0F * (float) Math.PI));
double range = 150D;
this.headingX *= range;
this.headingY *= range;
this.headingZ *= range;
performHitscan();
}
@Override
protected void entityInit() {
this.dataWatcher.addObject(3, Integer.valueOf(0));
}
public void setBulletConfig(BulletConfig config) {
this.config = config;
this.dataWatcher.updateObject(3, config.id);
}
public BulletConfig getBulletConfig() {
int id = this.dataWatcher.getWatchableObjectInt(3);
if(id < 0 || id > BulletConfig.configs.size()) return null;
return BulletConfig.configs.get(id);
}
@Override
public void onUpdate() {
if(config == null) config = this.getBulletConfig();
if(config == null){
this.setDead();
return;
}
super.onUpdate();
if(!worldObj.isRemote && this.ticksExisted > config.expires) this.setDead();
}
protected void performHitscan() {
Vec3 pos = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
Vec3 nextPos = Vec3.createVectorHelper(this.posX + this.headingX, this.posY + this.headingY, this.posZ + this.headingZ);
MovingObjectPosition mop = null;
if(!this.isSpectral()) mop = this.worldObj.func_147447_a(pos, nextPos, false, true, false);
pos = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
nextPos = Vec3.createVectorHelper(this.posX + this.headingX, this.posY + this.headingY, this.posZ + this.headingZ);
if(mop != null) {
nextPos = Vec3.createVectorHelper(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
}
if(!this.worldObj.isRemote && this.doesImpactEntities()) {
Entity hitEntity = null;
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.headingX, this.headingY, this.headingZ).expand(1.0D, 1.0D, 1.0D));
double nearest = 0.0D;
MovingObjectPosition nonPenImpact = null;
for(int j = 0; j < list.size(); ++j) {
Entity entity = (Entity) list.get(j);
if(entity.canBeCollidedWith() && entity != thrower) {
double hitbox = 0.3F;
AxisAlignedBB aabb = entity.boundingBox.expand(hitbox, hitbox, hitbox);
MovingObjectPosition hitMop = aabb.calculateIntercept(pos, nextPos);
if(hitMop != null) {
// if penetration is enabled, run impact for all intersecting entities
if(this.doesPenetrate()) {
this.onImpact(new MovingObjectPosition(entity, hitMop.hitVec));
} else {
double dist = pos.distanceTo(hitMop.hitVec);
if(dist < nearest || nearest == 0.0D) {
hitEntity = entity;
nearest = dist;
nonPenImpact = hitMop;
}
}
}
}
}
// if not, only run it for the closest MOP
if(!this.doesPenetrate() && hitEntity != null) {
mop = new MovingObjectPosition(hitEntity, nonPenImpact.hitVec);
}
}
if(mop != null) {
if(mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && this.worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ) == Blocks.portal) {
this.setInPortal();
} else {
this.onImpact(mop);
}
Vec3 vec = Vec3.createVectorHelper(mop.hitVec.xCoord - posX, mop.hitVec.yCoord - posY, mop.hitVec.zCoord - posZ);
this.beamLength = vec.lengthVector();
} else {
Vec3 vec = Vec3.createVectorHelper(nextPos.xCoord - posX, nextPos.yCoord - posY, nextPos.zCoord - posZ);
this.beamLength = vec.lengthVector();
}
}
protected void onImpact(MovingObjectPosition mop) {
if(!worldObj.isRemote) {
if(this.config.onImpactBeam != null) this.config.onImpactBeam.accept(this, mop);
}
}
public boolean doesImpactEntities() { return this.config.impactsEntities; }
public boolean doesPenetrate() { return this.config.doesPenetrate; }
public boolean isSpectral() { return this.config.isSpectral; }
@Override @SideOnly(Side.CLIENT) public float getShadowSize() { return 0.0F; }
@Override protected void writeEntityToNBT(NBTTagCompound nbt) { }
@Override public boolean writeToNBTOptional(NBTTagCompound nbt) { return false; }
@Override public void readEntityFromNBT(NBTTagCompound nbt) { this.setDead(); }
@Override public void writeSpawnData(ByteBuf buf) {
buf.writeDouble(beamLength);
}
@Override public void readSpawnData(ByteBuf buf) {
this.beamLength = buf.readDouble();
}
}

View File

@ -1,530 +0,0 @@
package com.hbm.entity.projectile;
import java.util.List;
import com.hbm.entity.grenade.EntityGrenadeZOMG;
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.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.play.server.S2BPacketChangeGameState;
import net.minecraft.util.AxisAlignedBB;
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;
public class EntityNightmareBlast extends Entity implements IProjectile
{
private int field_145791_d = -1;
private int field_145792_e = -1;
private int field_145789_f = -1;
public double gravity = 0.0D;
private Block field_145790_g;
private int inData;
private boolean inGround;
/** 1 if the player can pick up the arrow */
public int canBePickedUp;
/** Seems to be some sort of timer for animating an arrow. */
public int arrowShake;
/** The owner of this arrow. */
public Entity shootingEntity;
private int ticksInGround;
private int ticksInAir;
private double damage = 2.0D;
/** The amount of knockback an arrow applies when it hits a mob. */
private int knockbackStrength;
public EntityNightmareBlast(World p_i1753_1_)
{
super(p_i1753_1_);
this.renderDistanceWeight = 10.0D;
this.setSize(0.5F, 0.5F);
}
public EntityNightmareBlast(World p_i1754_1_, double p_i1754_2_, double p_i1754_4_, double p_i1754_6_)
{
super(p_i1754_1_);
this.renderDistanceWeight = 10.0D;
this.setSize(0.5F, 0.5F);
this.setPosition(p_i1754_2_, p_i1754_4_, p_i1754_6_);
this.yOffset = 0.0F;
}
public EntityNightmareBlast(World p_i1755_1_, EntityLivingBase p_i1755_2_, EntityLivingBase p_i1755_3_, float p_i1755_4_, float p_i1755_5_)
{
super(p_i1755_1_);
this.renderDistanceWeight = 10.0D;
this.shootingEntity = p_i1755_2_;
if (p_i1755_2_ instanceof EntityPlayer)
{
this.canBePickedUp = 1;
}
this.posY = p_i1755_2_.posY + p_i1755_2_.getEyeHeight() - 0.10000000149011612D;
double d0 = p_i1755_3_.posX - p_i1755_2_.posX;
double d1 = p_i1755_3_.boundingBox.minY + p_i1755_3_.height / 3.0F - this.posY;
double d2 = p_i1755_3_.posZ - p_i1755_2_.posZ;
double d3 = MathHelper.sqrt_double(d0 * d0 + d2 * d2);
if (d3 >= 1.0E-7D)
{
float f2 = (float)(Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F;
float f3 = (float)(-(Math.atan2(d1, d3) * 180.0D / Math.PI));
double d4 = d0 / d3;
double d5 = d2 / d3;
this.setLocationAndAngles(p_i1755_2_.posX + d4, this.posY, p_i1755_2_.posZ + d5, f2, f3);
this.yOffset = 0.0F;
float f4 = (float)d3 * 0.2F;
this.setThrowableHeading(d0, d1 + f4, d2, p_i1755_4_, p_i1755_5_);
}
}
public EntityNightmareBlast(World p_i1756_1_, EntityLivingBase p_i1756_2_, float p_i1756_3_, int dmgMin, int dmgMax, EntityGrenadeZOMG grenade) {
super(p_i1756_1_);
this.renderDistanceWeight = 10.0D;
this.shootingEntity = p_i1756_2_;
this.setSize(0.5F, 0.5F);
this.setLocationAndAngles(grenade.posX, grenade.posY + grenade.getEyeHeight(), grenade.posZ,
grenade.rotationYaw, grenade.rotationPitch);
this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
this.posY -= 0.10000000149011612D;
this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
this.setPosition(this.posX, this.posY, this.posZ);
this.yOffset = 0.0F;
this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI)
* MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
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, p_i1756_3_ * 1.5F, 1.0F);
}
public EntityNightmareBlast(World p_i1756_1_, EntityLivingBase p_i1756_2_, float p_i1756_3_)
{
super(p_i1756_1_);
this.renderDistanceWeight = 10.0D;
this.shootingEntity = p_i1756_2_;
this.setSize(0.5F, 0.5F);
this.setLocationAndAngles(p_i1756_2_.posX, p_i1756_2_.posY + p_i1756_2_.getEyeHeight(), p_i1756_2_.posZ, p_i1756_2_.rotationYaw, p_i1756_2_.rotationPitch);
this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F;
this.posY -= 0.10000000149011612D;
this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F;
this.setPosition(this.posX, this.posY, this.posZ);
this.yOffset = 0.0F;
this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI);
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, p_i1756_3_ * 1.5F, 1.0F);
}
public EntityNightmareBlast(World world, int x, int y, int z, double mx, double my, double mz, double grav) {
super(world);
this.posX = x + 0.5F;
this.posY = y + 0.5F;
this.posZ = z + 0.5F;
this.motionX = mx;
this.motionY = my;
this.motionZ = mz;
this.gravity = grav;
}
@Override
protected void entityInit()
{
this.dataWatcher.addObject(16, Byte.valueOf((byte)0));
}
/**
* Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction.
*/
@Override
public void setThrowableHeading(double p_70186_1_, double p_70186_3_, double p_70186_5_, float p_70186_7_, float p_70186_8_)
{
float f2 = MathHelper.sqrt_double(p_70186_1_ * p_70186_1_ + p_70186_3_ * p_70186_3_ + p_70186_5_ * p_70186_5_);
p_70186_1_ /= f2;
p_70186_3_ /= f2;
p_70186_5_ /= f2;
p_70186_1_ += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.054499999832361937D * p_70186_8_;
p_70186_3_ += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.054499999832361937D * p_70186_8_;
p_70186_5_ += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.054499999832361937D * p_70186_8_;
p_70186_1_ *= p_70186_7_;
p_70186_3_ *= p_70186_7_;
p_70186_5_ *= p_70186_7_;
this.motionX = p_70186_1_;
this.motionY = p_70186_3_;
this.motionZ = p_70186_5_;
float f3 = MathHelper.sqrt_double(p_70186_1_ * p_70186_1_ + p_70186_5_ * p_70186_5_);
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(p_70186_1_, p_70186_5_) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(p_70186_3_, f3) * 180.0D / Math.PI);
this.ticksInGround = 0;
}
/**
* Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX,
* posY, posZ, yaw, pitch
*/
@Override
@SideOnly(Side.CLIENT)
public void setPositionAndRotation2(double p_70056_1_, double p_70056_3_, double p_70056_5_, float p_70056_7_, float p_70056_8_, int p_70056_9_)
{
this.setPosition(p_70056_1_, p_70056_3_, p_70056_5_);
this.setRotation(p_70056_7_, p_70056_8_);
}
/**
* Sets the velocity to the args. Args: x, y, z
*/
@Override
@SideOnly(Side.CLIENT)
public void setVelocity(double p_70016_1_, double p_70016_3_, double p_70016_5_)
{
this.motionX = p_70016_1_;
this.motionY = p_70016_3_;
this.motionZ = p_70016_5_;
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
{
float f = MathHelper.sqrt_double(p_70016_1_ * p_70016_1_ + p_70016_5_ * p_70016_5_);
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(p_70016_1_, p_70016_5_) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(p_70016_3_, f) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch;
this.prevRotationYaw = this.rotationYaw;
this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
this.ticksInGround = 0;
}
}
/**
* Called to update the entity's position/logic.
*/
//@Override
@Override
public void onUpdate()
{
super.onUpdate();
if(this.ticksExisted > 100)
this.setDead();
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
{
MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
//this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI);
}
Block block = this.worldObj.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f);
if (block.getMaterial() != Material.air)
{
block.setBlockBoundsBasedOnState(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
block.getCollisionBoundingBoxFromPool(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
if(!worldObj.isRemote) {
this.worldObj.setBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f, Blocks.air);
this.setDead();
}
}
if (this.arrowShake > 0)
{
--this.arrowShake;
}
else
{
++this.ticksInAir;
Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
Vec3 vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec31, vec3, false, true, false);
vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
if (movingobjectposition != null)
{
vec3 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
}
Entity entity = null;
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
int i;
float f1;
for (i = 0; i < list.size(); ++i)
{
Entity entity1 = (Entity)list.get(i);
if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5))
{
f1 = 0.3F;
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand(f1, f1, f1);
MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec31, vec3);
if (movingobjectposition1 != null)
{
double d1 = vec31.distanceTo(movingobjectposition1.hitVec);
if (d1 < d0 || d0 == 0.0D)
{
entity = entity1;
d0 = d1;
}
}
}
}
if (entity != null)
{
movingobjectposition = new MovingObjectPosition(entity);
}
if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer)
{
EntityPlayer entityplayer = (EntityPlayer)movingobjectposition.entityHit;
if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer)this.shootingEntity).canAttackPlayer(entityplayer))
{
movingobjectposition = null;
}
}
float f2;
float f4;
if (movingobjectposition != null)
{
if (movingobjectposition.entityHit != null)
{
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
int k = MathHelper.ceiling_double_int(f2 * this.damage);
if (this.getIsCritical())
{
k += this.rand.nextInt(k / 2 + 2);
}
DamageSource damagesource = null;
if (this.shootingEntity == null)
{
damagesource = DamageSource.generic;
}
else
{
damagesource = DamageSource.generic;
}
if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman))
{
movingobjectposition.entityHit.setFire(5);
}
if (movingobjectposition.entityHit.attackEntityFrom(damagesource, k))
{
if (movingobjectposition.entityHit instanceof EntityLivingBase)
{
EntityLivingBase entitylivingbase = (EntityLivingBase)movingobjectposition.entityHit;
if (this.knockbackStrength > 0)
{
f4 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
if (f4 > 0.0F)
{
movingobjectposition.entityHit.addVelocity(this.motionX * this.knockbackStrength * 0.6000000238418579D / f4, 0.1D, this.motionZ * this.knockbackStrength * 0.6000000238418579D / f4);
}
}
if (this.shootingEntity != null && this.shootingEntity instanceof EntityLivingBase)
{
EnchantmentHelper.func_151384_a(entitylivingbase, this.shootingEntity);
EnchantmentHelper.func_151385_b((EntityLivingBase)this.shootingEntity, entitylivingbase);
}
if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && movingobjectposition.entityHit instanceof EntityPlayer && this.shootingEntity instanceof EntityPlayerMP)
{
((EntityPlayerMP)this.shootingEntity).playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F));
}
}
if (!(movingobjectposition.entityHit instanceof EntityEnderman))
{
if (!this.worldObj.isRemote && movingobjectposition.entityHit instanceof EntityLivingBase)
{
movingobjectposition.entityHit.attackEntityFrom(damagesource, (float) this.damage);
if(!worldObj.isRemote)
this.worldObj.setBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f, Blocks.air);
this.setDead();
}
}
}
}
else
{
this.field_145791_d = movingobjectposition.blockX;
this.field_145792_e = movingobjectposition.blockY;
this.field_145789_f = movingobjectposition.blockZ;
this.field_145790_g = this.worldObj.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f);
this.inData = this.worldObj.getBlockMetadata(this.field_145791_d, this.field_145792_e, this.field_145789_f);
}
}
this.posX += this.motionX;
this.posY += this.motionY;
this.posZ += this.motionZ;
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
f1 = 0.05F;
if (this.isInWater())
{
for (int l = 0; l < 4; ++l)
{
f4 = 0.25F;
this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f4, this.posY - this.motionY * f4, this.posZ - this.motionZ * f4, this.motionX, this.motionY, this.motionZ);
}
}
if (this.isWet())
{
this.extinguish();
}
this.setPosition(this.posX, this.posY, this.posZ);
this.func_145775_I();
}
}
/**
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
@Override
public void writeEntityToNBT(NBTTagCompound p_70014_1_)
{
p_70014_1_.setShort("xTile", (short)this.field_145791_d);
p_70014_1_.setShort("yTile", (short)this.field_145792_e);
p_70014_1_.setShort("zTile", (short)this.field_145789_f);
p_70014_1_.setShort("life", (short)this.ticksInGround);
p_70014_1_.setByte("inTile", (byte)Block.getIdFromBlock(this.field_145790_g));
p_70014_1_.setByte("inData", (byte)this.inData);
p_70014_1_.setByte("shake", (byte)this.arrowShake);
p_70014_1_.setByte("inGround", (byte)(this.inGround ? 1 : 0));
p_70014_1_.setByte("pickup", (byte)this.canBePickedUp);
p_70014_1_.setDouble("damage", this.damage);
}
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
@Override
public void readEntityFromNBT(NBTTagCompound p_70037_1_)
{
this.field_145791_d = p_70037_1_.getShort("xTile");
this.field_145792_e = p_70037_1_.getShort("yTile");
this.field_145789_f = p_70037_1_.getShort("zTile");
this.ticksInGround = p_70037_1_.getShort("life");
this.field_145790_g = Block.getBlockById(p_70037_1_.getByte("inTile") & 255);
this.inData = p_70037_1_.getByte("inData") & 255;
this.arrowShake = p_70037_1_.getByte("shake") & 255;
this.inGround = p_70037_1_.getByte("inGround") == 1;
if (p_70037_1_.hasKey("damage", 99))
{
this.damage = p_70037_1_.getDouble("damage");
}
if (p_70037_1_.hasKey("pickup", 99))
{
this.canBePickedUp = p_70037_1_.getByte("pickup");
}
else if (p_70037_1_.hasKey("player", 99))
{
this.canBePickedUp = p_70037_1_.getBoolean("player") ? 1 : 0;
}
}
/**
* returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
* prevent them from trampling crops
*/
@Override
protected boolean canTriggerWalking()
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public float getShadowSize()
{
return 0.0F;
}
public void setDamage(double p_70239_1_)
{
this.damage = p_70239_1_;
}
public double getDamage()
{
return this.damage;
}
/**
* Sets the amount of knockback the arrow applies when it hits a mob.
*/
public void setKnockbackStrength(int p_70240_1_)
{
this.knockbackStrength = p_70240_1_;
}
/**
* If returns false, the item will not inflict any damage against entities.
*/
@Override
public boolean canAttackWithItem()
{
return false;
}
/**
* Whether the arrow has a stream of critical hit particles flying behind it.
*/
public void setIsCritical(boolean p_70243_1_)
{
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
if (p_70243_1_)
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 1)));
}
else
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -2)));
}
}
/**
* Whether the arrow has a stream of critical hit particles flying behind it.
*/
public boolean getIsCritical()
{
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
return (b0 & 1) != 0;
}
}

View File

@ -1,556 +0,0 @@
package com.hbm.entity.projectile;
import java.util.List;
import com.hbm.entity.grenade.EntityGrenadeZOMG;
import com.hbm.explosion.ExplosionChaos;
import com.hbm.explosion.ExplosionThermo;
import com.hbm.items.ModItems;
import com.hbm.lib.ModDamageSource;
import com.hbm.main.MainRegistry;
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.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.play.server.S2BPacketChangeGameState;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
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;
public class EntityPlasmaBeam extends Entity implements IProjectile
{
private int field_145791_d = -1;
private int field_145792_e = -1;
private int field_145789_f = -1;
public double gravity = 0.0D;
private Block field_145790_g;
private int inData;
private boolean inGround;
/** 1 if the player can pick up the arrow */
public int canBePickedUp;
/** Seems to be some sort of timer for animating an arrow. */
public int arrowShake;
/** The owner of this arrow. */
public Entity shootingEntity;
private int ticksInGround;
private int ticksInAir;
private double damage = 2.0D;
/** The amount of knockback an arrow applies when it hits a mob. */
private int knockbackStrength;
public EntityPlasmaBeam(World p_i1753_1_)
{
super(p_i1753_1_);
this.renderDistanceWeight = 10.0D;
this.setSize(0.5F, 0.5F);
}
public EntityPlasmaBeam(World p_i1754_1_, double p_i1754_2_, double p_i1754_4_, double p_i1754_6_)
{
super(p_i1754_1_);
this.renderDistanceWeight = 10.0D;
this.setSize(0.5F, 0.5F);
this.setPosition(p_i1754_2_, p_i1754_4_, p_i1754_6_);
this.yOffset = 0.0F;
}
public EntityPlasmaBeam(World p_i1755_1_, EntityLivingBase p_i1755_2_, EntityLivingBase p_i1755_3_, float p_i1755_4_, float p_i1755_5_)
{
super(p_i1755_1_);
this.renderDistanceWeight = 10.0D;
this.shootingEntity = p_i1755_2_;
if (p_i1755_2_ instanceof EntityPlayer)
{
this.canBePickedUp = 1;
}
this.posY = p_i1755_2_.posY + p_i1755_2_.getEyeHeight() - 0.10000000149011612D;
double d0 = p_i1755_3_.posX - p_i1755_2_.posX;
double d1 = p_i1755_3_.boundingBox.minY + p_i1755_3_.height / 3.0F - this.posY;
double d2 = p_i1755_3_.posZ - p_i1755_2_.posZ;
double d3 = MathHelper.sqrt_double(d0 * d0 + d2 * d2);
if (d3 >= 1.0E-7D)
{
float f2 = (float)(Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F;
float f3 = (float)(-(Math.atan2(d1, d3) * 180.0D / Math.PI));
double d4 = d0 / d3;
double d5 = d2 / d3;
this.setLocationAndAngles(p_i1755_2_.posX + d4, this.posY, p_i1755_2_.posZ + d5, f2, f3);
this.yOffset = 0.0F;
float f4 = (float)d3 * 0.2F;
this.setThrowableHeading(d0, d1 + f4, d2, p_i1755_4_, p_i1755_5_);
}
}
public EntityPlasmaBeam(World p_i1756_1_, EntityLivingBase p_i1756_2_, float p_i1756_3_, int dmgMin, int dmgMax, EntityGrenadeZOMG grenade) {
super(p_i1756_1_);
this.renderDistanceWeight = 10.0D;
this.shootingEntity = p_i1756_2_;
this.setSize(0.5F, 0.5F);
this.setLocationAndAngles(grenade.posX, grenade.posY + grenade.getEyeHeight(), grenade.posZ,
grenade.rotationYaw, grenade.rotationPitch);
this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
this.posY -= 0.10000000149011612D;
this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
this.setPosition(this.posX, this.posY, this.posZ);
this.yOffset = 0.0F;
this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI)
* MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
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, p_i1756_3_ * 1.5F, 1.0F);
}
public EntityPlasmaBeam(World p_i1756_1_, EntityLivingBase p_i1756_2_, float p_i1756_3_)
{
super(p_i1756_1_);
this.renderDistanceWeight = 10.0D;
this.shootingEntity = p_i1756_2_;
this.setSize(0.5F, 0.5F);
this.setLocationAndAngles(p_i1756_2_.posX, p_i1756_2_.posY + p_i1756_2_.getEyeHeight(), p_i1756_2_.posZ, p_i1756_2_.rotationYaw, p_i1756_2_.rotationPitch);
this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F;
this.posY -= 0.10000000149011612D;
this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F;
this.setPosition(this.posX, this.posY, this.posZ);
this.yOffset = 0.0F;
this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI);
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, p_i1756_3_ * 1.5F, 1.0F);
}
public EntityPlasmaBeam(World world, int x, int y, int z, double mx, double my, double mz, double grav) {
super(world);
this.posX = x + 0.5F;
this.posY = y + 0.5F;
this.posZ = z + 0.5F;
this.motionX = mx;
this.motionY = my;
this.motionZ = mz;
this.gravity = grav;
}
@Override
protected void entityInit()
{
this.dataWatcher.addObject(16, Byte.valueOf((byte)0));
}
/**
* Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction.
*/
@Override
public void setThrowableHeading(double p_70186_1_, double p_70186_3_, double p_70186_5_, float p_70186_7_, float p_70186_8_)
{
float f2 = MathHelper.sqrt_double(p_70186_1_ * p_70186_1_ + p_70186_3_ * p_70186_3_ + p_70186_5_ * p_70186_5_);
p_70186_1_ /= f2;
p_70186_3_ /= f2;
p_70186_5_ /= f2;
p_70186_1_ += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.002499999832361937D * p_70186_8_;
p_70186_3_ += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.002499999832361937D * p_70186_8_;
p_70186_5_ += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.002499999832361937D * p_70186_8_;
p_70186_1_ *= p_70186_7_;
p_70186_3_ *= p_70186_7_;
p_70186_5_ *= p_70186_7_;
this.motionX = p_70186_1_;
this.motionY = p_70186_3_;
this.motionZ = p_70186_5_;
float f3 = MathHelper.sqrt_double(p_70186_1_ * p_70186_1_ + p_70186_5_ * p_70186_5_);
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(p_70186_1_, p_70186_5_) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(p_70186_3_, f3) * 180.0D / Math.PI);
this.ticksInGround = 0;
}
/**
* Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX,
* posY, posZ, yaw, pitch
*/
@Override
@SideOnly(Side.CLIENT)
public void setPositionAndRotation2(double p_70056_1_, double p_70056_3_, double p_70056_5_, float p_70056_7_, float p_70056_8_, int p_70056_9_)
{
this.setPosition(p_70056_1_, p_70056_3_, p_70056_5_);
this.setRotation(p_70056_7_, p_70056_8_);
}
/**
* Sets the velocity to the args. Args: x, y, z
*/
@Override
@SideOnly(Side.CLIENT)
public void setVelocity(double p_70016_1_, double p_70016_3_, double p_70016_5_)
{
this.motionX = p_70016_1_;
this.motionY = p_70016_3_;
this.motionZ = p_70016_5_;
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
{
float f = MathHelper.sqrt_double(p_70016_1_ * p_70016_1_ + p_70016_5_ * p_70016_5_);
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(p_70016_1_, p_70016_5_) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(p_70016_3_, f) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch;
this.prevRotationYaw = this.rotationYaw;
this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
this.ticksInGround = 0;
}
}
/**
* Called to update the entity's position/logic.
*/
//@Override
@Override
public void onUpdate()
{
super.onUpdate();
if(this.ticksExisted > 100)
this.setDead();
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
{
MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
//this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI);
}
Block block = this.worldObj.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f);
if (block.getMaterial() != Material.air)
{
block.setBlockBoundsBasedOnState(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
block.getCollisionBoundingBoxFromPool(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
if(!worldObj.isRemote) {
ExplosionChaos.burn(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 2);
ExplosionChaos.flameDeath(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 5);
ExplosionThermo.scorchLight(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 3);
}
this.setDead();
}
if (this.arrowShake > 0)
{
--this.arrowShake;
}
else
{
++this.ticksInAir;
Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
Vec3 vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec31, vec3, false, true, false);
vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
if (movingobjectposition != null)
{
vec3 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
}
Entity entity = null;
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
int i;
float f1;
for (i = 0; i < list.size(); ++i)
{
Entity entity1 = (Entity)list.get(i);
if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5))
{
f1 = 0.3F;
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand(f1, f1, f1);
MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec31, vec3);
if (movingobjectposition1 != null)
{
double d1 = vec31.distanceTo(movingobjectposition1.hitVec);
if (d1 < d0 || d0 == 0.0D)
{
entity = entity1;
d0 = d1;
}
}
}
}
if (entity != null)
{
movingobjectposition = new MovingObjectPosition(entity);
}
if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer)
{
EntityPlayer entityplayer = (EntityPlayer)movingobjectposition.entityHit;
if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer)this.shootingEntity).canAttackPlayer(entityplayer))
{
movingobjectposition = null;
}
if(this.ticksExisted > 5 && surviveImmolation(entityplayer))
movingobjectposition = null;
}
float f2;
float f4;
if (movingobjectposition != null)
{
if (movingobjectposition.entityHit != null)
{
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
int k = MathHelper.ceiling_double_int(f2 * this.damage);
if (this.getIsCritical())
{
k += this.rand.nextInt(k / 2 + 2);
}
DamageSource damagesource = null;
if (this.shootingEntity == null)
{
damagesource = DamageSource.generic;
}
else
{
damagesource = ModDamageSource.causePlasmaDamage(this, this.shootingEntity);
}
if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman))
{
movingobjectposition.entityHit.setFire(5);
}
if (movingobjectposition.entityHit.attackEntityFrom(damagesource, k))
{
if (movingobjectposition.entityHit instanceof EntityLivingBase)
{
EntityLivingBase entitylivingbase = (EntityLivingBase)movingobjectposition.entityHit;
if (this.knockbackStrength > 0)
{
f4 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
if (f4 > 0.0F)
{
movingobjectposition.entityHit.addVelocity(this.motionX * this.knockbackStrength * 0.6000000238418579D / f4, 0.1D, this.motionZ * this.knockbackStrength * 0.6000000238418579D / f4);
}
}
if (this.shootingEntity != null && this.shootingEntity instanceof EntityLivingBase)
{
EnchantmentHelper.func_151384_a(entitylivingbase, this.shootingEntity);
EnchantmentHelper.func_151385_b((EntityLivingBase)this.shootingEntity, entitylivingbase);
}
if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && movingobjectposition.entityHit instanceof EntityPlayer && this.shootingEntity instanceof EntityPlayerMP)
{
((EntityPlayerMP)this.shootingEntity).playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F));
}
}
if (!(movingobjectposition.entityHit instanceof EntityEnderman))
{
if (!this.worldObj.isRemote && movingobjectposition.entityHit instanceof EntityLivingBase)
{
movingobjectposition.entityHit.attackEntityFrom(damagesource, 25 + rand.nextInt(20));
if(!worldObj.isRemote) {
ExplosionChaos.burn(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 2);
ExplosionChaos.flameDeath(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 5);
ExplosionThermo.scorchLight(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 3);
}
this.setDead();
}
}
}
}
else
{
this.field_145791_d = movingobjectposition.blockX;
this.field_145792_e = movingobjectposition.blockY;
this.field_145789_f = movingobjectposition.blockZ;
this.field_145790_g = this.worldObj.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f);
this.inData = this.worldObj.getBlockMetadata(this.field_145791_d, this.field_145792_e, this.field_145789_f);
}
}
this.posX += this.motionX;
this.posY += this.motionY;
this.posZ += this.motionZ;
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
f1 = 0.05F;
if (this.isInWater())
{
this.setDead();
if(!worldObj.isRemote) {
ExplosionChaos.burn(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 2);
ExplosionChaos.flameDeath(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 5);
ExplosionThermo.scorchLight(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 3);
}
}
if (this.isWet())
{
this.extinguish();
}
this.setPosition(this.posX, this.posY, this.posZ);
this.func_145775_I();
}
}
/**
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
@Override
public void writeEntityToNBT(NBTTagCompound p_70014_1_)
{
p_70014_1_.setShort("xTile", (short)this.field_145791_d);
p_70014_1_.setShort("yTile", (short)this.field_145792_e);
p_70014_1_.setShort("zTile", (short)this.field_145789_f);
p_70014_1_.setShort("life", (short)this.ticksInGround);
p_70014_1_.setByte("inTile", (byte)Block.getIdFromBlock(this.field_145790_g));
p_70014_1_.setByte("inData", (byte)this.inData);
p_70014_1_.setByte("shake", (byte)this.arrowShake);
p_70014_1_.setByte("inGround", (byte)(this.inGround ? 1 : 0));
p_70014_1_.setByte("pickup", (byte)this.canBePickedUp);
p_70014_1_.setDouble("damage", this.damage);
}
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
@Override
public void readEntityFromNBT(NBTTagCompound p_70037_1_)
{
this.field_145791_d = p_70037_1_.getShort("xTile");
this.field_145792_e = p_70037_1_.getShort("yTile");
this.field_145789_f = p_70037_1_.getShort("zTile");
this.ticksInGround = p_70037_1_.getShort("life");
this.field_145790_g = Block.getBlockById(p_70037_1_.getByte("inTile") & 255);
this.inData = p_70037_1_.getByte("inData") & 255;
this.arrowShake = p_70037_1_.getByte("shake") & 255;
this.inGround = p_70037_1_.getByte("inGround") == 1;
if (p_70037_1_.hasKey("damage", 99))
{
this.damage = p_70037_1_.getDouble("damage");
}
if (p_70037_1_.hasKey("pickup", 99))
{
this.canBePickedUp = p_70037_1_.getByte("pickup");
}
else if (p_70037_1_.hasKey("player", 99))
{
this.canBePickedUp = p_70037_1_.getBoolean("player") ? 1 : 0;
}
}
/**
* returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
* prevent them from trampling crops
*/
@Override
protected boolean canTriggerWalking()
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public float getShadowSize()
{
return 0.0F;
}
public void setDamage(double p_70239_1_)
{
this.damage = p_70239_1_;
}
public double getDamage()
{
return this.damage;
}
/**
* Sets the amount of knockback the arrow applies when it hits a mob.
*/
public void setKnockbackStrength(int p_70240_1_)
{
this.knockbackStrength = p_70240_1_;
}
/**
* If returns false, the item will not inflict any damage against entities.
*/
@Override
public boolean canAttackWithItem()
{
return false;
}
/**
* Whether the arrow has a stream of critical hit particles flying behind it.
*/
public void setIsCritical(boolean p_70243_1_)
{
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
if (p_70243_1_)
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 1)));
}
else
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -2)));
}
}
/**
* Whether the arrow has a stream of critical hit particles flying behind it.
*/
public boolean getIsCritical()
{
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
return (b0 & 1) != 0;
}
private boolean surviveImmolation(EntityPlayer player) {
if(player.inventory.hasItem(ModItems.gun_revolver_pip) && player.inventory.hasItem(ModItems.bottle_sparkle) && player.inventory.hasItem(ModItems.geiger_counter)) {
player.triggerAchievement(MainRegistry.achSacrifice);
player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 3 * 20, 6));
return true;
} else {
return false;
}
}
}

View File

@ -1609,7 +1609,6 @@ public class ModItems {
public static Item gun_liberator;
public static Item gun_congolake;
public static Item gun_flamer;
public static Item gun_lag;
public static Item gun_uzi;
public static Item gun_spas12;
public static Item gun_panzerschreck;
@ -1620,9 +1619,11 @@ public class ModItems {
public static Item gun_autoshotgun;
public static Item gun_autoshotgun_sexy;
public static Item gun_quadro;
public static Item gun_lag;
public static Item gun_minigun;
public static Item gun_missile_launcher;
public static Item gun_tesla_cannon;
public static Item gun_stg77;
public static Item ammo_standard;
@ -5284,8 +5285,8 @@ public class ModItems {
jetpack_break = new JetpackBreak(Fluids.KEROSENE, 12000).setUnlocalizedName("jetpack_break").setCreativeTab(CreativeTabs.tabCombat).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":jetpack_break");
jetpack_fly = new JetpackRegular(Fluids.KEROSENE, 12000).setUnlocalizedName("jetpack_fly").setCreativeTab(CreativeTabs.tabCombat).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":jetpack_fly");
jetpack_vector = new JetpackVectorized(Fluids.KEROSENE, 16000).setUnlocalizedName("jetpack_vector").setCreativeTab(CreativeTabs.tabCombat).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":jetpack_vector");
wings_murk = new WingsMurk(MainRegistry.aMatCobalt).setUnlocalizedName("wings_murk").setCreativeTab(CreativeTabs.tabCombat).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":wings_murk");
wings_limp = new WingsMurk(MainRegistry.aMatCobalt).setUnlocalizedName("wings_limp").setCreativeTab(CreativeTabs.tabCombat).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":wings_limp");
wings_murk = new WingsMurk().setUnlocalizedName("wings_murk").setCreativeTab(CreativeTabs.tabCombat).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":wings_murk");
wings_limp = new WingsMurk().setUnlocalizedName("wings_limp").setCreativeTab(CreativeTabs.tabCombat).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":wings_limp");
cape_radiation = new ArmorModel(ArmorMaterial.CHAIN, 1).setUnlocalizedName("cape_radiation").setCreativeTab(MainRegistry.consumableTab).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":cape_radiation");
cape_gasmask = new ArmorModel(ArmorMaterial.CHAIN, 1).setUnlocalizedName("cape_gasmask").setCreativeTab(MainRegistry.consumableTab).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":cape_gasmask");
@ -6969,7 +6970,6 @@ public class ModItems {
GameRegistry.registerItem(gun_liberator, gun_liberator.getUnlocalizedName());
GameRegistry.registerItem(gun_congolake, gun_congolake.getUnlocalizedName());
GameRegistry.registerItem(gun_flamer, gun_flamer.getUnlocalizedName());
GameRegistry.registerItem(gun_lag, gun_lag.getUnlocalizedName());
GameRegistry.registerItem(gun_uzi, gun_uzi.getUnlocalizedName());
GameRegistry.registerItem(gun_spas12, gun_spas12.getUnlocalizedName());
GameRegistry.registerItem(gun_panzerschreck, gun_panzerschreck.getUnlocalizedName());
@ -6980,9 +6980,11 @@ public class ModItems {
GameRegistry.registerItem(gun_autoshotgun, gun_autoshotgun.getUnlocalizedName());
GameRegistry.registerItem(gun_autoshotgun_sexy, gun_autoshotgun_sexy.getUnlocalizedName());
GameRegistry.registerItem(gun_quadro, gun_quadro.getUnlocalizedName());
GameRegistry.registerItem(gun_lag, gun_lag.getUnlocalizedName());
GameRegistry.registerItem(gun_minigun, gun_minigun.getUnlocalizedName());
GameRegistry.registerItem(gun_missile_launcher, gun_missile_launcher.getUnlocalizedName());
GameRegistry.registerItem(gun_tesla_cannon, gun_tesla_cannon.getUnlocalizedName());
GameRegistry.registerItem(gun_stg77, gun_stg77.getUnlocalizedName());
GameRegistry.registerItem(ammo_standard, ammo_standard.getUnlocalizedName());

View File

@ -3,11 +3,9 @@ package com.hbm.items.armor;
import java.util.List;
import com.hbm.handler.ArmorModHandler;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.render.model.ModelJetPack;
import com.hbm.util.ArmorUtil;
import api.hbm.fluid.IFillableItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
@ -17,28 +15,21 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderPlayerEvent;
public abstract class JetpackBase extends ItemArmorMod implements IFillableItem {
public abstract class JetpackBase extends ItemArmorMod {
private ModelJetPack model;
public FluidType fuel;
public int maxFuel;
protected ModelBiped cachedModel;
public JetpackBase(FluidType fuel, int maxFuel) {
public JetpackBase() {
super(ArmorModHandler.plate_only, false, true, false, false);
this.fuel = fuel;
this.maxFuel = maxFuel;
}
@Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
list.add(EnumChatFormatting.LIGHT_PURPLE + fuel.getLocalizedName() + ": " + this.getFuel(itemstack) + "mB / " + this.maxFuel + "mB");
list.add("");
super.addInformation(itemstack, player, list, bool);
list.add(EnumChatFormatting.GOLD + "Can be worn on its own!");
}
@ -51,7 +42,7 @@ public abstract class JetpackBase extends ItemArmorMod implements IFillableItem
if(jetpack == null)
return;
list.add(EnumChatFormatting.RED + " " + stack.getDisplayName() + " (" + fuel.getLocalizedName() + ": " + this.getFuel(jetpack) + "mB / " + this.maxFuel + "mB");
list.add(EnumChatFormatting.RED + " " + stack.getDisplayName());
}
@Override
@ -103,87 +94,12 @@ public abstract class JetpackBase extends ItemArmorMod implements IFillableItem
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) {
if (armorSlot == 1) {
if (model == null) {
this.model = new ModelJetPack();
if (cachedModel == null) {
this.cachedModel = new ModelJetPack();
}
return this.model;
return this.cachedModel;
}
return null;
}
protected void useUpFuel(EntityPlayer player, ItemStack stack, int rate) {
if(player.ticksExisted % rate == 0)
this.setFuel(stack, this.getFuel(stack) - 1);
}
public static int getFuel(ItemStack stack) {
if(stack.stackTagCompound == null) {
stack.stackTagCompound = new NBTTagCompound();
return 0;
}
return stack.stackTagCompound.getInteger("fuel");
}
public static void setFuel(ItemStack stack, int i) {
if(stack.stackTagCompound == null) {
stack.stackTagCompound = new NBTTagCompound();
}
stack.stackTagCompound.setInteger("fuel", i);
}
public int getMaxFill(ItemStack stack) {
return this.maxFuel;
}
public int getLoadSpeed(ItemStack stack) {
return 10;
}
@Override
public boolean acceptsFluid(FluidType type, ItemStack stack) {
return type == this.fuel;
}
@Override
public int tryFill(FluidType type, int amount, ItemStack stack) {
if(!acceptsFluid(type, stack))
return amount;
int fill = this.getFuel(stack);
int req = maxFuel - fill;
int toFill = Math.min(amount, req);
//toFill = Math.min(toFill, getLoadSpeed(stack));
this.setFuel(stack, fill + toFill);
return amount - toFill;
}
@Override
public boolean providesFluid(FluidType type, ItemStack stack) {
return false;
}
@Override
public int tryEmpty(FluidType type, int amount, ItemStack stack) {
return 0;
}
@Override
public FluidType getFirstFluidType(ItemStack stack) {
return null;
}
@Override
public int getFill(ItemStack stack) {
return 0;
}
}

View File

@ -17,7 +17,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public class JetpackBooster extends JetpackBase {
public class JetpackBooster extends JetpackFueledBase {
public JetpackBooster(FluidType fuel, int maxFuel) {
super(fuel, maxFuel);

View File

@ -16,7 +16,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
public class JetpackBreak extends JetpackBase {
public class JetpackBreak extends JetpackFueledBase {
public static int maxFuel = 1200;

View File

@ -0,0 +1,117 @@
package com.hbm.items.armor;
import java.util.List;
import com.hbm.handler.ArmorModHandler;
import com.hbm.inventory.fluid.FluidType;
import api.hbm.fluid.IFillableItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
public abstract class JetpackFueledBase extends JetpackBase implements IFillableItem {
public FluidType fuel;
public int maxFuel;
public JetpackFueledBase(FluidType fuel, int maxFuel) {
super();
this.fuel = fuel;
this.maxFuel = maxFuel;
}
@Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
list.add(EnumChatFormatting.LIGHT_PURPLE + fuel.getLocalizedName() + ": " + this.getFuel(itemstack) + "mB / " + this.maxFuel + "mB");
list.add("");
super.addInformation(itemstack, player, list, bool);
}
@Override
public void addDesc(List list, ItemStack stack, ItemStack armor) {
ItemStack jetpack = ArmorModHandler.pryMods(armor)[ArmorModHandler.plate_only];
if(jetpack == null)
return;
list.add(EnumChatFormatting.RED + " " + stack.getDisplayName() + " (" + fuel.getLocalizedName() + ": " + this.getFuel(jetpack) + "mB / " + this.maxFuel + "mB)");
}
protected void useUpFuel(EntityPlayer player, ItemStack stack, int rate) {
if(player.ticksExisted % rate == 0){
this.setFuel(stack, this.getFuel(stack) - 1);
}
}
public static int getFuel(ItemStack stack) {
if(stack.stackTagCompound == null) {
stack.stackTagCompound = new NBTTagCompound();
return 0;
}
return stack.stackTagCompound.getInteger("fuel");
}
public static void setFuel(ItemStack stack, int i) {
if(stack.stackTagCompound == null) {
stack.stackTagCompound = new NBTTagCompound();
}
stack.stackTagCompound.setInteger("fuel", i);
}
public int getMaxFill(ItemStack stack) {
return this.maxFuel;
}
public int getLoadSpeed(ItemStack stack) {
return 10;
}
@Override
public boolean acceptsFluid(FluidType type, ItemStack stack) {
return type == this.fuel;
}
@Override
public int tryFill(FluidType type, int amount, ItemStack stack) {
if(!acceptsFluid(type, stack))
return amount;
int fill = this.getFuel(stack);
int req = maxFuel - fill;
int toFill = Math.min(amount, req);
//toFill = Math.min(toFill, getLoadSpeed(stack));
this.setFuel(stack, fill + toFill);
return amount - toFill;
}
@Override
public boolean providesFluid(FluidType type, ItemStack stack) {
return false;
}
@Override
public int tryEmpty(FluidType type, int amount, ItemStack stack) {
return 0;
}
@Override
public FluidType getFirstFluidType(ItemStack stack) {
return null;
}
@Override
public int getFill(ItemStack stack) {
return 0;
}
}

View File

@ -16,7 +16,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
public class JetpackRegular extends JetpackBase {
public class JetpackRegular extends JetpackFueledBase {
public JetpackRegular(FluidType fuel, int maxFuel) {
super(fuel, maxFuel);

View File

@ -17,7 +17,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public class JetpackVectorized extends JetpackBase {
public class JetpackVectorized extends JetpackFueledBase {
public JetpackVectorized(FluidType fuel, int maxFuel) {
super(fuel, maxFuel);

View File

@ -2,37 +2,43 @@ package com.hbm.items.armor;
import com.hbm.extprop.HbmPlayerProps;
import com.hbm.items.ModItems;
import com.hbm.main.ResourceManager;
import com.hbm.render.model.ModelArmorWings;
import com.hbm.util.ArmorUtil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public class WingsMurk extends ItemArmor {
public class WingsMurk extends JetpackBase {
public WingsMurk(ArmorMaterial material) {
super(material, 0, 1);
public WingsMurk() {
super();
}
@SideOnly(Side.CLIENT)
ModelArmorWings model;
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
return ResourceManager.wings_murk.toString();
}
@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) {
if(model == null) {
model = new ModelArmorWings(this == ModItems.wings_murk ? 0 : 1);
if (armorSlot == 1) {
if(cachedModel == null) {
cachedModel = new ModelArmorWings(this == ModItems.wings_murk ? 0 : 1);
}
return cachedModel;
}
return model;
return null;
}
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {

View File

@ -4,10 +4,6 @@ import java.util.List;
import java.util.Random;
import com.google.common.collect.Multimap;
import com.hbm.entity.projectile.EntityPlasmaBeam;
import com.hbm.items.ModItems;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
@ -17,6 +13,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.ArrowNockEvent;
@Deprecated
public class GunHP extends Item {
Random rand = new Random();
@ -46,52 +43,7 @@ public class GunHP extends Item {
}
@Override
public void onUsingTick(ItemStack stack, EntityPlayer player, int count) {
World world = player.worldObj;
boolean flag = player.capabilities.isCreativeMode
|| EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0;
if ((player.capabilities.isCreativeMode || player.inventory.hasItem(ModItems.gun_hp_ammo))) {
EntityPlasmaBeam plasma = new EntityPlasmaBeam(world, player, 1F);
EntityPlasmaBeam plasma1 = new EntityPlasmaBeam(world, player, 1F);
EntityPlasmaBeam plasma2 = new EntityPlasmaBeam(world, player, 1F);
EntityPlasmaBeam plasma3 = new EntityPlasmaBeam(world, player, 1F);
EntityPlasmaBeam plasma4 = new EntityPlasmaBeam(world, player, 1F);
plasma1.motionX *= (0.75 + (rand.nextDouble() * 0.5));
plasma1.motionY *= (0.75 + (rand.nextDouble() * 0.5));
plasma1.motionZ *= (0.75 + (rand.nextDouble() * 0.5));
plasma2.motionX *= (0.75 + (rand.nextDouble() * 0.5));
plasma2.motionY *= (0.75 + (rand.nextDouble() * 0.5));
plasma2.motionZ *= (0.75 + (rand.nextDouble() * 0.5));
plasma3.motionX *= (0.75 + (rand.nextDouble() * 0.5));
plasma3.motionY *= (0.75 + (rand.nextDouble() * 0.5));
plasma3.motionZ *= (0.75 + (rand.nextDouble() * 0.5));
plasma4.motionX *= (0.75 + (rand.nextDouble() * 0.5));
plasma4.motionY *= (0.75 + (rand.nextDouble() * 0.5));
plasma4.motionZ *= (0.75 + (rand.nextDouble() * 0.5));
if (flag) {
plasma.canBePickedUp = 2;
} else {
if (count % 20 == 0)
player.inventory.consumeInventoryItem(ModItems.gun_hp_ammo);
}
if (count == this.getMaxItemUseDuration(stack))
world.playSoundAtEntity(player, "hbm:weapon.immolatorIgnite", 1.0F, 1F);
if (count % 10 == 0)
world.playSoundAtEntity(player, "hbm:weapon.immolatorShoot", 1.0F, 1F);
if (!world.isRemote) {
world.spawnEntityInWorld(plasma);
world.spawnEntityInWorld(plasma1);
world.spawnEntityInWorld(plasma2);
world.spawnEntityInWorld(plasma3);
world.spawnEntityInWorld(plasma4);
}
}
}
public void onUsingTick(ItemStack stack, EntityPlayer player, int count) { }
@Override
public int getItemEnchantability() {

View File

@ -6,6 +6,8 @@ import java.util.function.BiConsumer;
import java.util.function.Consumer;
import com.hbm.entity.projectile.EntityBulletBaseMK4;
import com.hbm.entity.projectile.EntityBulletBeamBase;
import com.hbm.interfaces.NotableComments;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
@ -25,6 +27,7 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.util.ForgeDirection;
@NotableComments
public class BulletConfig implements Cloneable {
public static List<BulletConfig> configs = new ArrayList();
@ -55,8 +58,9 @@ public class BulletConfig implements Cloneable {
/** Whether damage dealt to an entity is subtracted from the projectile's damage on penetration */
public boolean damageFalloffByPen = true;
public Consumer<EntityBulletBaseMK4> onUpdate;
public Consumer<Entity> onUpdate;
public BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> onImpact;
public BiConsumer<EntityBulletBeamBase, MovingObjectPosition> onImpactBeam; //fuck fuck fuck fuck i should have used a better base class here god dammit
public BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> onRicochet = LAMBDA_STANDARD_RICOCHET;
public BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> onEntityHit = LAMBDA_STANDARD_ENTITY_HIT;
@ -71,6 +75,7 @@ public class BulletConfig implements Cloneable {
public boolean renderRotations = true;
public SpentCasing casing;
public BiConsumer<EntityBulletBaseMK4, Float> renderer;
public BiConsumer<EntityBulletBeamBase, Float> rendererBeam;
public BulletConfig() {
this.id = configs.size();
@ -108,18 +113,21 @@ public class BulletConfig implements Cloneable {
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 setOnRicochet(BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> lambda) { this.onRicochet = lambda; return this; }
public BulletConfig setOnImpact(BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> lambda) { this.onImpact = lambda; return this; }
public BulletConfig setOnEntityHit(BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> lambda) { this.onEntityHit = lambda; return this; }
public DamageSource getDamage(EntityBulletBaseMK4 bullet, EntityLivingBase shooter, boolean bypass) {
public BulletConfig setRenderer(BiConsumer<EntityBulletBaseMK4, Float> renderer) { this.renderer = renderer; return this; }
public BulletConfig setRendererBeam(BiConsumer<EntityBulletBeamBase, Float> renderer) { this.rendererBeam = renderer; return this; }
public BulletConfig setOnUpdate(Consumer<Entity> lambda) { this.onUpdate = lambda; return this; }
public BulletConfig setOnRicochet(BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> lambda) { this.onRicochet = lambda; return this; }
public BulletConfig setOnImpact(BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> lambda) { this.onImpact = lambda; return this; }
public BulletConfig setOnBeamImpact(BiConsumer<EntityBulletBeamBase, MovingObjectPosition> lambda) { this.onImpactBeam = lambda; return this; }
public BulletConfig setOnEntityHit(BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> lambda) { this.onEntityHit = lambda; return this; }
public DamageSource getDamage(Entity projectile, EntityLivingBase shooter, boolean bypass) {
DamageSource dmg;
if(shooter != null) dmg = new EntityDamageSourceIndirect(damageType, bullet, shooter);
if(shooter != null) dmg = new EntityDamageSourceIndirect(damageType, projectile, shooter);
else dmg = new DamageSource(damageType);
if(this.dmgProj) dmg.setProjectile();

View File

@ -143,6 +143,12 @@ public class Receiver {
.fire(Lego.LAMBDA_STANDARD_FIRE);
}
public Receiver setupBeamFire() {
return this
.canFire(Lego.LAMBDA_STANDARD_CAN_FIRE)
.fire(Lego.LAMBDA_BEAM_FIRE);
}
public Receiver setupLockonFire() {
return this
.canFire(Lego.LAMBDA_LOCKON_CAN_FIRE)

View File

@ -78,6 +78,7 @@ public class GunFactory {
G40_HE, G40_HEAT, G40_DEMO, G40_INC, G40_PHOSPHORUS,
ROCKET_HE, ROCKET_HEAT, ROCKET_DEMO, ROCKET_INC, ROCKET_PHOSPHORUS,
FLAME_DIESEL, FLAME_GAS, FLAME_NAPALM, FLAME_BALEFIRE,
CAPACITOR, CAPACITOR_OVERCHARGE, CAPACITOR_BLACKLIGHTNING,
M44_EQUESTRIAN, G12_EQUESTRIAN, BMG50_EQUESTRIAN
}
}

View File

@ -11,11 +11,13 @@ import static com.hbm.items.weapon.sedna.factory.XFactory556mm.*;
import static com.hbm.items.weapon.sedna.factory.XFactory762mm.*;
import static com.hbm.items.weapon.sedna.factory.XFactory9mm.*;
import static com.hbm.items.weapon.sedna.factory.XFactoryBlackPowder.*;
import static com.hbm.items.weapon.sedna.factory.XFactoryEnergy.*;
import static com.hbm.items.weapon.sedna.factory.XFactoryRocket.*;
import java.util.function.BiConsumer;
import com.hbm.entity.projectile.EntityBulletBaseMK4;
import com.hbm.entity.projectile.EntityBulletBeamBase;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.BulletConfig;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
@ -59,6 +61,7 @@ public class GunFactoryClient {
MinecraftForgeClient.registerItemRenderer(ModItems.gun_minigun, new ItemRenderMinigun());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_missile_launcher, new ItemRenderMissileLauncher());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_tesla_cannon, new ItemRenderTeslaCannon());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_stg77, new ItemRenderSTG77());
//PROJECTILES
ammo_debug.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
ammo_debug_buckshot.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
@ -127,6 +130,8 @@ public class GunFactoryClient {
setRendererBulk(LegoClient.RENDER_RPZB, rocket_rpzb);
setRendererBulk(LegoClient.RENDER_QD, rocket_qd);
setRendererBulk(LegoClient.RENDER_ML, rocket_ml);
setRendererBulkBeam(LegoClient.RENDER_LIGHTNING, energy_tesla, energy_tesla_overcharge);
//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);
@ -143,7 +148,6 @@ public class GunFactoryClient {
((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_flamer) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO_NOCOUNTER);
((ItemGunBaseNT) ModItems.gun_lag) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_uzi) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_spas12) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_panzerschreck) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
@ -154,9 +158,11 @@ public class GunFactoryClient {
((ItemGunBaseNT) ModItems.gun_autoshotgun) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_autoshotgun_sexy) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_quadro) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_lag) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_minigun) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_missile_launcher) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_tesla_cannon) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_stg77) .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);
@ -164,7 +170,6 @@ public class GunFactoryClient {
((ItemGunBaseNT) ModItems.gun_maresleg_akimbo) .getConfig(null, 1).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
}
public static void setRendererBulk(BiConsumer<EntityBulletBaseMK4, Float> renderer, BulletConfig... configs) {
for(BulletConfig config : configs) config.setRenderer(renderer);
}
public static void setRendererBulk(BiConsumer<EntityBulletBaseMK4, Float> renderer, BulletConfig... configs) { for(BulletConfig config : configs) config.setRenderer(renderer); }
public static void setRendererBulkBeam(BiConsumer<EntityBulletBeamBase, Float> renderer, BulletConfig... configs) { for(BulletConfig config : configs) config.setRendererBeam(renderer); }
}

View File

@ -6,10 +6,12 @@ import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import com.hbm.entity.projectile.EntityBulletBaseMK4;
import com.hbm.entity.projectile.EntityBulletBeamBase;
import com.hbm.explosion.vanillant.ExplosionVNT;
import com.hbm.explosion.vanillant.standard.EntityProcessorCrossSmooth;
import com.hbm.explosion.vanillant.standard.ExplosionEffectWeapon;
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
import com.hbm.interfaces.NotableComments;
import com.hbm.items.weapon.sedna.BulletConfig;
import com.hbm.items.weapon.sedna.GunConfig;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
@ -31,8 +33,11 @@ import net.minecraft.util.Vec3;
/**
* "LEGO" - i.e. standardized building blocks which can be used to set up gun configs easily.
*
* small update, 24/11/03: this turned into fucking spaghetti. fuuuuuuuck.
*
* @author hbm
*/
@NotableComments
public class Lego {
public static final Random ANIM_RAND = new Random();
@ -63,11 +68,13 @@ public class Lego {
};
/** If IDLE and ammo is loaded, fire and set to JUST_FIRED. */
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_CLICK_PRIMARY = (stack, ctx) -> {
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_CLICK_PRIMARY = (stack, ctx) -> { clickReceiver(stack, ctx, 0); };
public static void clickReceiver(ItemStack stack, LambdaContext ctx, int receiver) {
EntityLivingBase entity = ctx.entity;
EntityPlayer player = ctx.getPlayer();
Receiver rec = ctx.config.getReceivers(stack)[0];
Receiver rec = ctx.config.getReceivers(stack)[receiver];
int index = ctx.configIndex;
GunState state = ItemGunBaseNT.getState(stack, index);
@ -93,7 +100,7 @@ public class Lego {
}
}
}
};
}
/** If IDLE, switch mode between 0 and 1. */
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_CLICK_SECONDARY = (stack, ctx) -> {
@ -182,6 +189,9 @@ public class Lego {
doStandardFire(stack, ctx, AnimType.CYCLE, true);
ItemGunBaseNT.setIsLockedOn(stack, false);
};
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_BEAM_FIRE = (stack, ctx) -> {
doBeamFire(stack, ctx, AnimType.CYCLE, true);
};
public static void doStandardFire(ItemStack stack, LambdaContext ctx, AnimType anim, boolean calcWear) {
EntityLivingBase entity = ctx.entity;
@ -194,23 +204,58 @@ public class Lego {
IMagazine mag = primary.getMagazine(stack);
BulletConfig config = (BulletConfig) mag.getType(stack, ctx.inventory);
Vec3 offset = primary.getProjectileOffset(stack);
double forwardOffset = offset.xCoord;
double heightOffset = offset.yCoord;
double sideOffset = ItemGunBaseNT.getIsAiming(stack) ? 0 : offset.zCoord; //TODO: make this configurable
/*forwardOffset = 0.75;
heightOffset = -0.125;
sideOffset = -0.25D;*/
int projectiles = config.projectilesMin;
if(config.projectilesMax > config.projectilesMin) projectiles += entity.getRNG().nextInt(config.projectilesMax - config.projectilesMin + 1);
for(int i = 0; i < projectiles; i++) {
float damage = calcDamage(ctx, stack, primary, calcWear, index);
float spread = calcSpread(ctx, stack, primary, calcWear, index, aim);
EntityBulletBaseMK4 mk4 = new EntityBulletBaseMK4(entity, config, damage, spread, sideOffset, heightOffset, forwardOffset);
if(ItemGunBaseNT.getIsLockedOn(stack)) mk4.lockonTarget = entity.worldObj.getEntityByID(ItemGunBaseNT.getLockonTarget(stack));
entity.worldObj.spawnEntityInWorld(mk4);
}
mag.useUpAmmo(stack, ctx.inventory, 1);
if(calcWear) ItemGunBaseNT.setWear(stack, index, Math.min(ItemGunBaseNT.getWear(stack, index) + config.wear, ctx.config.getDurability(stack)));
}
//shittily copy pasted because god damn this sucks ass why do projectiles need this much fucking setup jesus christ have mercy
public static void doBeamFire(ItemStack stack, LambdaContext ctx, AnimType anim, boolean calcWear) {
EntityLivingBase entity = ctx.entity;
EntityPlayer player = ctx.getPlayer();
int index = ctx.configIndex;
if(anim != null) ItemGunBaseNT.playAnimation(player, stack, anim, ctx.configIndex);
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, ctx.inventory);
Vec3 offset = primary.getProjectileOffset(stack);
double forwardOffset = offset.xCoord;
double heightOffset = offset.yCoord;
double sideOffset = ItemGunBaseNT.getIsAiming(stack) ? 0 : offset.zCoord;
/*forwardOffset = 0.75;
heightOffset = -0.125;
sideOffset = -0.25D;*/
heightOffset = 0;
sideOffset = -0.375D;*/
int projectiles = config.projectilesMin;
if(config.projectilesMax > config.projectilesMin) projectiles += entity.getRNG().nextInt(config.projectilesMax - config.projectilesMin + 1);
for(int i = 0; i < projectiles; i++) {
float damage = primary.getBaseDamage(stack) * (calcWear ? getStandardWearDamage(stack, ctx.config, index) : 1);
float spread = primary.getGunSpread(stack) * aim + (calcWear ? getStandardWearSpread(stack, ctx.config, index) * 0.125F : 0F);
EntityBulletBaseMK4 mk4 = new EntityBulletBaseMK4(entity, config, damage, spread, sideOffset, heightOffset, forwardOffset);
if(ItemGunBaseNT.getIsLockedOn(stack)) mk4.lockonTarget = entity.worldObj.getEntityByID(ItemGunBaseNT.getLockonTarget(stack));
float damage = calcDamage(ctx, stack, primary, calcWear, index);
float spread = calcSpread(ctx, stack, primary, calcWear, index, aim);
EntityBulletBeamBase mk4 = new EntityBulletBeamBase(entity, config, damage, spread, sideOffset, heightOffset, forwardOffset);
entity.worldObj.spawnEntityInWorld(mk4);
}
@ -224,11 +269,27 @@ public class Lego {
return (percent - 0.5F) * 2F;
}
/** Returns the standard multiplier for damage based on wear */
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;
}
/** Returns the full calculated damage based on guncfg and wear */
public static float calcDamage(LambdaContext ctx, ItemStack stack, Receiver primary, boolean calcWear, int index) {
return primary.getBaseDamage(stack) * (calcWear ? getStandardWearDamage(stack, ctx.config, index) : 1);
}
public static float calcSpread(LambdaContext ctx, ItemStack stack, Receiver primary, boolean calcWear, int index, float aim) {
return primary.getGunSpread(stack) * aim + (calcWear ? getStandardWearSpread(stack, ctx.config, index) * 0.125F : 0F); //TODO: redo all this spread shit
/*
* spread should have multiple additive parts:
* - hipfire penalty (mitigated by aiming)
* - innate gun inaccuracy (usually 0, increases with wear)
* - bullet inaccuray (usually 0, higher with buckshot)
*/
}
public static void standardExplode(EntityBulletBaseMK4 bullet, MovingObjectPosition mop, float range) { standardExplode(bullet, mop, range, 1F); }
public static void standardExplode(EntityBulletBaseMK4 bullet, MovingObjectPosition mop, float range, float damageMod) {

View File

@ -5,16 +5,22 @@ import java.util.function.BiConsumer;
import org.lwjgl.opengl.GL11;
import com.hbm.entity.projectile.EntityBulletBaseMK4;
import com.hbm.entity.projectile.EntityBulletBeamBase;
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 com.hbm.render.util.BeamPronter;
import com.hbm.render.util.BeamPronter.EnumBeamType;
import com.hbm.render.util.BeamPronter.EnumWaveType;
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.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3;
public class LegoClient {
@ -219,4 +225,21 @@ public class LegoClient {
double length = bullet.prevVelocity + (bullet.velocity - bullet.prevVelocity) * interp;
if(length > 0) renderBulletStandard(Tessellator.instance, 0x808080, 0xFFF2A7, length * 2, true);
};
public static BiConsumer<EntityBulletBeamBase, Float> RENDER_LIGHTNING = (bullet, interp) -> {
GL11.glPushMatrix();
GL11.glRotatef(180 - bullet.rotationYaw, 0, 1F, 0);
GL11.glRotatef(-bullet.rotationPitch - 90, 1F, 0, 0);
Vec3 delta = Vec3.createVectorHelper(0, bullet.beamLength, 0);
double age = MathHelper.clamp_double(1D - ((double) bullet.ticksExisted - 2 + interp) / (double) bullet.getBulletConfig().expires, 0, 1);
GL11.glScaled(age / 2 + 0.5, 1, age / 2 + 0.5);
double scale = 0.075D;
int colorInner = ((int)(0x20 * age) << 16) | ((int)(0x20 * age) << 8) | (int) (0x40 * age);
int colorOuter = ((int)(0x40 * age) << 16) | ((int)(0x40 * age) << 8) | (int) (0x80 * age);
BeamPronter.prontBeam(delta, EnumWaveType.RANDOM, EnumBeamType.SOLID, colorInner, colorInner, bullet.ticksExisted / 3, (int)(bullet.beamLength / 2 + 1), (float)scale * 1F, 4, 0.25F);
BeamPronter.prontBeam(delta, EnumWaveType.RANDOM, EnumBeamType.SOLID, colorOuter, colorOuter, bullet.ticksExisted, (int)(bullet.beamLength / 2 + 1), (float)scale * 7F, 2, 0.0625F);
BeamPronter.prontBeam(delta, EnumWaveType.RANDOM, EnumBeamType.SOLID, colorOuter, colorOuter, bullet.ticksExisted / 2, (int)(bullet.beamLength / 2 + 1), (float)scale * 7F, 2, 0.0625F);
GL11.glPopMatrix();
};
}

View File

@ -859,19 +859,21 @@ public class Orchestras {
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
if(type == AnimType.CYCLE) {
if(timer == 2) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.fire.shredderCycle", 0.25F, 1.5F);
if(timer == 2) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.fire.shredderCycle", 0.25F, 1.25F);
}
if(type == AnimType.CYCLE_DRY) {
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.dryFireClick", 1F, 1F);
if(timer == 2) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.fire.shredderCycle", 0.25F, 1.5F);
}
if(type == AnimType.RELOAD) {
if(timer == 2) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magRemove", 1F, 1F);
if(timer == 32) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magInsert", 1F, 1F);
if(timer == 2) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.fire.shredderCycle", 0.25F, 1.25F);
}
if(type == AnimType.INSPECT) {
if(timer == 2) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magRemove", 1F, 1F);
if(timer == 28) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magInsert", 1F, 1F);
if(timer == 12) entity.worldObj.playSoundAtEntity(entity, "hbm:block.squeakyToy", 0.25F, 1F);
}
};
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_STG77 = (stack, ctx) -> {
EntityLivingBase entity = ctx.entity;
if(entity.worldObj.isRemote) return;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
};
}

View File

@ -9,9 +9,11 @@ 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.ItemGunBaseNT.GunState;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.main.MainRegistry;
import com.hbm.particle.SpentCasing;
@ -51,12 +53,33 @@ public class XFactory556mm {
.setupStandardConfiguration().ps(Lego.LAMBDA_STANDARD_CLICK_SECONDARY)
.anim(LAMBDA_G3_ANIMS).orchestra(Orchestras.ORCHESTRA_G3)
).setUnlocalizedName("gun_g3");
ModItems.gun_stg77 = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig()
.dura(3_000).draw(10).inspect(33).crosshair(Crosshair.CIRCLE).smoke(LAMBDA_SMOKE)
.rec(new Receiver(0)
.dmg(15F).delay(2).dry(15).auto(true).spread(0.0F).reload(50).jam(47).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.mag(new MagazineFullReload(0, 30).addConfigs(r556_sp, r556_fmj, r556_jhp, r556_ap))
.offset(1, -0.0625 * 2.5, -0.25D)
.setupStandardFire().recoil(Lego.LAMBDA_STANDARD_RECOIL))
.pp(Lego.LAMBDA_STANDARD_CLICK_PRIMARY).ps(Lego.LAMBDA_STANDARD_CLICK_PRIMARY).pr(Lego.LAMBDA_STANDARD_RELOAD).pt(Lego.LAMBDA_TOGGLE_AIM)
.decider(LAMBDA_STG77_DECIDER)
.anim(LAMBDA_STG77_ANIMS).orchestra(Orchestras.ORCHESTRA_STG77)
).setUnlocalizedName("gun_stg77");
}
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SMOKE = (stack, ctx) -> {
Lego.handleStandardSmoke(ctx.entity, stack, 1500, 0.075D, 1.1D, 0);
};
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STG77_DECIDER = (stack, ctx) -> {
int index = ctx.configIndex;
GunState lastState = ItemGunBaseNT.getState(stack, index);
GunStateDecider.deciderStandardFinishDraw(stack, lastState, index);
GunStateDecider.deciderStandardClearJam(stack, lastState, index);
GunStateDecider.deciderStandardReload(stack, ctx, lastState, 0, index);
GunStateDecider.deciderAutoRefire(stack, ctx, lastState, 0, index, () -> { return ItemGunBaseNT.getSecondary(stack, index); });
};
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_G3_ANIMS = (stack, type) -> {
boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory) <= 0;
switch(type) {
@ -108,4 +131,16 @@ public class XFactory556mm {
return null;
};
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_STG77_ANIMS = (stack, type) -> {
boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory) <= 0;
switch(type) {
case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_FULL));
case CYCLE: return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, ItemGunBaseNT.getIsAiming(stack) ? -0.125 : -0.375, 25, IType.SIN_DOWN).addPos(0, 0, 0, 75, IType.SIN_FULL));
}
return null;
};
}

View File

@ -1,7 +1,12 @@
package com.hbm.items.weapon.sedna.factory;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import com.hbm.entity.projectile.EntityBulletBeamBase;
import com.hbm.explosion.vanillant.ExplosionVNT;
import com.hbm.explosion.vanillant.standard.EntityProcessorCrossSmooth;
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.BulletConfig;
import com.hbm.items.weapon.sedna.Crosshair;
@ -11,54 +16,92 @@ import com.hbm.items.weapon.sedna.Receiver;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.mags.MagazineBelt;
import com.hbm.main.MainRegistry;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toclient.AuxParticlePacketNT;
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 cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MovingObjectPosition;
import net.minecraftforge.common.util.ForgeDirection;
public class XFactoryEnergy {
public static BulletConfig energy_tesla;
public static BulletConfig energy_tesla_overcharge;
public static BulletConfig energy_tesla_blacklightning;
public static BiConsumer<EntityBulletBeamBase, MovingObjectPosition> LAMBDA_LIGHTNING_HIT = (beam, mop) -> {
if(mop.typeOfHit == mop.typeOfHit.BLOCK) {
ForgeDirection dir = ForgeDirection.getOrientation(mop.sideHit);
mop.hitVec.xCoord += dir.offsetX * 0.5;
mop.hitVec.yCoord += dir.offsetY * 0.5;
mop.hitVec.zCoord += dir.offsetZ * 0.5;
}
ExplosionVNT vnt = new ExplosionVNT(beam.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 2F);
vnt.setEntityProcessor(new EntityProcessorCrossSmooth(1, beam.damage));
vnt.setPlayerProcessor(new PlayerProcessorStandard());
vnt.explode();
beam.worldObj.playSoundEffect(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, "hbm:entity.ufoBlast", 5.0F, 0.9F + beam.worldObj.rand.nextFloat() * 0.2F);
beam.worldObj.playSoundEffect(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, "fireworks.blast", 5.0F, 0.5F);
float yaw = beam.worldObj.rand.nextFloat() * 180F;
for(int i = 0; i < 3; i++) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "plasmablast");
data.setFloat("r", 0.5F);
data.setFloat("g", 0.5F);
data.setFloat("b", 1.0F);
data.setFloat("pitch", -60F + 60F * i);
data.setFloat("yaw", yaw);
data.setFloat("scale", 2F);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord),
new TargetPoint(beam.worldObj.provider.dimensionId, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 100));
}
};
public static void init() {
energy_tesla = new BulletConfig().setItem(EnumAmmo.P9_SP).setSpread(0.01F);
energy_tesla = new BulletConfig().setItem(EnumAmmo.CAPACITOR).setSpread(0.0F).setLife(5).setRenderRotations(false).setDoesPenetrate(true)
.setOnBeamImpact(LAMBDA_LIGHTNING_HIT);
energy_tesla_overcharge = new BulletConfig().setItem(EnumAmmo.CAPACITOR_OVERCHARGE).setSpread(0.0F).setLife(5).setRenderRotations(false).setDoesPenetrate(true)
.setDamage(1.5F).setOnBeamImpact(LAMBDA_LIGHTNING_HIT);
energy_tesla_blacklightning = new BulletConfig().setItem(EnumAmmo.CAPACITOR_BLACKLIGHTNING).setSpread(0.0F).setLife(5).setRenderRotations(false).setDoesPenetrate(true)
.setDamage(5F).setOnBeamImpact(LAMBDA_LIGHTNING_HIT);
ModItems.gun_tesla_cannon = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig()
.dura(2_000).draw(10).inspect(33).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.dura(2_000).draw(10).inspect(33).reloadSequential(true).crosshair(Crosshair.CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0)
.dmg(15F).delay(10).reload(44).jam(19).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.mag(new MagazineBelt().addConfigs(energy_tesla))
.offset(0.75, -0.125, -0.25)
.setupStandardFire().recoil(Lego.LAMBDA_STANDARD_RECOIL))
.dmg(15F).delay(20).reload(44).jam(19).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.mag(new MagazineBelt().addConfigs(energy_tesla, energy_tesla_overcharge, energy_tesla_blacklightning))
.offset(0.75, 0, -0.375)
.setupBeamFire().recoil(Lego.LAMBDA_STANDARD_RECOIL))
.setupStandardConfiguration()
.anim(LAMBDA_TESLA_ANIMS).orchestra(Orchestras.ORCHESTRA_TESLA)
).setUnlocalizedName("gun_tesla_cannon");
}
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_TESLA_ANIMS = (stack, type) -> {
int amount = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory);
switch(type) {
case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN));
.addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 1000, IType.SIN_DOWN));
case CYCLE: return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, -1, 50, IType.SIN_DOWN).addPos(0, 0, 0, 150, IType.SIN_FULL))
.addBus("CYCLE", new BusAnimationSequence().addPos(0, 0, 0, 150).addPos(0, 0, 18, 100));
.addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, ItemGunBaseNT.getIsAiming(stack) ? -0.5 : -1, 100, IType.SIN_DOWN).addPos(0, 0, 0, 250, IType.SIN_FULL))
.addBus("CYCLE", new BusAnimationSequence().addPos(0, 0, 0, 150).addPos(0, 0, 22.5, 350))
.addBus("COUNT", new BusAnimationSequence().addPos(amount, 0, 0, 0));
case CYCLE_DRY: return new BusAnimation()
.addBus("CYCLE", new BusAnimationSequence().addPos(0, 0, 0, 150).addPos(0, 0, 18, 100));
case RELOAD: return new BusAnimation()
.addBus("MAG", new BusAnimationSequence().addPos(0, -8, 0, 250, IType.SIN_UP).addPos(0, -8, 0, 1000).addPos(0, 0, 0, 300))
.addBus("LIFT", new BusAnimationSequence().addPos(0, 0, 0, 750).addPos(-25, 0, 0, 300, IType.SIN_FULL).addPos(-25, 0, 0, 500).addPos(-27, 0, 0, 100, IType.SIN_DOWN).addPos(-25, 0, 0, 100, IType.SIN_FULL).addPos(-25, 0, 0, 150).addPos(0, 0, 0, 300, IType.SIN_FULL));
case JAMMED: return new BusAnimation()
.addBus("MAG", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(0, -2, 0, 150, IType.SIN_UP).addPos(0, 0, 0, 100))
.addBus("LIFT", new BusAnimationSequence().addPos(0, 0, 0, 750).addPos(-2, 0, 0, 100, IType.SIN_DOWN).addPos(0, 0, 0, 100, IType.SIN_FULL));
.addBus("CYCLE", new BusAnimationSequence().addPos(0, 0, 0, 150).addPos(0, 0, 22.5, 350));
case INSPECT: return new BusAnimation()
.addBus("MAG", new BusAnimationSequence()
.addPos(0, -1, 0, 150).addPos(6, -1, 0, 150).addPos(6, 12, 0, 350, IType.SIN_DOWN).addPos(6, -2, 0, 350, IType.SIN_UP).addPos(6, -1, 0, 50)
.addPos(6, -1, 0, 100).addPos(0, -1, 0, 150, IType.SIN_FULL).addPos(0, 0, 0, 150, IType.SIN_UP))
.addBus("SPEEN", new BusAnimationSequence().addPos(0, 0, 0, 300).addPos(360, 0, 0, 700))
.addBus("LIFT", new BusAnimationSequence().addPos(0, 0, 0, 1450).addPos(-2, 0, 0, 100, IType.SIN_DOWN).addPos(0, 0, 0, 100, IType.SIN_FULL));
.addBus("YOMI", new BusAnimationSequence().addPos(8, -4, 0, 0).addPos(4, -1, 0, 500, IType.SIN_DOWN).addPos(4, -1, 0, 1000).addPos(6, -6, 0, 500, IType.SIN_UP))
.addBus("SQUEEZE", new BusAnimationSequence().addPos(1, 1, 1, 0).addPos(1, 1, 1, 750).addPos(1, 1, 0.5, 125).addPos(1, 1, 1, 125));
}
return null;

View File

@ -28,6 +28,7 @@ import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
@ -44,10 +45,10 @@ public class XFactoryFlamer {
public static BulletConfig flame_balefire;
public static BulletConfig flame_digamma;
public static Consumer<EntityBulletBaseMK4> LAMBDA_FIRE = (bullet) -> {
public static Consumer<Entity> LAMBDA_FIRE = (bullet) -> {
if(bullet.worldObj.isRemote && MainRegistry.proxy.me().getDistanceToEntity(bullet) < 100) FlameCreator.composeEffectClient(bullet.worldObj, bullet.posX, bullet.posY - 0.125, bullet.posZ, FlameCreator.META_FIRE);
};
public static Consumer<EntityBulletBaseMK4> LAMBDA_BALEFIRE = (bullet) -> {
public static Consumer<Entity> LAMBDA_BALEFIRE = (bullet) -> {
if(bullet.worldObj.isRemote && MainRegistry.proxy.me().getDistanceToEntity(bullet) < 100) FlameCreator.composeEffectClient(bullet.worldObj, bullet.posX, bullet.posY - 0.125, bullet.posZ, FlameCreator.META_BALEFIRE);
};
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_IGNITE_FIRE = (bullet, mop) -> {

View File

@ -31,6 +31,7 @@ import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
@ -48,10 +49,12 @@ public class XFactoryRocket {
public static BulletConfig[] rocket_ml;
// FLYING
public static Consumer<EntityBulletBaseMK4> LAMBDA_STANDARD_ACCELERATE = (bullet) -> {
public static Consumer<Entity> LAMBDA_STANDARD_ACCELERATE = (entity) -> {
EntityBulletBaseMK4 bullet = (EntityBulletBaseMK4) entity;
if(bullet.accel < 7) bullet.accel += 0.4D;
};
public static Consumer<EntityBulletBaseMK4> LAMBDA_STEERING_ACCELERATE = (bullet) -> {
public static Consumer<Entity> LAMBDA_STEERING_ACCELERATE = (entity) -> {
EntityBulletBaseMK4 bullet = (EntityBulletBaseMK4) entity;
if(bullet.accel < 4) bullet.accel += 0.4D;
if(bullet.getThrower() == null || !(bullet.getThrower() instanceof EntityPlayer)) return;

View File

@ -107,7 +107,7 @@ public class ItemGunStinger extends ItemGunBaseNT {
Vec3NT toEntity = new Vec3NT(0, 0, 0);
for(Entity entity : entities) {
if(entity.height < 0.5F) continue;
if(entity.height < 0.5F || !entity.canBeCollidedWith()) continue;
toEntity.setComponents(entity.posX - x, entity.posY + entity.height / 2D - y, entity.posZ - z);
double vecProd = toEntity.xCoord * delta.xCoord + toEntity.yCoord * delta.yCoord + toEntity.zCoord * delta.zCoord;

View File

@ -96,9 +96,6 @@ public class HbmWorldGen implements IWorldGenerator {
DungeonToolbox.generateFlowers(world, rand, i, j, ModBlocks.reeds, 0);
}
}
if(WorldConfig.oilcoalSpawn > 0 && rand.nextInt(WorldConfig.oilcoalSpawn) == 0)
DungeonToolbox.generateOre(world, rand, i, j, 1, 64, 32, 32, ModBlocks.ore_coal_oil);
if(WorldConfig.gasbubbleSpawn > 0 && rand.nextInt(WorldConfig.gasbubbleSpawn) == 0)
DungeonToolbox.generateOre(world, rand, i, j, 1, 32, 30, 10, ModBlocks.gas_flammable, 1);

View File

@ -95,10 +95,6 @@ public class ModDamageSource extends DamageSource {
return (new EntityDamageSourceIndirect(s_euthanized, ent, hit)).setDamageBypassesArmor();
}
public static DamageSource causePlasmaDamage(EntityPlasmaBeam ent, Entity hit) {
return (new EntityDamageSourceIndirect(s_immolator, ent, hit)).setDamageBypassesArmor();
}
public static DamageSource causeIceDamage(EntityLN2 ent, Entity hit) {
return (new EntityDamageSourceIndirect(s_cryolator, ent, hit)).setDamageBypassesArmor();
}

View File

@ -624,9 +624,8 @@ public class ClientProxy extends ServerProxy {
RenderingRegistry.registerEntityRenderingHandler(EntityBullet.class, new RenderRocket());
RenderingRegistry.registerEntityRenderingHandler(EntityBulletBaseNT.class, new RenderBullet());
RenderingRegistry.registerEntityRenderingHandler(EntityBulletBaseMK4.class, new RenderBulletMK4());
RenderingRegistry.registerEntityRenderingHandler(EntityBulletBeamBase.class, new RenderBeam());
RenderingRegistry.registerEntityRenderingHandler(EntityRainbow.class, new RenderRainbow());
RenderingRegistry.registerEntityRenderingHandler(EntityNightmareBlast.class, new RenderOminousBullet());
RenderingRegistry.registerEntityRenderingHandler(EntityPlasmaBeam.class, new RenderBeam());
RenderingRegistry.registerEntityRenderingHandler(EntityLaserBeam.class, new RenderBeam2());
RenderingRegistry.registerEntityRenderingHandler(EntityMinerBeam.class, new RenderBeam3());
RenderingRegistry.registerEntityRenderingHandler(EntitySparkBeam.class, new RenderBeam4());

View File

@ -41,6 +41,7 @@ import com.hbm.items.armor.ArmorFSBPowered;
import com.hbm.items.armor.ArmorNo9;
import com.hbm.items.armor.ItemArmorMod;
import com.hbm.items.armor.JetpackBase;
import com.hbm.items.armor.JetpackFueledBase;
import com.hbm.items.machine.ItemDepletedFuel;
import com.hbm.items.machine.ItemFluidDuct;
import com.hbm.items.machine.ItemRBMKPellet;
@ -441,11 +442,11 @@ public class ModEventHandlerClient {
GL11.glEnable(GL11.GL_TEXTURE_2D);
} else if(player.inventory.armorInventory[2] != null && player.inventory.armorInventory[2].getItem() instanceof JetpackBase) {
} else if(player.inventory.armorInventory[2] != null && player.inventory.armorInventory[2].getItem() instanceof JetpackFueledBase) {
ItemStack stack = player.inventory.armorInventory[2];
float tot = (float) ((JetpackBase) stack.getItem()).getFuel(stack) / (float) ((JetpackBase) stack.getItem()).getMaxFill(stack);
float tot = (float) ((JetpackFueledBase) stack.getItem()).getFuel(stack) / (float) ((JetpackFueledBase) stack.getItem()).getMaxFill(stack);
int top = height - GuiIngameForge.left_height + 3;

View File

@ -860,6 +860,8 @@ public class ResourceManager {
public static final IModelCustom mike_hawk = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/mike_hawk.obj")).asVBO();
public static final IModelCustom minigun = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/minigun.obj")).asVBO();
public static final IModelCustom missile_launcher = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/missile_launcher.obj")).asVBO();
public static final IModelCustom tesla_cannon = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/tesla_cannon.obj")).asVBO();
public static final IModelCustom stg77 = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/stg77.obj")).asVBO();
public static final HashMap<String, BusAnimation> python_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/python.json"));
public static final HashMap<String, BusAnimation> cursed_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/cursed.json"));
@ -991,6 +993,8 @@ public class ResourceManager {
public static final ResourceLocation quadro_rocket_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/quadro_rocket.png");
public static final ResourceLocation minigun_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/minigun.png");
public static final ResourceLocation missile_launcher_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/missile_launcher.png");
public static final ResourceLocation tesla_cannon_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/tesla_cannon.png");
public static final ResourceLocation stg77_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/stg77.png");
public static final ResourceLocation lance_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/lance.png");

View File

@ -1,6 +1,7 @@
package com.hbm.render.block;
import com.hbm.blocks.generic.BlockReeds;
import com.hbm.config.ClientConfig;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
@ -27,10 +28,15 @@ public class RenderReeds implements ISimpleBlockRenderingHandler {
tessellator.setColorOpaque_F(r * m, g * m, b * m);
int depth = 0;
for(int i = y - 1; i > 0 ; i--) {
Block water = world.getBlock(x, i, z);
depth = y - i;
if(water != Blocks.water && water != Blocks.flowing_water) break;
if(!ClientConfig.RENDER_REEDS.get()) {
depth = 1;
} else {
for(int i = y - 1; i > 0 ; i--) {
Block water = world.getBlock(x, i, z);
depth = y - i;
if(water != Blocks.water && water != Blocks.flowing_water) break;
}
}
BlockReeds reeds = (BlockReeds) block;

View File

@ -1,80 +1,36 @@
package com.hbm.render.entity.projectile;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import com.hbm.lib.RefStrings;
import net.minecraft.client.renderer.Tessellator;
import com.hbm.entity.projectile.EntityBulletBeamBase;
import com.hbm.main.ResourceManager;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
public class RenderBeam extends Render {
Random rand = new Random();
@Override
public void doRender(Entity rocket, double x, double y, double z, float p_76986_8_, float p_76986_9_) {
float radius = 0.12F;
//float radius = 0.06F;
int distance = 4;
Tessellator tessellator = Tessellator.instance;
public void doRender(Entity entity, double x, double y, double z, float f0, float interp) {
EntityBulletBeamBase bullet = (EntityBulletBeamBase) entity;
if(bullet.config == null) bullet.config = bullet.getBulletConfig();
if(bullet.config == null) return;
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
GL11.glTranslatef((float) x, (float) y, (float) z);
GL11.glRotatef(rocket.rotationYaw, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-rocket.rotationPitch, 1.0F, 0.0F, 0.0F);
boolean red = false;
boolean green = true;
boolean blue = false;
for (float o = 0; o <= radius; o += radius / 8) {
float color = 1f - (o * 8.333f);
if (color < 0)
color = 0;
tessellator.startDrawingQuads();
tessellator.setColorRGBA_F(red ? 1 : color, green ? 1 : color, blue ? 1 : color, 1f);
tessellator.addVertex(0 + o, 0 - o, 0);
tessellator.addVertex(0 + o, 0 + o, 0);
tessellator.addVertex(0 + o, 0 + o, 0 + distance);
tessellator.addVertex(0 + o, 0 - o, 0 + distance);
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setColorRGBA_F(red ? 1 : color, green ? 1 : color, blue ? 1 : color, 1f);
tessellator.addVertex(0 - o, 0 - o, 0);
tessellator.addVertex(0 + o, 0 - o, 0);
tessellator.addVertex(0 + o, 0 - o, 0 + distance);
tessellator.addVertex(0 - o, 0 - o, 0 + distance);
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setColorRGBA_F(red ? 1 : color, green ? 1 : color, blue ? 1 : color, 1f);
tessellator.addVertex(0 - o, 0 + o, 0);
tessellator.addVertex(0 - o, 0 - o, 0);
tessellator.addVertex(0 - o, 0 - o, 0 + distance);
tessellator.addVertex(0 - o, 0 + o, 0 + distance);
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setColorRGBA_F(red ? 1 : color, green ? 1 : color, blue ? 1 : color, 1f);
tessellator.addVertex(0 + o, 0 + o, 0);
tessellator.addVertex(0 - o, 0 + o, 0);
tessellator.addVertex(0 - o, 0 + o, 0 + distance);
tessellator.addVertex(0 + o, 0 + o, 0 + distance);
tessellator.draw();
if(bullet.config.renderRotations) {
GL11.glRotatef(bullet.prevRotationYaw + (bullet.rotationYaw - bullet.prevRotationYaw) * interp - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(bullet.prevRotationPitch + (bullet.rotationPitch - bullet.prevRotationPitch) * interp + 180, 0.0F, 0.0F, 1.0F);
}
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_TEXTURE_2D);
if(bullet.config.rendererBeam != null) {
bullet.config.rendererBeam.accept(bullet, interp);
}
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
return new ResourceLocation(RefStrings.MODID + ":textures/models/PlasmaBeam.png");
}
@Override protected ResourceLocation getEntityTexture(Entity entity) { return ResourceManager.universal; }
}

View File

@ -1,87 +0,0 @@
package com.hbm.render.entity.projectile;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import com.hbm.lib.RefStrings;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
public class RenderOminousBullet extends Render {
Random rand = new Random();
@Override
public void doRender(Entity rocket, double x, double y, double z, float p_76986_8_, float p_76986_9_) {
float radius = 0.12F;
int distance = 4;
radius = 0.03F;
Tessellator tessellator = Tessellator.instance;
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
GL11.glTranslatef((float) x, (float) y, (float) z);
GL11.glRotatef(rocket.rotationYaw, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-rocket.rotationPitch, 1.0F, 0.0F, 0.0F);
boolean red = false;
boolean green = false;
boolean blue = false;
green = true;
red = true;
//for (float o = 0; o <= radius; o += radius / 8) {
for (float o = 0; o <= radius; o += radius / 1) {
float color = 1f - (o * 8.333f);
if (color < 0)
color = 0;
tessellator.startDrawingQuads();
tessellator.setColorRGBA_F(red ? 1 : color, green ? 1 : color, blue ? 1 : color, 1f);
tessellator.addVertex(0 + o, 0 - o, 0);
tessellator.addVertex(0 + o, 0 + o, 0);
tessellator.addVertex(0 + o, 0 + o, 0 + distance);
tessellator.addVertex(0 + o, 0 - o, 0 + distance);
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setColorRGBA_F(red ? 1 : color, green ? 1 : color, blue ? 1 : color, 1f);
tessellator.addVertex(0 - o, 0 - o, 0);
tessellator.addVertex(0 + o, 0 - o, 0);
tessellator.addVertex(0 + o, 0 - o, 0 + distance);
tessellator.addVertex(0 - o, 0 - o, 0 + distance);
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setColorRGBA_F(red ? 1 : color, green ? 1 : color, blue ? 1 : color, 1f);
tessellator.addVertex(0 - o, 0 + o, 0);
tessellator.addVertex(0 - o, 0 - o, 0);
tessellator.addVertex(0 - o, 0 - o, 0 + distance);
tessellator.addVertex(0 - o, 0 + o, 0 + distance);
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setColorRGBA_F(red ? 1 : color, green ? 1 : color, blue ? 1 : color, 1f);
tessellator.addVertex(0 + o, 0 + o, 0);
tessellator.addVertex(0 - o, 0 + o, 0);
tessellator.addVertex(0 - o, 0 + o, 0 + distance);
tessellator.addVertex(0 + o, 0 + o, 0 + distance);
tessellator.draw();
}
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
return new ResourceLocation(RefStrings.MODID + ":textures/models/Rainbow.png");
}
}

View File

@ -0,0 +1,115 @@
package com.hbm.render.item.weapon.sedna;
import org.lwjgl.opengl.GL11;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
public class ItemRenderSTG77 extends ItemRenderWeaponBase {
@Override
protected float getTurnMagnitude(ItemStack stack) { return ItemGunBaseNT.getIsAiming(stack) ? 2.5F : -0.25F; }
@Override
public void setupFirstPerson(ItemStack stack) {
GL11.glTranslated(0, 0, 0.875);
float offset = 0.8F;
standardAimingTransform(stack,
-1.5F * offset, -1F * offset, 2.5F * offset,
0, -5.75 / 8D, 1);
}
@Override
public void renderFirstPerson(ItemStack stack) {
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.stg77_tex);
double scale = 0.5D;
GL11.glScaled(scale, scale, scale);
double[] equip = HbmAnimations.getRelevantTransformation("EQUIP");
double[] recoil = HbmAnimations.getRelevantTransformation("RECOIL");
double[] mag = HbmAnimations.getRelevantTransformation("MAG");
double[] speen = HbmAnimations.getRelevantTransformation("SPEEN");
double[] bolt = HbmAnimations.getRelevantTransformation("BOLT");
double[] handle = HbmAnimations.getRelevantTransformation("HANDLE");
double[] bullet = HbmAnimations.getRelevantTransformation("BULLET");
GL11.glTranslated(0, -1, -4);
GL11.glRotated(equip[0], 1, 0, 0);
GL11.glTranslated(0, 1, 4);
GL11.glTranslated(0, 0, recoil[2]);
GL11.glShadeModel(GL11.GL_SMOOTH);
ResourceManager.stg77.renderPart("Gun");
ResourceManager.stg77.renderPart("Barrel");
ResourceManager.stg77.renderPart("Lever");
ResourceManager.stg77.renderPart("Magazine");
GL11.glPushMatrix();
GL11.glTranslated(0.25, 0, 0);
ResourceManager.stg77.renderPart("Safety");
GL11.glPopMatrix();
double smokeScale = 0.75;
GL11.glPushMatrix();
GL11.glTranslated(0, 0, 8);
GL11.glRotated(90, 0, 1, 0);
GL11.glScaled(smokeScale, smokeScale, smokeScale);
this.renderSmokeNodes(gun.getConfig(stack, 0).smokeNodes, 0.5D);
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPushMatrix();
GL11.glTranslated(0, 0, 7.5);
GL11.glRotated(90, 0, 1, 0);
GL11.glScaled(0.25, 0.25, 0.25);
GL11.glRotated(-5 + gun.shotRand * 10, 1, 0, 0);
this.renderGapFlash(gun.lastShot[0]);
GL11.glPopMatrix();
}
@Override
public void setupThirdPerson(ItemStack stack) {
super.setupThirdPerson(stack);
double scale = 1D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(0, 2, 4);
}
@Override
public void setupInv(ItemStack stack) {
super.setupInv(stack);
double scale = 1.375D;
GL11.glScaled(scale, scale, scale);
GL11.glRotated(25, 1, 0, 0);
GL11.glRotated(45, 0, 1, 0);
GL11.glTranslated(-0.5, 0.5, 0);
}
@Override
public void renderOther(ItemStack stack, ItemRenderType type) {
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glShadeModel(GL11.GL_SMOOTH);
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.stg77_tex);
ResourceManager.stg77.renderPart("Gun");
ResourceManager.stg77.renderPart("Barrel");
ResourceManager.stg77.renderPart("Lever");
ResourceManager.stg77.renderPart("Magazine");
ResourceManager.stg77.renderPart("Safety");
GL11.glShadeModel(GL11.GL_FLAT);
}
}

View File

@ -1,26 +1,150 @@
package com.hbm.render.item.weapon.sedna;
import org.lwjgl.opengl.GL11;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations;
import com.hbm.render.tileentity.RenderPlushie;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
public class ItemRenderTeslaCannon implements IItemRenderer {
public class ItemRenderTeslaCannon extends ItemRenderWeaponBase {
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
// TODO Auto-generated method stub
return false;
protected float getTurnMagnitude(ItemStack stack) { return ItemGunBaseNT.getIsAiming(stack) ? 2.5F : -0.5F; }
@Override
public void setupFirstPerson(ItemStack stack) {
GL11.glTranslated(0, 0, 0.875);
float offset = 0.8F;
standardAimingTransform(stack,
-1.75F * offset, -0.5F * offset, 1.75F * offset,
-1.3125F * offset, 0F * offset, -0.5F * offset);
}
protected static String label = "AUTO";
@Override
public void renderFirstPerson(ItemStack stack) {
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.tesla_cannon_tex);
double scale = 0.75D;
GL11.glScaled(scale, scale, scale);
double[] equip = HbmAnimations.getRelevantTransformation("EQUIP");
double[] recoil = HbmAnimations.getRelevantTransformation("RECOIL");
double[] cycle = HbmAnimations.getRelevantTransformation("CYCLE");
double[] count = HbmAnimations.getRelevantTransformation("COUNT");
double[] yomi = HbmAnimations.getRelevantTransformation("YOMI");
double[] squeeze = HbmAnimations.getRelevantTransformation("SQUEEZE");
GL11.glTranslated(0, -2, -2);
GL11.glRotated(equip[0], 1, 0, 0);
GL11.glTranslated(0, 2, 2);
GL11.glTranslated(0, 0, recoil[2]);
GL11.glRotated(recoil[2] * 2, 1, 0, 0);
GL11.glShadeModel(GL11.GL_SMOOTH);
int amount = Math.max((int) count[0], gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory));
ResourceManager.tesla_cannon.renderPart("Gun");
ResourceManager.tesla_cannon.renderPart("Extension");
double cogAngle = cycle[2];
GL11.glPushMatrix();
GL11.glTranslated(0, -1.625, 0);
GL11.glRotated(cogAngle, 0, 0, 1);
GL11.glTranslated(0, 1.625, 0);
ResourceManager.tesla_cannon.renderPart("Cog");
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(0, -1.625, 0);
GL11.glRotated(cogAngle, 0, 0, 1);
GL11.glTranslated(0, 1.625, 0);
for(int i = 0; i < Math.min(amount, 8); i++) {
ResourceManager.tesla_cannon.renderPart("Capacitor");
if(i < 4) {
GL11.glTranslated(0, -1.625, 0);
GL11.glRotated(-22.5, 0, 0, 1);
GL11.glTranslated(0, 1.625, 0);
} else {
if(i == 4) {
GL11.glTranslated(0, -1.625, 0);
GL11.glRotated(-cogAngle, 0, 0, 1);
GL11.glTranslated(0, 1.625, 0);
GL11.glTranslated(-cogAngle * 0.5 / 22.5, 0, 0);
}
GL11.glTranslated(0.5, 0, 0);
}
}
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPushMatrix();
GL11.glTranslated(yomi[0], yomi[1], yomi[2]);
GL11.glRotated(135, 0, 1, 0);
GL11.glScaled(squeeze[0], squeeze[1], squeeze[2]);
Minecraft.getMinecraft().renderEngine.bindTexture(RenderPlushie.yomiTex);
RenderPlushie.yomiModel.renderAll();
GL11.glPopMatrix();
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
// TODO Auto-generated method stub
return false;
public void setupThirdPerson(ItemStack stack) {
super.setupThirdPerson(stack);
double scale = 2.75D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(0, 1.5, 1);
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
// TODO Auto-generated method stub
public void setupInv(ItemStack stack) {
super.setupInv(stack);
double scale = 1.25D;
GL11.glScaled(scale, scale, scale);
GL11.glRotated(25, 1, 0, 0);
GL11.glRotated(45, 0, 1, 0);
GL11.glTranslated(0, 0.5, 0);
}
@Override
public void renderOther(ItemStack stack, ItemRenderType type) {
GL11.glEnable(GL11.GL_LIGHTING);
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.tesla_cannon_tex);
GL11.glShadeModel(GL11.GL_SMOOTH);
ResourceManager.tesla_cannon.renderPart("Gun");
ResourceManager.tesla_cannon.renderPart("Extension");
ResourceManager.tesla_cannon.renderPart("Cog");
GL11.glPushMatrix();
for(int i = 0; i < 10; i++) {
ResourceManager.tesla_cannon.renderPart("Capacitor");
if(i < 4) {
GL11.glTranslated(0, -1.625, 0);
GL11.glRotated(-22.5, 0, 0, 1);
GL11.glTranslated(0, 1.625, 0);
} else {
GL11.glTranslated(0.5, 0, 0);
}
}
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
}
}

View File

@ -0,0 +1,38 @@
package com.hbm.tileentity.machine;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.world.World;
public class TileEntityMachineAmmoPress extends TileEntityMachineBase implements IGUIProvider {
public TileEntityMachineAmmoPress() {
super(10);
}
@Override
public String getName() {
return "container.machineAmmoPress";
}
@Override
public void updateEntity() {
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return null;
}
@Override
@SideOnly(Side.CLIENT)
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
return null;
}
}

View File

@ -37,6 +37,7 @@ public class Compat {
public static final String MOD_RC = "Railcraft";
public static final String MOD_TC = "tc";
public static final String MOD_EIDS = "endlessids";
public static final String MOD_ANG = "angelica";
public static Item tryLoadItem(String domain, String name) {
return (Item) Item.itemRegistry.getObject(getReg(domain, name));

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB