Added RitualStopEvent and RitualRunEvent

This commit is contained in:
WayofTime 2014-11-13 09:37:09 -05:00
parent f39db196ca
commit 6c4c579e89
7 changed files with 61 additions and 11 deletions

View file

@ -0,0 +1,16 @@
package WayofTime.alchemicalWizardry.api.event;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import cpw.mods.fml.common.eventhandler.Cancelable;
@Cancelable
public class RitualRunEvent extends RitualEvent
{
public RitualRunEvent(IMasterRitualStone mrs, String ownerKey, String ritualKey)
{
super(mrs, ownerKey, ritualKey);
}
}

View file

@ -0,0 +1,15 @@
package WayofTime.alchemicalWizardry.api.event;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualBreakMethod;
public class RitualStopEvent extends RitualEvent
{
public final RitualBreakMethod method;
public RitualStopEvent(IMasterRitualStone mrs, String ownerKey, String ritualKey, RitualBreakMethod method)
{
super(mrs, ownerKey, ritualKey);
this.method = method;
}
}

View file

@ -1,4 +1,4 @@
package WayofTime.alchemicalWizardry.common.renderer;
package WayofTime.alchemicalWizardry.api.renderer;
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
import net.minecraft.client.renderer.texture.TextureManager;

View file

@ -1,15 +1,19 @@
package WayofTime.alchemicalWizardry.api.rituals;
import WayofTime.alchemicalWizardry.common.renderer.MRSRenderer;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import WayofTime.alchemicalWizardry.api.event.RitualRunEvent;
import WayofTime.alchemicalWizardry.api.event.RitualStopEvent;
import WayofTime.alchemicalWizardry.api.renderer.MRSRenderer;
import cpw.mods.fml.common.eventhandler.Event;
public class Rituals
{
private int crystalLevel;
@ -300,9 +304,18 @@ public class Rituals
public static void performEffect(IMasterRitualStone ritualStone, String ritualID)
{
if (ritualMap.containsKey(ritualID))
String ownerName = ritualStone.getOwner();
RitualRunEvent event = new RitualRunEvent(ritualStone, ownerName, ritualID);
if(MinecraftForge.EVENT_BUS.post(event) || event.getResult() == Event.Result.DENY)
{
return;
}
if (ritualMap.containsKey(event.ritualKey))
{
Rituals ritual = ritualMap.get(ritualID);
Rituals ritual = ritualMap.get(event.ritualKey);
if (ritual != null && ritual.effect != null)
{
ritual.effect.performEffect(ritualStone);
@ -326,6 +339,10 @@ public class Rituals
public static void onRitualBroken(IMasterRitualStone ritualStone, String ritualID, RitualBreakMethod method)
{
String ownerName = ritualStone.getOwner();
RitualStopEvent event = new RitualStopEvent(ritualStone, ownerName, ritualID, method);
MinecraftForge.EVENT_BUS.post(event);
if (ritualMap.containsKey(ritualID))
{
Rituals ritual = ritualMap.get(ritualID);

View file

@ -1,9 +1,11 @@
package WayofTime.alchemicalWizardry.common.renderer;
import WayofTime.alchemicalWizardry.api.renderer.MRSRenderer;
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
public class AlchemyCircleRenderer extends MRSRenderer

View file

@ -1,7 +1,7 @@
package WayofTime.alchemicalWizardry.common.renderer.block;
import WayofTime.alchemicalWizardry.api.renderer.MRSRenderer;
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
import WayofTime.alchemicalWizardry.common.renderer.MRSRenderer;
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;

View file

@ -346,9 +346,9 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
performRitual(worldObj, xCoord, yCoord, zCoord, currentRitualString);
}
public void performRitual(World world, int x, int y, int z, String currentRitualString2)
public void performRitual(World world, int x, int y, int z, String currentRitualString)
{
Rituals.performEffect(this, currentRitualString2);
Rituals.performEffect(this, currentRitualString);
}
public String getOwner()