Added CorporeaRequestEvent to the API.

This commit is contained in:
Lizbeth Rika committed 2015-04-30 14:59:37 +01:00
1 parent 950851697e
commit cf372a9193
2 files changed
+47 -1

No files matched your search

@@ -16,12 +16,14 @@ import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
import net.minecraft.client.Minecraft;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
public final class CorporeaHelper {
@@ -163,8 +165,12 @@ public final class CorporeaHelper {
* equals or matches (case a regex is passed in) the matcher string.
*/
public static List<ItemStack> requestItem(Object matcher, int itemCount, ICorporeaSpark spark, boolean checkNBT, boolean doit) {
List<IInventory> inventories = getInventoriesOnNetwork(spark);
List<ItemStack> stacks = new ArrayList();
CorporeaRequestEvent event = new CorporeaRequestEvent(matcher, itemCount, spark, checkNBT, doit);
if(MinecraftForge.EVENT_BUS.post(event))
return stacks;
List<IInventory> inventories = getInventoriesOnNetwork(spark);
Map<ICorporeaInterceptor, ICorporeaSpark> interceptors = new HashMap();
lastRequestMatches = 0;
@@ -0,0 +1,40 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Apr 30, 2015, 2:55:57 PM (GMT)]
*/
package vazkii.botania.api.corporea;
import cpw.mods.fml.common.eventhandler.Cancelable;
import cpw.mods.fml.common.eventhandler.Event;
/**
* Fired when a corporea request is initiated. Can be cancelled.
*/
@Cancelable
public class CorporeaRequestEvent extends Event {
public final Object request;
public final int count;
public final ICorporeaSpark spark;
public final boolean checkNBT;
/**
* If false then items won't be pulled.
*/
public final boolean realRequest;
public CorporeaRequestEvent(Object request, int count, ICorporeaSpark spark, boolean nbt, boolean real) {
this.request = request;
this.count = count;
this.spark = spark;
this.checkNBT = nbt;
this.realRequest = real;
}
}