2013-07-27 00:16:21 +02:00
|
|
|
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;
|
2013-07-27 00:16:21 +02:00
|
|
|
|
|
|
|
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-07-27 00:16:21 +02:00
|
|
|
{
|
2013-08-25 15:37:11 +02:00
|
|
|
public final IElectricityNetwork network;
|
2013-07-27 00:16:21 +02:00
|
|
|
public ElectricityPack electricityPack;
|
|
|
|
public TileEntity[] ignoreTiles;
|
|
|
|
|
2013-08-25 15:37:11 +02:00
|
|
|
public NetworkEvent(IElectricityNetwork network, ElectricityPack electricityPack, TileEntity... ignoreTiles)
|
2013-07-27 00:16:21 +02:00
|
|
|
{
|
2013-08-25 15:37:11 +02:00
|
|
|
this.network = network;
|
2013-07-27 00:16:21 +02:00
|
|
|
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-07-27 00:16:21 +02:00
|
|
|
{
|
2013-08-25 15:37:11 +02:00
|
|
|
public ElectricityProductionEvent(IElectricityNetwork network, ElectricityPack electricityPack, TileEntity... ignoreTiles)
|
|
|
|
{
|
|
|
|
super(network, electricityPack, ignoreTiles);
|
|
|
|
}
|
|
|
|
}
|
2013-07-27 00:16:21 +02:00
|
|
|
|
2013-08-25 15:37:11 +02:00
|
|
|
public static class ElectricityRequestEvent extends NetworkEvent
|
|
|
|
{
|
|
|
|
public ElectricityRequestEvent(IElectricityNetwork network, ElectricityPack electricityPack, TileEntity... ignoreTiles)
|
2013-07-27 00:16:21 +02:00
|
|
|
{
|
2013-08-25 15:37:11 +02:00
|
|
|
super(network, electricityPack, ignoreTiles);
|
2013-07-27 00:16:21 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|