mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
balls-o-tron progress: 20%
This commit is contained in:
parent
10a404fb4e
commit
95b359acd3
Binary file not shown.
|
Before Width: | Height: | Size: 330 B After Width: | Height: | Size: 563 B |
BIN
src/main/java/assets/hbm/textures/items/drax_mk2.png
Normal file
BIN
src/main/java/assets/hbm/textures/items/drax_mk2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 516 B |
BIN
src/main/java/assets/hbm/textures/items/drax_mk3.png
Normal file
BIN
src/main/java/assets/hbm/textures/items/drax_mk3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 509 B |
@ -1,7 +1,13 @@
|
||||
package com.hbm.entity.mob.sodtekhnologiyah;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityBallsOTronBase extends EntityWormBase {
|
||||
|
||||
public EntityBallsOTronBase(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeadID() {
|
||||
return 0;
|
||||
|
||||
@ -2,6 +2,7 @@ package com.hbm.entity.mob.sodtekhnologiyah;
|
||||
|
||||
import net.minecraft.entity.boss.IBossDisplayData;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityBallsOTronHead extends EntityBallsOTronBase implements IBossDisplayData {
|
||||
|
||||
@ -11,14 +12,8 @@ public class EntityBallsOTronHead extends EntityBallsOTronBase implements IBossD
|
||||
* |___/_/ \_\____|____|___/ |___| |_| |_|\_\___|_|\_|
|
||||
*/
|
||||
|
||||
@Override
|
||||
public float getMaxHealth() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getHealth() {
|
||||
return 0;
|
||||
public EntityBallsOTronHead(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -1,5 +1,11 @@
|
||||
package com.hbm.entity.mob.sodtekhnologiyah;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityBallsOTronSegment extends EntityBallsOTronBase {
|
||||
|
||||
public EntityBallsOTronSegment(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,84 @@
|
||||
package com.hbm.entity.mob.sodtekhnologiyah;
|
||||
|
||||
public abstract class EntityBurrowing {
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class EntityBurrowing extends EntityCreature {
|
||||
|
||||
protected float dragInAir;
|
||||
protected float dragInGround;
|
||||
|
||||
public EntityBurrowing(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
/*
|
||||
* No need to update this
|
||||
*/
|
||||
protected void fall(float dist) { }
|
||||
|
||||
/*
|
||||
* Our "eye"-height should always be centered
|
||||
*/
|
||||
public float getEyeHeight() {
|
||||
return this.height * 0.5F;
|
||||
}
|
||||
|
||||
public boolean getIsHead() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* No fall damage :P
|
||||
*/
|
||||
protected void updateFallState(double distFallen, boolean onGround) { }
|
||||
|
||||
public void moveEntityWithHeading(float strafe, float forward) {
|
||||
|
||||
float drag = this.dragInGround;
|
||||
if ((!isEntityInsideOpaqueBlock()) && (!isInWater()) && (!handleLavaMovement()))
|
||||
{
|
||||
drag = this.dragInAir;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.distanceWalkedModified = ((float)(this.distanceWalkedModified + Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ) * 0.4D));
|
||||
this.distanceWalkedOnStepModified = ((float)(this.distanceWalkedOnStepModified + Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ + this.motionY * this.motionY) * 0.4D));
|
||||
/*if (this.distanceWalkedOnStepModified > this.nextStepDistance)
|
||||
{
|
||||
//this.nextStepDistance = ((int)this.distanceWalkedOnStepModified + 1);
|
||||
if (isInWater())
|
||||
{
|
||||
float var39 = (float) (Math.sqrt(this.motionX * this.motionX * 0.2D + this.motionY * this.motionY + this.motionZ * this.motionZ * 0.2) * 0.35F);
|
||||
if (var39 > 1.0F) {
|
||||
var39 = 1.0F;
|
||||
}
|
||||
playSound("liquid.swim", var39, 1.0F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.4F);
|
||||
}
|
||||
if (getIsHead()) {
|
||||
playSound("alexmod.destroyer.dig", getSoundVolume(), 1.0F);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
if (!getIsHead()) {
|
||||
drag *= 0.9F;
|
||||
}
|
||||
moveFlying(strafe, forward, 0.02F);
|
||||
|
||||
moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
this.motionX *= drag;
|
||||
this.motionY *= drag;
|
||||
this.motionZ *= drag;
|
||||
|
||||
this.prevLimbSwingAmount = this.limbSwingAmount;
|
||||
double var10 = this.posX - this.prevPosX;
|
||||
double var9 = this.posZ - this.prevPosZ;
|
||||
float var7 = (float) Math.sqrt(var10 * var10 + var9 * var9) * 4.0F;
|
||||
if (var7 > 1.0F) {
|
||||
var7 = 1.0F;
|
||||
}
|
||||
this.limbSwingAmount += (var7 - this.limbSwingAmount) * 0.4F;
|
||||
this.limbSwing += this.limbSwingAmount;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,14 +1,179 @@
|
||||
package com.hbm.entity.mob.sodtekhnologiyah;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.command.IEntitySelector;
|
||||
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.ChunkCoordinates;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.EnumDifficulty;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class EntityWormBase extends EntityBurrowing {
|
||||
|
||||
public abstract int getHeadID();
|
||||
public int aggroCooldown = 0;
|
||||
public int courseChangeCooldown = 0;
|
||||
public double waypointX;
|
||||
public double waypointY;
|
||||
public double waypointZ;
|
||||
protected Entity targetedEntity = null;
|
||||
protected boolean canFly = false;
|
||||
protected int dmgCooldown = 0;
|
||||
protected boolean wasNearGround;
|
||||
protected ChunkCoordinates spawnPoint = new ChunkCoordinates();
|
||||
protected double attackRange;
|
||||
protected double maxSpeed;
|
||||
protected double fallSpeed;
|
||||
protected double rangeForParts;
|
||||
protected EntityWormBase followed;
|
||||
protected int surfaceY;
|
||||
private int uniqueWormID;
|
||||
private int partID;
|
||||
protected boolean didCheck;
|
||||
protected double bodySpeed;
|
||||
protected double maxBodySpeed;
|
||||
protected double segmentDistance;
|
||||
protected double knockbackDivider;
|
||||
protected int attackTick;
|
||||
|
||||
public abstract int getPartID();
|
||||
public static final IEntitySelector wormSelector = new IEntitySelector() {
|
||||
|
||||
public abstract boolean getIsHead();
|
||||
@Override
|
||||
public boolean isEntityApplicable(Entity target) {
|
||||
return target instanceof EntityWormBase;
|
||||
}
|
||||
};
|
||||
|
||||
public abstract void setPartID(int id);
|
||||
public EntityWormBase(World world) {
|
||||
super(world);
|
||||
this.setSize(1.0F, 1.0F);
|
||||
this.surfaceY = 60;
|
||||
this.renderDistanceWeight = 5.0D;
|
||||
}
|
||||
|
||||
public abstract void setHeadID(int id);
|
||||
public int getPartID() {
|
||||
return this.partID;
|
||||
}
|
||||
|
||||
public void setPartID(int par1) {
|
||||
this.partID = par1;
|
||||
}
|
||||
|
||||
public int getUniqueWormID() {
|
||||
return this.uniqueWormID;
|
||||
}
|
||||
|
||||
public void setUniqueWormID(int par1) {
|
||||
this.uniqueWormID = par1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource source, float amount) {
|
||||
|
||||
if(this.isEntityInvulnerable() || source == DamageSource.drown || source == DamageSource.inWall ||
|
||||
((source.getEntity() instanceof EntityWormBase) && ((EntityWormBase) source.getEntity()).uniqueWormID == this.uniqueWormID)) {
|
||||
return false;
|
||||
} else {
|
||||
this.setBeenAttacked();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateEntityActionState() {
|
||||
|
||||
if((!this.worldObj.isRemote) && (this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL)) {
|
||||
setDead();
|
||||
}
|
||||
if((this.targetedEntity != null) && (this.targetedEntity.isDead)) {
|
||||
this.targetedEntity = null;
|
||||
}
|
||||
if((getIsHead()) && (this.targetedEntity != null) && ((this.targetedEntity instanceof EntityPlayer))) {
|
||||
this.entityAge = 0;
|
||||
}
|
||||
if(this.posY < -10.0D) {
|
||||
setPositionAndUpdate(this.posX, 128.0D, this.posZ);
|
||||
this.motionY = 0.0D;
|
||||
} else if(this.posY < 3.0D) {
|
||||
this.motionY = 0.3D;
|
||||
}
|
||||
this.attackTick = Math.max(this.attackTick - 1, 0);
|
||||
if(this.attackTick == 0) {
|
||||
this.attackTick = 10;
|
||||
|
||||
attackEntitiesInList(this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(0.5D, 0.5D, 0.5D)));
|
||||
}
|
||||
}
|
||||
|
||||
protected void attackEntitiesInList(List<Entity> par1List) {
|
||||
|
||||
for(Entity var3 : par1List) {
|
||||
if(((var3 instanceof EntityLivingBase)) && (canAttackClass(var3.getClass()))
|
||||
&& ((!(var3 instanceof EntityWormBase)) || (((EntityWormBase) var3).getUniqueWormID() != getUniqueWormID()))) {
|
||||
attackEntityAsMob(var3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAttackClass(Class clazz) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityAsMob(Entity par1Entity) {
|
||||
|
||||
boolean var2 = par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), getAttackStrength(par1Entity));
|
||||
|
||||
if(var2) {
|
||||
this.entityAge = 0;
|
||||
double var5 = (this.boundingBox.minX + this.boundingBox.maxX) / 2.0D;
|
||||
double var6 = (this.boundingBox.minZ + this.boundingBox.maxZ) / 2.0D;
|
||||
double var7 = (this.boundingBox.minY + this.boundingBox.maxY) / 2.0D;
|
||||
double var8 = par1Entity.posX - var5;
|
||||
double var10 = par1Entity.posZ - var6;
|
||||
double var11 = par1Entity.posY - var7;
|
||||
double var12 = this.knockbackDivider * (var8 * var8 + var10 * var10 + var11 * var11 + 0.1D);
|
||||
par1Entity.addVelocity(var8 / var12, var11 / var12, var10 / var12);
|
||||
}
|
||||
|
||||
return var2;
|
||||
}
|
||||
|
||||
public abstract float getAttackStrength(Entity paramsa);
|
||||
|
||||
@Override
|
||||
public void addVelocity(double x, double y, double z) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void faceEntity(Entity entity, float yaw, float pitch) {
|
||||
}
|
||||
|
||||
protected boolean isCourseTraversable() {
|
||||
return (this.canFly) || (isEntityInsideOpaqueBlock());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getSoundVolume() {
|
||||
return 5.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead() {
|
||||
playSound(getDeathSound(), getSoundVolume(), getSoundPitch());
|
||||
super.setDead();
|
||||
}
|
||||
|
||||
public void writeEntityToNBT(NBTTagCompound nbt) {
|
||||
super.writeEntityToNBT(nbt);
|
||||
nbt.setInteger("wormID", this.getUniqueWormID());
|
||||
}
|
||||
|
||||
public void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
super.readEntityFromNBT(nbt);
|
||||
setUniqueWormID(nbt.getInteger("wormID"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
package com.hbm.entity.mob.sodtekhnologiyah;
|
||||
|
||||
public class WormMovementBody {
|
||||
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
package com.hbm.entity.mob.sodtekhnologiyah;
|
||||
|
||||
public class WormMovementHead {
|
||||
|
||||
}
|
||||
@ -5,6 +5,7 @@ import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class RecipesCommon {
|
||||
@ -222,8 +223,37 @@ public class RecipesCommon {
|
||||
|
||||
NBTTagCompound nbt;
|
||||
|
||||
public ComparableNBTStack(ItemStack stack) {
|
||||
super(stack);
|
||||
}
|
||||
|
||||
public ComparableNBTStack(Item item) {
|
||||
super(item);
|
||||
}
|
||||
|
||||
public ComparableNBTStack(Block item) {
|
||||
super(item);
|
||||
}
|
||||
|
||||
public ComparableNBTStack(Block item, int stacksize) {
|
||||
super(item, stacksize);
|
||||
}
|
||||
|
||||
public ComparableNBTStack(Block item, int stacksize, int meta) {
|
||||
super(item, stacksize, meta);
|
||||
}
|
||||
|
||||
public ComparableNBTStack(Item item, int stacksize) {
|
||||
super(item, stacksize);
|
||||
}
|
||||
|
||||
public ComparableNBTStack(Item item, int stacksize, int meta) {
|
||||
super(item, stacksize, meta);
|
||||
}
|
||||
|
||||
public ComparableNBTStack addNBT(NBTTagCompound nbt) {
|
||||
this.nbt = nbt;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemStack toStack() {
|
||||
|
||||
@ -13,8 +13,6 @@ import net.minecraft.world.World;
|
||||
|
||||
public class ItemModDoor extends Item
|
||||
{
|
||||
private static final String __OBFID = "CL_00000020";
|
||||
|
||||
public ItemModDoor()
|
||||
{
|
||||
this.maxStackSize = 1;
|
||||
|
||||
@ -19,7 +19,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.play.client.C07PacketPlayerDigging;
|
||||
import net.minecraft.network.play.server.S23PacketBlockChange;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
@ -165,22 +164,6 @@ public class ItemSwordAbility extends ItemSword implements IItemAbility {
|
||||
}
|
||||
}
|
||||
|
||||
private int getAbility(ItemStack stack) {
|
||||
|
||||
if(stack.hasTagCompound())
|
||||
return stack.stackTagCompound.getInteger("ability");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void setAbility(ItemStack stack, int ability) {
|
||||
|
||||
if(!stack.hasTagCompound())
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
|
||||
stack.stackTagCompound.setInteger("ability", ability);
|
||||
}
|
||||
|
||||
protected boolean canOperate(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -4,13 +4,14 @@ import java.util.List;
|
||||
|
||||
import com.hbm.lib.Library;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ItemSwordAbilityPower extends ItemSwordAbility {
|
||||
public class ItemSwordAbilityPower extends ItemSwordAbility implements IBatteryItem {
|
||||
|
||||
public long maxPower = 1;
|
||||
public long chargeRate;
|
||||
@ -23,7 +24,8 @@ public class ItemSwordAbilityPower extends ItemSwordAbility {
|
||||
this.consumption = consumption;
|
||||
this.setMaxDamage(1);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void chargeBattery(ItemStack stack, long i) {
|
||||
if(stack.getItem() instanceof ItemSwordAbilityPower) {
|
||||
if(stack.hasTagCompound()) {
|
||||
@ -34,7 +36,8 @@ public class ItemSwordAbilityPower extends ItemSwordAbility {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setCharge(ItemStack stack, long i) {
|
||||
if(stack.getItem() instanceof ItemSwordAbilityPower) {
|
||||
if(stack.hasTagCompound()) {
|
||||
@ -45,7 +48,8 @@ public class ItemSwordAbilityPower extends ItemSwordAbility {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void dischargeBattery(ItemStack stack, long i) {
|
||||
if(stack.getItem() instanceof ItemSwordAbilityPower) {
|
||||
if(stack.hasTagCompound()) {
|
||||
@ -59,8 +63,9 @@ public class ItemSwordAbilityPower extends ItemSwordAbility {
|
||||
stack.stackTagCompound.setLong("charge", 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static long getCharge(ItemStack stack) {
|
||||
|
||||
@Override
|
||||
public long getCharge(ItemStack stack) {
|
||||
if(stack.getItem() instanceof ItemSwordAbilityPower) {
|
||||
if(stack.hasTagCompound()) {
|
||||
return stack.stackTagCompound.getLong("charge");
|
||||
@ -81,39 +86,47 @@ public class ItemSwordAbilityPower extends ItemSwordAbility {
|
||||
|
||||
super.addInformation(stack, player, list, ext);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
|
||||
return getCharge(stack) < maxPower;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
|
||||
return 1 - (double)getCharge(stack) / (double)maxPower;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected boolean canOperate(ItemStack stack) {
|
||||
|
||||
return getCharge(stack) >= this.consumption;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getMaxCharge() {
|
||||
return maxPower;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getChargeRate() {
|
||||
return chargeRate;
|
||||
}
|
||||
|
||||
public static long getMaxChargeStatic(ItemStack stack) {
|
||||
return ((ItemSwordAbilityPower)stack.getItem()).maxPower;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getDischargeRate() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDamage(ItemStack stack, int damage)
|
||||
{
|
||||
this.dischargeBattery(stack, damage * consumption);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isDamageable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ public class ItemToolAbility extends ItemTool implements IItemAbility {
|
||||
Sets.newHashSet(new Block[] { Blocks.grass, Blocks.dirt, Blocks.sand, Blocks.gravel, Blocks.snow_layer, Blocks.snow, Blocks.clay, Blocks.farmland, Blocks.soul_sand, Blocks.mycelium })
|
||||
),
|
||||
MINER(
|
||||
Sets.newHashSet(new Material[] { Material.iron, Material.anvil, Material.rock, Material.clay, Material.sand, Material.ground, Material.snow, Material.craftedSnow })
|
||||
Sets.newHashSet(new Material[] { Material.grass, Material.iron, Material.anvil, Material.rock, Material.clay, Material.sand, Material.ground, Material.snow, Material.craftedSnow })
|
||||
);
|
||||
|
||||
private EnumToolType(Set<Material> materials) {
|
||||
|
||||
@ -4,13 +4,14 @@ import java.util.List;
|
||||
|
||||
import com.hbm.lib.Library;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ItemToolAbilityPower extends ItemToolAbility {
|
||||
public class ItemToolAbilityPower extends ItemToolAbility implements IBatteryItem {
|
||||
|
||||
public long maxPower = 1;
|
||||
public long chargeRate;
|
||||
@ -23,7 +24,8 @@ public class ItemToolAbilityPower extends ItemToolAbility {
|
||||
this.consumption = consumption;
|
||||
this.setMaxDamage(1);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void chargeBattery(ItemStack stack, long i) {
|
||||
if(stack.getItem() instanceof ItemToolAbilityPower) {
|
||||
if(stack.hasTagCompound()) {
|
||||
@ -34,7 +36,8 @@ public class ItemToolAbilityPower extends ItemToolAbility {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setCharge(ItemStack stack, long i) {
|
||||
if(stack.getItem() instanceof ItemToolAbilityPower) {
|
||||
if(stack.hasTagCompound()) {
|
||||
@ -45,7 +48,8 @@ public class ItemToolAbilityPower extends ItemToolAbility {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void dischargeBattery(ItemStack stack, long i) {
|
||||
if(stack.getItem() instanceof ItemToolAbilityPower) {
|
||||
if(stack.hasTagCompound()) {
|
||||
@ -59,8 +63,9 @@ public class ItemToolAbilityPower extends ItemToolAbility {
|
||||
stack.stackTagCompound.setLong("charge", 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static long getCharge(ItemStack stack) {
|
||||
|
||||
@Override
|
||||
public long getCharge(ItemStack stack) {
|
||||
if(stack.getItem() instanceof ItemToolAbilityPower) {
|
||||
if(stack.hasTagCompound()) {
|
||||
return stack.stackTagCompound.getLong("charge");
|
||||
@ -81,39 +86,47 @@ public class ItemToolAbilityPower extends ItemToolAbility {
|
||||
|
||||
super.addInformation(stack, player, list, ext);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
|
||||
return getCharge(stack) < maxPower;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
|
||||
return 1 - (double)getCharge(stack) / (double)maxPower;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected boolean canOperate(ItemStack stack) {
|
||||
|
||||
return getCharge(stack) >= this.consumption;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getMaxCharge() {
|
||||
return maxPower;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getChargeRate() {
|
||||
return chargeRate;
|
||||
}
|
||||
|
||||
public static long getMaxChargeStatic(ItemStack stack) {
|
||||
return ((ItemToolAbilityPower)stack.getItem()).maxPower;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getDischargeRate() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDamage(ItemStack stack, int damage)
|
||||
{
|
||||
this.dischargeBattery(stack, damage * consumption);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isDamageable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -20,7 +20,6 @@ import com.hbm.interfaces.IFluidSource;
|
||||
import com.hbm.interfaces.ISource;
|
||||
import com.hbm.interfaces.Spaghetti;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.tool.ItemToolAbilityPower;
|
||||
import com.hbm.tileentity.TileEntityProxyInventory;
|
||||
import com.hbm.tileentity.conductor.TileEntityCable;
|
||||
import com.hbm.tileentity.conductor.TileEntityCableSwitch;
|
||||
@ -368,21 +367,6 @@ public class Library {
|
||||
if(slots[index] != null && slots[index].getItem() == ModItems.dynosphere_dineutronium && battery.getCharge(slots[index]) >= battery.getMaxCharge())
|
||||
slots[index] = new ItemStack(ModItems.dynosphere_dineutronium_charged);
|
||||
}
|
||||
|
||||
if(slots[index] != null && slots[index].getItem() instanceof ItemToolAbilityPower) {
|
||||
|
||||
long batMax = ItemToolAbilityPower.getMaxChargeStatic(slots[index]);
|
||||
long batCharge = ItemToolAbilityPower.getCharge(slots[index]);
|
||||
long batRate = ((ItemToolAbilityPower)slots[index].getItem()).getChargeRate();
|
||||
|
||||
//in hHE
|
||||
long toCharge = Math.min(Math.min(power, batRate), batMax - batCharge);
|
||||
|
||||
power -= toCharge;
|
||||
|
||||
((ItemToolAbilityPower)slots[index].getItem()).chargeBattery(slots[index], toCharge);
|
||||
|
||||
}
|
||||
|
||||
return power;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user