Ritual diviner now auto-constructs rituals.

This commit is contained in:
WayofTime 2015-04-29 17:39:06 -04:00
parent 9329387b6c
commit b90db3857b
10 changed files with 361 additions and 150 deletions

View file

@ -7,6 +7,7 @@ import WayofTime.alchemicalWizardry.common.block.BlockAltar;
import WayofTime.alchemicalWizardry.common.block.BlockBelljar;
import WayofTime.alchemicalWizardry.common.block.BlockBloodLightSource;
import WayofTime.alchemicalWizardry.common.block.BlockConduit;
import WayofTime.alchemicalWizardry.common.block.BlockCrucible;
import WayofTime.alchemicalWizardry.common.block.BlockCrystal;
import WayofTime.alchemicalWizardry.common.block.BlockDemonPortal;
import WayofTime.alchemicalWizardry.common.block.BlockEnchantmentGlyph;
@ -98,7 +99,7 @@ public class ModBlocks
public static Block blockMimic;
public static Block blockEnchantmentGlyph;
public static Block blockStabilityGlyph;
public static Block blockIncence;
public static void init()
{
@ -141,6 +142,7 @@ public class ModBlocks
blockLifeEssence = new LifeEssenceBlock();
blockEnchantmentGlyph = new BlockEnchantmentGlyph();
blockStabilityGlyph = new BlockStabilityGlyph();
blockIncence = new BlockCrucible();
}
public static void registerBlocksInPre()
@ -186,6 +188,8 @@ public class ModBlocks
GameRegistry.registerBlock(ModBlocks.blockMimic, "blockMimic");
GameRegistry.registerBlock(ModBlocks.blockEnchantmentGlyph, ItemEnchantmentGlyphBlock.class, "blockEnchantmentGlyph");
GameRegistry.registerBlock(ModBlocks.blockStabilityGlyph, ItemStabilityGlyphBlock.class, "blockStabilityGlyph");
// GameRegistry.registerBlock(ModBlocks.blockIncence, "blockIncence");
}
public static void registerBlocksInInit()

View file

