aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/tileentity
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2017-03-04 12:58:47 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2017-03-04 12:58:47 +1000
commitae21012d216df71f31aed6fbc9d76215fc24ceed (patch)
treecc89accbe6ce5c04b72ed3c5e46b2a185f88be6a /src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/tileentity
parentba89972a22a316030f8c3bd99974f915b1d7aefc (diff)
downloadGT5-Unofficial-ae21012d216df71f31aed6fbc9d76215fc24ceed.tar.gz
GT5-Unofficial-ae21012d216df71f31aed6fbc9d76215fc24ceed.tar.bz2
GT5-Unofficial-ae21012d216df71f31aed6fbc9d76215fc24ceed.zip
+ New texture for the slow builders ring.
+ Added the Alkalus Disk. $ Fixed Frame Box Assembler Recipes. $ Fixed Missing 7Li material. $ Fixed Tiered Tanks not showing their capacity in the tooltip. $ Fixed tooltips for alloys containing Bronze or Steel. $ Fixed Clay Pipe Extruder Recipes. - Removed a handful of Plasma cells for misc. materials. % Changed the Industrial Coke Oven's tooltip, to better describe the input/output requirements. % Cleaned up The Entire Project.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/tileentity')
-rw-r--r--src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/tileentity/TileEntityKineticWindGenerator.java132
1 files changed, 65 insertions, 67 deletions
diff --git a/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/tileentity/TileEntityKineticWindGenerator.java b/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/tileentity/TileEntityKineticWindGenerator.java
index e2140f9fce..29206c398d 100644
--- a/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/tileentity/TileEntityKineticWindGenerator.java
+++ b/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/tileentity/TileEntityKineticWindGenerator.java
@@ -1,5 +1,10 @@
package gtPlusPlus.xmod.ic2.block.kieticgenerator.tileentity;
+import java.util.List;
+import java.util.Vector;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.energy.tile.IKineticSource;
import ic2.api.item.IKineticRotor;
import ic2.api.item.IKineticRotor.GearboxType;
@@ -8,12 +13,7 @@ import ic2.core.block.invslot.InvSlotConsumableKineticRotor;
import ic2.core.block.kineticgenerator.container.ContainerWindKineticGenerator;
import ic2.core.block.kineticgenerator.gui.GuiWindKineticGenerator;
import ic2.core.block.kineticgenerator.tileentity.TileEntityWindKineticGenerator;
-import ic2.core.network.NetworkManager;
import ic2.core.util.Util;
-
-import java.util.List;
-import java.util.Vector;
-
import net.minecraft.block.Block;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
@@ -22,8 +22,6 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.ChunkCache;
import net.minecraftforge.common.util.ForgeDirection;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
public class TileEntityKineticWindGenerator
extends TileEntityWindKineticGenerator
@@ -40,63 +38,63 @@ implements IKineticSource, IHasGui
public TileEntityKineticWindGenerator()
{
- this.updateTicker = IC2.random.nextInt(getTickRate());
+ this.updateTicker = IC2.random.nextInt(this.getTickRate());
this.rotorSlot = new InvSlotConsumableKineticRotor(this, "rotorslot", 0, null, 1, null, GearboxType.WIND);
}
-
+
public void update2Entity()
{
super.updateEntity();
assert (IC2.platform.isSimulating());
- if (this.updateTicker++ % getTickRate() != 0) {
+ if ((this.updateTicker++ % this.getTickRate()) != 0) {
return;
}
boolean needsInvUpdate = false;
if (!this.rotorSlot.isEmpty())
{
- if (checkSpace(1, true) == 0)
+ if (this.checkSpace(1, true) == 0)
{
- if (getActive() != true) {
- setActive(true);
+ if (this.getActive() != true) {
+ this.setActive(true);
}
needsInvUpdate = true;
}
else
{
- if (getActive()) {
- setActive(false);
+ if (this.getActive()) {
+ this.setActive(false);
}
needsInvUpdate = true;
}
}
else
{
- if (getActive()) {
- setActive(false);
+ if (this.getActive()) {
+ this.setActive(false);
}
needsInvUpdate = true;
}
- if (getActive())
+ if (this.getActive())
{
- this.crossSection = (getRotorDiameter() / 2 * 2 * 2 + 1);
+ this.crossSection = (((this.getRotorDiameter() / 2) * 2 * 2) + 1);
this.crossSection *= this.crossSection;
- this.obstructedCrossSection = checkSpace(getRotorDiameter() * 3, false);
- if ((this.obstructedCrossSection > 0) && (this.obstructedCrossSection <= (getRotorDiameter() + 1) / 2)) {
+ this.obstructedCrossSection = this.checkSpace(this.getRotorDiameter() * 3, false);
+ if ((this.obstructedCrossSection > 0) && (this.obstructedCrossSection <= ((this.getRotorDiameter() + 1) / 2))) {
this.obstructedCrossSection = 0;
} else if (this.obstructedCrossSection < 0) {
this.obstructedCrossSection = this.crossSection;
}
- this.windStrength = calcWindStrength();
+ this.windStrength = this.calcWindStrength();
- float speed = (float)Util.limit((this.windStrength - getMinWindStrength()) / getMaxWindStrength(), 0.0D, 2.0D);
+ final float speed = (float)Util.limit((this.windStrength - this.getMinWindStrength()) / this.getMaxWindStrength(), 0.0D, 2.0D);
- setRotationSpeed(speed*2);
- if (this.windStrength >= getMinWindStrength()) {
- if (this.windStrength <= getMaxWindStrength()) {
+ this.setRotationSpeed(speed*2);
+ if (this.windStrength >= this.getMinWindStrength()) {
+ if (this.windStrength <= this.getMaxWindStrength()) {
this.rotorSlot.damage(1, false);
} else {
this.rotorSlot.damage(4, false);
@@ -110,7 +108,7 @@ implements IKineticSource, IHasGui
@Override
public List<String> getNetworkedFields()
{
- List<String> ret = new Vector<String>(1);
+ final List<String> ret = new Vector<>(1);
ret.add("rotationSpeed");
ret.add("rotorSlot");
@@ -120,35 +118,35 @@ implements IKineticSource, IHasGui
}
@Override
- public ContainerBase<TileEntityWindKineticGenerator> getGuiContainer(EntityPlayer entityPlayer)
+ public ContainerBase<TileEntityWindKineticGenerator> getGuiContainer(final EntityPlayer entityPlayer)
{
return new ContainerWindKineticGenerator(entityPlayer, this);
}
@Override
@SideOnly(Side.CLIENT)
- public GuiScreen getGui(EntityPlayer entityPlayer, boolean isAdmin)
+ public GuiScreen getGui(final EntityPlayer entityPlayer, final boolean isAdmin)
{
return new GuiWindKineticGenerator(new ContainerWindKineticGenerator(entityPlayer, this));
}
@Override
- public boolean facingMatchesDirection(ForgeDirection direction)
+ public boolean facingMatchesDirection(final ForgeDirection direction)
{
- return direction.ordinal() == getFacing();
+ return direction.ordinal() == this.getFacing();
}
@Override
- public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side)
+ public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final int side)
{
if ((side == 0) || (side == 1)) {
return false;
}
- return getFacing() != side;
+ return this.getFacing() != side;
}
@Override
- public void setFacing(short side)
+ public void setFacing(final short side)
{
super.setFacing(side);
}
@@ -162,22 +160,22 @@ implements IKineticSource, IHasGui
public String getRotorhealth()
{
if (!this.rotorSlot.isEmpty()) {
- return StatCollector.translateToLocalFormatted("ic2.WindKineticGenerator.gui.rotorhealth", new Object[] { Integer.valueOf((int)(100.0F - this.rotorSlot.get().getItemDamage() / this.rotorSlot.get().getMaxDamage() * 100.0F)) });
+ return StatCollector.translateToLocalFormatted("ic2.WindKineticGenerator.gui.rotorhealth", new Object[] { Integer.valueOf((int)(100.0F - ((this.rotorSlot.get().getItemDamage() / this.rotorSlot.get().getMaxDamage()) * 100.0F))) });
}
return "";
}
@Override
- public int maxrequestkineticenergyTick(ForgeDirection directionFrom)
+ public int maxrequestkineticenergyTick(final ForgeDirection directionFrom)
{
- return getKuOutput();
+ return this.getKuOutput();
}
@Override
- public int requestkineticenergy(ForgeDirection directionFrom, int requestkineticenergy)
+ public int requestkineticenergy(final ForgeDirection directionFrom, final int requestkineticenergy)
{
- if (facingMatchesDirection(directionFrom.getOpposite())) {
- return Math.min(requestkineticenergy, getKuOutput());
+ if (this.facingMatchesDirection(directionFrom.getOpposite())) {
+ return Math.min(requestkineticenergy, this.getKuOutput());
}
return 0;
}
@@ -189,18 +187,18 @@ implements IKineticSource, IHasGui
}
@Override
- public void onGuiClosed(EntityPlayer entityPlayer) {}
+ public void onGuiClosed(final EntityPlayer entityPlayer) {}
@Override
- public boolean shouldRenderInPass(int pass)
+ public boolean shouldRenderInPass(final int pass)
{
return pass == 0;
}
@Override
- public int checkSpace(int length, boolean onlyrotor)
+ public int checkSpace(int length, final boolean onlyrotor)
{
- int box = getRotorDiameter() / 2;
+ int box = this.getRotorDiameter() / 2;
int lentemp = 0;
if (onlyrotor)
{
@@ -210,36 +208,36 @@ implements IKineticSource, IHasGui
if (!onlyrotor) {
box *= 2;
}
- ForgeDirection fwdDir = ForgeDirection.VALID_DIRECTIONS[getFacing()];
- ForgeDirection rightDir = fwdDir.getRotation(ForgeDirection.DOWN);
+ final ForgeDirection fwdDir = ForgeDirection.VALID_DIRECTIONS[this.getFacing()];
+ final ForgeDirection rightDir = fwdDir.getRotation(ForgeDirection.DOWN);
- int xMaxDist = Math.abs(length * fwdDir.offsetX + box * rightDir.offsetX);
+ final int xMaxDist = Math.abs((length * fwdDir.offsetX) + (box * rightDir.offsetX));
- int zMaxDist = Math.abs(length * fwdDir.offsetZ + box * rightDir.offsetZ);
+ final int zMaxDist = Math.abs((length * fwdDir.offsetZ) + (box * rightDir.offsetZ));
- ChunkCache chunkCache = new ChunkCache(this.worldObj, this.xCoord - xMaxDist, this.yCoord - box, this.zCoord - zMaxDist, this.xCoord + xMaxDist, this.yCoord + box, this.zCoord + zMaxDist, 0);
+ final ChunkCache chunkCache = new ChunkCache(this.worldObj, this.xCoord - xMaxDist, this.yCoord - box, this.zCoord - zMaxDist, this.xCoord + xMaxDist, this.yCoord + box, this.zCoord + zMaxDist, 0);
int ret = 0;
for (int up = -box; up <= box; up++)
{
- int y = this.yCoord + up;
+ final int y = this.yCoord + up;
for (int right = -box; right <= box; right++)
{
boolean occupied = false;
for (int fwd = lentemp - length; fwd <= length; fwd++)
{
- int x = this.xCoord + fwd * fwdDir.offsetX + right * rightDir.offsetX;
+ final int x = this.xCoord + (fwd * fwdDir.offsetX) + (right * rightDir.offsetX);
- int z = this.zCoord + fwd * fwdDir.offsetZ + right * rightDir.offsetZ;
+ final int z = this.zCoord + (fwd * fwdDir.offsetZ) + (right * rightDir.offsetZ);
assert (Math.abs(x - this.xCoord) <= xMaxDist);
assert (Math.abs(z - this.zCoord) <= zMaxDist);
- Block block = chunkCache.getBlock(x, y, z);
+ final Block block = chunkCache.getBlock(x, y, z);
if (!block.isAir(chunkCache, x, y, z))
{
occupied = true;
@@ -265,15 +263,15 @@ implements IKineticSource, IHasGui
@Override
public boolean rotorspace()
{
- return checkSpace(1, true) == 0;
+ return this.checkSpace(1, true) == 0;
}
- private void setRotationSpeed(float speed)
+ private void setRotationSpeed(final float speed)
{
if (this.rotationSpeed != speed)
{
this.rotationSpeed = speed;
- ((NetworkManager)IC2.network.get()).updateTileEntityField(this, "rotationSpeed");
+ IC2.network.get().updateTileEntityField(this, "rotationSpeed");
}
}
@@ -299,10 +297,10 @@ implements IKineticSource, IHasGui
{
if (this.rotationSpeed > 0.0F)
{
- long period = (long) (5.0E+008F / this.rotationSpeed);
+ final long period = (long) (5.0E+008F / this.rotationSpeed);
- return (float)(System.nanoTime() % period) / (float)period * 360.0F;
+ return ((float)(System.nanoTime() % period) / (float)period) * 360.0F;
}
return 0.0F;
}
@@ -310,7 +308,7 @@ implements IKineticSource, IHasGui
@Override
public float getefficiency()
{
- ItemStack stack = this.rotorSlot.get();
+ final ItemStack stack = this.rotorSlot.get();
if ((stack != null) && ((stack.getItem() instanceof IKineticRotor))) {
return (float) (((IKineticRotor)stack.getItem()).getEfficiency(stack)*1.5);
}
@@ -320,7 +318,7 @@ implements IKineticSource, IHasGui
@Override
public int getMinWindStrength()
{
- ItemStack stack = this.rotorSlot.get();
+ final ItemStack stack = this.rotorSlot.get();
if ((stack != null) && ((stack.getItem() instanceof IKineticRotor))) {
return ((IKineticRotor)stack.getItem()).getMinWindStrength(stack)/2;
}
@@ -330,7 +328,7 @@ implements IKineticSource, IHasGui
@Override
public int getMaxWindStrength()
{
- ItemStack stack = this.rotorSlot.get();
+ final ItemStack stack = this.rotorSlot.get();
if ((stack != null) && ((stack.getItem() instanceof IKineticRotor))) {
return ((IKineticRotor)stack.getItem()).getMaxWindStrength(stack)*2;
}
@@ -340,7 +338,7 @@ implements IKineticSource, IHasGui
@Override
public int getRotorDiameter()
{
- ItemStack stack = this.rotorSlot.get();
+ final ItemStack stack = this.rotorSlot.get();
if ((stack != null) && ((stack.getItem() instanceof IKineticRotor))) {
return ((IKineticRotor)stack.getItem()).getDiameter(stack)/2;
}
@@ -350,7 +348,7 @@ implements IKineticSource, IHasGui
@Override
public ResourceLocation getRotorRenderTexture()
{
- ItemStack stack = this.rotorSlot.get();
+ final ItemStack stack = this.rotorSlot.get();
if ((stack != null) && ((stack.getItem() instanceof IKineticRotor))) {
return ((IKineticRotor)stack.getItem()).getRotorRenderTexture(stack);
}
@@ -360,7 +358,7 @@ implements IKineticSource, IHasGui
@Override
public boolean guiisoverload()
{
- if (this.windStrength > getMaxWindStrength()) {
+ if (this.windStrength > this.getMaxWindStrength()) {
return true;
}
return false;
@@ -369,14 +367,14 @@ implements IKineticSource, IHasGui
@Override
public boolean guiisminWindStrength()
{
- return this.windStrength >= getMinWindStrength();
+ return this.windStrength >= this.getMinWindStrength();
}
@Override
public int getKuOutput()
{
- if ((this.windStrength >= getMinWindStrength()) && (getActive())) {
- return (int)(this.windStrength * 50.0D * getefficiency());
+ if ((this.windStrength >= this.getMinWindStrength()) && (this.getActive())) {
+ return (int)(this.windStrength * 50.0D * this.getefficiency());
}
return 0;
}