mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-08-10 17:55:44 +00:00
yeah let's just start over entirely
This commit is contained in:
parent
1f36fd1a86
commit
ab1e78b2a7
@ -13,6 +13,7 @@
|
||||
* Updated light brick texture
|
||||
* The maximum character limit on RoR channels is now the same for all RoR devices, being 15
|
||||
* This does not include special RoR interactive devices that don't use GUI text fields like the RoR terminal or the AUTOCAL units
|
||||
* Pile output rods like the bred uranium and the plutonium rods can no longer be dismantled using the anvil, the PUREX is now mandatory
|
||||
|
||||
## Fixed
|
||||
* Fixed AUTOCAL's number comparison functions not working with variable substitution as advertised
|
||||
|
||||
@ -44,8 +44,6 @@ public class StackCache {
|
||||
}
|
||||
|
||||
cache.addMonitor(monitor);
|
||||
|
||||
System.out.println(monitor.toZeroStack() + " " + cache.monitors.size());
|
||||
}
|
||||
|
||||
public CacheSlot getSlotFromStack(ItemStack stack) {
|
||||
|
||||
@ -5,12 +5,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.bomb.BlockDetonatable;
|
||||
import com.hbm.entity.effect.EntityCloudFleijaRainbow;
|
||||
import com.hbm.entity.effect.EntityEMPBlast;
|
||||
import com.hbm.entity.logic.EntityNukeExplosionMK3;
|
||||
import com.hbm.entity.logic.EntityNukeExplosionMK5;
|
||||
import com.hbm.explosion.ExplosionLarge;
|
||||
import com.hbm.explosion.ExplosionNukeGeneric;
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.BlockMutatorFire;
|
||||
@ -25,7 +19,6 @@ import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
import com.hbm.util.ArmorUtil;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.Tuple.Pair;
|
||||
|
||||
@ -34,7 +27,6 @@ import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
@ -182,29 +174,6 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
return;
|
||||
}
|
||||
|
||||
if(worldObj.isRemote && config.style == BulletConfiguration.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) {
|
||||
@ -251,7 +220,7 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
boolean hRic = rand.nextInt(100) < config.HBRC;
|
||||
boolean doesRic = config.doesRicochet && hRic;
|
||||
|
||||
if(!config.isSpectral && !doesRic) {
|
||||
if(!doesRic) {
|
||||
this.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
|
||||
this.onBlockImpact(mop.blockX, mop.blockY, mop.blockZ, mop.sideHit);
|
||||
}
|
||||
@ -293,7 +262,6 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
worldObj.playSoundAtEntity(this, "hbm:weapon.gBounce", 1.0F, 1.0F);
|
||||
|
||||
this.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
|
||||
onRicochet(mop.blockX, mop.blockY, mop.blockZ);
|
||||
|
||||
//worldObj.setBlock((int) Math.floor(posX), (int) Math.floor(posY), (int) Math.floor(posZ), Blocks.dirt);
|
||||
|
||||
@ -304,10 +272,6 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
}
|
||||
}
|
||||
|
||||
/*this.posX += (mop.hitVec.xCoord - this.posX) * 0.6;
|
||||
this.posY += (mop.hitVec.yCoord - this.posY) * 0.6;
|
||||
this.posZ += (mop.hitVec.zCoord - this.posZ) * 0.6;*/
|
||||
|
||||
this.motionX *= config.bounceMod;
|
||||
this.motionY *= config.bounceMod;
|
||||
this.motionZ *= config.bounceMod;
|
||||
@ -380,7 +344,7 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
config.bntImpact.behaveBlockHit(this, bX, bY, bZ, sideHit);
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
if(!config.liveAfterImpact && !config.isSpectral && bY > -1 && !this.inGround) this.setDead();
|
||||
if(bY > -1 && !this.inGround) this.setDead();
|
||||
if(!config.doesPenetrate && bY == -1) this.setDead();
|
||||
}
|
||||
|
||||
@ -394,24 +358,6 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
if(worldObj.rand.nextInt(3) == 0 && worldObj.getBlock((int)posX, (int)posY, (int)posZ - 1) == Blocks.air) worldObj.setBlock((int)posX, (int)posY, (int)posZ - 1, Blocks.fire);
|
||||
}
|
||||
|
||||
if(config.emp > 0)
|
||||
ExplosionNukeGeneric.empBlast(this.worldObj, (int)(this.posX + 0.5D), (int)(this.posY + 0.5D), (int)(this.posZ + 0.5D), config.emp);
|
||||
|
||||
if(config.emp > 3) {
|
||||
if (!this.worldObj.isRemote) {
|
||||
|
||||
EntityEMPBlast cloud = new EntityEMPBlast(this.worldObj, config.emp);
|
||||
cloud.posX = this.posX;
|
||||
cloud.posY = this.posY + 0.5F;
|
||||
cloud.posZ = this.posZ;
|
||||
|
||||
this.worldObj.spawnEntityInWorld(cloud);
|
||||
}
|
||||
}
|
||||
|
||||
if(config.jolt > 0 && !worldObj.isRemote)
|
||||
ExplosionLarge.jolt(worldObj, posX, posY, posZ, config.jolt, 150, 0.25);
|
||||
|
||||
if(config.explosive > 0 && !worldObj.isRemote) {
|
||||
//worldObj.newExplosion(this.thrower, posX, posY, posZ, config.explosive, config.incendiary > 0, config.blockDamage);
|
||||
ExplosionVNT vnt = new ExplosionVNT(worldObj, posX, posY, posZ, config.explosive, this.thrower);
|
||||
@ -424,32 +370,6 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
vnt.explode();
|
||||
}
|
||||
|
||||
if(config.shrapnel > 0 && !worldObj.isRemote)
|
||||
ExplosionLarge.spawnShrapnels(worldObj, posX, posY, posZ, config.shrapnel);
|
||||
|
||||
if(config.rainbow > 0 && !worldObj.isRemote) {
|
||||
EntityNukeExplosionMK3 ex = EntityNukeExplosionMK3.statFacFleija(worldObj, posX, posY, posZ, config.rainbow);
|
||||
if(!ex.isDead) {
|
||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 100.0f, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
|
||||
worldObj.spawnEntityInWorld(ex);
|
||||
|
||||
EntityCloudFleijaRainbow cloud = new EntityCloudFleijaRainbow(this.worldObj, config.rainbow);
|
||||
cloud.posX = this.posX;
|
||||
cloud.posY = this.posY;
|
||||
cloud.posZ = this.posZ;
|
||||
this.worldObj.spawnEntityInWorld(cloud);
|
||||
}
|
||||
}
|
||||
|
||||
if(config.nuke > 0 && !worldObj.isRemote) {
|
||||
worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, config.nuke, posX, posY, posZ));
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "muke");
|
||||
if(MainRegistry.polaroidID == 11 || rand.nextInt(100) == 0) data.setBoolean("balefire", true);
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(dimension, posX, posY, posZ, 250));
|
||||
worldObj.playSoundEffect(posX, posY, posZ, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
|
||||
}
|
||||
|
||||
if(config.destroysBlocks && !worldObj.isRemote) {
|
||||
if(block.getBlockHardness(worldObj, bX, bY, bZ) <= 120)
|
||||
worldObj.func_147480_a(bX, bY, bZ, false);
|
||||
@ -463,30 +383,15 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
}
|
||||
}
|
||||
|
||||
//for when a bullet dies by hitting a block
|
||||
private void onRicochet(int bX, int bY, int bZ) {
|
||||
|
||||
if(config.bntRicochet != null)
|
||||
config.bntRicochet.behaveBlockRicochet(this, bX, bY, bZ);
|
||||
}
|
||||
|
||||
//for when a bullet dies by hitting an entity
|
||||
private void onEntityImpact(Entity e) {
|
||||
onEntityHurt(e);
|
||||
onBlockImpact(-1, -1, -1, -1);
|
||||
|
||||
if(config.bntHit != null)
|
||||
config.bntHit.behaveEntityHit(this, e);
|
||||
|
||||
//this.setDead();
|
||||
}
|
||||
|
||||
//for when a bullet hurts an entity, not necessarily dying
|
||||
private void onEntityHurt(Entity e) {
|
||||
|
||||
if(config.bntHurt != null)
|
||||
config.bntHurt.behaveEntityHurt(this, e);
|
||||
|
||||
if(config.incendiary > 0 && !worldObj.isRemote) {
|
||||
e.setFire(config.incendiary);
|
||||
}
|
||||
@ -501,19 +406,6 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
((EntityLivingBase)e).addPotionEffect(new PotionEffect(effect));
|
||||
}
|
||||
}
|
||||
|
||||
if(config.instakill && e instanceof EntityLivingBase && !worldObj.isRemote) {
|
||||
|
||||
if(!(e instanceof EntityPlayer && ((EntityPlayer)e).capabilities.isCreativeMode))
|
||||
((EntityLivingBase)e).setHealth(0.0F);
|
||||
}
|
||||
|
||||
if(config.caustic > 0 && e instanceof EntityPlayer){
|
||||
ArmorUtil.damageSuit((EntityPlayer)e, 0, config.caustic);
|
||||
ArmorUtil.damageSuit((EntityPlayer)e, 1, config.caustic);
|
||||
ArmorUtil.damageSuit((EntityPlayer)e, 2, config.caustic);
|
||||
ArmorUtil.damageSuit((EntityPlayer)e, 3, config.caustic);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -521,11 +413,6 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
return this.config.doesPenetrate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSpectral() {
|
||||
return this.config.isSpectral;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int selfDamageDelay() {
|
||||
return this.config.selfDamageDelay;
|
||||
|
||||
@ -4,32 +4,24 @@ import java.util.List;
|
||||
|
||||
import com.hbm.entity.projectile.EntityBulletBaseNT;
|
||||
import com.hbm.entity.projectile.EntityBulletBaseNT.*;
|
||||
import com.hbm.handler.guncfg.BulletConfigFactory;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.particle.SpentCasing;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EntityDamageSourceIndirect;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
@Deprecated
|
||||
public class BulletConfiguration implements Cloneable {
|
||||
|
||||
//what item this specific configuration consumes
|
||||
public ComparableStack ammo;
|
||||
//how many ammo units one item restores
|
||||
public int ammoCount = 1;
|
||||
//how fast the bullet is (in sanics per second, or sps)
|
||||
public float velocity;
|
||||
//spread of bullets in gaussian range
|
||||
public float spread;
|
||||
//weapon durability reduced (centered around 10)
|
||||
public int wear;
|
||||
//greatest amount of pellets created each shot
|
||||
public int bulletsMin;
|
||||
//least amount of pellets created each shot
|
||||
@ -60,39 +52,16 @@ public class BulletConfiguration implements Cloneable {
|
||||
|
||||
//whether or not the bullet should penetrate mobs
|
||||
public boolean doesPenetrate;
|
||||
//disables collisions with blocks entirely
|
||||
public boolean isSpectral;
|
||||
//whether or not the bullet should break glass
|
||||
public boolean doesBreakGlass;
|
||||
//bullets still call the impact function when hitting blocks but do not get destroyed
|
||||
public boolean liveAfterImpact;
|
||||
|
||||
//creates a "muzzle flash" and a ton of smoke with every projectile spawned
|
||||
public boolean blackPowder = false;
|
||||
|
||||
//bullet effects
|
||||
public List<PotionEffect> effects;
|
||||
public int incendiary;
|
||||
public int emp;
|
||||
public boolean blockDamage = true;
|
||||
public float explosive;
|
||||
public double jolt;
|
||||
public int rainbow;
|
||||
public int nuke;
|
||||
public int shrapnel;
|
||||
public int chlorine;
|
||||
public int leadChance;
|
||||
public int caustic;
|
||||
public boolean destroysBlocks;
|
||||
public boolean instakill;
|
||||
/*public IBulletHurtBehavior bHurt;
|
||||
public IBulletHitBehavior bHit;
|
||||
public IBulletRicochetBehavior bRicochet;
|
||||
public IBulletImpactBehavior bImpact;
|
||||
public IBulletUpdateBehavior bUpdate;*/
|
||||
public IBulletHurtBehaviorNT bntHurt;
|
||||
public IBulletHitBehaviorNT bntHit;
|
||||
public IBulletRicochetBehaviorNT bntRicochet;
|
||||
public IBulletImpactBehaviorNT bntImpact;
|
||||
public IBulletUpdateBehaviorNT bntUpdate;
|
||||
|
||||
@ -104,17 +73,6 @@ public class BulletConfiguration implements Cloneable {
|
||||
public int plink;
|
||||
//vanilla particle FX
|
||||
public String vPFX = "";
|
||||
public SpentCasing spentCasing;
|
||||
|
||||
//energy projectiles
|
||||
//power consumed per shot
|
||||
public int dischargePerShot;
|
||||
//unlocalised firing mode name
|
||||
public String modeName;
|
||||
//firing mode text colour
|
||||
public EnumChatFormatting chatColour = EnumChatFormatting.WHITE;
|
||||
//firing rate
|
||||
public int firingRate;
|
||||
|
||||
public String damageType = ModDamageSource.s_bullet;
|
||||
public boolean dmgProj = true;
|
||||
@ -122,23 +80,14 @@ public class BulletConfiguration implements Cloneable {
|
||||
public boolean dmgExplosion = false;
|
||||
public boolean dmgBypass = false;
|
||||
|
||||
public static final int STYLE_NONE = -1;
|
||||
public static final int STYLE_NORMAL = 0;
|
||||
public static final int STYLE_PISTOL = 1;
|
||||
public static final int STYLE_FLECHETTE = 2;
|
||||
public static final int STYLE_PELLET = 3;
|
||||
public static final int STYLE_BOLT = 4;
|
||||
public static final int STYLE_FOLLY = 5;
|
||||
public static final int STYLE_ROCKET = 6;
|
||||
public static final int STYLE_STINGER = 7;
|
||||
public static final int STYLE_GRENADE = 10;
|
||||
public static final int STYLE_BF = 11;
|
||||
public static final int STYLE_ORB = 12;
|
||||
public static final int STYLE_METEOR = 13;
|
||||
public static final int STYLE_APDS = 14;
|
||||
public static final int STYLE_BLADE = 15;
|
||||
public static final int STYLE_TAU = 17;
|
||||
public static final int STYLE_LEADBURSTER = 18;
|
||||
|
||||
public static final int PLINK_NONE = 0;
|
||||
public static final int PLINK_BULLET = 1;
|
||||
@ -149,10 +98,7 @@ public class BulletConfiguration implements Cloneable {
|
||||
public static final int BOLT_LACUNAE = 0;
|
||||
public static final int BOLT_NIGHTMARE = 1;
|
||||
public static final int BOLT_LASER = 2;
|
||||
public static final int BOLT_ZOMG = 3;
|
||||
public static final int BOLT_WORM = 4;
|
||||
public static final int BOLT_GLASS_CYAN = 5;
|
||||
public static final int BOLT_GLASS_BLUE = 6;
|
||||
|
||||
public BulletConfiguration setToBolt(int trail) {
|
||||
|
||||
@ -172,37 +118,6 @@ public class BulletConfiguration implements Cloneable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public BulletConfiguration getChlorophyte() {
|
||||
this.bntUpdate = BulletConfigFactory.getHomingBehavior(30, 180);
|
||||
this.bntHurt = BulletConfigFactory.getPenHomingBehavior();
|
||||
this.dmgMin *= 2F;
|
||||
this.dmgMax *= 2F;
|
||||
this.wear *= 0.5;
|
||||
this.velocity *= 0.3;
|
||||
this.doesRicochet = false;
|
||||
this.doesPenetrate = true;
|
||||
this.vPFX = "greendust";
|
||||
|
||||
if(this.spentCasing != null) {
|
||||
int[] colors = this.spentCasing.getColors();
|
||||
this.spentCasing = this.spentCasing.clone();
|
||||
|
||||
if(colors != null && colors.length > 0) {
|
||||
int[] colorClone = new int[colors.length];
|
||||
for(int i = 0; i < colors.length; i++) colorClone[i] = colors[i];
|
||||
colorClone[colorClone.length - 1] = 0x659750; // <- standard chlorophyte coloring in last place
|
||||
this.spentCasing.setColor(colorClone).register(this.spentCasing.getName() + "Cl");
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public BulletConfiguration setToHoming(ItemStack ammo) {
|
||||
this.ammo = new ComparableStack(ammo);
|
||||
return getChlorophyte();
|
||||
}
|
||||
|
||||
public BulletConfiguration accuracyMod(float mod) {
|
||||
|
||||
this.spread *= mod;
|
||||
|
||||
@ -23,7 +23,6 @@ public class BulletConfigFactory {
|
||||
|
||||
bullet.velocity = 5.0F;
|
||||
bullet.spread = defaultSpread;
|
||||
bullet.wear = 10;
|
||||
bullet.bulletsMin = 1;
|
||||
bullet.bulletsMax = 1;
|
||||
bullet.gravity = 0D;
|
||||
@ -49,7 +48,6 @@ public class BulletConfigFactory {
|
||||
|
||||
bullet.velocity = 2.0F;
|
||||
bullet.spread = defaultSpread;
|
||||
bullet.wear = 10;
|
||||
bullet.bulletsMin = 1;
|
||||
bullet.bulletsMax = 1;
|
||||
bullet.gravity = 0.005D;
|
||||
@ -75,7 +73,6 @@ public class BulletConfigFactory {
|
||||
|
||||
bullet.velocity = 2.0F;
|
||||
bullet.spread = defaultSpread;
|
||||
bullet.wear = 10;
|
||||
bullet.bulletsMin = 1;
|
||||
bullet.bulletsMax = 1;
|
||||
bullet.gravity = 0.035D;
|
||||
|
||||
@ -33,7 +33,6 @@ public class GunNPCFactory {
|
||||
bullet.ammo = new ComparableStack(ModItems.coin_maskman);
|
||||
bullet.velocity = 0.25F;
|
||||
bullet.spread = 0.000F;
|
||||
bullet.wear = 10;
|
||||
bullet.bulletsMin = 1;
|
||||
bullet.bulletsMax = 1;
|
||||
bullet.dmgMin = 100;
|
||||
@ -85,7 +84,6 @@ public class GunNPCFactory {
|
||||
bullet.spread = 0.0F;
|
||||
bullet.dmgMin = 15;
|
||||
bullet.dmgMax = 20;
|
||||
bullet.wear = 10;
|
||||
bullet.leadChance = 0;
|
||||
bullet.explosive = 0.5F;
|
||||
bullet.setToBolt(BulletConfiguration.BOLT_LACUNAE);
|
||||
@ -103,7 +101,6 @@ public class GunNPCFactory {
|
||||
bullet.spread = 0.0F;
|
||||
bullet.dmgMin = 5;
|
||||
bullet.dmgMax = 10;
|
||||
bullet.wear = 10;
|
||||
bullet.leadChance = 15;
|
||||
bullet.style = BulletConfiguration.STYLE_FLECHETTE;
|
||||
bullet.vPFX = "bluedust";
|
||||
@ -119,7 +116,6 @@ public class GunNPCFactory {
|
||||
bullet.spread = 0.0F;
|
||||
bullet.dmgMin = 15;
|
||||
bullet.dmgMax = 20;
|
||||
bullet.wear = 10;
|
||||
bullet.leadChance = 0;
|
||||
bullet.setToBolt(BulletConfiguration.BOLT_NIGHTMARE);
|
||||
bullet.vPFX = "reddust";
|
||||
|
||||
@ -77,6 +77,10 @@ public class ContainerPneumoStorageAccess extends Container implements ICustomPa
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
|
||||
public int getStackCount() {
|
||||
return itemCountForClient;
|
||||
}
|
||||
|
||||
public void updateListing(int startingIndex) { // DEMO
|
||||
if(this.access.cache == null || this.access.cache.hasExpired) return;
|
||||
StackCache cache = this.access.cache;
|
||||
|
||||
@ -0,0 +1,384 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.hbm.inventory.SlotNonRetarded;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.ContainerNBTCommsPacket;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageAccess;
|
||||
import com.hbm.util.EnumUtil;
|
||||
|
||||
import api.hbm.ntl.StackCache;
|
||||
import api.hbm.ntl.StackCache.CacheSlot;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
public class ContainerPneumoStorageAccessMK2 extends Container implements ICustomPayloadReceiver {
|
||||
|
||||
protected TileEntityPneumoStorageAccess access;
|
||||
protected InventoryPneumoStorageAccess inventory;
|
||||
|
||||
/** On the server, this is used to find changes in the system and then send them to the client. On the client, this is just to keep track of all items. */
|
||||
protected LinkedHashMap<Long, CacheSlotDummy> cachedEntries = new LinkedHashMap();
|
||||
/** Server to client queue, contains NBT tags that represents deltas yet to be sent to the client */
|
||||
public LinkedList<NBTTagCompound> s2cQueue = new LinkedList();
|
||||
|
||||
/** Used to temporarily store the previous CacheSlot contents to calculate deltas with (i.e. detect changes) */
|
||||
public static class CacheSlotDummy {
|
||||
|
||||
public final ItemStack displayStack;
|
||||
public long stacksize;
|
||||
public final int itemId;
|
||||
public final int meta;
|
||||
public final NBTTagCompound nbt;
|
||||
|
||||
public CacheSlotDummy(ItemStack displayStack, long stacksize) {
|
||||
this.displayStack = displayStack;
|
||||
this.stacksize = stacksize;
|
||||
this.itemId = Item.getIdFromItem(displayStack.getItem());
|
||||
this.meta = displayStack.getItemDamage();
|
||||
if(displayStack.hasTagCompound()) this.nbt = (NBTTagCompound) displayStack.stackTagCompound.copy();
|
||||
else this.nbt = null;
|
||||
}
|
||||
|
||||
public CacheSlotDummy(CacheSlot original) {
|
||||
this(original.displayStack.copy(), original.stacksize);
|
||||
}
|
||||
}
|
||||
|
||||
public static final int GRID_SIZE = 6 * 8;
|
||||
public static final int DELTAS_PER_MSG = 6 * 8;
|
||||
|
||||
public int listingStart = 0;
|
||||
|
||||
public int getStackCount() {
|
||||
return cachedEntries.size();
|
||||
}
|
||||
|
||||
/** Serverside, creates a new delta for a new item stack */
|
||||
public void pushNewItem(ItemStack zeroStack, long amount) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setByte("type", (byte) DeltaType.NEW_TYPE.ordinal());
|
||||
zeroStack.writeToNBT(data);
|
||||
data.setLong("amount", amount);
|
||||
s2cQueue.add(data);
|
||||
}
|
||||
|
||||
/** Serverside, creates a new delta for an amount update */
|
||||
public void updateCount(long hash, long amount) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setByte("type", (byte) DeltaType.COUNT_CHANGE.ordinal());
|
||||
data.setLong("hash", hash);
|
||||
data.setLong("amount", amount);
|
||||
s2cQueue.add(data);
|
||||
}
|
||||
|
||||
/** Serverside, bunches up deltas into NBTTagLists and sends them, 48 (DELTAS_PER_MSG) at a time */
|
||||
public void processDeltasAndSync(EntityPlayerMP playerMP) {
|
||||
if(s2cQueue.isEmpty()) return;
|
||||
|
||||
NBTTagList list = null;
|
||||
|
||||
while(!s2cQueue.isEmpty()) {
|
||||
if(list == null) list = new NBTTagList();
|
||||
list.appendTag(s2cQueue.removeFirst());
|
||||
if(list.tagCount() >= DELTAS_PER_MSG) { bonVoyage(list, playerMP); list = null; }
|
||||
}
|
||||
|
||||
if(list != null) bonVoyage(list, playerMP);
|
||||
}
|
||||
|
||||
/** Wraps the NBTTagList into a master compound tag and sends it to the client */
|
||||
public void bonVoyage(NBTTagList list, EntityPlayerMP playerMP) {
|
||||
NBTTagCompound masterTag = new NBTTagCompound();
|
||||
masterTag.setTag("list", list);
|
||||
PacketDispatcher.wrapper.sendTo(new ContainerNBTCommsPacket(playerMP.currentWindowId, masterTag), playerMP);
|
||||
}
|
||||
|
||||
/** Compares the original access stack cache with the one we have buffered to detect changes and pushes them to the s2c sending queue */
|
||||
public void checkAndSyncCache() {
|
||||
if(this.access.cache == null || this.access.cache.hasExpired) return;
|
||||
|
||||
for(Entry<Long, CacheSlot> entry : this.access.cache.cacheSlots.entrySet()) {
|
||||
|
||||
Long hash = entry.getKey();
|
||||
if(hash == StackCache.getNullIdentity()) continue;
|
||||
|
||||
CacheSlotDummy existingCache = this.cachedEntries.get(hash);
|
||||
CacheSlot properCache = entry.getValue();
|
||||
|
||||
// if the previous entries already contain this type, check for amount change
|
||||
if(existingCache != null) {
|
||||
if(existingCache.stacksize != properCache.stacksize) {
|
||||
this.updateCount(hash, properCache.stacksize);
|
||||
existingCache.stacksize = properCache.stacksize;
|
||||
}
|
||||
// if not, add that type to our index
|
||||
} else {
|
||||
existingCache = new CacheSlotDummy(properCache);
|
||||
existingCache.stacksize = properCache.stacksize;
|
||||
this.cachedEntries.put(hash, existingCache);
|
||||
this.pushNewItem(existingCache.displayStack, existingCache.stacksize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ContainerPneumoStorageAccessMK2(InventoryPlayer invPlayer, TileEntityPneumoStorageAccess access) {
|
||||
this.access = access;
|
||||
this.inventory = new InventoryPneumoStorageAccess(access);
|
||||
|
||||
for(int i = 0; i < 6; i++) for(int j = 0; j < 8; j++) {
|
||||
this.addSlotToContainer(new SlotPneumo(inventory, j + i * 8, 8 + j * 18, 17 + i * 18));
|
||||
}
|
||||
|
||||
for(int i = 0; i < 3; i++) for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new SlotNonRetarded(invPlayer, j + i * 9 + 9, 8 + j * 18, 169 + i * 18));
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new SlotNonRetarded(invPlayer, i, 8 + i * 18, 227));
|
||||
}
|
||||
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int index, int button, int mode, EntityPlayer player) {
|
||||
if(mode == 6) return null;
|
||||
|
||||
boolean leftClick = button == 0 && mode == 0;
|
||||
boolean rightClick = button == 1 && mode == 0;
|
||||
boolean shiftClick = button == 0 && mode == 1;
|
||||
|
||||
if(index >= 0 && index < GRID_SIZE) {
|
||||
|
||||
// TODO: in this new version, the server has no fucking idea what slot we are even clicking on
|
||||
|
||||
// shift clicking an item from the player inv to the storage
|
||||
} else if(index >= GRID_SIZE && index < this.inventorySlots.size()) {
|
||||
|
||||
Slot slot = this.getSlot(index);
|
||||
|
||||
if(shiftClick && slot.getHasStack()) {
|
||||
ItemStack stack = slot.getStack().copy();
|
||||
if(this.access.cache == null || this.access.cache.hasExpired) return null;
|
||||
StackCache cache = this.access.cache;
|
||||
int remainder = (int) cache.addItemsAndReturnQuantity(stack, stack.stackSize);
|
||||
slot.decrStackSize(stack.stackSize - remainder);
|
||||
if(remainder <= 0) slot.putStack(null);
|
||||
slot.onSlotChanged();
|
||||
detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
|
||||
return super.slotClick(index, button, mode, player);
|
||||
}
|
||||
|
||||
public long[] previousStackSizes = new long[GRID_SIZE];
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
|
||||
// skip the first 6*8 slots, i.e. all the ones visible in the access grid
|
||||
for(int i = GRID_SIZE; i < this.inventorySlots.size(); i++) {
|
||||
ItemStack stack0 = ((Slot) this.inventorySlots.get(i)).getStack();
|
||||
ItemStack stack1 = (ItemStack) this.inventoryItemStacks.get(i);
|
||||
|
||||
if(!ItemStack.areItemStacksEqual(stack1, stack0)) {
|
||||
stack1 = stack0 == null ? null : stack0.copy();
|
||||
this.inventoryItemStacks.set(i, stack1);
|
||||
|
||||
for(int j = 0; j < this.crafters.size(); ++j) {
|
||||
((ICrafting) this.crafters.get(j)).sendSlotContents(this, i, stack1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean isServer = !this.access.getWorldObj().isRemote;
|
||||
|
||||
if(isServer) {
|
||||
checkAndSyncCache();
|
||||
} else {
|
||||
rebuildClientIndex();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return access.getDistanceFrom(player.posX, player.posY, player.posZ) <= 15 * 15;
|
||||
}
|
||||
|
||||
public static enum DeltaType {
|
||||
NEW_TYPE,
|
||||
COUNT_CHANGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acceptData(Side side, int windowId, NBTTagCompound data) {
|
||||
if(windowId != this.windowId) return;
|
||||
|
||||
if(side == Side.CLIENT) {
|
||||
NBTTagList list = data.getTagList("list", 10);
|
||||
|
||||
for(int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound line = list.getCompoundTagAt(i);
|
||||
DeltaType type = EnumUtil.grabEnumSafely(DeltaType.class, line.getByte("type"));
|
||||
|
||||
if(type == DeltaType.NEW_TYPE) {
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(line);
|
||||
long amount = line.getLong("amount");
|
||||
long hash = StackCache.getStackIdentity(stack);
|
||||
CacheSlotDummy dummy = new CacheSlotDummy(stack, amount);
|
||||
this.cachedEntries.put(hash, dummy);
|
||||
|
||||
} else if(type == DeltaType.COUNT_CHANGE) {
|
||||
long hash = line.getLong("hash");
|
||||
CacheSlotDummy dummy = this.cachedEntries.get(hash);
|
||||
if(dummy != null) dummy.stacksize = line.getLong("amount");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int startingIndex;
|
||||
|
||||
public void rebuildClientIndex() {
|
||||
|
||||
List<CacheSlotDummy> cacheSlots = new ArrayList(this.cachedEntries.size());
|
||||
cacheSlots.addAll(this.cachedEntries.values());
|
||||
cacheSlots.removeIf(x -> { return x.stacksize <= 0; });
|
||||
Collections.sort(cacheSlots, SORT_BY_STACK_SIZE);
|
||||
int size = cacheSlots.size();
|
||||
|
||||
int offset = startingIndex * 8;
|
||||
|
||||
for(int i = 0; i < inventory.slots.length; i++) {
|
||||
int grabIndex = offset + i;
|
||||
if(grabIndex < size) {
|
||||
CacheSlotDummy cacheSlot = cacheSlots.get(grabIndex);
|
||||
if(cacheSlot.displayStack != null) {
|
||||
inventory.slots[i] = cacheSlot.displayStack.copy();
|
||||
} else {
|
||||
inventory.slots[i] = null;
|
||||
}
|
||||
} else {
|
||||
inventory.slots[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final Comparator<CacheSlotDummy> SORT_BY_STACK_SIZE = new Comparator<CacheSlotDummy>() {
|
||||
@Override
|
||||
public int compare(CacheSlotDummy o1, CacheSlotDummy o2) {
|
||||
if(o1.stacksize > o2.stacksize) return -1; if(o1.stacksize < o2.stacksize) return 1;
|
||||
if(o1.itemId < o2.itemId) return -1; if(o1.itemId > o2.itemId) return 1;
|
||||
if(o1.meta < o2.meta) return -1; if(o1.meta > o2.meta) return 1;
|
||||
if(o1.nbt == null && o2.nbt != null) return -1; if(o1.nbt != null && o2.nbt == null) return 1;
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
public static final Comparator<CacheSlotDummy> SORT_BY_ID = new Comparator<CacheSlotDummy>() {
|
||||
@Override
|
||||
public int compare(CacheSlotDummy o1, CacheSlotDummy o2) {
|
||||
if(o1.itemId < o2.itemId) return -1; if(o1.itemId > o2.itemId) return 1;
|
||||
if(o1.meta < o2.meta) return -1; if(o1.meta > o2.meta) return 1;
|
||||
if(o1.stacksize > o2.stacksize) return -1; if(o1.stacksize < o2.stacksize) return 1;
|
||||
if(o1.nbt == null && o2.nbt != null) return -1; if(o1.nbt != null && o2.nbt == null) return 1;
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
public static final Comparator<CacheSlotDummy> SORT_BY_INTERNAL = new Comparator<CacheSlotDummy>() {
|
||||
@Override
|
||||
public int compare(CacheSlotDummy o1, CacheSlotDummy o2) {
|
||||
String name1 = o1.displayStack.getItem().getUnlocalizedName(o1.displayStack);
|
||||
String name2 = o2.displayStack.getItem().getUnlocalizedName(o2.displayStack);
|
||||
int compare = name1.compareToIgnoreCase(name2);
|
||||
if(compare != 0) return compare;
|
||||
return SORT_BY_ID.compare(o1, o2);
|
||||
}
|
||||
};
|
||||
|
||||
public static final Comparator<CacheSlotDummy> SORT_BY_LOCALIZED = new Comparator<CacheSlotDummy>() {
|
||||
@Override
|
||||
public int compare(CacheSlotDummy o1, CacheSlotDummy o2) {
|
||||
String name1 = o1.displayStack.getItem().getItemStackDisplayName(o1.displayStack);
|
||||
String name2 = o2.displayStack.getItem().getItemStackDisplayName(o2.displayStack);
|
||||
int compare = name1.compareToIgnoreCase(name2);
|
||||
if(compare != 0) return compare;
|
||||
return SORT_BY_ID.compare(o1, o2);
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class SlotPneumo extends SlotNonRetarded {
|
||||
|
||||
public long amount;
|
||||
|
||||
public SlotPneumo(IInventory inventory, int id, int x, int y) {
|
||||
super(inventory, id, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/** This inventory instance only exists to prepare the contents of a StackCache in such a way that we can use it in a container. */
|
||||
public static class InventoryPneumoStorageAccess implements IInventory {
|
||||
|
||||
public StackCache cache;
|
||||
public ItemStack[] slots;
|
||||
|
||||
public InventoryPneumoStorageAccess(TileEntityPneumoStorageAccess access) {
|
||||
this.slots = new ItemStack[getSizeInventory()];
|
||||
this.cache = access.cache;
|
||||
}
|
||||
|
||||
@Override public int getSizeInventory() { return GRID_SIZE; }
|
||||
@Override public ItemStack getStackInSlot(int slot) { return slots[slot]; }
|
||||
@Override public int getInventoryStackLimit() { return 1; }
|
||||
@Override public ItemStack decrStackSize(int slot, int amount) { return null; }
|
||||
@Override public void setInventorySlotContents(int slot, ItemStack stack) { this.slots[slot] = stack; }
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
if(slots[slot] != null) {
|
||||
ItemStack stack = slots[slot];
|
||||
slots[slot] = null;
|
||||
return stack;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public String getInventoryName() { return "null"; }
|
||||
@Override public boolean hasCustomInventoryName() { return false; }
|
||||
@Override public boolean isItemValidForSlot(int slot, ItemStack stack) { return false; }
|
||||
@Override public void markDirty() { }
|
||||
@Override public boolean isUseableByPlayer(EntityPlayer player) { return true; }
|
||||
@Override public void openInventory() { }
|
||||
@Override public void closeInventory() { }
|
||||
}
|
||||
}
|
||||
@ -7,8 +7,8 @@ import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import static com.hbm.inventory.gui.element.GUIElements.*;
|
||||
import com.hbm.inventory.container.ContainerPneumoStorageAccess;
|
||||
import com.hbm.inventory.container.ContainerPneumoStorageAccess.SlotPneumo;
|
||||
import com.hbm.inventory.container.ContainerPneumoStorageAccessMK2;
|
||||
import com.hbm.inventory.container.ContainerPneumoStorageAccessMK2.SlotPneumo;
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
@ -40,7 +40,7 @@ public class GUIPneumoStorageAccess extends GuiInfoContainer {
|
||||
protected boolean draggingScroll = false;
|
||||
|
||||
public GUIPneumoStorageAccess(InventoryPlayer invPlayer, TileEntityPneumoStorageAccess access) {
|
||||
super(new ContainerPneumoStorageAccess(invPlayer, access));
|
||||
super(new ContainerPneumoStorageAccessMK2(invPlayer, access));
|
||||
this.access = access;
|
||||
|
||||
this.xSize = 176;
|
||||
@ -63,8 +63,8 @@ public class GUIPneumoStorageAccess extends GuiInfoContainer {
|
||||
@Override
|
||||
public void drawScreen(int x, int y, float interp) {
|
||||
|
||||
ContainerPneumoStorageAccess container = (ContainerPneumoStorageAccess) this.inventorySlots;
|
||||
this.scrollBounds = (int) Math.ceil(container.itemCountForClient / 8D - 6D);
|
||||
ContainerPneumoStorageAccessMK2 container = (ContainerPneumoStorageAccessMK2) this.inventorySlots;
|
||||
this.scrollBounds = (int) Math.ceil(container.getStackCount() / 8D - 6D);
|
||||
if(this.scrollBounds < 1) this.scrollBounds = 1;
|
||||
if(this.scrollIndex < 0) this.setScroll(0);
|
||||
if(this.scrollIndex > scrollBounds) this.setScroll(scrollBounds);
|
||||
@ -154,7 +154,7 @@ public class GUIPneumoStorageAccess extends GuiInfoContainer {
|
||||
}
|
||||
|
||||
public int getScrollBarYPos() {
|
||||
ContainerPneumoStorageAccess container = (ContainerPneumoStorageAccess) this.inventorySlots;
|
||||
ContainerPneumoStorageAccessMK2 container = (ContainerPneumoStorageAccessMK2) this.inventorySlots;
|
||||
int scrollArea = 106 - 15; // bar height minus the scroll knob's height
|
||||
double scrollProgress = (double) container.listingStart / (double) scrollBounds;
|
||||
int scrollYPos = 17 + (int) (scrollProgress * scrollArea);
|
||||
@ -172,7 +172,7 @@ public class GUIPneumoStorageAccess extends GuiInfoContainer {
|
||||
}
|
||||
|
||||
public void refreshContainer() {
|
||||
this.mc.playerController.windowClick(this.inventorySlots.windowId, ContainerPneumoStorageAccess.SLOT_CLICK_ID_REFRESH, 0, this.scrollIndex, this.mc.thePlayer);
|
||||
//this.mc.playerController.windowClick(this.inventorySlots.windowId, ContainerPneumoStorageAccessMK2.SLOT_CLICK_ID_REFRESH, 0, this.scrollIndex, this.mc.thePlayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -967,19 +967,6 @@ public class AnvilRecipes extends SerializableRecipe {
|
||||
new AnvilOutput(new ItemStack(ModItems.circuit, 1, EnumCircuitType.BASIC.ordinal())),
|
||||
new AnvilOutput(new ItemStack(ModItems.circuit, 1, EnumCircuitType.BASIC.ordinal()), 0.5F),
|
||||
}).setTier(4));
|
||||
constructionRecipes.add(new AnvilConstructionRecipe(
|
||||
new ComparableStack(ModItems.pile_rod_plutonium), new AnvilOutput[] {
|
||||
new AnvilOutput(new ItemStack(ModItems.billet_pu_mix, 2)),
|
||||
new AnvilOutput(new ItemStack(ModItems.billet_uranium, 1)),
|
||||
new AnvilOutput(new ItemStack(ModItems.plate_iron, 2))
|
||||
}).setTier(2));
|
||||
constructionRecipes.add(new AnvilConstructionRecipe(
|
||||
new ComparableStack(ModItems.pile_rod_pu239), new AnvilOutput[] {
|
||||
new AnvilOutput(new ItemStack(ModItems.billet_pu239, 1)), //Might need to be cut to 3 nuggets, but a full billet is nice and round
|
||||
new AnvilOutput(new ItemStack(ModItems.billet_pu_mix, 1)),
|
||||
new AnvilOutput(new ItemStack(ModItems.billet_uranium, 1)),
|
||||
new AnvilOutput(new ItemStack(ModItems.plate_iron, 2))
|
||||
}).setTier(2));
|
||||
|
||||
} else {
|
||||
constructionRecipes.add(new AnvilConstructionRecipe(
|
||||
|
||||
@ -3,17 +3,12 @@ package com.hbm.render.entity.projectile;
|
||||
import java.util.Random;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import com.hbm.entity.projectile.EntityBulletBaseNT;
|
||||
import com.hbm.entity.projectile.IBulletBase;
|
||||
import com.hbm.handler.BulletConfiguration;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.model.ModelBullet;
|
||||
import com.hbm.render.util.RenderSparks;
|
||||
import com.hbm.util.Tuple.Pair;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
@ -22,20 +17,12 @@ import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
@Deprecated
|
||||
@Deprecated // the entire old bullet system should finally fucking die i hate it
|
||||
public class RenderBullet extends Render {
|
||||
|
||||
private ModelBullet bullet;
|
||||
|
||||
public RenderBullet() {
|
||||
bullet = new ModelBullet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(Entity bullet, double x, double y, double z, float f0, float f1) {
|
||||
|
||||
@ -54,21 +41,14 @@ public class RenderBullet extends Render {
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
|
||||
switch(style) {
|
||||
case BulletConfiguration.STYLE_NONE: break;
|
||||
case BulletConfiguration.STYLE_NORMAL: renderBullet(trail); break;
|
||||
case BulletConfiguration.STYLE_PISTOL: renderPistol(trail); break;
|
||||
case BulletConfiguration.STYLE_BOLT: renderDart(trail, bullet.getEntityId()); break;
|
||||
case BulletConfiguration.STYLE_FLECHETTE: renderFlechette(); break;
|
||||
case BulletConfiguration.STYLE_FOLLY: renderBullet(trail); break;
|
||||
case BulletConfiguration.STYLE_PELLET: renderBuckshot(); break;
|
||||
case BulletConfiguration.STYLE_ROCKET: renderRocket(trail); break;
|
||||
case BulletConfiguration.STYLE_GRENADE: renderGrenade(trail); break;
|
||||
case BulletConfiguration.STYLE_ORB: renderOrb(trail); break;
|
||||
case BulletConfiguration.STYLE_METEOR: renderMeteor(trail); break;
|
||||
case BulletConfiguration.STYLE_APDS: renderAPDS(); break;
|
||||
case BulletConfiguration.STYLE_BLADE: renderBlade(); break;
|
||||
case BulletConfiguration.STYLE_TAU: renderTau(bullet, trail, f1); break;
|
||||
case BulletConfiguration.STYLE_LEADBURSTER: renderLeadburster(bullet, f1); break;
|
||||
default: renderBullet(trail); break;
|
||||
}
|
||||
|
||||
@ -78,48 +58,13 @@ public class RenderBullet extends Render {
|
||||
|
||||
private void renderBullet(int type) {
|
||||
|
||||
if (type == 2) {
|
||||
bindTexture(new ResourceLocation(RefStrings.MODID + ":textures/models/emplacer.png"));
|
||||
bullet.renderAll(0.0625F);
|
||||
} else if (type == 1) {
|
||||
bindTexture(new ResourceLocation(RefStrings.MODID + ":textures/models/tau.png"));
|
||||
bullet.renderAll(0.0625F);
|
||||
} else if (type == 0) {
|
||||
|
||||
GL11.glScaled(0.5, 0.5, 0.5);
|
||||
GL11.glRotated(90, 0, 0, 1);
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.bullet_rifle_tex);
|
||||
ResourceManager.projectiles.renderPart("BulletRifle");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void renderPistol(int type) {
|
||||
|
||||
GL11.glScaled(0.5, 0.5, 0.5);
|
||||
GL11.glRotated(90, 0, 0, 1);
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.bullet_pistol_tex);
|
||||
ResourceManager.projectiles.renderPart("BulletPistol");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
|
||||
}
|
||||
|
||||
private void renderBuckshot() {
|
||||
|
||||
GL11.glScaled(0.5, 0.5, 0.5);
|
||||
GL11.glRotated(90, 0, 0, 1);
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.buckshot_tex);
|
||||
ResourceManager.projectiles.renderPart("Buckshot");
|
||||
bindTexture(ResourceManager.bullet_rifle_tex);
|
||||
ResourceManager.projectiles.renderPart("BulletRifle");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}
|
||||
|
||||
@ -216,18 +161,6 @@ public class RenderBullet extends Render {
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}
|
||||
|
||||
private void renderAPDS() {
|
||||
|
||||
GL11.glScaled(2, 2, 2);
|
||||
GL11.glRotated(90, 0, 0, 1);
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.flechette_tex);
|
||||
ResourceManager.projectiles.renderPart("Flechette");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}
|
||||
|
||||
private void renderDart(int style, int eID) {
|
||||
|
||||
float red = 1F;
|
||||
@ -239,15 +172,6 @@ public class RenderBullet extends Render {
|
||||
case BulletConfiguration.BOLT_NIGHTMARE: red = 1F; green = 1F; blue = 0F; break;
|
||||
case BulletConfiguration.BOLT_LACUNAE: red = 0.25F; green = 0F; blue = 0.75F; break;
|
||||
case BulletConfiguration.BOLT_WORM: red = 0F; green = 1F; blue = 0F; break;
|
||||
case BulletConfiguration.BOLT_GLASS_CYAN: red = 0F; green = 1F; blue = 1F; break;
|
||||
case BulletConfiguration.BOLT_GLASS_BLUE: red = 0F; green = 0F; blue = 1F; break;
|
||||
|
||||
case BulletConfiguration.BOLT_ZOMG:
|
||||
Random rand = new Random(eID * eID);
|
||||
red = rand.nextInt(2) * 0.6F;
|
||||
green = rand.nextInt(2) * 0.6F;
|
||||
blue = rand.nextInt(2) * 0.6F;
|
||||
break;
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
@ -397,134 +321,8 @@ public class RenderBullet extends Render {
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void renderTau(Entity bullet, int trail, float interp) {
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
float scale = 0.125F;
|
||||
|
||||
double pX = bullet.prevPosX + (bullet.posX - bullet.prevPosX) * interp;
|
||||
double pY = bullet.prevPosY + (bullet.posY - bullet.prevPosY) * interp;
|
||||
double pZ = bullet.prevPosZ + (bullet.posZ - bullet.prevPosZ) * interp;
|
||||
|
||||
IBulletBase iface = (IBulletBase) bullet;
|
||||
|
||||
if(iface.prevY() == 0) {
|
||||
iface.prevX(pX);
|
||||
iface.prevY(pY);
|
||||
iface.prevZ(pZ);
|
||||
}
|
||||
|
||||
double deltaX = iface.prevX() - pX;
|
||||
double deltaY = iface.prevY() - pY;
|
||||
double deltaZ = iface.prevZ() - pZ;
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
double dX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)interp;
|
||||
double dY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)interp;
|
||||
double dZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)interp;
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(pX - dX, pY - dY, pZ - dZ);
|
||||
|
||||
float r = 1F;
|
||||
float g = 0.5F;
|
||||
float b = 0F;
|
||||
|
||||
if(trail == 1) {
|
||||
r = 1;
|
||||
g = 1;
|
||||
b = 1;
|
||||
}
|
||||
|
||||
for(Pair<Vec3, Double> pair : iface.nodes()) {
|
||||
Vec3 pos = pair.getKey();
|
||||
|
||||
double mult = 1D;
|
||||
pos.xCoord += deltaX * mult;
|
||||
pos.yCoord += deltaY * mult;
|
||||
pos.zCoord += deltaZ * mult;
|
||||
}
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0F, 1F, 0F);
|
||||
|
||||
for(int i = 0; i < iface.nodes().size() - 1; i++) {
|
||||
final Pair<Vec3, Double> node = iface.nodes().get(i), past = iface.nodes().get(i + 1);
|
||||
final Vec3 nodeLoc = node.getKey(), pastLoc = past.getKey();
|
||||
float nodeAlpha = node.getValue().floatValue();
|
||||
float pastAlpha = past.getValue().floatValue();
|
||||
|
||||
double timeAlpha = Math.max(2D - bullet.ticksExisted * 0.2, 0D);
|
||||
nodeAlpha *= timeAlpha;
|
||||
pastAlpha *= timeAlpha;
|
||||
float outerAlpha = 0.25F;
|
||||
|
||||
if(nodeAlpha == 0 && pastAlpha == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
tessellator.setNormal(0F, 1F, 0F);
|
||||
tessellator.setColorRGBA_F(r, g, b, nodeAlpha);
|
||||
tessellator.addVertex(nodeLoc.xCoord, nodeLoc.yCoord, nodeLoc.zCoord);
|
||||
tessellator.setColorRGBA_F(r, g, b, nodeAlpha * outerAlpha);
|
||||
tessellator.addVertex(nodeLoc.xCoord, nodeLoc.yCoord + scale, nodeLoc.zCoord);
|
||||
tessellator.setColorRGBA_F(r, g, b, pastAlpha * outerAlpha);
|
||||
tessellator.addVertex(pastLoc.xCoord, pastLoc.yCoord + scale, pastLoc.zCoord);
|
||||
tessellator.setColorRGBA_F(r, g, b, pastAlpha);
|
||||
tessellator.addVertex(pastLoc.xCoord, pastLoc.yCoord, pastLoc.zCoord);
|
||||
|
||||
tessellator.setColorRGBA_F(r, g, b, nodeAlpha);
|
||||
tessellator.addVertex(nodeLoc.xCoord, nodeLoc.yCoord, nodeLoc.zCoord);
|
||||
tessellator.setColorRGBA_F(r, g, b, nodeAlpha * outerAlpha);
|
||||
tessellator.addVertex(nodeLoc.xCoord, nodeLoc.yCoord - scale, nodeLoc.zCoord);
|
||||
tessellator.setColorRGBA_F(r, g, b, pastAlpha * outerAlpha);
|
||||
tessellator.addVertex(pastLoc.xCoord, pastLoc.yCoord - scale, pastLoc.zCoord);
|
||||
tessellator.setColorRGBA_F(r, g, b, pastAlpha);
|
||||
tessellator.addVertex(pastLoc.xCoord, pastLoc.yCoord, pastLoc.zCoord);
|
||||
}
|
||||
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
tessellator.draw();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.1F);
|
||||
|
||||
iface.prevX(pX);
|
||||
iface.prevY(pY);
|
||||
iface.prevZ(pZ);
|
||||
}
|
||||
|
||||
private void renderLeadburster(Entity bullet, float interp) {
|
||||
EntityBulletBaseNT bulletnt = (EntityBulletBaseNT) bullet;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glRotated(90, 0, 0, -1);
|
||||
double scale = 0.05;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
bindTexture(ResourceManager.leadburster_tex);
|
||||
ResourceManager.leadburster.renderPart("Based");
|
||||
if(bulletnt.getStuckIn() != -1) {
|
||||
GL11.glRotated((bullet.ticksExisted + interp) * -18, 0, 1, 0);
|
||||
}
|
||||
ResourceManager.leadburster.renderPart("Based.001");
|
||||
ResourceManager.leadburster.renderPart("Backlight");
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
|
||||
return new ResourceLocation(RefStrings.MODID + ":textures/models/bullet.png");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package com.hbm.tileentity.network.pneumatic;
|
||||
|
||||
import com.hbm.inventory.container.ContainerPneumoStorageAccess;
|
||||
import com.hbm.inventory.container.ContainerPneumoStorageAccessMK2;
|
||||
import com.hbm.inventory.gui.GUIPneumoStorageAccess;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
@ -75,6 +75,6 @@ public class TileEntityPneumoStorageAccess extends TileEntityLoadedBase implemen
|
||||
return dir == selfdir.getOpposite();
|
||||
}
|
||||
|
||||
@Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerPneumoStorageAccess(player.inventory, this); }
|
||||
@Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerPneumoStorageAccessMK2(player.inventory, this); }
|
||||
@Override public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIPneumoStorageAccess(player.inventory, this); }
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user