Mekanism-tilera-Edition/common/universalelectricity/core/electricity/ElectricalEvent.java

69 lines
1.8 KiB
Java
Raw Normal View History

package universalelectricity.core.electricity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.event.Cancelable;
import net.minecraftforge.event.Event;
import universalelectricity.core.block.IElectrical;
2013-08-25 15:37:11 +02:00
import universalelectricity.core.grid.IElectricityNetwork;
public class ElectricalEvent extends Event
{
/**
* Call this to have your TileEntity produce power into the network.
*
* @author Calclavia
*
*/
@Cancelable
public static class ElectricityProduceEvent extends ElectricalEvent
{
public World world;
public IElectrical tileEntity;
public ElectricityProduceEvent(IElectrical tileEntity)
{
this.tileEntity = tileEntity;
this.world = ((TileEntity) this.tileEntity).worldObj;
}
}
2013-08-25 15:37:11 +02:00
public static class NetworkEvent extends ElectricalEvent
{
2013-08-25 15:37:11 +02:00
public final IElectricityNetwork network;
public ElectricityPack electricityPack;
public TileEntity[] ignoreTiles;
2013-08-25 15:37:11 +02:00
public NetworkEvent(IElectricityNetwork network, ElectricityPack electricityPack, TileEntity... ignoreTiles)
{
2013-08-25 15:37:11 +02:00
this.network = network;
this.electricityPack = electricityPack;
this.ignoreTiles = ignoreTiles;
}
}
2013-08-25 15:37:11 +02:00
/**
* Internal Events. These events are fired when something happens in the network.
*
* @author Calclavia
*
*/
@Cancelable
public static class ElectricityProductionEvent extends NetworkEvent
{
2013-08-25 15:37:11 +02:00
public ElectricityProductionEvent(IElectricityNetwork network, ElectricityPack electricityPack, TileEntity... ignoreTiles)
{
super(network, electricityPack, ignoreTiles);
}
}
2013-08-25 15:37:11 +02:00
public static class ElectricityRequestEvent extends NetworkEvent
{
public ElectricityRequestEvent(IElectricityNetwork network, ElectricityPack electricityPack, TileEntity... ignoreTiles)
{
2013-08-25 15:37:11 +02:00
super(network, electricityPack, ignoreTiles);
}
}
}