cryo cannon, bullet stuff

This commit is contained in:
Bob 2023-07-12 23:23:14 +02:00
parent 13c4cdc24d
commit 6bd552f3be
54 changed files with 8374 additions and 14464 deletions

View File

@ -1,10 +1,19 @@
## Added
* UAC pistol
* Uses the .45 caliber
* Cryo cannon
* Freezes entities
* Can only deal damage to already frozen entities
* Damage is proportional to max health, dealing more damage the stronger the mob is
## Changed
* Making LPG in the compressor now requires two compression steps
* This fixes an issue where polymer is unobtainable in 528 mode since petroleum at 1PU not being obtainable
* Fire and cryo damage now bypasses glyphid's armor, being unaffected by the armor's damage reduction and not being able to break off armor either
* Fire now deals 4x more damage to glyphids
* Cryogenic fluids from the chemthrower no longer deal direct damage, instead freezing the target
* Once the target is already frozen, it will deal damage and apply the same effects as it used to
## Fixed
* Fixed issue where mk5 explosions would behave weirdly in their origin chunk, often blowing through bedrock and thick layers of concrete
* Fixed saturnite rifle disappearing in third person when scoping

View File

@ -6,6 +6,7 @@ import java.util.List;
import com.hbm.entity.pathfinder.PathFinderUtils;
import com.hbm.items.ModItems;
import com.hbm.lib.ModDamageSource;
import com.hbm.main.ResourceManager;
import net.minecraft.entity.Entity;
@ -86,7 +87,7 @@ public class EntityGlyphid extends EntityMob {
@Override
public boolean attackEntityFrom(DamageSource source, float amount) {
if(!source.isDamageAbsolute() && !source.isUnblockable() && !worldObj.isRemote) {
if(!source.isDamageAbsolute() && !source.isUnblockable() && !worldObj.isRemote && !source.isFireDamage() && !source.getDamageType().equals(ModDamageSource.s_cryolator)) {
byte armor = this.dataWatcher.getWatchableObjectByte(17);
if(armor != 0) { //if at least one bit of armor is present
@ -106,6 +107,8 @@ public class EntityGlyphid extends EntityMob {
amount = this.calculateDamage(amount);
}
if(source.isFireDamage()) amount *= 4F;
return super.attackEntityFrom(source, amount);
}

View File

@ -0,0 +1,231 @@
package com.hbm.entity.projectile;
import java.util.ArrayList;
import java.util.List;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.interfaces.IBulletHitBehavior;
import com.hbm.interfaces.IBulletHurtBehavior;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.interfaces.IBulletRicochetBehavior;
import com.hbm.interfaces.IBulletUpdateBehavior;
import com.hbm.items.weapon.ItemGunBase;
import com.hbm.main.MainRegistry;
import com.hbm.util.Tuple.Pair;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public class EntityBulletBaseNT extends EntityThrowableInterp {
private BulletConfiguration config;
public float overrideDamage;
public double prevRenderX;
public double prevRenderY;
public double prevRenderZ;
public final List<Pair<Vec3, Double>> trailNodes = new ArrayList();
public BulletConfiguration getConfig() {
return config;
}
public EntityBulletBaseNT(World world) {
super(world);
this.renderDistanceWeight = 10.0D;
this.setSize(0.5F, 0.5F);
}
public EntityBulletBaseNT(World world, int config) {
super(world);
this.config = BulletConfigSyncingUtil.pullConfig(config);
this.dataWatcher.updateObject(18, config);
this.renderDistanceWeight = 10.0D;
if(this.config == null) {
this.setDead();
return;
}
this.dataWatcher.updateObject(16, (byte)this.config.style);
this.dataWatcher.updateObject(17, (byte)this.config.trail);
this.setSize(0.5F, 0.5F);
}
public EntityBulletBaseNT(World world, int config, EntityLivingBase entity) {
super(world);
this.config = BulletConfigSyncingUtil.pullConfig(config);
this.dataWatcher.updateObject(18, config);
thrower = entity;
ItemStack gun = entity.getHeldItem();
boolean offsetShot = true;
if(gun != null && gun.getItem() instanceof ItemGunBase) {
GunConfiguration cfg = ((ItemGunBase) gun.getItem()).mainConfig;
if(cfg != null && cfg.hasSights && entity.isSneaking()) {
offsetShot = false;
}
}
this.setLocationAndAngles(entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ, entity.rotationYaw, entity.rotationPitch);
if(offsetShot) {
double sideOffset = 0.16D;
this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * sideOffset;
this.posY -= 0.1D;
this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * sideOffset;
} else {
this.posY -= 0.1D;
}
this.setPosition(this.posX, this.posY, this.posZ);
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.renderDistanceWeight = 10.0D;
this.setSize(0.5F, 0.5F);
this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, 1.0F, this.config.spread * (offsetShot ? 1F : 0.25F));
this.dataWatcher.updateObject(16, (byte)this.config.style);
this.dataWatcher.updateObject(17, (byte)this.config.trail);
}
public EntityBulletBaseNT(World world, int config, EntityLivingBase entity, EntityLivingBase target, float motion, float deviation) {
super(world);
this.config = BulletConfigSyncingUtil.pullConfig(config);
this.dataWatcher.updateObject(18, config);
this.thrower = entity;
this.renderDistanceWeight = 10.0D;
this.setSize(0.5F, 0.5F);
this.posY = entity.posY + entity.getEyeHeight() - 0.10000000149011612D;
double d0 = target.posX - entity.posX;
double d1 = target.boundingBox.minY + target.height / 3.0F - this.posY;
double d2 = target.posZ - entity.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(entity.posX + d4, this.posY, entity.posZ + d5, f2, f3);
this.yOffset = 0.0F;
this.setThrowableHeading(d0, d1, d2, motion, deviation);
}
this.dataWatcher.updateObject(16, (byte)this.config.style);
this.dataWatcher.updateObject(17, (byte)this.config.trail);
}
@Override
public void onUpdate() {
if(config == null) config = BulletConfigSyncingUtil.pullConfig(dataWatcher.getWatchableObjectInt(18));
if(config == null){
this.setDead();
return;
}
if(worldObj.isRemote && config.style == config.STYLE_TAU) {
if(trailNodes.isEmpty()) {
this.ignoreFrustumCheck = true;
trailNodes.add(new Pair<Vec3, Double>(Vec3.createVectorHelper(-motionX * 2, -motionY * 2, -motionZ * 2), 0D));
} else {
trailNodes.add(new Pair<Vec3, Double>(Vec3.createVectorHelper(0, 0, 0), 1D));
}
}
if(worldObj.isRemote && this.config.blackPowder && this.ticksExisted == 1) {
for(int i = 0; i < 15; i++) {
double mod = rand.nextDouble();
this.worldObj.spawnParticle("smoke", this.posX, this.posY, this.posZ,
(this.motionX + rand.nextGaussian() * 0.05) * mod,
(this.motionY + rand.nextGaussian() * 0.05) * mod,
(this.motionZ + rand.nextGaussian() * 0.05) * mod);
}
double mod = 0.5;
this.worldObj.spawnParticle("flame", this.posX + this.motionX * mod, this.posY + this.motionY * mod, this.posZ + this.motionZ * mod, 0, 0, 0);
}
if(!worldObj.isRemote) {
if(config.maxAge == 0) {
if(this.config.bUpdate != null) this.config.bntUpdate.behaveUpdate(this);
this.setDead();
return;
}
if(this.config.bUpdate != null) this.config.bntUpdate.behaveUpdate(this);
}
super.onUpdate();
if(worldObj.isRemote && !config.vPFX.isEmpty()) {
Vec3 vec = Vec3.createVectorHelper(posX - prevPosX, posY - prevPosY, posZ - prevPosZ);
double motion = Math.max(vec.lengthVector(), 0.1);
vec = vec.normalize();
for(double d = 0; d < motion; d += 0.5) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString("type", "vanillaExt");
nbt.setString("mode", config.vPFX);
nbt.setDouble("posX", this.posX - vec.xCoord * d);
nbt.setDouble("posY", this.posY - vec.yCoord * d);
nbt.setDouble("posZ", this.posZ - vec.zCoord * d);
MainRegistry.proxy.effectNT(nbt);
}
}
}
@Override
protected void onImpact(MovingObjectPosition mop) {
if(mop.typeOfHit == mop.typeOfHit.BLOCK) {
}
}
@Override
public boolean doesPenetrate() {
return this.config.doesPenetrate;
}
@Override
public boolean isSpectral() {
return this.config.isSpectral;
}
public IBulletHurtBehavior bHurt;
public IBulletHitBehavior bHit;
public IBulletRicochetBehavior bRicochet;
public IBulletImpactBehavior bImpact;
public IBulletUpdateBehavior bUpdate;
public interface IBulletHurtBehaviorNT { public void behaveEntityHurt(EntityBulletBaseNT bullet, Entity hit); }
public interface IBulletHitBehaviorNT { public void behaveEntityHit(EntityBulletBaseNT bullet, Entity hit); }
public interface IBulletRicochetBehaviorNT { public void behaveBlockRicochet(EntityBulletBaseNT bullet, int x, int y, int z); }
public interface IBulletImpactBehaviorNT { public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z); }
public interface IBulletUpdateBehaviorNT { public void behaveUpdate(EntityBulletBaseNT bullet); }
}

