mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
81 lines
1.7 KiB
Java
81 lines
1.7 KiB
Java
package com.hbm.tileentity.machine;
|
|
|
|
import com.hbm.lib.Library;
|
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import net.minecraft.util.AxisAlignedBB;
|
|
|
|
public class TileEntityMachineFENSU extends TileEntityMachineBattery {
|
|
|
|
public float prevRotation = 0F;
|
|
public float rotation = 0F;
|
|
|
|
@Override
|
|
public void updateEntity() {
|
|
|
|
this.maxPower = Long.MAX_VALUE;
|
|
|
|
if(!worldObj.isRemote) {
|
|
|
|
short mode = (short) this.getRelevantMode();
|
|
|
|
if(mode == 1 || mode == 2)
|
|
{
|
|
age++;
|
|
if(age >= 20)
|
|
{
|
|
age = 0;
|
|
}
|
|
|
|
if(age == 9 || age == 19)
|
|
ffgeuaInit();
|
|
}
|
|
|
|
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
|
power = Library.chargeItemsFromTE(slots, 1, power, maxPower);
|
|
|
|
NBTTagCompound nbt = new NBTTagCompound();
|
|
nbt.setLong("power", power);
|
|
nbt.setLong("maxPower", maxPower);
|
|
nbt.setShort("redLow", redLow);
|
|
nbt.setShort("redHigh", redHigh);
|
|
this.networkPack(nbt, 250);
|
|
} else {
|
|
this.prevRotation = this.rotation;
|
|
this.rotation += this.getSpeed();
|
|
|
|
if(rotation >= 360) {
|
|
rotation -= 360;
|
|
prevRotation -= 360;
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public long getPowerRemainingScaled(long i) {
|
|
|
|
double powerScaled = (double)power / (double)maxPower;
|
|
|
|
return (long)(i * powerScaled);
|
|
}
|
|
|
|
public float getSpeed() {
|
|
return (float) Math.pow(Math.log(power * 0.75 + 1) * 0.05F, 5);
|
|
}
|
|
|
|
@Override
|
|
public AxisAlignedBB getRenderBoundingBox() {
|
|
return TileEntity.INFINITE_EXTENT_AABB;
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public double getMaxRenderDistanceSquared()
|
|
{
|
|
return 65536.0D;
|
|
}
|
|
}
|