mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
patched up smelly turret
This commit is contained in:
parent
59ccb1ebc2
commit
62d755432e
@ -250,6 +250,7 @@ public class EntityBulletBase extends Entity implements IProjectile {
|
||||
|
||||
if (victim != null) {
|
||||
movement = new MovingObjectPosition(victim);
|
||||
movement.hitVec.yCoord += victim.height * 0.5D;
|
||||
}
|
||||
|
||||
/// ZONE 2 END ///
|
||||
@ -264,10 +265,12 @@ public class EntityBulletBase extends Entity implements IProjectile {
|
||||
DamageSource damagesource = this.config.getDamage(this, shooter);
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
if(!config.doesPenetrate)
|
||||
if(!config.doesPenetrate) {
|
||||
this.setPosition(movement.hitVec.xCoord, movement.hitVec.yCoord, movement.hitVec.zCoord);
|
||||
onEntityImpact(victim);
|
||||
else
|
||||
} else {
|
||||
onEntityHurt(victim);
|
||||
}
|
||||
}
|
||||
|
||||
float damage = rand.nextFloat() * (config.dmgMax - config.dmgMin) + config.dmgMin;
|
||||
@ -292,8 +295,10 @@ public class EntityBulletBase extends Entity implements IProjectile {
|
||||
boolean hRic = rand.nextInt(100) < config.HBRC;
|
||||
boolean doesRic = config.doesRicochet || hRic;
|
||||
|
||||
if(!config.isSpectral && !doesRic)
|
||||
if(!config.isSpectral && !doesRic) {
|
||||
this.setPosition(movement.hitVec.xCoord, movement.hitVec.yCoord, movement.hitVec.zCoord);
|
||||
this.onBlockImpact(movement.blockX, movement.blockY, movement.blockZ);
|
||||
}
|
||||
|
||||
if(doesRic) {
|
||||
|
||||
@ -342,10 +347,12 @@ public class EntityBulletBase extends Entity implements IProjectile {
|
||||
|
||||
onRicochet(movement.blockX, movement.blockY, movement.blockZ);
|
||||
|
||||
} else {
|
||||
if(!worldObj.isRemote)
|
||||
onBlockImpact(movement.blockX, movement.blockY, movement.blockZ);
|
||||
}
|
||||
} else {
|
||||
if(!worldObj.isRemote) {
|
||||
this.setPosition(movement.hitVec.xCoord, movement.hitVec.yCoord, movement.hitVec.zCoord);
|
||||
onBlockImpact(movement.blockX, movement.blockY, movement.blockZ);
|
||||
}
|
||||
}
|
||||
|
||||
this.posX += (movement.hitVec.xCoord - this.posX) * 0.6;
|
||||
this.posY += (movement.hitVec.yCoord - this.posY) * 0.6;
|
||||
|
||||
@ -904,6 +904,22 @@ public class ItemRenderLibrary {
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}});
|
||||
|
||||
renderers.put(Item.getItemFromBlock(ModBlocks.turret_howard_damaged), new ItemRenderBase() {
|
||||
public void renderInventory() {
|
||||
GL11.glTranslated(0, -4.5, 0);
|
||||
GL11.glScaled(4, 4, 4);
|
||||
}
|
||||
public void renderCommon() {
|
||||
GL11.glTranslated(-0.75, 0, 0);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.turret_base_rusted); ResourceManager.turret_chekhov.renderPart("Base");
|
||||
bindTexture(ResourceManager.turret_carriage_ciws_rusted); ResourceManager.turret_howard.renderPart("Carriage");
|
||||
bindTexture(ResourceManager.turret_howard_rusted); ResourceManager.turret_howard_damaged.renderPart("Body");
|
||||
bindTexture(ResourceManager.turret_howard_barrels_rusted); ResourceManager.turret_howard_damaged.renderPart("BarrelsTop");
|
||||
bindTexture(ResourceManager.turret_howard_barrels_rusted); ResourceManager.turret_howard_damaged.renderPart("BarrelsBottom");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}});
|
||||
|
||||
renderers.put(Item.getItemFromBlock(ModBlocks.machine_silex), new ItemRenderBase() {
|
||||
public void renderInventory() {
|
||||
GL11.glTranslated(0, -2.5, 0);
|
||||
|
||||
@ -21,6 +21,7 @@ import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.INpc;
|
||||
import net.minecraft.entity.boss.EntityDragon;
|
||||
import net.minecraft.entity.boss.EntityDragonPart;
|
||||
@ -31,6 +32,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Vec3;
|
||||
@ -495,12 +497,15 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
|
||||
if(e.isDead || !e.isEntityAlive())
|
||||
return false;
|
||||
|
||||
if(!hasThermalVision() && e instanceof EntityLivingBase && ((EntityLivingBase)e).isPotionActive(Potion.invisibility))
|
||||
return false;
|
||||
|
||||
Vec3 pos = this.getTurretPos();
|
||||
Vec3 ent = this.getEntityPos(e);
|
||||
Vec3 delta = Vec3.createVectorHelper(ent.xCoord - pos.xCoord, ent.yCoord - pos.yCoord, ent.zCoord - pos.zCoord);
|
||||
double length = delta.lengthVector();
|
||||
|
||||
if(length < this.getDecetorGrace())
|
||||
if(length < this.getDecetorGrace() || length > this.getDecetorRange() * 1.1) //the latter statement is only relevant for entities that have already been detected
|
||||
return false;
|
||||
|
||||
delta = delta.normalize();
|
||||
@ -511,18 +516,6 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
|
||||
if(pitchDeg < -this.getTurretDepression() || pitchDeg > this.getTurretElevation())
|
||||
return false;
|
||||
|
||||
/*for(double i = 0; i < length; i += 0.25D) {
|
||||
|
||||
double x = pos.xCoord + delta.xCoord * i;
|
||||
double y = pos.yCoord + delta.yCoord * i;
|
||||
double z = pos.zCoord + delta.zCoord * i;
|
||||
|
||||
worldObj.spawnParticle("reddust", x, y, z, 0, 0, 0);
|
||||
}
|
||||
|
||||
worldObj.spawnParticle("cloud", pos.xCoord, pos.yCoord, pos.zCoord, 0, 0.1, 0);
|
||||
worldObj.spawnParticle("flame", ent.xCoord, ent.yCoord, ent.zCoord, 0, 0.1, 0);*/
|
||||
|
||||
return !Library.isObstructed(worldObj, ent.xCoord, ent.yCoord, ent.zCoord, pos.xCoord, pos.yCoord, pos.zCoord);
|
||||
}
|
||||
|
||||
@ -661,6 +654,14 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
|
||||
public double getBarrelLength() {
|
||||
return 1.0D;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the turret can detect invisible targets or not
|
||||
* @return
|
||||
*/
|
||||
public boolean hasThermalVision() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The pivot point of the turret, this position is used for LOS calculation and more
|
||||
|
||||
@ -106,7 +106,7 @@ public class TileEntityTurretFritz extends TileEntityTurretBaseNT implements IFl
|
||||
for(int i = 1; i < 10; i++) {
|
||||
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.ammo_fuel) {
|
||||
if(this.tank.getTankType() == FluidType.DIESEL && this.tank.getFill() <= this.tank.getMaxFill()) {
|
||||
if(this.tank.getTankType() == FluidType.DIESEL && this.tank.getFill() + 1000 <= this.tank.getMaxFill()) {
|
||||
this.tank.setFill(this.tank.getFill() + 1000);
|
||||
this.decrStackSize(i, 1);
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import com.hbm.util.EntityDamageUtil;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
@ -36,11 +37,25 @@ public class TileEntityTurretHowardDamaged extends TileEntityTurretHoward {
|
||||
|
||||
@Override
|
||||
public double getDecetorRange() {
|
||||
return 64D;
|
||||
return 16D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDecetorGrace() {
|
||||
return 5D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasThermalVision() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean entityAcceptableTarget(Entity e) { //will fire at any living entity
|
||||
|
||||
if(e instanceof EntityPlayer && ((EntityPlayer)e).capabilities.isCreativeMode)
|
||||
return false;
|
||||
|
||||
return e instanceof EntityLivingBase;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
Loading…
x
Reference in New Issue
Block a user