From a94e2982f8fda9e543ac830b97181496a8ebed0a Mon Sep 17 00:00:00 2001 From: Vasco Lavos Date: Fri, 16 May 2014 23:52:43 +0100 Subject: [PATCH] Allow the Runic Altar to be fully automated. --- .../common/block/tile/TileRuneAltar.java | 20 ++++++++++++++----- resources/assets/botania/lang/en_US.lang | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/MODSRC/vazkii/botania/common/block/tile/TileRuneAltar.java b/MODSRC/vazkii/botania/common/block/tile/TileRuneAltar.java index 33df1b677..8381bd17c 100644 --- a/MODSRC/vazkii/botania/common/block/tile/TileRuneAltar.java +++ b/MODSRC/vazkii/botania/common/block/tile/TileRuneAltar.java @@ -37,7 +37,7 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor int mana = 0; public boolean addItem(EntityPlayer player, ItemStack stack) { - if(stack.getItem() == ModItems.twigWand || stack.getItem() == ModItems.lexicon || manaToGet != 0) + if(stack.getItem() == ModItems.twigWand || stack.getItem() == ModItems.lexicon || manaToGet != 0) return false; boolean did = false; @@ -49,9 +49,9 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor stackToAdd.stackSize = 1; setInventorySlotContents(i, stackToAdd); - if(!player.capabilities.isCreativeMode) { + if(player == null || !player.capabilities.isCreativeMode) { stack.stackSize--; - if(stack.stackSize == 0) + if(stack.stackSize == 0 && player != null) player.inventory.setInventorySlotContents(player.inventory.currentItem, null); } @@ -71,6 +71,17 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor // Update every tick. recieveMana(0); + if(!worldObj.isRemote) { + List items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1)); + for(EntityItem item : items) + if(!item.isDead && item.getEntityItem() != null && item.getEntityItem().getItem() != Item.getItemFromBlock(ModBlocks.livingrock)) { + ItemStack stack = item.getEntityItem(); + if(addItem(null, stack) && stack.stackSize == 0) + item.setDead(); + } + } + + if(worldObj.isRemote && manaToGet > 0 && mana >= manaToGet) { if(worldObj.rand.nextInt(20) == 0) { worldObj.playSoundEffect(xCoord, yCoord, zCoord, "mob.creeper.live", 1F, 1F); @@ -80,7 +91,6 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor Botania.proxy.lightningFX(worldObj, vec, endVec, 2F, 0x00948B, 0x00E4D7); } } - } public void updateRecipe() { @@ -117,7 +127,7 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor List items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1)); EntityItem livingrock = null; for(EntityItem item : items) - if(item.getEntityItem() != null && item.getEntityItem().getItem() == Item.getItemFromBlock(ModBlocks.livingrock)) { + if(!item.isDead && item.getEntityItem() != null && item.getEntityItem().getItem() == Item.getItemFromBlock(ModBlocks.livingrock)) { livingrock = item; break; } diff --git a/resources/assets/botania/lang/en_US.lang b/resources/assets/botania/lang/en_US.lang index 597fe1f41..a4c053ddc 100644 --- a/resources/assets/botania/lang/en_US.lang +++ b/resources/assets/botania/lang/en_US.lang @@ -377,7 +377,7 @@ botania.page.wand1=The petals used determine the colors of the wand # -- RUNIC ALTAR botania.entry.runeAltar=Runic Altar -botania.page.runeAltar0=&1Runes&0 are extremely important components of complex magical devices or flora.
In order to create these, one would require a &1Runic Altar&0.
To utilize this &1Runic Altar&0, start by placing, via right click, the components to the rune you want to create. +botania.page.runeAltar0=&1Runes&0 are extremely important components of complex magical devices or flora.
In order to create these, one would require a &1Runic Altar&0.
To utilize this &1Runic Altar&0, start by placing, via either a right click or simply tossing, the components to the rune you want to create. botania.page.runeAltar1=Proceed by linking a &1Mana Spreader&0 to the altar, and right click it with a &1Wand of the Forest&0.
It should be apparent when the altar has received enough &4Mana&0. When that happens, just drop a piece of &1Livingrock&0 on top of it and use the wand on it again to collect your rune. botania.page.runeAltar2=Crafting the &1Runic Altar&0. botania.page.runeAltar3=A total of 16 &1Runes&0 exist.
The most basic and elementary runes are named after the &4Four Elements&0. The intermediate runes are named after the &4Four Seasons&0, and the most advanced runes are named after the &4Seven Deadly Sins&0. A separate &1Rune of Mana&0 also exists.