@ -0,0 +1,42 @@
package WayofTime.alchemicalWizardry.common.block;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockCrucible extends Block
{
public BlockCrucible()
{
super(Material.anvil);
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("blockIncence");
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
{
return null;
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z)
{
this.setBlockBounds(0.4F, 0.0F, 0.4F, 0.6F, 0.8F, 0.6F);
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
}

View file

@ -1,16 +1,15 @@
package WayofTime.alchemicalWizardry.common.block;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockReagentConduit extends BlockContainer
{
@ -66,9 +65,9 @@ public class BlockReagentConduit extends BlockContainer
return -1;
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
{
return null;
}
// @Override
// public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
// {
// return null;
// }
}

View file

@ -155,9 +155,15 @@ public class BloodMagicGuide
fivePeoplePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.fivePeople")));
entries.add(new EntryUniText(fivePeoplePages, "guide.BloodMagic.entryName.architect.fivePeople"));
ArrayList<IPage> tier3Pages = new ArrayList();
tier3Pages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/altars/T3.png"), true));
tier3Pages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.tier3")));
entries.add(new EntryUniText(tier3Pages, "guide.BloodMagic.entryName.architect.tier3"));
ArrayList<IPage> magicianOrbPages = new ArrayList();
magicianOrbPages.add(new PageAltarRecipe(RecipeHolder.magicianBloodOrbRecipe));
magicianOrbPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.magicianOrb")));
entries.add(new EntryUniText(magicianOrbPages, "guide.BloodMagic.entryName.architect.magicianOrb"));
categories.add(new CategoryItemStack(entries, "guide.BloodMagic.category.architect", new ItemStack(ModItems.divinationSigil)));
}

View file

@ -63,7 +63,7 @@ public class TEDemonPortal extends TileEntity
public static int[] tierCostList = new int[]{1500};
public static Set<IHoardDemon> hoardList = new HashSet();
public Set<IHoardDemon> hoardList = new HashSet();
public static List<DemonBuilding> buildingList = new ArrayList();
public Random rand = new Random();

View file

@ -5,6 +5,7 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@ -21,7 +22,9 @@ import org.lwjgl.input.Keyboard;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.api.Int3;
import WayofTime.alchemicalWizardry.api.items.interfaces.IRitualDiviner;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.IRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
@ -51,14 +54,14 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
public void addInformation(ItemStack stack, EntityPlayer player, List par3List, boolean x)
{
par3List.add(StatCollector.translateToLocal("tooltip.ritualdiviner.desc"));
if (this.getMaxRuneDisplacement(par1ItemStack) == 1)
if (this.getMaxRuneDisplacement(stack) == 1)
{
par3List.add(StatCollector.translateToLocal("tooltip.ritualdiviner.canplace"));
}else if (this.getMaxRuneDisplacement(par1ItemStack) >= 2)
}else if (this.getMaxRuneDisplacement(stack) >= 2)
{
par3List.add(StatCollector.translateToLocal("tooltip.ritualdiviner.canplacedawn"));
@ -67,19 +70,19 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner
par3List.add(StatCollector.translateToLocal("tooltip.ritualdiviner.cannotplace"));
}
par3List.add(StatCollector.translateToLocal("tooltip.ritualdiviner.ritualtunedto") + " " + this.getNameForDirection(this.getDirection(par1ItemStack)));
par3List.add(StatCollector.translateToLocal("tooltip.ritualdiviner.ritualtunedto") + " " + this.getNameForDirection(this.getDirection(stack)));
boolean sneaking = Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT);
if(sneaking)
{
if (!(par1ItemStack.getTagCompound() == null))
if (!(stack.getTagCompound() == null))
{
String ritualID = this.getCurrentRitual(par1ItemStack);
String ritualID = this.getCurrentRitual(stack);
//TODO
par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName"));
par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + stack.getTagCompound().getString("ownerName"));
par3List.add(StatCollector.translateToLocal("tooltip.alchemy.ritualid") + " " + ritualID);
List<RitualComponent> ritualList = Rituals.getRitualList(this.getCurrentRitual(par1ItemStack));
List<RitualComponent> ritualList = Rituals.getRitualList(this.getCurrentRitual(stack));
if (ritualList == null)
{
return;
@ -146,35 +149,56 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner
}
@Override
public String getItemStackDisplayName(ItemStack par1ItemStack)
public String getItemStackDisplayName(ItemStack stack)
{
if (!(par1ItemStack.getTagCompound() == null))
if (!(stack.getTagCompound() == null))
{
String ritualID = this.getCurrentRitual(par1ItemStack);
String ritualID = this.getCurrentRitual(stack);
if (ritualID.equals(""))
{
return super.getItemStackDisplayName(par1ItemStack);
return super.getItemStackDisplayName(stack);
}
return "Ritual: " + Rituals.getNameOfRitual(ritualID);
} else
{
return super.getItemStackDisplayName(par1ItemStack);
return super.getItemStackDisplayName(stack);
}
}
@Override
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10)
{
int direction = this.getDirection(par1ItemStack);
if (!EnergyItems.checkAndSetItemOwner(stack, player)) return false;
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par2EntityPlayer)) return false;
ItemStack[] playerInventory = par2EntityPlayer.inventory.mainInventory;
TileEntity tileEntity = par3World.getTileEntity(par4, par5, par6);
if(placeRitualStoneAtMasterStone(stack, player, world, x, y, z))
{
this.setStoredLocation(stack, new Int3(x, y, z));
return true;
}else if(!(world.getBlock(x, y, z) instanceof IRitualStone || world.getBlock(x, y, z) instanceof IMasterRitualStone) && !player.isSneaking())
{
if(world.isRemote)
{
return false;
}
this.cycleDirection(stack);
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip.ritualdiviner.ritualtunedto") + " " + this.getNameForDirection(this.getDirection(stack))));
return true;
}
return false;
}
public boolean placeRitualStoneAtMasterStone(ItemStack stack, EntityPlayer player, World world, int x, int y, int z)
{
int direction = this.getDirection(stack);
ItemStack[] playerInventory = player.inventory.mainInventory;
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity instanceof TEMasterStone)
{
TEMasterStone masterStone = (TEMasterStone) tileEntity;
List<RitualComponent> ritualList = Rituals.getRitualList(this.getCurrentRitual(par1ItemStack));
List<RitualComponent> ritualList = Rituals.getRitualList(this.getCurrentRitual(stack));
if (ritualList == null)
{
return false;
@ -198,28 +222,28 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner
for (RitualComponent rc : ritualList)
{
if (par3World.isAirBlock(par4 + rc.getX(direction), par5 + rc.getY(), par6 + rc.getZ(direction)))
if (world.isAirBlock(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction)))
{
if (playerInvRitualStoneLocation >= 0 || par2EntityPlayer.capabilities.isCreativeMode)
if (playerInvRitualStoneLocation >= 0 || player.capabilities.isCreativeMode)
{
if (rc.getStoneType() > this.maxMetaData + this.getMaxRuneDisplacement(par1ItemStack))
if (rc.getStoneType() > this.maxMetaData + this.getMaxRuneDisplacement(stack))
{
par3World.playAuxSFX(200, par4, par5 + 1, par6, 0);
world.playAuxSFX(200, x, y + 1, z, 0);
return true;
}
if (!par2EntityPlayer.capabilities.isCreativeMode)
if (!player.capabilities.isCreativeMode)
{
par2EntityPlayer.inventory.decrStackSize(playerInvRitualStoneLocation, 1);
player.inventory.decrStackSize(playerInvRitualStoneLocation, 1);
}
if(EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, getEnergyUsed()))
if(EnergyItems.syphonBatteries(stack, player, getEnergyUsed()))
{
par3World.setBlock(par4 + rc.getX(direction), par5 + rc.getY(), par6 + rc.getZ(direction), ModBlocks.ritualStone, rc.getStoneType(), 3);
world.setBlock(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction), ModBlocks.ritualStone, rc.getStoneType(), 3);
if (par3World.isRemote)
if (world.isRemote)
{
par3World.playAuxSFX(2005, par4, par5 + 1, par6, 0);
world.playAuxSFX(2005, x, y + 1, z, 0);
return true;
}
@ -229,56 +253,119 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner
}
} else
{
Block block = par3World.getBlock(par4 + rc.getX(direction), par5 + rc.getY(), par6 + rc.getZ(direction));
Block block = world.getBlock(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction));
if (block == ModBlocks.ritualStone)
{
int metadata = par3World.getBlockMetadata(par4 + rc.getX(direction), par5 + rc.getY(), par6 + rc.getZ(direction));
int metadata = world.getBlockMetadata(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction));
if (metadata != rc.getStoneType())
{
if(EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, getEnergyUsed()))
if(EnergyItems.syphonBatteries(stack, player, getEnergyUsed()))
{
if (rc.getStoneType() > this.maxMetaData + this.getMaxRuneDisplacement(par1ItemStack))
if (rc.getStoneType() > this.maxMetaData + this.getMaxRuneDisplacement(stack))
{
par3World.playAuxSFX(200, par4, par5 + 1, par6, 0);
world.playAuxSFX(200, x, y + 1, z, 0);
return true;
}
par3World.setBlockMetadataWithNotify(par4 + rc.getX(direction), par5 + rc.getY(), par6 + rc.getZ(direction), rc.getStoneType(), 3);
world.setBlockMetadataWithNotify(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction), rc.getStoneType(), 3);
return true;
}
}
} else
{
par3World.playAuxSFX(0000, par4, par5 + 1, par6, 0);
world.playAuxSFX(0000, x, y + 1, z, 0);
return true;
}
}
}
}else if(!(par3World.getBlock(par4, par5, par6) instanceof IRitualStone) && !par2EntityPlayer.isSneaking())
{
if(par3World.isRemote)
{
return false;
}
this.cycleDirection(par1ItemStack);
par2EntityPlayer.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip.ritualdiviner.ritualtunedto") + " " + this.getNameForDirection(this.getDirection(par1ItemStack))));
return true;
}
return false;
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5)
{
if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) && par3EntityPlayer.isSneaking())
if(entity instanceof EntityPlayer && hasStoredLocation(stack) && world.getWorldTime() % 5 == 0)
{
rotateRituals(par2World,par3EntityPlayer, par1ItemStack, true);
Int3 loc = getStoredLocation(stack);
int x = loc.xCoord;
int y = loc.yCoord;
int z = loc.zCoord;
if(!this.placeRitualStoneAtMasterStone(stack, (EntityPlayer)entity, world, x, y, z))
{
this.voidStoredLocation(stack);
}
}
}
return par1ItemStack;
public void setStoredLocation(ItemStack stack, Int3 location)
{
NBTTagCompound tag = stack.getTagCompound();
if(tag == null)
{
tag = new NBTTagCompound();
stack.setTagCompound(tag);
}
NBTTagCompound locTag = location.writeToNBT(new NBTTagCompound());
locTag.setBoolean("isStored", true);
tag.setTag("location", locTag);
}
public void voidStoredLocation(ItemStack stack)
{
NBTTagCompound tag = stack.getTagCompound();
if(tag == null || !tag.hasKey("location"))
{
tag = new NBTTagCompound();
stack.setTagCompound(tag);
}
NBTTagCompound locTag = (NBTTagCompound)tag.getTag("location");
locTag.setBoolean("isStored", false);
}
public Int3 getStoredLocation(ItemStack stack)
{
NBTTagCompound tag = stack.getTagCompound();
if(tag == null || !tag.hasKey("location"))
{
return new Int3(0, 0, 0);
}
NBTTagCompound locTag = (NBTTagCompound)tag.getTag("location");
return Int3.readFromNBT(locTag);
}
public boolean hasStoredLocation(ItemStack stack)
{
NBTTagCompound tag = stack.getTagCompound();
if(tag == null || !tag.hasKey("location"))
{
return false;
}
NBTTagCompound locTag = (NBTTagCompound)tag.getTag("location");
return locTag.getBoolean("isStored");
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World par2World, EntityPlayer par3EntityPlayer)
{
if (EnergyItems.checkAndSetItemOwner(stack, par3EntityPlayer) && par3EntityPlayer.isSneaking())
{
rotateRituals(par2World,par3EntityPlayer, stack, true);
}
return stack;
}
@Override
@ -327,37 +414,37 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner
}
@Override
public String getCurrentRitual(ItemStack par1ItemStack)
public String getCurrentRitual(ItemStack stack)
{
if (par1ItemStack.getTagCompound() == null)
if (stack.getTagCompound() == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
stack.setTagCompound(new NBTTagCompound());
}
return par1ItemStack.getTagCompound().getString("ritualID");
return stack.getTagCompound().getString("ritualID");
}
@Override
public void setCurrentRitual(ItemStack par1ItemStack, String ritualID)
public void setCurrentRitual(ItemStack stack, String ritualID)
{
if (par1ItemStack.getTagCompound() == null)
if (stack.getTagCompound() == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
stack.setTagCompound(new NBTTagCompound());
}
par1ItemStack.getTagCompound().setString("ritualID", ritualID);
stack.getTagCompound().setString("ritualID", ritualID);
}
@Override
public int getMaxRuneDisplacement(ItemStack par1ItemStack) //0 indicates the starting 4 runes, 1 indicates it can use Dusk runes
public int getMaxRuneDisplacement(ItemStack stack) //0 indicates the starting 4 runes, 1 indicates it can use Dusk runes
{
return par1ItemStack.getItemDamage();
return stack.getItemDamage();
}
@Override
public void setMaxRuneDisplacement(ItemStack par1ItemStack, int displacement)
public void setMaxRuneDisplacement(ItemStack stack, int displacement)
{
par1ItemStack.setItemDamage(displacement);
stack.setItemDamage(displacement);
}
@Override

