This commit is contained in:
WayofTime 2015-02-13 14:48:34 -05:00
commit 815dc167dd
3 changed files with 79 additions and 27 deletions

View file

@ -9,10 +9,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.*;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@ -772,6 +769,8 @@ public class AlchemicalWizardry
this.blacklistDemons();
this.blacklistAccelerators();
MinecraftForge.EVENT_BUS.register(new ModLivingDropsEvent());
proxy.InitRendering();
NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
@ -1151,6 +1150,31 @@ public class AlchemicalWizardry
// this.createItemTextureFiles();
}
public static void blacklistAccelerators()
{
if (Loader.isModLoaded("Torcherino"))
{
FMLInterModComms.sendMessage("Torcherino", "blacklist-tile", TEAltar.class.getName());
FMLInterModComms.sendMessage("Torcherino", "blacklist-tile", TEMasterStone.class.getName());
}
if (Loader.isModLoaded("ChromatiCraft"))
{
try
{
Class api = Class.forName("Reika.ChromatiCraft.API.AcceleratorBlacklist");
Class reason = Class.forName("Reika.ChromatiCraft.API.AcceleratorBlacklist$BlacklistReason");
Object exploit = Enum.valueOf(reason,"EXPLOIT");
Method add = api.getMethod("addBlacklist", Class.class, String.class, reason);
add.invoke(null, TEAltar.class, TEAltar.class.getSimpleName(),exploit);
add.invoke(null, TEMasterStone.class, TEMasterStone.class.getSimpleName(),exploit);
} catch (Exception e)
{
logger.log(Level.ERROR, "ChromatiCraft Accelerator Blacklist Failure");
}
}
}
public static void blacklistDemons()
{
String[] mobs = new String[]{"FallenAngel","LowerGuardian","BileDemon","WingedFireDemon","SmallEarthGolem","IceDemon","BoulderFist","Shade","AirElemental",

View file

@ -154,7 +154,7 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner
{
int direction = this.getDirection(par1ItemStack);
EnergyItems.checkAndSetItemOwner(par1ItemStack, par2EntityPlayer);
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par2EntityPlayer)) return false;
ItemStack[] playerInventory = par2EntityPlayer.inventory.mainInventory;
TileEntity tileEntity = par3World.getTileEntity(par4, par5, par6);
@ -187,7 +187,7 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner
{
if (par3World.isAirBlock(par4 + rc.getX(direction), par5 + rc.getY(), par6 + rc.getZ(direction)))
{
if (playerInvRitualStoneLocation >= 0)
if (playerInvRitualStoneLocation >= 0 || par2EntityPlayer.capabilities.isCreativeMode)
{
if (rc.getStoneType() > this.maxMetaData + this.getMaxRuneDisplacement(par1ItemStack))
{
@ -243,7 +243,7 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner
}
}
}
}else if(!(par3World.getBlock(par4, par5, par6) instanceof IRitualStone))
}else if(!(par3World.getBlock(par4, par5, par6) instanceof IRitualStone) && !par2EntityPlayer.isSneaking())
{
if(par3World.isRemote)
{
@ -251,6 +251,7 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner
}
this.cycleDirection(par1ItemStack);
par2EntityPlayer.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip.ritualdiviner.ritualtunedto") + " " + this.getNameForDirection(this.getDirection(par1ItemStack))));
return true;
}
return false;
@ -259,18 +260,9 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking())
if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) && par3EntityPlayer.isSneaking())
{
int maxRitualID = Rituals.getNumberOfRituals();
String currentRitualID = this.getCurrentRitual(par1ItemStack);
this.setCurrentRitual(par1ItemStack, Rituals.getNextRitualKey(currentRitualID));
if (par2World.isRemote)
{
IChatComponent chatmessagecomponent = new ChatComponentText(StatCollector.translateToLocal("message.ritual.currentritual") + " " + Rituals.getNameOfRitual(this.getCurrentRitual(par1ItemStack)));
par3EntityPlayer.addChatComponentMessage(chatmessagecomponent);
}
rotateRituals(par2World,par3EntityPlayer, par1ItemStack, true);
}
return par1ItemStack;
@ -283,17 +275,23 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner
{
EntityPlayer player = (EntityPlayer) entityLiving;
if (player.isSneaking() && !player.isSwingInProgress)
if (!EnergyItems.checkAndSetItemOwner(stack,player)) return true;
if (!player.isSwingInProgress)
{
int maxRitualID = Rituals.getNumberOfRituals();
String currentRitualID = this.getCurrentRitual(stack);
this.setCurrentRitual(stack, Rituals.getPreviousRitualKey(currentRitualID));
if (entityLiving.worldObj.isRemote)
if (player.isSneaking())
{
IChatComponent chatmessagecomponent = new ChatComponentText(StatCollector.translateToLocal("message.ritual.currentritual") + " " + Rituals.getNameOfRitual(this.getCurrentRitual(stack)));
player.addChatComponentMessage(chatmessagecomponent);
rotateRituals(player.worldObj, player, stack, false);
}
else
{
if (!player.worldObj.isRemote)
{
int direction = this.getDirection(stack) - 1;
if (direction == 0) direction = 4;
this.setDirection(stack, direction);
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip.ritualdiviner.ritualtunedto") + " " + this.getNameForDirection(direction)));
}
}
}
}
@ -301,6 +299,20 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner
return false;
}
public void rotateRituals(World world, EntityPlayer player, ItemStack stack, boolean next)
{
int maxRitualID = Rituals.getNumberOfRituals();
String currentRitualID = this.getCurrentRitual(stack);
this.setCurrentRitual(stack, next? Rituals.getNextRitualKey(currentRitualID):Rituals.getPreviousRitualKey(currentRitualID));
if (world.isRemote)
{
IChatComponent chatmessagecomponent = new ChatComponentText(StatCollector.translateToLocal("message.ritual.currentritual") + " " + Rituals.getNameOfRitual(this.getCurrentRitual(stack)));
player.addChatComponentMessage(chatmessagecomponent);
}
}
@Override
public String getCurrentRitual(ItemStack par1ItemStack)
{

View file

@ -1,7 +1,11 @@
package WayofTime.alchemicalWizardry.common.potion;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import java.util.ArrayList;
public class PotionSoulFray extends Potion
{
public PotionSoulFray(int par1, boolean par2, int par3)
@ -15,4 +19,16 @@ public class PotionSoulFray extends Potion
super.setIconIndex(par1, par2);
return this;
}
@Override
public void performEffect(EntityLivingBase entityLivingBase, int level)
{
entityLivingBase.getActivePotionEffect(this).setCurativeItems(new ArrayList<ItemStack>());
}
@Override
public boolean isReady(int duration, int level)
{
return true;
}
}