View File

@ -185,9 +185,15 @@ public class EntityChemical extends EntityThrowableNT {
if(style == ChemicalStyle.LIQUID || style == ChemicalStyle.GAS) {
if(type.temperature < -20) {
if(living != null) { //only living things are affected
EntityDamageUtil.attackEntityFromIgnoreIFrame(e, getDamage(ModDamageSource.s_cryolator), 5F + (type.temperature + 20) * -0.05F); //5 damage at -20°C with one extra damage every -20°C
living.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 2));
living.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 100, 4));
HbmLivingProps.setTemperature(living, HbmLivingProps.getTemperature(living) + type.temperature / 20);
if(HbmLivingProps.isFrozen(living)) {
if(!EntityDamageUtil.attackEntityFromIgnoreIFrame(e, getDamage(ModDamageSource.s_cryolator), living.getMaxHealth() * -type.temperature / 273 * 0.01F))
e.attackEntityFrom(getDamage(ModDamageSource.s_cryolator), living.getMaxHealth() * -type.temperature / 273);
living.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 2));
living.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 100, 4));
}
}
}

View File

@ -156,7 +156,8 @@ public abstract class EntityThrowableNT extends Entity implements IProjectile {
Vec3 pos = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
Vec3 nextPos = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
MovingObjectPosition mop = this.worldObj.rayTraceBlocks(pos, nextPos);
MovingObjectPosition mop = null;
if(!this.isSpectral()) mop = this.worldObj.rayTraceBlocks(pos, nextPos);
pos = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
nextPos = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
@ -180,17 +181,25 @@ public abstract class EntityThrowableNT extends Entity implements IProjectile {
MovingObjectPosition hitMop = aabb.calculateIntercept(pos, nextPos);
if(hitMop != null) {
double dist = pos.distanceTo(hitMop.hitVec);
if(dist < nearest || nearest == 0.0D) {
hitEntity = entity;
nearest = dist;
// if penetration is enabled, run impact for all intersecting entities
if(this.doesPenetrate()) {
this.onImpact(hitMop);
} else {
double dist = pos.distanceTo(hitMop.hitVec);
if(dist < nearest || nearest == 0.0D) {
hitEntity = entity;
nearest = dist;
}
}
}
}
}
if(hitEntity != null) {
// if not, only run it for the closest MOP
if(!this.doesPenetrate() && hitEntity != null) {
mop = new MovingObjectPosition(hitEntity);
}
}
@ -249,8 +258,12 @@ public abstract class EntityThrowableNT extends Entity implements IProjectile {
}
}
public boolean alowMultiImpact() {
return false; //TODO
public boolean doesPenetrate() {
return false;
}
public boolean isSpectral() {
return false;
}
public void getStuck(int x, int y, int z) {

View File

@ -25,6 +25,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.IExtendedEntityProperties;
@ -46,6 +47,9 @@ public class HbmLivingProps implements IExtendedEntityProperties {
private int bombTimer;
private int contagion;
private int oil;
private int temperature;
private boolean frozen = false;
private boolean burning = false;
private List<ContaminationEffect> contamination = new ArrayList();
public HbmLivingProps(EntityLivingBase entity) {
@ -270,6 +274,24 @@ public class HbmLivingProps implements IExtendedEntityProperties {
public static void setOil(EntityLivingBase entity, int oil) {
getData(entity).oil = oil;
}
/// TEMPERATURE ///
public static int getTemperature(EntityLivingBase entity) {
return getData(entity).temperature;
}
public static void setTemperature(EntityLivingBase entity, int temperature) {
HbmLivingProps data = getData(entity);
temperature = MathHelper.clamp_int(temperature, -2500, 2500);
data.temperature = temperature;
if(temperature > 1000) data.burning = true;
if(temperature < 800) data.burning = false;
if(temperature < -1000) data.frozen = true;
if(temperature > -800) data.frozen = false;
}
public static boolean isFrozen(EntityLivingBase entity) { return getData(entity).frozen; };
public static boolean isBurning(EntityLivingBase entity) { return getData(entity).burning; };
@Override
public void init(Entity entity, World world) { }

View File

@ -3,6 +3,7 @@ package com.hbm.handler;
import java.util.List;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT.*;
import com.hbm.handler.guncfg.BulletConfigFactory;
import com.hbm.interfaces.IBulletHitBehavior;
import com.hbm.interfaces.IBulletHurtBehavior;
@ -92,6 +93,11 @@ public class BulletConfiguration implements Cloneable {
public IBulletRicochetBehavior bRicochet;
public IBulletImpactBehavior bImpact;
public IBulletUpdateBehavior bUpdate;
public IBulletHurtBehaviorNT bntHurt;
public IBulletHitBehaviorNT bntHit;
public IBulletRicochetBehaviorNT bntRicochet;
public IBulletImpactBehaviorNT bntImpact;
public IBulletUpdateBehaviorNT bntUpdate;
//appearance
public int style;

View File

@ -97,6 +97,7 @@ public class EntityEffectHandler {
handleLungDisease(entity);
handleOil(entity);
handlePollution(entity);
handleTemperature(entity);
handleDashing(entity);
handlePlinking(entity);
@ -444,7 +445,7 @@ public class EntityEffectHandler {
nbt.setInteger("count", 1);
nbt.setInteger("block", Block.getIdFromBlock(Blocks.coal_block));
nbt.setInteger("entity", entity.getEntityId());
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25));
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25));
}
}
}
@ -486,6 +487,43 @@ public class EntityEffectHandler {
}
}
private static void handleTemperature(Entity entity) {
if(!(entity instanceof EntityLivingBase)) return;
if(entity.worldObj.isRemote) return;
EntityLivingBase living = (EntityLivingBase) entity;
int temp = HbmLivingProps.getTemperature(living);
if(temp < 0) HbmLivingProps.setTemperature(living, temp + Math.min(-temp, 5));
if(temp > 0) HbmLivingProps.setTemperature(living, temp - Math.min(temp, 5));
if(HbmLivingProps.isFrozen(living)) {
living.motionX = 0;
living.motionZ = 0;
living.motionY = Math.min(living.motionY, 0);
if(entity.ticksExisted % 5 == 0) {
NBTTagCompound nbt0 = new NBTTagCompound();
nbt0.setString("type", "sweat");
nbt0.setInteger("count", 1);
nbt0.setInteger("block", Block.getIdFromBlock(Blocks.snow));
nbt0.setInteger("entity", entity.getEntityId());
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(nbt0, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25));
if(entity instanceof EntityPlayerMP) {
NBTTagCompound nbt1 = new NBTTagCompound();
nbt1.setString("type", "frozen");
PacketDispatcher.wrapper.sendTo(new AuxParticlePacketNT(nbt1, 0, 0, 0), (EntityPlayerMP) entity);
}
}
}
if(HbmLivingProps.isBurning(living)) {
living.setFire(1);
}
}
private static void handleDashing(Entity entity) {
//AAAAAAAAAAAAAAAAAAAAEEEEEEEEEEEEEEEEEEEE

View File

@ -1,15 +1,20 @@
package com.hbm.items.weapon;
import com.hbm.entity.projectile.EntityChemical;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.packet.GunAnimationPacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class ItemCryoCannon extends ItemGunBase {
@ -18,13 +23,96 @@ public class ItemCryoCannon extends ItemGunBase {
super(config);
}
@Override
protected void fire(ItemStack stack, World world, EntityPlayer player) {
if(this.getPressure(stack) >= 1000) return;
if(this.getTurbine(stack) < 100) return;
BulletConfiguration config = null;
if(mainConfig.reloadType == mainConfig.RELOAD_NONE) {
config = getBeltCfg(player, stack, true);
} else {
config = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack)));
}
int bullets = config.bulletsMin;
for(int k = 0; k < mainConfig.roundsPerCycle; k++) {
if(!hasAmmo(stack, player, true))
break;
if(config.bulletsMax > config.bulletsMin)
bullets += world.rand.nextInt(config.bulletsMax - config.bulletsMin);
for(int i = 0; i < bullets; i++) {
spawnProjectile(world, player, stack, BulletConfigSyncingUtil.getKey(config));
}
useUpAmmo(player, stack, true);
player.inventoryContainer.detectAndSendChanges();
int wear = (int) Math.ceil(config.wear / (1F + EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack)));
setItemWear(stack, getItemWear(stack) + wear);
}
world.playSoundAtEntity(player, mainConfig.firingSound, mainConfig.firingVolume, mainConfig.firingPitch);
if(mainConfig.ejector != null && !mainConfig.ejector.getAfterReload())
queueCasing(player, mainConfig.ejector, config, stack);
}
@Override
protected void spawnProjectile(World world, EntityPlayer player, ItemStack stack, int config) {
EntityChemical chem = new EntityChemical(world, player);
chem.setFluid(Fluids.OXYGEN);
world.spawnEntityInWorld(chem);
int pressure = this.getPressure(stack);
pressure += 5;
pressure = MathHelper.clamp_int(pressure, 0, 1000);
this.setPressure(stack, pressure);
if(player instanceof EntityPlayerMP) PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(AnimType.CYCLE.ordinal()), (EntityPlayerMP) player);
}
@Override
protected void updateServer(ItemStack stack, World world, EntityPlayer player, int slot, boolean isCurrentItem) {
int turbine = this.getTurbine(stack);
int pressure = this.getPressure(stack);
if(this.getIsMouseDown(stack)) {
turbine += 10;
} else {
turbine -= 5;
pressure -= 5;
}
turbine = MathHelper.clamp_int(turbine, 0, 100);
pressure = MathHelper.clamp_int(pressure, 0, 1000);
this.setTurbine(stack, turbine);
this.setPressure(stack, pressure);
super.updateServer(stack, world, player, slot, isCurrentItem);
}
public static void setTurbine(ItemStack stack, int i) {
writeNBT(stack, "turbine", i);
}
public static int getTurbine(ItemStack stack) {
return readNBT(stack, "turbine");
}
public static void setPressure(ItemStack stack, int i) {
writeNBT(stack, "pressure", i);
}
public static int getPressure(ItemStack stack) {
return readNBT(stack, "pressure");
}
}