View file

@ -3,9 +3,13 @@ package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.util.StatCollector;
@ -42,7 +46,8 @@ public class SacrificialDagger extends Item
}
}
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
@Override
public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
if (AlchemicalWizardry.wimpySettings)
{
@ -54,36 +59,72 @@ public class SacrificialDagger extends Item
}
}
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
/**
* called when the player releases the use item button. Args: itemstack, world, entityplayer, itemInUseCount
*/
@Override
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int itemInUseCount)
{
if (!par3EntityPlayer.capabilities.isCreativeMode)
if(itemInUseCount < 32)
{
SacrificeKnifeUsedEvent evt = new SacrificeKnifeUsedEvent(par3EntityPlayer, true, true, 2);
return;
}
}
@Override
public int getMaxItemUseDuration(ItemStack stack)
{
return 72000;
}
/**
* returns the action that specifies what animation to play when the items is being used
*/
@Override
public EnumAction getItemUseAction(ItemStack stack)
{
return EnumAction.bow;
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
if (this.canUseForSacrifice(stack))
{
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
return stack;
}
if (!player.capabilities.isCreativeMode)
{
SacrificeKnifeUsedEvent evt = new SacrificeKnifeUsedEvent(player, true, true, 2);
if(MinecraftForge.EVENT_BUS.post(evt))
{
return par1ItemStack;
return stack;
}
if(evt.shouldDrainHealth)
{
par3EntityPlayer.setHealth(par3EntityPlayer.getHealth() - 2);
player.setHealth(player.getHealth() - 2);
}
if(!evt.shouldFillAltar)
{
return par1ItemStack;
return stack;
}
}
if (par3EntityPlayer instanceof FakePlayer)
if (player instanceof FakePlayer)
{
return par1ItemStack;
return stack;
}
double posX = par3EntityPlayer.posX;
double posY = par3EntityPlayer.posY;
double posZ = par3EntityPlayer.posZ;
par2World.playSoundEffect((double) ((float) posX + 0.5F), (double) ((float) posY + 0.5F), (double) ((float) posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.8F);
double posX = player.posX;
double posY = player.posY;
double posZ = player.posZ;
world.playSoundEffect((double) ((float) posX + 0.5F), (double) ((float) posY + 0.5F), (double) ((float) posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
float f = (float) 1.0F;
float f1 = f * 0.6F + 0.4F;
float f2 = f * f * 0.7F - 0.5F;
@ -91,28 +132,28 @@ public class SacrificialDagger extends Item
for (int l = 0; l < 8; ++l)
{
par2World.spawnParticle("reddust", posX + Math.random() - Math.random(), posY + Math.random() - Math.random(), posZ + Math.random() - Math.random(), f1, f2, f3);
world.spawnParticle("reddust", posX + Math.random() - Math.random(), posY + Math.random() - Math.random(), posZ + Math.random() - Math.random(), f1, f2, f3);
}
if (!par2World.isRemote && SpellHelper.isFakePlayer(par2World, par3EntityPlayer))
if (!world.isRemote && SpellHelper.isFakePlayer(world, player))
{
return par1ItemStack;
return stack;
}
if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionSoulFray))
if (player.isPotionActive(AlchemicalWizardry.customPotionSoulFray))
{
findAndFillAltar(par2World, par3EntityPlayer, 20);
findAndFillAltar(world, player, 20);
} else
{
findAndFillAltar(par2World, par3EntityPlayer, 200);
findAndFillAltar(world, player, 200);
}
if (par3EntityPlayer.getHealth() <= 0.001f)
if (player.getHealth() <= 0.001f)
{
par3EntityPlayer.onDeath(DamageSource.generic);
player.onDeath(DamageSource.generic);
}
return par1ItemStack;
return stack;
}
public void findAndFillAltar(World world, EntityPlayer player, int amount)
@ -142,40 +183,64 @@ public class SacrificialDagger extends Item
for (int k = -2; k <= 1; k++)
{
tileEntity = world.getTileEntity(i + x, k + y, j + z);
if ((tileEntity instanceof IBloodAltar))
{
return (IBloodAltar) tileEntity;
}
}
if ((tileEntity instanceof IBloodAltar))
{
return (IBloodAltar) tileEntity;
}
}
if ((tileEntity instanceof IBloodAltar))
{
return (IBloodAltar) tileEntity;
}
}
if ((tileEntity instanceof IBloodAltar))
{
return (IBloodAltar) tileEntity;
}
return null;
}
@Override
public String getItemStackDisplayName(ItemStack par1ItemStack)
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5)
{
if(!world.isRemote && entity instanceof EntityPlayer)
{
this.setUseForSacrifice(stack, this.isPlayerPreparedForSacrifice(world, (EntityPlayer)entity));
}
}
@Override
public String getItemStackDisplayName(ItemStack stack)
{
if (AlchemicalWizardry.wimpySettings)
{
return "Sacrificial Orb";
}
return super.getItemStackDisplayName(par1ItemStack);
return super.getItemStackDisplayName(stack);
}
public boolean isPlayerPreparedForSacrifice(World world, EntityPlayer player)
{
return !world.isRemote && player.isPotionActive(Potion.regeneration);
}
public boolean canUseForSacrifice(ItemStack stack)
{
NBTTagCompound tag = stack.getTagCompound();
if(tag == null)
{
return false;
}
return tag.getBoolean("sacrifice");
}
public void setUseForSacrifice(ItemStack stack, boolean sacrifice)
{
NBTTagCompound tag = stack.getTagCompound();
if(tag == null)
{
tag = new NBTTagCompound();
stack.setTagCompound(tag);
}
tag.setBoolean("sacrifice", sacrifice);
}
@Override
@SideOnly(Side.CLIENT)
public boolean hasEffect(ItemStack stack, int pass)
{
return this.canUseForSacrifice(stack) ? true : super.hasEffect(stack, pass);
}
}

