mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-02-24 06:50:46 +00:00
Merge branch 'HbmMods:master' into master
This commit is contained in:
commit
c380b7f84f
@ -43,9 +43,13 @@ public class EntityNukeTorex extends Entity {
|
|||||||
double range = (torusWidth - rollerSize) * 0.25;
|
double range = (torusWidth - rollerSize) * 0.25;
|
||||||
|
|
||||||
if(this.ticksExisted + cloudletLife * 2 < maxAge) {
|
if(this.ticksExisted + cloudletLife * 2 < maxAge) {
|
||||||
for(int i = 0; i < 20; i++) {
|
|
||||||
|
int toSpawn = (int) Math.ceil(10 * getSimulationSpeed());
|
||||||
|
|
||||||
|
for(int i = 0; i < toSpawn; i++) {
|
||||||
double y = posY + rand.nextGaussian() - 3; //this.ticksExisted < 60 ? this.posY + this.coreHeight : posY + rand.nextGaussian() - 3;
|
double y = posY + rand.nextGaussian() - 3; //this.ticksExisted < 60 ? this.posY + this.coreHeight : posY + rand.nextGaussian() - 3;
|
||||||
Cloudlet cloud = new Cloudlet(posX + rand.nextGaussian() * range, y, posZ + rand.nextGaussian() * range, (float)(rand.nextDouble() * 2D * Math.PI), 0);
|
Cloudlet cloud = new Cloudlet(posX + rand.nextGaussian() * range, y, posZ + rand.nextGaussian() * range, (float)(rand.nextDouble() * 2D * Math.PI), 0);
|
||||||
|
cloud.setScale(1F + this.ticksExisted * 0.001F, 5F);
|
||||||
cloudlets.add(cloud);
|
cloudlets.add(cloud);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -53,10 +57,12 @@ public class EntityNukeTorex extends Entity {
|
|||||||
int cloudCount = ticksExisted * 3;
|
int cloudCount = ticksExisted * 3;
|
||||||
if(ticksExisted < 200) {
|
if(ticksExisted < 200) {
|
||||||
for(int i = 0; i < cloudCount; i++) {
|
for(int i = 0; i < cloudCount; i++) {
|
||||||
Vec3 vec = Vec3.createVectorHelper(ticksExisted + rand.nextDouble(), 0, 0);
|
Vec3 vec = Vec3.createVectorHelper((ticksExisted + rand.nextDouble()) * 2, 0, 0);
|
||||||
float rot = (float) (Math.PI * 2 * rand.nextDouble());
|
float rot = (float) (Math.PI * 2 * rand.nextDouble());
|
||||||
vec.rotateAroundY(rot);
|
vec.rotateAroundY(rot);
|
||||||
this.cloudlets.add(new Cloudlet(vec.xCoord + posX, worldObj.getHeightValue((int) (vec.xCoord + posX) + 2, (int) (vec.zCoord + posZ)), vec.zCoord + posZ, rot, 0));
|
this.cloudlets.add(new Cloudlet(vec.xCoord + posX, worldObj.getHeightValue((int) (vec.xCoord + posX) + 1, (int) (vec.zCoord + posZ)), vec.zCoord + posZ, rot, 0)
|
||||||
|
.setScale(5F, 2F)
|
||||||
|
.setMotion(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,6 +85,16 @@ public class EntityNukeTorex extends Entity {
|
|||||||
this.setDead();
|
this.setDead();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getSimulationSpeed() {
|
||||||
|
|
||||||
|
if(EntityNukeTorex.this.ticksExisted > 45 * 20) {
|
||||||
|
int timeLeft = 1600 - EntityNukeTorex.this.ticksExisted;
|
||||||
|
return MathHelper.clamp_double((double) timeLeft / 900D, 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1.0D;
|
||||||
|
}
|
||||||
|
|
||||||
public class Cloudlet {
|
public class Cloudlet {
|
||||||
|
|
||||||
@ -135,17 +151,11 @@ public class EntityNukeTorex extends Entity {
|
|||||||
this.motionY = convection.yCoord * factor + lift.yCoord * (1D - factor);
|
this.motionY = convection.yCoord * factor + lift.yCoord * (1D - factor);
|
||||||
this.motionZ = convection.zCoord * factor + lift.zCoord * (1D - factor);
|
this.motionZ = convection.zCoord * factor + lift.zCoord * (1D - factor);
|
||||||
|
|
||||||
if(EntityNukeTorex.this.ticksExisted > 45 * 20) {
|
double mult = this.motionMult * getSimulationSpeed();
|
||||||
int timeLeft = 1600 - EntityNukeTorex.this.ticksExisted;
|
|
||||||
double scaled = Math.max((double) timeLeft / 900D, 0);
|
this.posX += this.motionX * mult;
|
||||||
this.motionX *= scaled;
|
this.posY += this.motionY * mult;
|
||||||
this.motionY *= scaled;
|
this.posZ += this.motionZ * mult;
|
||||||
this.motionZ *= scaled;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.posX += this.motionX;
|
|
||||||
this.posY += this.motionY;
|
|
||||||
this.posZ += this.motionZ;
|
|
||||||
|
|
||||||
this.updateColor();
|
this.updateColor();
|
||||||
}
|
}
|
||||||
@ -223,7 +233,6 @@ public class EntityNukeTorex extends Entity {
|
|||||||
|
|
||||||
dist = Math.max(dist, 1);
|
dist = Math.max(dist, 1);
|
||||||
double col = 2D / dist;
|
double col = 2D / dist;
|
||||||
//col *= col;
|
|
||||||
|
|
||||||
this.color = Vec3.createVectorHelper(
|
this.color = Vec3.createVectorHelper(
|
||||||
Math.max(col * 2, 0.25),
|
Math.max(col * 2, 0.25),
|
||||||
@ -245,6 +254,30 @@ public class EntityNukeTorex extends Entity {
|
|||||||
prevColor.yCoord + (color.yCoord - prevColor.yCoord) * interp,
|
prevColor.yCoord + (color.yCoord - prevColor.yCoord) * interp,
|
||||||
prevColor.zCoord + (color.zCoord - prevColor.zCoord) * interp);
|
prevColor.zCoord + (color.zCoord - prevColor.zCoord) * interp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getAlpha() {
|
||||||
|
return 1F - ((float)age / (float)cloudletLife);
|
||||||
|
}
|
||||||
|
|
||||||
|
private float startingScale = 1;
|
||||||
|
private float growingScale = 5F;
|
||||||
|
|
||||||
|
public float getScale() {
|
||||||
|
return startingScale + ((float)age / (float)cloudletLife) * growingScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Cloudlet setScale(float start, float grow) {
|
||||||
|
this.startingScale = start;
|
||||||
|
this.growingScale = grow;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private double motionMult = 1F;
|
||||||
|
|
||||||
|
public Cloudlet setMotion(double mult) {
|
||||||
|
this.motionMult = mult;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
package com.hbm.entity.projectile;
|
package com.hbm.entity.projectile;
|
||||||
|
|
||||||
import com.hbm.entity.logic.IChunkLoader;
|
import com.hbm.entity.logic.IChunkLoader;
|
||||||
|
import com.hbm.items.weapon.ItemAmmoArty;
|
||||||
|
import com.hbm.items.weapon.ItemAmmoArty.ArtilleryShell;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
@ -32,12 +35,18 @@ public class EntityArtilleryShell extends EntityThrowableNT implements IChunkLoa
|
|||||||
private double targetX;
|
private double targetX;
|
||||||
private double targetY;
|
private double targetY;
|
||||||
private double targetZ;
|
private double targetZ;
|
||||||
|
private boolean shouldWhistle = false;
|
||||||
private boolean didWhistle = false;
|
private boolean didWhistle = false;
|
||||||
|
|
||||||
public EntityArtilleryShell(World world) {
|
public EntityArtilleryShell(World world) {
|
||||||
super(world);
|
super(world);
|
||||||
this.ignoreFrustumCheck = true;
|
this.ignoreFrustumCheck = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void entityInit() {
|
||||||
|
this.dataWatcher.addObject(10, new Integer(0));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@ -45,19 +54,36 @@ public class EntityArtilleryShell extends EntityThrowableNT implements IChunkLoa
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityArtilleryShell setType(int type) {
|
||||||
|
this.dataWatcher.updateObject(10, type);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArtilleryShell getType() {
|
||||||
|
try {
|
||||||
|
return ItemAmmoArty.types[this.dataWatcher.getWatchableObjectInt(10)];
|
||||||
|
} catch(Exception ex) {
|
||||||
|
return ItemAmmoArty.types[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setTarget(int x, int y, int z) {
|
public void setTarget(int x, int y, int z) {
|
||||||
this.targetX = x;
|
this.targetX = x;
|
||||||
this.targetY = y;
|
this.targetY = y;
|
||||||
this.targetZ = z;
|
this.targetZ = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setWhistle(boolean whistle) {
|
||||||
|
this.shouldWhistle = whistle;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUpdate() {
|
public void onUpdate() {
|
||||||
|
|
||||||
if(!worldObj.isRemote) {
|
if(!worldObj.isRemote) {
|
||||||
super.onUpdate();
|
super.onUpdate();
|
||||||
|
|
||||||
if(!didWhistle) {
|
if(!didWhistle && this.shouldWhistle) {
|
||||||
double speed = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
double speed = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||||
double deltaX = this.posX - this.targetX;
|
double deltaX = this.posX - this.targetX;
|
||||||
double deltaZ = this.posZ - this.targetZ;
|
double deltaZ = this.posZ - this.targetZ;
|
||||||
@ -127,6 +153,16 @@ public class EntityArtilleryShell extends EntityThrowableNT implements IChunkLoa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeEntityToNBT(NBTTagCompound nbt) {
|
||||||
|
super.writeEntityToNBT(nbt);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readEntityFromNBT(NBTTagCompound nbt) {
|
||||||
|
super.readEntityFromNBT(nbt);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected float getAirDrag() {
|
protected float getAirDrag() {
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
|
|||||||
@ -97,7 +97,7 @@ public abstract class ToolAbility {
|
|||||||
int meta = world.getBlockMetadata(x, y, z);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
int refMeta = world.getBlockMetadata(refX, refY, refZ);
|
int refMeta = world.getBlockMetadata(refX, refY, refZ);
|
||||||
|
|
||||||
if(b != ref)
|
if(!isSameBlock(b, ref))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(meta != refMeta)
|
if(meta != refMeta)
|
||||||
@ -122,6 +122,14 @@ public abstract class ToolAbility {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isSameBlock(Block b1, Block b2) {
|
||||||
|
|
||||||
|
if(b1 == b2) return true;
|
||||||
|
if((b1 == Blocks.redstone_ore && b2 == Blocks.lit_redstone_ore) || (b1 == Blocks.lit_redstone_ore && b2 == Blocks.redstone_ore)) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|||||||
@ -1212,6 +1212,7 @@ public class ModItems {
|
|||||||
public static Item designator;
|
public static Item designator;
|
||||||
public static Item designator_range;
|
public static Item designator_range;
|
||||||
public static Item designator_manual;
|
public static Item designator_manual;
|
||||||
|
public static Item designator_arty_range;
|
||||||
public static Item linker;
|
public static Item linker;
|
||||||
public static Item reactor_sensor;
|
public static Item reactor_sensor;
|
||||||
public static Item oil_detector;
|
public static Item oil_detector;
|
||||||
@ -3976,6 +3977,7 @@ public class ModItems {
|
|||||||
designator = new ItemDesingator().setUnlocalizedName("designator").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":designator");
|
designator = new ItemDesingator().setUnlocalizedName("designator").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":designator");
|
||||||
designator_range = new ItemDesingatorRange().setUnlocalizedName("designator_range").setFull3D().setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":designator_range_alt");
|
designator_range = new ItemDesingatorRange().setUnlocalizedName("designator_range").setFull3D().setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":designator_range_alt");
|
||||||
designator_manual = new ItemDesingatorManual().setUnlocalizedName("designator_manual").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":designator_manual");
|
designator_manual = new ItemDesingatorManual().setUnlocalizedName("designator_manual").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":designator_manual");
|
||||||
|
designator_arty_range = new ItemDesignatorArtyRange().setUnlocalizedName("designator_arty_range").setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":designator_arty_range");
|
||||||
missile_assembly = new Item().setUnlocalizedName("missile_assembly").setMaxStackSize(1).setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":missile_assembly");
|
missile_assembly = new Item().setUnlocalizedName("missile_assembly").setMaxStackSize(1).setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":missile_assembly");
|
||||||
missile_generic = new Item().setUnlocalizedName("missile_generic").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":missile_generic");
|
missile_generic = new Item().setUnlocalizedName("missile_generic").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":missile_generic");
|
||||||
missile_anti_ballistic = new Item().setUnlocalizedName("missile_anti_ballistic").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":missile_anti_ballistic");
|
missile_anti_ballistic = new Item().setUnlocalizedName("missile_anti_ballistic").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":missile_anti_ballistic");
|
||||||
@ -6926,6 +6928,7 @@ public class ModItems {
|
|||||||
GameRegistry.registerItem(designator, designator.getUnlocalizedName());
|
GameRegistry.registerItem(designator, designator.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(designator_range, designator_range.getUnlocalizedName());
|
GameRegistry.registerItem(designator_range, designator_range.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(designator_manual, designator_manual.getUnlocalizedName());
|
GameRegistry.registerItem(designator_manual, designator_manual.getUnlocalizedName());
|
||||||
|
GameRegistry.registerItem(designator_arty_range, designator_arty_range.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(turret_control, turret_control.getUnlocalizedName());
|
GameRegistry.registerItem(turret_control, turret_control.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(turret_chip, turret_chip.getUnlocalizedName());
|
GameRegistry.registerItem(turret_chip, turret_chip.getUnlocalizedName());
|
||||||
//GameRegistry.registerItem(turret_biometry, turret_biometry.getUnlocalizedName());
|
//GameRegistry.registerItem(turret_biometry, turret_biometry.getUnlocalizedName());
|
||||||
|
|||||||
@ -0,0 +1,93 @@
|
|||||||
|
package com.hbm.items.tool;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.hbm.blocks.ModBlocks;
|
||||||
|
import com.hbm.blocks.turret.TurretArty;
|
||||||
|
import com.hbm.lib.Library;
|
||||||
|
import com.hbm.tileentity.turret.TileEntityTurretArty;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class ItemDesignatorArtyRange extends Item {
|
||||||
|
|
||||||
|
public ItemDesignatorArtyRange() {
|
||||||
|
this.setFull3D();
|
||||||
|
this.setMaxStackSize(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
|
||||||
|
if(itemstack.getTagCompound() == null) {
|
||||||
|
list.add(EnumChatFormatting.RED + "No turret linked!");
|
||||||
|
} else {
|
||||||
|
list.add(EnumChatFormatting.YELLOW + "Linked to " + itemstack.stackTagCompound.getInteger("x") + ", " + itemstack.stackTagCompound.getInteger("y") + ", " + itemstack.stackTagCompound.getInteger("z"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
|
||||||
|
|
||||||
|
Block b = world.getBlock(x, y, z);
|
||||||
|
|
||||||
|
if(b == ModBlocks.turret_arty) {
|
||||||
|
int pos[] = ((TurretArty) b).findCore(world, x, y, z);
|
||||||
|
|
||||||
|
if(pos == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||||
|
|
||||||
|
if(te instanceof TileEntityTurretArty) {
|
||||||
|
|
||||||
|
if(world.isRemote)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if(!stack.hasTagCompound())
|
||||||
|
stack.stackTagCompound = new NBTTagCompound();
|
||||||
|
|
||||||
|
stack.stackTagCompound.setInteger("x", pos[0]);
|
||||||
|
stack.stackTagCompound.setInteger("y", pos[1]);
|
||||||
|
stack.stackTagCompound.setInteger("z", pos[2]);
|
||||||
|
world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||||
|
|
||||||
|
if(!stack.hasTagCompound())
|
||||||
|
return stack;
|
||||||
|
|
||||||
|
MovingObjectPosition pos = Library.rayTrace(player, 500, 1);
|
||||||
|
int x = pos.blockX;
|
||||||
|
int y = pos.blockY;
|
||||||
|
int z = pos.blockZ;
|
||||||
|
|
||||||
|
if(!world.isRemote) {
|
||||||
|
TileEntity te = world.getTileEntity(stack.stackTagCompound.getInteger("x"), stack.stackTagCompound.getInteger("y"), stack.stackTagCompound.getInteger("z"));
|
||||||
|
|
||||||
|
if(te instanceof TileEntityTurretArty) {
|
||||||
|
TileEntityTurretArty arty = (TileEntityTurretArty) te;
|
||||||
|
if(arty.mode == arty.MODE_MANUAL) {
|
||||||
|
arty.enqueueTarget(x + 0.5, y + 0.5, z + 0.5);
|
||||||
|
world.playSoundAtEntity(player, "hbm:item.techBoop", 1.0F, 1.0F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,9 +2,9 @@ package com.hbm.items.weapon;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.hbm.entity.projectile.EntityArtilleryShell;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.util.EnumUtil;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -13,45 +13,40 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
|
|
||||||
public class ItemAmmoArty extends Item {
|
public class ItemAmmoArty extends Item {
|
||||||
|
|
||||||
public static enum EnumArtyType {
|
public static ArtilleryShell[] types = new ArtilleryShell[5];
|
||||||
NORMAL("ammo_arty"),
|
public int NORMAL = 0;
|
||||||
CLASSIC("ammo_arty_classic"),
|
public int CLASSIC = 1;
|
||||||
EXPLOSIVE("ammo_arty_he"),
|
public int EXPLOSIVE = 2;
|
||||||
MINI_NUKE("ammo_arty_mini_nuke"),
|
public int MINI_NUKE = 3;
|
||||||
NUKE("ammo_arty_nuke");
|
public int NUKE = 4;
|
||||||
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
private EnumArtyType(String texture) {
|
|
||||||
this.name = texture;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemAmmoArty() {
|
public ItemAmmoArty() {
|
||||||
this.setHasSubtypes(true);
|
this.setHasSubtypes(true);
|
||||||
this.setCreativeTab(MainRegistry.weaponTab);
|
this.setCreativeTab(MainRegistry.weaponTab);
|
||||||
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||||
for(int i = 0; i < EnumArtyType.values().length; i++) {
|
for(int i = 0; i < types.length; i++) {
|
||||||
list.add(new ItemStack(item, 1, i));
|
list.add(new ItemStack(item, 1, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IIcon[] icons = new IIcon[EnumArtyType.values().length];
|
private IIcon[] icons = new IIcon[types.length];
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerIcons(IIconRegister reg) {
|
public void registerIcons(IIconRegister reg) {
|
||||||
|
|
||||||
this.icons = new IIcon[EnumArtyType.values().length];
|
this.icons = new IIcon[types.length];
|
||||||
|
|
||||||
for(int i = 0; i < icons.length; i++) {
|
for(int i = 0; i < icons.length; i++) {
|
||||||
this.icons[i] = reg.registerIcon(RefStrings.MODID + ":" + EnumArtyType.values()[i].name);
|
this.icons[i] = reg.registerIcon(RefStrings.MODID + ":" + types[i].name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +58,45 @@ public class ItemAmmoArty extends Item {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUnlocalizedName(ItemStack stack) {
|
public String getUnlocalizedName(ItemStack stack) {
|
||||||
EnumArtyType num = EnumUtil.grabEnumSafely(EnumArtyType.class, stack.getItemDamage());
|
return "item." + types[Math.abs(stack.getItemDamage()) % types.length].name;
|
||||||
return "item." + num.name;
|
}
|
||||||
|
|
||||||
|
public static abstract class ArtilleryShell {
|
||||||
|
|
||||||
|
String name;
|
||||||
|
|
||||||
|
public ArtilleryShell(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
this.types[NORMAL] = new ArtilleryShell("ammo_arty") {
|
||||||
|
@Override public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
|
||||||
|
shell.setDead();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.types[CLASSIC] = new ArtilleryShell("ammo_arty") {
|
||||||
|
@Override public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
|
||||||
|
shell.setDead();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.types[EXPLOSIVE] = new ArtilleryShell("ammo_arty") {
|
||||||
|
@Override public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
|
||||||
|
shell.setDead();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.types[MINI_NUKE] = new ArtilleryShell("ammo_arty") {
|
||||||
|
@Override public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
|
||||||
|
shell.setDead();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.types[NUKE] = new ArtilleryShell("ammo_arty") {
|
||||||
|
@Override public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
|
||||||
|
shell.setDead();
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,8 +84,8 @@ public class RenderTorex extends Render {
|
|||||||
|
|
||||||
private void tessellateCloudlet(Tessellator tess, double posX, double posY, double posZ, Cloudlet cloud, float interp) {
|
private void tessellateCloudlet(Tessellator tess, double posX, double posY, double posZ, Cloudlet cloud, float interp) {
|
||||||
|
|
||||||
float alpha = 1F - ((float)cloud.age / (float)EntityNukeTorex.cloudletLife);
|
float alpha = cloud.getAlpha();
|
||||||
float scale = 1F + ((float)cloud.age / (float)EntityNukeTorex.cloudletLife) * 5;
|
float scale = cloud.getScale();
|
||||||
|
|
||||||
float f1 = ActiveRenderInfo.rotationX;
|
float f1 = ActiveRenderInfo.rotationX;
|
||||||
float f2 = ActiveRenderInfo.rotationZ;
|
float f2 = ActiveRenderInfo.rotationZ;
|
||||||
@ -93,8 +93,6 @@ public class RenderTorex extends Render {
|
|||||||
float f4 = ActiveRenderInfo.rotationXY;
|
float f4 = ActiveRenderInfo.rotationXY;
|
||||||
float f5 = ActiveRenderInfo.rotationXZ;
|
float f5 = ActiveRenderInfo.rotationXZ;
|
||||||
|
|
||||||
//Random rand = new Random((long) ((posX * 5 + posY * 25 + posZ * 125) * 1000D));
|
|
||||||
|
|
||||||
float brightness = 0.75F * cloud.colorMod;
|
float brightness = 0.75F * cloud.colorMod;
|
||||||
Vec3 color = cloud.getInterpColor(interp);
|
Vec3 color = cloud.getInterpColor(interp);
|
||||||
tess.setColorRGBA_F((float)color.xCoord * brightness, (float)color.yCoord * brightness, (float)color.zCoord * brightness, alpha);
|
tess.setColorRGBA_F((float)color.xCoord * brightness, (float)color.yCoord * brightness, (float)color.zCoord * brightness, alpha);
|
||||||
|
|||||||
@ -3,13 +3,11 @@ package com.hbm.tileentity.machine;
|
|||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManager;
|
||||||
import com.hbm.inventory.container.ContainerFurnaceIron;
|
import com.hbm.inventory.container.ContainerFurnaceIron;
|
||||||
import com.hbm.inventory.gui.GUIFurnaceIron;
|
import com.hbm.inventory.gui.GUIFurnaceIron;
|
||||||
import com.hbm.items.ModItems;
|
|
||||||
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
||||||
import com.hbm.module.ModuleBurnTime;
|
import com.hbm.module.ModuleBurnTime;
|
||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
|
|
||||||
import api.hbm.energy.IBatteryItem;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
@ -18,7 +16,6 @@ import net.minecraft.inventory.Container;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntityFurnace;
|
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
@ -180,6 +177,24 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI
|
|||||||
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
|
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
|
||||||
return i == 3;
|
return i == 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
|
super.readFromNBT(nbt);
|
||||||
|
|
||||||
|
this.maxBurnTime = nbt.getInteger("maxBurnTime");
|
||||||
|
this.burnTime = nbt.getInteger("burnTime");
|
||||||
|
this.progress = nbt.getInteger("progress");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound nbt) {
|
||||||
|
super.writeToNBT(nbt);
|
||||||
|
|
||||||
|
nbt.setInteger("maxBurnTime", maxBurnTime);
|
||||||
|
nbt.setInteger("burnTime", burnTime);
|
||||||
|
nbt.setInteger("progress", progress);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
@ -187,6 +202,7 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
return new GUIFurnaceIron(player.inventory, this);
|
return new GUIFurnaceIron(player.inventory, this);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,6 +82,7 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyUser
|
|||||||
if (age == 9 || age == 19)
|
if (age == 9 || age == 19)
|
||||||
fillFluidInit(tanks[1].getTankType());
|
fillFluidInit(tanks[1].getTankType());
|
||||||
|
|
||||||
|
this.updateConnections();
|
||||||
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||||
|
|
||||||
/// START Processing part ///
|
/// START Processing part ///
|
||||||
@ -165,9 +166,6 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyUser
|
|||||||
|
|
||||||
this.networkPack(data, 250);
|
this.networkPack(data, 250);
|
||||||
/// END Notif packets ///
|
/// END Notif packets ///
|
||||||
|
|
||||||
this.trySubscribe(worldObj, xCoord, yCoord + 3, zCoord, ForgeDirection.UP);
|
|
||||||
this.trySubscribe(worldObj, xCoord, yCoord - 3, zCoord, ForgeDirection.DOWN);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -185,6 +183,20 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyUser
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateConnections() {
|
||||||
|
|
||||||
|
this.trySubscribe(worldObj, xCoord, yCoord + 3, zCoord, ForgeDirection.UP);
|
||||||
|
this.trySubscribe(worldObj, xCoord, yCoord - 3, zCoord, ForgeDirection.DOWN);
|
||||||
|
|
||||||
|
Vec3 vec = Vec3.createVectorHelper(5.75, 0, 0);
|
||||||
|
|
||||||
|
for(int i = 0; i < 16; i++) {
|
||||||
|
vec.rotateAroundY((float) (Math.PI / 8));
|
||||||
|
this.trySubscribe(worldObj, xCoord + (int)vec.xCoord, yCoord + 3, zCoord + (int)vec.zCoord, ForgeDirection.UP);
|
||||||
|
this.trySubscribe(worldObj, xCoord + (int)vec.xCoord, yCoord - 3, zCoord + (int)vec.zCoord, ForgeDirection.DOWN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void explode() {
|
private void explode() {
|
||||||
this.disassemble();
|
this.disassemble();
|
||||||
|
|
||||||
|
|||||||
@ -14,14 +14,13 @@ import com.hbm.packet.PacketDispatcher;
|
|||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.potion.Potion;
|
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@ -35,6 +34,8 @@ public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUI
|
|||||||
private boolean retracting = false;
|
private boolean retracting = false;
|
||||||
public double barrelPos = 0;
|
public double barrelPos = 0;
|
||||||
public double lastBarrelPos = 0;
|
public double lastBarrelPos = 0;
|
||||||
|
|
||||||
|
private List<Vec3> targetQueue = new ArrayList();
|
||||||
|
|
||||||
static List<Integer> configs = new ArrayList();
|
static List<Integer> configs = new ArrayList();
|
||||||
|
|
||||||
@ -46,6 +47,10 @@ public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUI
|
|||||||
configs.add(BulletConfigSyncingUtil.SHELL_W9);
|
configs.add(BulletConfigSyncingUtil.SHELL_W9);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void enqueueTarget(double x, double y, double z) {
|
||||||
|
this.targetQueue.add(Vec3.createVectorHelper(x, y, z));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<Integer> getAmmoList() {
|
protected List<Integer> getAmmoList() {
|
||||||
return configs;
|
return configs;
|
||||||
@ -195,7 +200,104 @@ public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.updateEntity();
|
if(this.mode == this.MODE_MANUAL) {
|
||||||
|
if(!this.targetQueue.isEmpty()) {
|
||||||
|
this.tPos = this.targetQueue.get(0);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.targetQueue.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(worldObj.isRemote) {
|
||||||
|
this.lastRotationPitch = this.rotationPitch;
|
||||||
|
this.lastRotationYaw = this.rotationYaw;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.aligned = false;
|
||||||
|
|
||||||
|
if(!worldObj.isRemote) {
|
||||||
|
|
||||||
|
if(this.target != null && !target.isEntityAlive()) {
|
||||||
|
this.target = null;
|
||||||
|
this.stattrak++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(target != null && this.mode != this.MODE_MANUAL) {
|
||||||
|
if(!this.entityInLOS(this.target)) {
|
||||||
|
this.target = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!worldObj.isRemote) {
|
||||||
|
|
||||||
|
if(target != null) {
|
||||||
|
this.tPos = this.getEntityPos(target);
|
||||||
|
} else {
|
||||||
|
if(this.mode != this.MODE_MANUAL) {
|
||||||
|
this.tPos = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isOn() && hasPower()) {
|
||||||
|
|
||||||
|
if(tPos != null)
|
||||||
|
this.alignTurret();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
this.target = null;
|
||||||
|
this.tPos = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!worldObj.isRemote) {
|
||||||
|
|
||||||
|
if(this.target != null && !target.isEntityAlive()) {
|
||||||
|
this.target = null;
|
||||||
|
this.tPos = null;
|
||||||
|
this.stattrak++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isOn() && hasPower()) {
|
||||||
|
searchTimer--;
|
||||||
|
|
||||||
|
this.setPower(this.getPower() - this.getConsumption());
|
||||||
|
|
||||||
|
if(searchTimer <= 0) {
|
||||||
|
searchTimer = this.getDecetorInterval();
|
||||||
|
|
||||||
|
if(this.target == null)
|
||||||
|
this.seekNewTarget();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
searchTimer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.aligned) {
|
||||||
|
this.updateFiringTick();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.power = Library.chargeTEFromItems(slots, 10, this.power, this.getMaxPower());
|
||||||
|
|
||||||
|
NBTTagCompound data = this.writePacket();
|
||||||
|
this.networkPack(data, 250);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
Vec3 vec = Vec3.createVectorHelper(this.getBarrelLength(), 0, 0);
|
||||||
|
vec.rotateAroundZ((float) -this.rotationPitch);
|
||||||
|
vec.rotateAroundY((float) -(this.rotationYaw + Math.PI * 0.5));
|
||||||
|
|
||||||
|
//this will fix the interpolation error when the turret crosses the 360° point
|
||||||
|
if(Math.abs(this.lastRotationYaw - this.rotationYaw) > Math.PI) {
|
||||||
|
|
||||||
|
if(this.lastRotationYaw < this.rotationYaw)
|
||||||
|
this.lastRotationYaw += Math.PI * 2;
|
||||||
|
else
|
||||||
|
this.lastRotationYaw -= Math.PI * 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.didJustShoot = false;
|
this.didJustShoot = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,6 +322,11 @@ public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUI
|
|||||||
vec.rotateAroundY((float) -(this.rotationYaw + Math.PI * 0.5));
|
vec.rotateAroundY((float) -(this.rotationYaw + Math.PI * 0.5));
|
||||||
this.didJustShoot = true;
|
this.didJustShoot = true;
|
||||||
|
|
||||||
|
if(this.mode == this.MODE_MANUAL && !this.targetQueue.isEmpty()) {
|
||||||
|
this.targetQueue.remove(0);
|
||||||
|
this.tPos = null;
|
||||||
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
data.setString("type", "vanillaExt");
|
data.setString("type", "vanillaExt");
|
||||||
data.setString("mode", "largeexplode");
|
data.setString("mode", "largeexplode");
|
||||||
@ -262,6 +369,7 @@ public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
return new GUITurretArty(player.inventory, this);
|
return new GUITurretArty(player.inventory, this);
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
src/main/resources/assets/hbm/textures/items/designator_arty.png
Normal file
BIN
src/main/resources/assets/hbm/textures/items/designator_arty.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 299 B |
Binary file not shown.
|
After Width: | Height: | Size: 259 B |
Loading…
x
Reference in New Issue
Block a user