View File

@ -1883,6 +1883,14 @@ public class ClientProxy extends ServerProxy {
ParticleFoundry sploosh = new ParticleFoundry(man, world, x, y, z, color, dir, length, base, offset);
Minecraft.getMinecraft().effectRenderer.addEffect(sploosh);
}
if("frozen".equals(type)) {
player.motionX = 0;
player.motionZ = 0;
player.motionY = Math.min(player.motionY, 0);
player.moveForward = 0;
player.moveStrafing = 0;
}
}
private HashMap<Integer, Long> vanished = new HashMap();

View File

@ -751,8 +751,8 @@ public class ResourceManager {
public static final IModelCustom tau = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/tau.obj"));
public static final IModelCustom benelli = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/benelli_new.obj")).asDisplayList();
public static final IModelCustom coilgun = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/coilgun.obj")).asDisplayList();
public static final IModelCustom cryocannon = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/cryo_cannon_alt.obj")).asDisplayList();
public static final IModelCustom uac_pistol = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/UAC pistol.obj")).asDisplayList(); //TODO: reduce this fat fuck
public static final IModelCustom cryocannon = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/cryo_cannon.obj")).asDisplayList();
public static final IModelCustom uac_pistol = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/UAC pistol.obj")).asDisplayList();
public static final IModelCustom lance = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/lance.obj"));

View File

@ -2,13 +2,28 @@ package com.hbm.render.item.weapon;
import org.lwjgl.opengl.GL11;
import com.hbm.items.weapon.ItemCryoCannon;
import com.hbm.items.weapon.ItemGunBase;
import com.hbm.lib.RefStrings;
import com.hbm.main.ResourceManager;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
public class ItemRenderWeaponCryoCannon implements IItemRenderer {
public static final ResourceLocation[] fill_tex = new ResourceLocation[15];
public static final ResourceLocation[] pressure_tex = new ResourceLocation[12];
public static final ResourceLocation[] turbine_tex = new ResourceLocation[9];
public ItemRenderWeaponCryoCannon() {
for(int i = 0; i < fill_tex.length; i++) fill_tex[i] = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/cryo_cannon/fill_" + i + ".png");
for(int i = 0; i < pressure_tex.length; i++) pressure_tex[i] = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/cryo_cannon/pressure_" + i + ".png");
for(int i = 0; i < turbine_tex.length; i++) turbine_tex[i] = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/cryo_cannon/turbine_" + i + ".png");
}
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
@ -35,6 +50,7 @@ public class ItemRenderWeaponCryoCannon implements IItemRenderer {
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glShadeModel(GL11.GL_SMOOTH);
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.cryocannon_tex);
@ -48,6 +64,17 @@ public class ItemRenderWeaponCryoCannon implements IItemRenderer {
GL11.glRotated(80, 0, 1, 0);
GL11.glScaled(s0, s0, s0);
ItemGunBase gun = (ItemGunBase) item.getItem();
ResourceManager.cryocannon.renderPart("Gun");
ResourceManager.cryocannon.renderPart("Rotor");
Minecraft.getMinecraft().renderEngine.bindTexture(fill_tex[MathHelper.clamp_int(ItemGunBase.getMag(item) * fill_tex.length / gun.mainConfig.ammoCap, 0, fill_tex.length - 1)]);
ResourceManager.cryocannon.renderPart("Fuel");
Minecraft.getMinecraft().renderEngine.bindTexture(turbine_tex[MathHelper.clamp_int(turbine_tex.length - 1 - ItemCryoCannon.getTurbine(item) * turbine_tex.length / 100, 0, turbine_tex.length - 1)]);
ResourceManager.cryocannon.renderPart("Spin");
Minecraft.getMinecraft().renderEngine.bindTexture(pressure_tex[MathHelper.clamp_int(ItemCryoCannon.getPressure(item) * pressure_tex.length / 1000, 0, pressure_tex.length - 1)]);
ResourceManager.cryocannon.renderPart("Pressure");
break;
case EQUIPPED:
@ -82,8 +109,8 @@ public class ItemRenderWeaponCryoCannon implements IItemRenderer {
default: break;
}
GL11.glShadeModel(GL11.GL_SMOOTH);
ResourceManager.cryocannon.renderAll();
if(type != ItemRenderType.EQUIPPED_FIRST_PERSON) ResourceManager.cryocannon.renderAll();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();

View File

@ -42,8 +42,6 @@ public class ItemRenderWeaponFFBolt implements IItemRenderer {
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
if(item.getItem() == ModItems.gun_bolt_action_saturnite && Minecraft.getMinecraft().thePlayer.isSneaking()) return;
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_CULL_FACE);
@ -55,6 +53,11 @@ public class ItemRenderWeaponFFBolt implements IItemRenderer {
case EQUIPPED_FIRST_PERSON:
if(item.getItem() == ModItems.gun_bolt_action_saturnite && Minecraft.getMinecraft().thePlayer.isSneaking()) {
GL11.glPopMatrix();
return;
}
double s0 = 0.5D;
GL11.glTranslated(0.5, 0.25, -0.2);
GL11.glScaled(s0, s0, s0);

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 B

After

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 B

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 B

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 B

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 B

After

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 B

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 B

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 B

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 B

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 225 B

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 B

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 B

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 225 B

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 B

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 B

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 B

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 B

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 235 B

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 B

After

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 B

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 B

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 B

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 B

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 B

After

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 B

After

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 B

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

After

Width:  |  Height:  |  Size: 214 B