View file

@ -1,5 +1,15 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
@ -8,14 +18,6 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.api.tile.IBloodAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectAutoAlchemy extends RitualEffect
{
@ -269,6 +271,12 @@ public class RitualEffectAutoAlchemy extends RitualEffect
{
continue;
}
if(!inputInv1.isItemValidForSlot(j, curItem) || (inputInv1 instanceof ISidedInventory && !((ISidedInventory) inputInv1).canExtractItem(j, curItem, ForgeDirection.DOWN.ordinal())))
{
continue;
}
if (areItemStacksEqualWithWildcard(recItem, curItem))
{
if (alchStack == null)

View file

@ -501,22 +501,22 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
}
}
if (AlchemicalWizardry.causeHungerWithRegen)
{
List<EntityPlayer> list = SpellHelper.getPlayersInRange(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 15, 15);
for (EntityPlayer player : list)
{
PotionEffect regenEffect = player.getActivePotionEffect(Potion.regeneration);
if (regenEffect != null && regenEffect.getAmplifier() > 0)
{
if(AlchemicalWizardry.causeHungerChatMessage && !player.isPotionActive(Potion.hunger.id))
{
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.altar.hunger")));
}
player.addPotionEffect(new PotionEffect(Potion.hunger.id, 40, regenEffect.getAmplifier() * 2 - 2));
}
}
}
// if (AlchemicalWizardry.causeHungerWithRegen)
// {
// List<EntityPlayer> list = SpellHelper.getPlayersInRange(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 15, 15);
// for (EntityPlayer player : list)
// {
// PotionEffect regenEffect = player.getActivePotionEffect(Potion.regeneration);
// if (regenEffect != null && regenEffect.getAmplifier() > 0)
// {
// if(AlchemicalWizardry.causeHungerChatMessage && !player.isPotionActive(Potion.hunger.id))
// {
// player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.altar.hunger")));
// }
// player.addPotionEffect(new PotionEffect(Potion.hunger.id, 40, regenEffect.getAmplifier() * 2 - 2));
// }
// }
// }
}
if(worldObj.getWorldTime() % Math.max(20 - this.accelerationUpgrades, 1) == 0)

File diff suppressed because one or more lines are too long