Added getter to internal.Robot to allow upgrade renderers know whether to animate or not. Closes #1127.

This commit is contained in:
Florian Nücke 2015-05-20 23:09:04 +02:00
parent 576b28fc68
commit 3540809a0d
3 changed files with 16 additions and 0 deletions

View File

@ -1,5 +1,7 @@
package li.cil.oc.api.internal; package li.cil.oc.api.internal;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import li.cil.oc.api.driver.EnvironmentHost; import li.cil.oc.api.driver.EnvironmentHost;
import li.cil.oc.api.network.Environment; import li.cil.oc.api.network.Environment;
import net.minecraft.inventory.ISidedInventory; import net.minecraft.inventory.ISidedInventory;
@ -65,4 +67,14 @@ public interface Robot extends Agent, Environment, EnvironmentHost, Tiered, ISid
* network packet to be sent. * network packet to be sent.
*/ */
void synchronizeSlot(int slot); void synchronizeSlot(int slot);
/**
* This essentially returns whether the robot is currently running or not.
* <p/>
* This is explicitly meant for client side use, to allow upgrade renderers
* to know whether to resume animations or not, based on whether the robot
* is currently powered on or not.
*/
@SideOnly(Side.CLIENT)
boolean shouldAnimate();
} }

View File

@ -187,6 +187,8 @@ class Robot extends traits.Computer with traits.PowerInformation with IFluidHand
ServerPacketSender.sendRobotLightChange(this) ServerPacketSender.sendRobotLightChange(this)
} }
override def shouldAnimate = isRunning
// ----------------------------------------------------------------------- // // ----------------------------------------------------------------------- //
override def node = if (isServer) machine.node else null override def node = if (isServer) machine.node else null

View File

@ -68,6 +68,8 @@ class RobotProxy(val robot: Robot) extends traits.Computer with traits.PowerInfo
override def setRunning(value: Boolean) = robot.setRunning(value) override def setRunning(value: Boolean) = robot.setRunning(value)
override def shouldAnimate(): Boolean = robot.shouldAnimate
// ----------------------------------------------------------------------- // // ----------------------------------------------------------------------- //
override def componentCount = robot.componentCount override def componentCount = robot.componentCount