mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 03:39:17 +00:00
Added ElvenPortalUpdateEvent to the API.
This commit is contained in:
1 parent
39d4d232ce
commit
442301946c
3 files changed
+50
-3
No files matched your search
@@ -1,4 +1,4 @@
|
||||
@API(owner = "Botania", apiVersion = "39", provides = "BotaniaAPI")
|
||||
@API(owner = "Botania", apiVersion = "40", provides = "BotaniaAPI")
|
||||
package vazkii.botania.api;
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* 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 17, 2015, 4:58:30 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.recipe;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
/**
|
||||
* An event fired when an Elven Portal TE updates. The portal's
|
||||
* relevant AABB and other stuff is passed in for convenience. This
|
||||
* is fired in MinecraftForge.EVENT_BUS.
|
||||
*/
|
||||
public class ElvenPortalUpdateEvent extends Event {
|
||||
|
||||
/**
|
||||
* May be casted to TileAlfPortal if you have botania code access aside from the API.
|
||||
*/
|
||||
public final TileEntity portalTile;
|
||||
public final AxisAlignedBB aabb;
|
||||
public boolean open;
|
||||
public final List<ItemStack> stacksInside;
|
||||
|
||||
public ElvenPortalUpdateEvent(TileEntity te, AxisAlignedBB aabb, boolean open, List<ItemStack> stacks) {
|
||||
portalTile = te;
|
||||
this.aabb = aabb;
|
||||
this.open = open;
|
||||
stacksInside = stacks;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -22,6 +23,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.ILexicon;
|
||||
import vazkii.botania.api.recipe.ElvenPortalUpdateEvent;
|
||||
import vazkii.botania.api.recipe.IElvenItem;
|
||||
import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
import vazkii.botania.common.Botania;
|
||||
@@ -100,13 +102,16 @@ public class TileAlfPortal extends TileMod {
|
||||
|
||||
if(!hasUnloadedParts) {
|
||||
ticksOpen++;
|
||||
|
||||
|
||||
AxisAlignedBB aabb = getPortalAABB();
|
||||
boolean open = ticksOpen > 60;
|
||||
ElvenPortalUpdateEvent event = new ElvenPortalUpdateEvent(this, aabb, open, stacksIn);
|
||||
|
||||
if(ticksOpen > 60) {
|
||||
ticksSinceLastItem++;
|
||||
if(ConfigHandler.elfPortalParticlesEnabled)
|
||||
blockParticle(meta);
|
||||
|
||||
AxisAlignedBB aabb = getPortalAABB();
|
||||
List<EntityItem> items = worldObj.getEntitiesWithinAABB(EntityItem.class, aabb);
|
||||
if(!worldObj.isRemote)
|
||||
for(EntityItem item : items) {
|
||||
|
||||
Reference in new issue
Block a user