more arty stuff, conveyor fixes, crane retexture
@ -130,7 +130,8 @@ public class CraneInserter extends BlockCraneBase implements IEnterableBlock {
|
||||
int index = access == null ? i : access[i];
|
||||
ItemStack stack = inv.getStackInSlot(index);
|
||||
|
||||
if(stack != null && toAdd.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(toAdd, stack) && stack.stackSize < Math.min(stack.getMaxStackSize(), limit)) {
|
||||
if(stack != null && toAdd.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(toAdd, stack) && stack.stackSize < Math.min(stack.getMaxStackSize(), limit)
|
||||
&& ((sided == null || sided.canInsertItem(index, toAdd, side)) && inv.isItemValidForSlot(index, toAdd))) {
|
||||
|
||||
int stackLimit = Math.min(stack.getMaxStackSize(), limit);
|
||||
int amount = Math.min(toAdd.stackSize, stackLimit - stack.stackSize);
|
||||
@ -149,7 +150,7 @@ public class CraneInserter extends BlockCraneBase implements IEnterableBlock {
|
||||
int index = access == null ? i : access[i];
|
||||
ItemStack stack = inv.getStackInSlot(index);
|
||||
|
||||
if(stack == null && (sided != null ? sided.canInsertItem(index, toAdd, side) : inv.isItemValidForSlot(index, toAdd))) {
|
||||
if(stack == null && ((sided == null || sided.canInsertItem(index, toAdd, side)) && inv.isItemValidForSlot(index, toAdd))) {
|
||||
|
||||
int amount = Math.min(toAdd.stackSize, limit);
|
||||
|
||||
|
||||
@ -0,0 +1,139 @@
|
||||
package com.hbm.entity.projectile;
|
||||
|
||||
import com.hbm.entity.logic.IChunkLoader;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
|
||||
public class EntityArtilleryShell extends EntityThrowableNT implements IChunkLoader {
|
||||
|
||||
private Ticket loaderTicket;
|
||||
|
||||
private int turnProgress;
|
||||
private double syncPosX;
|
||||
private double syncPosY;
|
||||
private double syncPosZ;
|
||||
private double syncYaw;
|
||||
private double syncPitch;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private double velocityX;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private double velocityY;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private double velocityZ;
|
||||
|
||||
private double targetX;
|
||||
private double targetY;
|
||||
private double targetZ;
|
||||
private boolean didWhistle = false;
|
||||
|
||||
public EntityArtilleryShell(World world) {
|
||||
super(world);
|
||||
this.ignoreFrustumCheck = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isInRangeToRenderDist(double distance) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setTarget(int x, int y, int z) {
|
||||
this.targetX = x;
|
||||
this.targetY = y;
|
||||
this.targetZ = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
super.onUpdate();
|
||||
|
||||
if(!didWhistle) {
|
||||
double speed = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
double deltaX = this.posX - this.targetX;
|
||||
double deltaZ = this.posZ - this.targetZ;
|
||||
double dist = Math.sqrt(deltaX * deltaX + deltaZ * deltaZ);
|
||||
|
||||
if(speed * 18 > dist) {
|
||||
worldObj.playSoundEffect(this.targetX, this.targetY, this.targetZ, "hbm:turret.mortarWhistle", 5.0F, 1.0F);
|
||||
this.didWhistle = true;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if(this.turnProgress > 0) {
|
||||
double interpX = this.posX + (this.syncPosX - this.posX) / (double) this.turnProgress;
|
||||
double interpY = this.posY + (this.syncPosY - this.posY) / (double) this.turnProgress;
|
||||
double interpZ = this.posZ + (this.syncPosZ - this.posZ) / (double) this.turnProgress;
|
||||
double d = MathHelper.wrapAngleTo180_double(this.syncYaw - (double) this.rotationYaw);
|
||||
this.rotationYaw = (float) ((double) this.rotationYaw + d / (double) this.turnProgress);
|
||||
this.rotationPitch = (float)((double)this.rotationPitch + (this.syncPitch - (double)this.rotationPitch) / (double)this.turnProgress);
|
||||
--this.turnProgress;
|
||||
this.setPosition(interpX, interpY, interpZ);
|
||||
} else {
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setVelocity(double p_70016_1_, double p_70016_3_, double p_70016_5_) {
|
||||
this.velocityX = this.motionX = p_70016_1_;
|
||||
this.velocityY = this.motionY = p_70016_3_;
|
||||
this.velocityZ = this.motionZ = p_70016_5_;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int theNumberThree) {
|
||||
this.syncPosX = x;
|
||||
this.syncPosY = y;
|
||||
this.syncPosZ = z;
|
||||
this.syncYaw = yaw;
|
||||
this.syncPitch = pitch;
|
||||
this.turnProgress = theNumberThree;
|
||||
this.motionX = this.velocityX;
|
||||
this.motionY = this.velocityY;
|
||||
this.motionZ = this.velocityZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition mop) {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
Vec3 vec = Vec3.createVectorHelper(motionX, motionY, motionZ).normalize();
|
||||
this.worldObj.newExplosion(this, mop.hitVec.xCoord - vec.xCoord, mop.hitVec.yCoord - vec.yCoord, mop.hitVec.zCoord - vec.zCoord, 15F, false, false);
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Ticket ticket) {
|
||||
if(!worldObj.isRemote && ticket != null) {
|
||||
if(loaderTicket == null) {
|
||||
loaderTicket = ticket;
|
||||
loaderTicket.bindEntity(this);
|
||||
loaderTicket.getModData();
|
||||
}
|
||||
ForgeChunkManager.forceChunk(loaderTicket, new ChunkCoordIntPair(chunkCoordX, chunkCoordZ));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getAirDrag() {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getGravityVelocity() {
|
||||
return 9.81 * 0.05;
|
||||
}
|
||||
}
|
||||
311
src/main/java/com/hbm/entity/projectile/EntityThrowableNT.java
Normal file
@ -0,0 +1,311 @@
|
||||
package com.hbm.entity.projectile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IProjectile;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Near-identical copy of EntityThrowable but deobfuscated & untangled
|
||||
* @author hbm
|
||||
*
|
||||
*/
|
||||
public abstract class EntityThrowableNT extends Entity implements IProjectile {
|
||||
|
||||
private int stuckBlockX = -1;
|
||||
private int stuckBlockY = -1;
|
||||
private int stuckBlockZ = -1;
|
||||
private Block stuckBlock;
|
||||
protected boolean inGround;
|
||||
public int throwableShake;
|
||||
private EntityLivingBase thrower;
|
||||
private String throwerName;
|
||||
private int ticksInGround;
|
||||
private int ticksInAir;
|
||||
|
||||
public EntityThrowableNT(World world) {
|
||||
super(world);
|
||||
this.setSize(0.25F, 0.25F);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() { }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isInRangeToRenderDist(double dist) {
|
||||
|
||||
double perimeter = this.boundingBox.getAverageEdgeLength() * 4.0D;
|
||||
perimeter *= 64.0D;
|
||||
return dist < perimeter * perimeter;
|
||||
}
|
||||
|
||||
public EntityThrowableNT(World world, EntityLivingBase thrower) {
|
||||
super(world);
|
||||
this.thrower = thrower;
|
||||
this.setSize(0.25F, 0.25F);
|
||||
this.setLocationAndAngles(thrower.posX, thrower.posY + (double) thrower.getEyeHeight(), thrower.posZ, thrower.rotationYaw, thrower.rotationPitch);
|
||||
this.posX -= (double) (MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F);
|
||||
this.posY -= 0.1D;
|
||||
this.posZ -= (double) (MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F);
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
this.yOffset = 0.0F;
|
||||
float velocity = 0.4F;
|
||||
this.motionX = (double) (-MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI) * velocity);
|
||||
this.motionZ = (double) (MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI) * velocity);
|
||||
this.motionY = (double) (-MathHelper.sin((this.rotationPitch + this.throwAngle()) / 180.0F * (float) Math.PI) * velocity);
|
||||
this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, this.throwForce(), 1.0F);
|
||||
}
|
||||
|
||||
public EntityThrowableNT(World world, double x, double y, double z) {
|
||||
super(world);
|
||||
this.ticksInGround = 0;
|
||||
this.setSize(0.25F, 0.25F);
|
||||
this.setPosition(x, y, z);
|
||||
this.yOffset = 0.0F;
|
||||
}
|
||||
|
||||
protected float throwForce() {
|
||||
return 1.5F;
|
||||
}
|
||||
|
||||
protected float throwAngle() {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setThrowableHeading(double motionX, double motionY, double motionZ, float velocity, float inaccuracy) {
|
||||
float throwLen = MathHelper.sqrt_double(motionX * motionX + motionY * motionY + motionZ * motionZ);
|
||||
motionX /= (double) throwLen;
|
||||
motionY /= (double) throwLen;
|
||||
motionZ /= (double) throwLen;
|
||||
motionX += this.rand.nextGaussian() * 0.0075D * (double) inaccuracy;
|
||||
motionY += this.rand.nextGaussian() * 0.0075D * (double) inaccuracy;
|
||||
motionZ += this.rand.nextGaussian() * 0.0075D * (double) inaccuracy;
|
||||
motionX *= (double) velocity;
|
||||
motionY *= (double) velocity;
|
||||
motionZ *= (double) velocity;
|
||||
this.motionX = motionX;
|
||||
this.motionY = motionY;
|
||||
this.motionZ = motionZ;
|
||||
float hyp = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
|
||||
this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(motionX, motionZ) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(motionY, (double) hyp) * 180.0D / Math.PI);
|
||||
this.ticksInGround = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setVelocity(double x, double y, double z) {
|
||||
this.motionX = x;
|
||||
this.motionY = y;
|
||||
this.motionZ = z;
|
||||
|
||||
if(this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) {
|
||||
float hyp = MathHelper.sqrt_double(x * x + z * z);
|
||||
this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(x, z) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(y, (double) hyp) * 180.0D / Math.PI);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
this.lastTickPosX = this.posX;
|
||||
this.lastTickPosY = this.posY;
|
||||
this.lastTickPosZ = this.posZ;
|
||||
super.onUpdate();
|
||||
|
||||
if(this.throwableShake > 0) {
|
||||
--this.throwableShake;
|
||||
}
|
||||
|
||||
if(this.inGround) {
|
||||
if(this.worldObj.getBlock(this.stuckBlockX, this.stuckBlockY, this.stuckBlockZ) == this.stuckBlock) {
|
||||
++this.ticksInGround;
|
||||
|
||||
if(this.groundDespawn() > 0 && this.ticksInGround == this.groundDespawn()) {
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.inGround = false;
|
||||
this.motionX *= (double) (this.rand.nextFloat() * 0.2F);
|
||||
this.motionY *= (double) (this.rand.nextFloat() * 0.2F);
|
||||
this.motionZ *= (double) (this.rand.nextFloat() * 0.2F);
|
||||
this.ticksInGround = 0;
|
||||
this.ticksInAir = 0;
|
||||
} else {
|
||||
++this.ticksInAir;
|
||||
}
|
||||
|
||||
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);
|
||||
pos = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
|
||||
nextPos = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||
|
||||
if(mop != null) {
|
||||
nextPos = Vec3.createVectorHelper(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
|
||||
}
|
||||
|
||||
if(!this.worldObj.isRemote) {
|
||||
|
||||
Entity hitEntity = null;
|
||||
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
|
||||
double nearest = 0.0D;
|
||||
EntityLivingBase thrower = this.getThrower();
|
||||
|
||||
for(int j = 0; j < list.size(); ++j) {
|
||||
Entity entity = (Entity) list.get(j);
|
||||
|
||||
if(entity.canBeCollidedWith() && (entity != thrower || this.ticksInAir >= 5)) {
|
||||
double hitbox = 0.3F;
|
||||
AxisAlignedBB aabb = entity.boundingBox.expand(hitbox, hitbox, hitbox);
|
||||
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(hitEntity != null) {
|
||||
mop = new MovingObjectPosition(hitEntity);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
this.posX += this.motionX;
|
||||
this.posY += this.motionY;
|
||||
this.posZ += this.motionZ;
|
||||
|
||||
float hyp = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
|
||||
|
||||
for(this.rotationPitch = (float) (Math.atan2(this.motionY, (double) hyp) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) {
|
||||
;
|
||||
}
|
||||
|
||||
while(this.rotationPitch - this.prevRotationPitch >= 180.0F) {
|
||||
this.prevRotationPitch += 360.0F;
|
||||
}
|
||||
|
||||
while(this.rotationYaw - this.prevRotationYaw < -180.0F) {
|
||||
this.prevRotationYaw -= 360.0F;
|
||||
}
|
||||
|
||||
while(this.rotationYaw - this.prevRotationYaw >= 180.0F) {
|
||||
this.prevRotationYaw += 360.0F;
|
||||
}
|
||||
|
||||
this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
|
||||
this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
|
||||
float drag = this.getAirDrag();
|
||||
double gravity = this.getGravityVelocity();
|
||||
|
||||
if(this.isInWater()) {
|
||||
for(int i = 0; i < 4; ++i) {
|
||||
float f = 0.25F;
|
||||
this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double) f, this.posY - this.motionY * (double) f, this.posZ - this.motionZ * (double) f, this.motionX, this.motionY, this.motionZ);
|
||||
}
|
||||
|
||||
drag = this.getWaterDrag();
|
||||
}
|
||||
|
||||
this.motionX *= (double) drag;
|
||||
this.motionY *= (double) drag;
|
||||
this.motionZ *= (double) drag;
|
||||
this.motionY -= gravity;
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
}
|
||||
|
||||
public double getGravityVelocity() {
|
||||
return 0.03D;
|
||||
}
|
||||
|
||||
protected abstract void onImpact(MovingObjectPosition mop);
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound nbt) {
|
||||
nbt.setShort("xTile", (short) this.stuckBlockX);
|
||||
nbt.setShort("yTile", (short) this.stuckBlockY);
|
||||
nbt.setShort("zTile", (short) this.stuckBlockZ);
|
||||
nbt.setByte("inTile", (byte) Block.getIdFromBlock(this.stuckBlock));
|
||||
nbt.setByte("shake", (byte) this.throwableShake);
|
||||
nbt.setByte("inGround", (byte) (this.inGround ? 1 : 0));
|
||||
|
||||
if((this.throwerName == null || this.throwerName.length() == 0) && this.thrower != null && this.thrower instanceof EntityPlayer) {
|
||||
this.throwerName = this.thrower.getCommandSenderName();
|
||||
}
|
||||
|
||||
nbt.setString("ownerName", this.throwerName == null ? "" : this.throwerName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
this.stuckBlockX = nbt.getShort("xTile");
|
||||
this.stuckBlockY = nbt.getShort("yTile");
|
||||
this.stuckBlockZ = nbt.getShort("zTile");
|
||||
this.stuckBlock = Block.getBlockById(nbt.getByte("inTile") & 255);
|
||||
this.throwableShake = nbt.getByte("shake") & 255;
|
||||
this.inGround = nbt.getByte("inGround") == 1;
|
||||
this.throwerName = nbt.getString("ownerName");
|
||||
|
||||
if(this.throwerName != null && this.throwerName.length() == 0) {
|
||||
this.throwerName = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getShadowSize() {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
public EntityLivingBase getThrower() {
|
||||
if(this.thrower == null && this.throwerName != null && this.throwerName.length() > 0) {
|
||||
this.thrower = this.worldObj.getPlayerEntityByName(this.throwerName);
|
||||
}
|
||||
return this.thrower;
|
||||
}
|
||||
|
||||
/* ================================== Additional Getters =====================================*/
|
||||
|
||||
protected float getAirDrag() {
|
||||
return 0.99F;
|
||||
}
|
||||
|
||||
protected float getWaterDrag() {
|
||||
return 0.8F;
|
||||
}
|
||||
|
||||
protected int groundDespawn() {
|
||||
return 1200;
|
||||
}
|
||||
}
|
||||
@ -16,6 +16,7 @@ public class ContainerMassStorage extends Container {
|
||||
|
||||
public ContainerMassStorage(InventoryPlayer invPlayer, TileEntityMassStorage te) {
|
||||
this.storage = te;
|
||||
this.storage.openInventory();
|
||||
|
||||
this.addSlotToContainer(new Slot(storage, 0, 61, 17));
|
||||
this.addSlotToContainer(new SlotPattern(storage, 1, 61, 53));
|
||||
@ -100,4 +101,10 @@ public class ContainerMassStorage extends Container {
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return storage.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer p_75134_1_) {
|
||||
super.onContainerClosed(p_75134_1_);
|
||||
this.storage.closeInventory();
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,7 +158,7 @@ public class Fluids {
|
||||
WASTEFLUID = new RadioactiveLiquid( "WASTEFLUID", 0x544400, 2, 0, 1, EnumSymbol.RADIATION).setRadiation(0.5F).addTraits(FluidTrait.NO_CONTAINER);
|
||||
WASTEGAS = new RadioactiveGas( "WASTEGAS", 0xB8B8B8, 2, 0, 1, EnumSymbol.RADIATION).setRadiation(0.5F).addTraits(FluidTrait.NO_CONTAINER);
|
||||
GASOLINE = new Fuel( "GASOLINE", 0x445772, 1, 2, 0, EnumSymbol.NONE).setCombustionEnergy(FuelGrade.HIGH, 1_000_000).setHeatEnergy(400_000).addContainers(0x2F7747, ExtContainer.CANISTER);
|
||||
COALGAS = new Fuel( "COALGAS", 0x445772, 1, 2, 0, EnumSymbol.NONE).setCombustionEnergy(FuelGrade.MEDIUM, 150_000).setHeatEnergy(75_000).addContainers(0x2F7759, ExtContainer.CANISTER);
|
||||
COALGAS = new Fuel( "COALGAS", 0x445772, 1, 2, 0, EnumSymbol.NONE).setCombustionEnergy(FuelGrade.MEDIUM, 150_000).setHeatEnergy(75_000).addContainers(0x2E155F, ExtContainer.CANISTER);
|
||||
SPENTSTEAM = new Gas( "SPENTSTEAM", 0x445772, 2, 0, 0, EnumSymbol.NONE).addTraits(FluidTrait.NO_CONTAINER).setCompression(1D);
|
||||
FRACKSOL = new Petrochemical( "FRACKSOL", 0x798A6B, 1, 3, 3, EnumSymbol.ACID).addTraits(FluidTrait.CORROSIVE).addContainers(0x4F887F, ExtContainer.CANISTER);
|
||||
PLASMA_DT = new FluidType( "PLASMA_DT", 0xF7AFDE, 0, 4, 0, EnumSymbol.RADIATION).setTemp(3250).addTraits(FluidTrait.NO_CONTAINER, FluidTrait.NO_ID);
|
||||
@ -184,7 +184,7 @@ public class Fluids {
|
||||
XPJUICE = new FluidType( "XPJUICE", 0xBBFF09, 0, 0, 0, EnumSymbol.NONE);
|
||||
ENDERJUICE = new FluidType( "ENDERJUICE", 0x127766, 0, 0, 0, EnumSymbol.NONE);
|
||||
PETROIL_LEADED = new Fuel( "PETROIL_LEADED", 0x44413d, 1, 3, 0, EnumSymbol.NONE).setCombustionEnergy(FuelGrade.MEDIUM, 450_000).setHeatEnergy(((FluidTypeFlammable)PETROIL).getHeatEnergy()).addContainers(0x2331F6, ExtContainer.CANISTER);
|
||||
GASOLINE_LEADED = new Fuel( "GASOLINE_LEADED", 0x445772, 1, 2, 0, EnumSymbol.NONE).setCombustionEnergy(FuelGrade.HIGH, 1_500_000).setHeatEnergy(((FluidTypeFlammable)GASOLINE).getHeatEnergy()).addContainers(0xD4F4ED, ExtContainer.CANISTER);
|
||||
GASOLINE_LEADED = new Fuel( "GASOLINE_LEADED", 0x445772, 1, 2, 0, EnumSymbol.NONE).setCombustionEnergy(FuelGrade.HIGH, 1_500_000).setHeatEnergy(((FluidTypeFlammable)GASOLINE).getHeatEnergy()).addContainers(0x2F775A, ExtContainer.CANISTER);
|
||||
COALGAS_LEADED = new Fuel( "COALGAS_LEADED", 0x445772, 1, 2, 0, EnumSymbol.NONE).setCombustionEnergy(FuelGrade.MEDIUM, 250_000).setHeatEnergy(((FluidTypeFlammable)COALGAS).getHeatEnergy()).addContainers(0x1E155F, ExtContainer.CANISTER);
|
||||
SULFURIC_ACID = new FluidType( "SULFURIC_ACID", 0xB0AA64, 3, 0, 2, EnumSymbol.ACID).addTraits(FluidTrait.CORROSIVE);
|
||||
COOLANT_HOT = new FluidType( "COOLANT_HOT", 0x99525E, 1, 0, 0, EnumSymbol.NONE).setTemp(600).setHeatCap(COOLANT.heatCap);
|
||||
|
||||
@ -34,8 +34,9 @@ public class GUITurretArty extends GUITurretBase {
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int mX, int mY) {
|
||||
super.drawGuiContainerBackgroundLayer(p_146976_1_, mX, mY);
|
||||
|
||||
if(((TileEntityTurretArty)turret).directMode)
|
||||
drawTexturedModalRect(guiLeft + 151, guiTop + 16, 210, 0, 18, 18);
|
||||
short mode = ((TileEntityTurretArty)turret).mode;
|
||||
if(mode == TileEntityTurretArty.MODE_CANNON) drawTexturedModalRect(guiLeft + 151, guiTop + 16, 210, 0, 18, 18);
|
||||
if(mode == TileEntityTurretArty.MODE_MANUAL) drawTexturedModalRect(guiLeft + 151, guiTop + 16, 210, 18, 18, 18);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -1563,6 +1563,7 @@ public class ModItems {
|
||||
public static Item ammo_shell_apfsds_du;
|
||||
public static Item ammo_shell_w9;
|
||||
public static Item ammo_dgk;
|
||||
public static Item ammo_arty;
|
||||
public static Item ammo_nuke;
|
||||
public static Item ammo_nuke_low;
|
||||
public static Item ammo_nuke_high;
|
||||
@ -4292,6 +4293,7 @@ public class ModItems {
|
||||
ammo_shell_apfsds_du = new ItemAmmo().setUnlocalizedName("ammo_shell_apfsds_du");
|
||||
ammo_shell_w9 = new ItemAmmo().setUnlocalizedName("ammo_shell_w9");
|
||||
ammo_dgk = new ItemAmmo().setUnlocalizedName("ammo_dgk");
|
||||
ammo_arty = new ItemAmmoArty().setUnlocalizedName("ammo_arty");
|
||||
ammo_nuke = new ItemAmmo().setUnlocalizedName("ammo_nuke");
|
||||
ammo_nuke_low = new ItemAmmo().setUnlocalizedName("ammo_nuke_low");
|
||||
ammo_nuke_high = new ItemAmmo().setUnlocalizedName("ammo_nuke_high");
|
||||
@ -7391,6 +7393,7 @@ public class ModItems {
|
||||
GameRegistry.registerItem(ammo_shell_apfsds_du, ammo_shell_apfsds_du.getUnlocalizedName());
|
||||
GameRegistry.registerItem(ammo_shell_w9, ammo_shell_w9.getUnlocalizedName());
|
||||
GameRegistry.registerItem(ammo_dgk, ammo_dgk.getUnlocalizedName());
|
||||
GameRegistry.registerItem(ammo_arty, ammo_arty.getUnlocalizedName());
|
||||
GameRegistry.registerItem(ammo_nuke, ammo_nuke.getUnlocalizedName());
|
||||
GameRegistry.registerItem(ammo_nuke_low, ammo_nuke_low.getUnlocalizedName());
|
||||
GameRegistry.registerItem(ammo_nuke_high, ammo_nuke_high.getUnlocalizedName());
|
||||
|
||||
69
src/main/java/com/hbm/items/weapon/ItemAmmoArty.java
Normal file
@ -0,0 +1,69 @@
|
||||
package com.hbm.items.weapon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.util.EnumUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class ItemAmmoArty extends Item {
|
||||
|
||||
public static enum EnumArtyType {
|
||||
NORMAL("ammo_arty"),
|
||||
CLASSIC("ammo_arty_classic"),
|
||||
EXPLOSIVE("ammo_arty_he"),
|
||||
MINI_NUKE("ammo_arty_mini_nuke"),
|
||||
NUKE("ammo_arty_nuke");
|
||||
|
||||
private String name;
|
||||
|
||||
private EnumArtyType(String texture) {
|
||||
this.name = texture;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemAmmoArty() {
|
||||
this.setHasSubtypes(true);
|
||||
this.setCreativeTab(MainRegistry.weaponTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for(int i = 0; i < EnumArtyType.values().length; i++) {
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
private IIcon[] icons = new IIcon[EnumArtyType.values().length];
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister reg) {
|
||||
|
||||
this.icons = new IIcon[EnumArtyType.values().length];
|
||||
|
||||
for(int i = 0; i < icons.length; i++) {
|
||||
this.icons[i] = reg.registerIcon(RefStrings.MODID + ":" + EnumArtyType.values()[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return this.icons[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
EnumArtyType num = EnumUtil.grabEnumSafely(EnumArtyType.class, stack.getItemDamage());
|
||||
return "item." + num.name;
|
||||
}
|
||||
}
|
||||
@ -530,6 +530,7 @@ public class ClientProxy extends ServerProxy {
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityBeamVortex.class, new RenderVortexBeam());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityRBMKDebris.class, new RenderRBMKDebris());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityZirnoxDebris.class, new RenderZirnoxDebris());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityArtilleryShell.class, new RenderArtilleryShell());
|
||||
//grenades
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeGeneric.class, new RenderSnowball(ModItems.grenade_generic));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeStrong.class, new RenderSnowball(ModItems.grenade_strong));
|
||||
|
||||
@ -35,7 +35,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@ -503,6 +502,7 @@ public class MainRegistry {
|
||||
EntityRegistry.registerModEntity(EntityMinecartPowder.class, "entity_ntm_cart_powder", 175, this, 250, 1, false);
|
||||
EntityRegistry.registerModEntity(EntityMinecartSemtex.class, "entity_ntm_cart_semtex", 176, this, 250, 1, false);
|
||||
EntityRegistry.registerModEntity(EntityNukeTorex.class, "entity_effect_torex", 177, this, 250, 1, false);
|
||||
EntityRegistry.registerModEntity(EntityArtilleryShell.class, "entity_artillery_shell", 178, this, 1000, 1, true);
|
||||
|
||||
EntityRegistry.registerGlobalEntityID(EntityNuclearCreeper.class, "entity_mob_nuclear_creeper", EntityRegistry.findGlobalUniqueEntityId(), 0x204131, 0x75CE00);
|
||||
EntityRegistry.registerGlobalEntityID(EntityTaintedCreeper.class, "entity_mob_tainted_creeper", EntityRegistry.findGlobalUniqueEntityId(), 0x813b9b, 0xd71fdd);
|
||||
|
||||
@ -0,0 +1,41 @@
|
||||
package com.hbm.render.entity.projectile;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderArtilleryShell extends Render {
|
||||
|
||||
@Override
|
||||
public void doRender(Entity shell, double x, double y, double z, float f0, float f1) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
GL11.glRotatef(shell.prevRotationYaw + (shell.rotationYaw - shell.prevRotationYaw) * f1 - 90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(shell.prevRotationPitch + (shell.rotationPitch - shell.prevRotationPitch) * f1 - 90, 0.0F, 0.0F, 1.0F);
|
||||
|
||||
float scale = 5F;
|
||||
GL11.glScalef(scale * 0.5F, scale, scale * 0.5F);
|
||||
|
||||
this.bindEntityTexture(shell);
|
||||
|
||||
boolean fog = GL11.glIsEnabled(GL11.GL_FOG);
|
||||
|
||||
if(fog) GL11.glDisable(GL11.GL_FOG);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
ResourceManager.projectiles.renderPart("Grenade");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
if(fog) GL11.glEnable(GL11.GL_FOG);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity entity) {
|
||||
return ResourceManager.grenade_tex;
|
||||
}
|
||||
}
|
||||
@ -35,6 +35,9 @@ public class RenderTurretArty extends TileEntitySpecialRenderer {
|
||||
GL11.glRotated(pitch, 1, 0, 0);
|
||||
GL11.glTranslated(0, -3, 0);
|
||||
ResourceManager.turret_arty.renderPart("Cannon");
|
||||
double barrel = turret.lastBarrelPos + (turret.barrelPos - turret.lastBarrelPos) * interp;
|
||||
double length = 2.5;
|
||||
GL11.glTranslated(0, 0, barrel * length);
|
||||
ResourceManager.turret_arty.renderPart("Barrel");
|
||||
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
|
||||
@ -99,6 +99,16 @@ public class TileEntityMassStorage extends TileEntityCrateBase implements INBTPa
|
||||
return Vec3.createVectorHelper(xCoord - player.posX, yCoord - player.posY, zCoord - player.posZ).lengthVector() < 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.storageOpen", 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.storageClose", 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
@ -75,6 +75,11 @@ public class TileEntityCraneInserter extends TileEntityMachineBase implements IG
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerCraneInserter(player.inventory, this);
|
||||
|
||||
@ -3,7 +3,7 @@ package com.hbm.tileentity.turret;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.entity.projectile.EntityBulletBase;
|
||||
import com.hbm.entity.projectile.EntityArtilleryShell;
|
||||
import com.hbm.handler.BulletConfigSyncingUtil;
|
||||
import com.hbm.handler.BulletConfiguration;
|
||||
import com.hbm.inventory.container.ContainerTurretBase;
|
||||
@ -22,7 +22,14 @@ import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUIProvider {
|
||||
|
||||
public boolean directMode = false;
|
||||
public short mode = 0;
|
||||
public static final short MODE_ARTILLERY = 0;
|
||||
public static final short MODE_CANNON = 1;
|
||||
public static final short MODE_MANUAL = 2;
|
||||
private boolean didJustShoot = false;
|
||||
private boolean retracting = false;
|
||||
public double barrelPos = 0;
|
||||
public double lastBarrelPos = 0;
|
||||
|
||||
static List<Integer> configs = new ArrayList();
|
||||
|
||||
@ -64,10 +71,40 @@ public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUI
|
||||
return 3D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDecetorRange() {
|
||||
return 128D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDecetorGrace() {
|
||||
return 32D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTurretYawSpeed() {
|
||||
return 1D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTurretPitchSpeed() {
|
||||
return 0.5D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTurretDepression() {
|
||||
return 30D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTurretElevation() {
|
||||
return 90D;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void seekNewTarget() {
|
||||
|
||||
if(this.directMode) {
|
||||
if(this.mode == MODE_CANNON) {
|
||||
super.seekNewTarget();
|
||||
return;
|
||||
}
|
||||
@ -78,8 +115,34 @@ public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUI
|
||||
|
||||
@Override
|
||||
protected void alignTurret() {
|
||||
/* TODO: calculate angles */
|
||||
this.turnTowards(tPos);
|
||||
|
||||
Vec3 pos = this.getTurretPos();
|
||||
|
||||
Vec3 barrel = Vec3.createVectorHelper(this.getBarrelLength(), 0, 0);
|
||||
barrel.rotateAroundZ((float) -this.rotationPitch);
|
||||
barrel.rotateAroundY((float) -(this.rotationYaw + Math.PI * 0.5));
|
||||
/*
|
||||
* This is done to compensate for the barrel length, as this small deviation has a huge impact in both modes at longer ranges.
|
||||
* The consequence of this is that using the >before< angle of the barrel as an approximation can lead to problems at closer range,
|
||||
* as the math tries to properly calculate the >after< angle. This should not be a problem due to the etector grace distance being
|
||||
* rather high, but it is still important to note.
|
||||
*/
|
||||
pos.xCoord += barrel.xCoord;
|
||||
pos.yCoord += barrel.yCoord;
|
||||
pos.zCoord += barrel.zCoord;
|
||||
|
||||
Vec3 delta = Vec3.createVectorHelper(tPos.xCoord - pos.xCoord, tPos.yCoord - pos.yCoord, tPos.zCoord - pos.zCoord);
|
||||
double targetYaw = -Math.atan2(delta.xCoord, delta.zCoord);
|
||||
|
||||
double x = Math.sqrt(delta.xCoord * delta.xCoord + delta.zCoord * delta.zCoord);
|
||||
double y = delta.yCoord;
|
||||
double v0 = 20;
|
||||
double v02 = v0 * v0;
|
||||
double g = 9.81 * 0.05;
|
||||
double upperLower = mode == MODE_CANNON ? 1 : 1;
|
||||
double targetPitch = Math.atan((v02 + Math.sqrt(v02*v02 - g*(g*x*x + 2*y*v02)) * upperLower) / (g*x));
|
||||
|
||||
this.turnTowardsAngle(targetPitch, targetYaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -90,46 +153,101 @@ public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUI
|
||||
vec.rotateAroundZ((float) -this.rotationPitch);
|
||||
vec.rotateAroundY((float) -(this.rotationYaw + Math.PI * 0.5));
|
||||
|
||||
/* TODO: replace bullet base entity with a chunkloading artillery shell */
|
||||
EntityBulletBase proj = new EntityBulletBase(worldObj, BulletConfigSyncingUtil.getKey(bullet));
|
||||
EntityArtilleryShell proj = new EntityArtilleryShell(worldObj);
|
||||
proj.setPositionAndRotation(pos.xCoord + vec.xCoord, pos.yCoord + vec.yCoord, pos.zCoord + vec.zCoord, 0.0F, 0.0F);
|
||||
proj.setThrowableHeading(vec.xCoord, vec.yCoord, vec.zCoord, 20F, 0.0F);
|
||||
proj.setTarget((int) tPos.xCoord, (int) tPos.yCoord, (int) tPos.zCoord);
|
||||
|
||||
proj.setThrowableHeading(vec.xCoord, vec.yCoord, vec.zCoord, bullet.velocity, bullet.spread);
|
||||
worldObj.spawnEntityInWorld(proj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(worldObj.isRemote) {
|
||||
this.lastBarrelPos = this.barrelPos;
|
||||
|
||||
if(this.didJustShoot) {
|
||||
this.retracting = true;
|
||||
System.out.println("beb");
|
||||
}
|
||||
|
||||
if(this.retracting) {
|
||||
this.barrelPos += 0.5;
|
||||
|
||||
if(this.barrelPos >= 1) {
|
||||
this.retracting = false;
|
||||
}
|
||||
|
||||
} else {
|
||||
this.barrelPos -= 0.05;
|
||||
if(this.barrelPos < 0) {
|
||||
this.barrelPos = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.updateEntity();
|
||||
this.didJustShoot = false;
|
||||
}
|
||||
|
||||
int timer;
|
||||
|
||||
@Override
|
||||
public void updateFiringTick() {
|
||||
|
||||
BulletConfiguration conf = this.getFirstConfigLoaded();
|
||||
timer++;
|
||||
|
||||
if(conf != null) {
|
||||
this.spawnBullet(conf);
|
||||
this.conusmeAmmo(conf.ammo);
|
||||
this.worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:turret.jeremy_fire", 4.0F, 1.0F);
|
||||
Vec3 pos = this.getTurretPos();
|
||||
Vec3 vec = Vec3.createVectorHelper(this.getBarrelLength(), 0, 0);
|
||||
vec.rotateAroundZ((float) -this.rotationPitch);
|
||||
vec.rotateAroundY((float) -(this.rotationYaw + Math.PI * 0.5));
|
||||
if(timer % 40 == 0) {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "vanillaExt");
|
||||
data.setString("mode", "largeexplode");
|
||||
data.setFloat("size", 0F);
|
||||
data.setByte("count", (byte)5);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, pos.xCoord + vec.xCoord, pos.yCoord + vec.yCoord, pos.zCoord + vec.zCoord), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
|
||||
BulletConfiguration conf = this.getFirstConfigLoaded();
|
||||
|
||||
if(conf != null) {
|
||||
this.spawnBullet(conf);
|
||||
//this.conusmeAmmo(conf.ammo);
|
||||
this.worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:turret.jeremy_fire", 25.0F, 1.0F);
|
||||
Vec3 pos = this.getTurretPos();
|
||||
Vec3 vec = Vec3.createVectorHelper(this.getBarrelLength(), 0, 0);
|
||||
vec.rotateAroundZ((float) -this.rotationPitch);
|
||||
vec.rotateAroundY((float) -(this.rotationYaw + Math.PI * 0.5));
|
||||
this.didJustShoot = true;
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "vanillaExt");
|
||||
data.setString("mode", "largeexplode");
|
||||
data.setFloat("size", 0F);
|
||||
data.setByte("count", (byte)5);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, pos.xCoord + vec.xCoord, pos.yCoord + vec.yCoord, pos.zCoord + vec.zCoord), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 150));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleButtonPacket(int value, int meta) {
|
||||
if(meta == 5) {
|
||||
this.directMode = !this.directMode;
|
||||
this.mode++;
|
||||
if(this.mode > 2)
|
||||
this.mode = 0;
|
||||
} else{
|
||||
super.handleButtonPacket(value, meta);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NBTTagCompound writePacket() {
|
||||
NBTTagCompound data = super.writePacket();
|
||||
data.setShort("mode", mode);
|
||||
data.setBoolean("didJustShoot", didJustShoot);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
this.mode = nbt.getShort("mode");
|
||||
this.didJustShoot = nbt.getBoolean("didJustShoot");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerTurretBase(player.inventory, this);
|
||||
|
||||
@ -209,19 +209,7 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
|
||||
|
||||
this.power = Library.chargeTEFromItems(slots, 10, this.power, this.getMaxPower());
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
if(this.tPos != null) {
|
||||
data.setDouble("tX", this.tPos.xCoord);
|
||||
data.setDouble("tY", this.tPos.yCoord);
|
||||
data.setDouble("tZ", this.tPos.zCoord);
|
||||
}
|
||||
data.setLong("power", this.power);
|
||||
data.setBoolean("isOn", this.isOn);
|
||||
data.setBoolean("targetPlayers", this.targetPlayers);
|
||||
data.setBoolean("targetAnimals", this.targetAnimals);
|
||||
data.setBoolean("targetMobs", this.targetMobs);
|
||||
data.setBoolean("targetMachines", this.targetMachines);
|
||||
data.setInteger("stattrak", this.stattrak);
|
||||
NBTTagCompound data = this.writePacket();
|
||||
this.networkPack(data, 250);
|
||||
|
||||
} else {
|
||||
@ -241,6 +229,25 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
|
||||
}
|
||||
}
|
||||
|
||||
protected NBTTagCompound writePacket() {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
if(this.tPos != null) {
|
||||
data.setDouble("tX", this.tPos.xCoord);
|
||||
data.setDouble("tY", this.tPos.yCoord);
|
||||
data.setDouble("tZ", this.tPos.zCoord);
|
||||
}
|
||||
data.setLong("power", this.power);
|
||||
data.setBoolean("isOn", this.isOn);
|
||||
data.setBoolean("targetPlayers", this.targetPlayers);
|
||||
data.setBoolean("targetAnimals", this.targetAnimals);
|
||||
data.setBoolean("targetMobs", this.targetMobs);
|
||||
data.setBoolean("targetMachines", this.targetMachines);
|
||||
data.setInteger("stattrak", this.stattrak);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getOpposite();
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
@ -40,6 +40,8 @@
|
||||
"block.bobble": {"category": "block", "sounds": [{"name": "block/bobble", "stream": false}]},
|
||||
"block.crateOpen": {"category": "block", "sounds": [{"name": "block/crateOpen", "stream": false}]},
|
||||
"block.crateClose": {"category": "block", "sounds": [{"name": "block/crateClose", "stream": false}]},
|
||||
"block.storageOpen": {"category": "block", "sounds": [{"name": "block/storageOpen", "stream": false}]},
|
||||
"block.storageClose": {"category": "block", "sounds": [{"name": "block/storageClose", "stream": false}]},
|
||||
|
||||
"door.TransitionSealOpen": {"category": "block", "sounds": [{"name": "block/door/transition_seal_open", "stream": true}]},
|
||||
|
||||
@ -168,6 +170,7 @@
|
||||
"turret.richard_fire": {"category": "block", "sounds": [{"name": "turret/richard_fire", "stream": false}]},
|
||||
"turret.howard_fire": {"category": "block", "sounds": [{"name": "turret/howard_fire", "stream": false}]},
|
||||
"turret.howard_reload": {"category": "block", "sounds": [{"name": "turret/howard_reload", "stream": false}]},
|
||||
"turret.mortarWhistle": {"category": "block", "sounds": [{"name": "weapon/mortarWhistle", "stream": false}]},
|
||||
|
||||
"entity.chopperFlyingLoop": {"category": "hostile", "sounds": [{"name": "entity/chopperFlyingLoop", "stream": true}]},
|
||||
"entity.chopperDrop": {"category": "hostile", "sounds": [{"name": "entity/chopperDrop", "stream": false}]},
|
||||
|
||||
BIN
src/main/resources/assets/hbm/sounds/block/storageClose.ogg
Normal file
BIN
src/main/resources/assets/hbm/sounds/block/storageOpen.ogg
Normal file
BIN
src/main/resources/assets/hbm/sounds/weapon/mortarWhistle.ogg
Normal file
|
Before Width: | Height: | Size: 221 B After Width: | Height: | Size: 305 B |
|
Before Width: | Height: | Size: 259 B After Width: | Height: | Size: 421 B |
|
Before Width: | Height: | Size: 259 B After Width: | Height: | Size: 419 B |
|
Before Width: | Height: | Size: 253 B After Width: | Height: | Size: 364 B |
|
Before Width: | Height: | Size: 178 B After Width: | Height: | Size: 252 B |
|
Before Width: | Height: | Size: 253 B After Width: | Height: | Size: 415 B |
|
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 412 B |
|
Before Width: | Height: | Size: 244 B After Width: | Height: | Size: 355 B |
|
Before Width: | Height: | Size: 176 B After Width: | Height: | Size: 349 B |
|
Before Width: | Height: | Size: 239 B After Width: | Height: | Size: 358 B |
|
Before Width: | Height: | Size: 199 B After Width: | Height: | Size: 325 B |
|
Before Width: | Height: | Size: 162 B After Width: | Height: | Size: 290 B |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 338 B After Width: | Height: | Size: 327 B |