1.0.1d push

This commit is contained in:
WayofTime 2014-05-04 18:11:09 -04:00
parent e13818e2da
commit 1c0deadfc6
129 changed files with 4403 additions and 2247 deletions

View file

@ -135,7 +135,7 @@ import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = "AWWayofTime", name = "AlchemicalWizardry", version = "v1.0.1c")
@Mod(modid = "AWWayofTime", name = "AlchemicalWizardry", version = "v1.0.1d")
@NetworkMod(clientSideRequired = true, serverSideRequired = false, channels = {"BloodAltar", "particle", "SetLifeEssence", "GetLifeEssence", "Ritual", "GetAltarEssence", "TESocket", "TEWritingTable", "CustomParticle", "SetPlayerVel", "SetPlayerPos", "TEPedestal", "TEPlinth", "TETeleposer", "InfiniteLPPath", "TEOrientor"}, packetHandler = PacketHandler.class)
public class AlchemicalWizardry

View file

@ -27,7 +27,7 @@ import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@Optional.InterfaceList(value = {@Interface(iface="IRevealer", modid = "Thaumcraft"), @Interface(iface="IGoggles", modid = "Thaumcraft")})
@Optional.InterfaceList(value = {@Interface(iface="thaumcraft.api.nodes.IRevealer", modid = "Thaumcraft"), @Interface(iface="thaumcraft.api.IGoggles", modid = "Thaumcraft")})
public class BoundArmour extends ItemArmor implements ISpecialArmor, IRevealer, IGoggles, IBindable
{
private static int invSize = 9;
@ -493,6 +493,7 @@ public class BoundArmour extends ItemArmor implements ISpecialArmor, IRevealer,
return false;
}
@Optional.Method(modid = "Thaumcraft")
public boolean hasIRevealer(ItemStack itemStack)
{
ItemStack[] inv = getInternalInventory(itemStack);
@ -518,6 +519,7 @@ public class BoundArmour extends ItemArmor implements ISpecialArmor, IRevealer,
return false;
}
@Optional.Method(modid = "Thaumcraft")
public boolean hasIGoggles(ItemStack itemStack)
{
ItemStack[] inv = getInternalInventory(itemStack);
@ -593,11 +595,13 @@ public class BoundArmour extends ItemArmor implements ISpecialArmor, IRevealer,
return 0;
}
@Optional.Method(modid = "Thaumcraft")
public boolean showNodes(ItemStack itemstack, EntityLivingBase player)
{
return this.hasIRevealer(itemstack);
}
@Optional.Method(modid = "Thaumcraft")
public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player)
{
return this.hasIGoggles(itemstack);

View file

@ -11,6 +11,7 @@ import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
@ -190,15 +191,20 @@ public class RitualEffectAutoAlchemy extends RitualEffect
}
}
for(int i=0; i<recipe.length;i++)
for(int i=0; i<5;i++)
{
ItemStack recItem = recipe[i];
if(recItem==null)
ItemStack recItem;
if(recipe.length<=i)
{
continue;
recItem = null;
}
else
{
recItem = recipe[i];
}
ItemStack alchStack = alchemyEntity.getStackInSlot(i+1);
if(alchStack!=null&&!(recItem.isItemEqual(alchStack)))
if((recItem==null&&alchStack!=null) || (alchStack!=null&&!(areItemStacksEqualWithWildcard(recItem,alchStack))))
{
for(int j=0;j<outputInv.getSizeInventory();j++)
{
@ -243,132 +249,136 @@ public class RitualEffectAutoAlchemy extends RitualEffect
}
}
if(flag==0&&inputInv1!=null)
if(world.getWorldTime()%10 == 0)
{
for(int i=0;i<recipe.length;i++)
{
ItemStack recItem = recipe[i];
if(recItem==null)
{
continue;
}
ItemStack alchStack = alchemyEntity.getStackInSlot(i+1);
if(alchStack!=null&&((!recItem.isItemEqual(alchStack))||alchStack.stackSize>=alchStack.getMaxStackSize()))
{
continue;
}
for(int j=0;j<inputInv1.getSizeInventory();j++)
{
ItemStack curItem = inputInv1.getStackInSlot(j);
if(curItem==null)
{
continue;
}
if(curItem.isItemEqual(recItem))
{
if(alchStack==null)
{
ItemStack copyStack = recItem.copy();
copyStack.stackSize = 1;
alchemyEntity.setInventorySlotContents(i+1, copyStack);
curItem.stackSize--;
if(curItem.stackSize<=0)
{
inputInv1.setInventorySlotContents(j, null);
}else
{
inputInv1.setInventorySlotContents(j, curItem);
}
flag++;
break;
}else
{
alchStack.stackSize++;
alchemyEntity.setInventorySlotContents(i+1, alchStack);
curItem.stackSize--;
if(curItem.stackSize<=0)
{
inputInv1.setInventorySlotContents(j, null);
}else
{
inputInv1.setInventorySlotContents(j, curItem);
}
flag++;
break;
}
}
}
}
}
if(flag==0&&inputInv2!=null)
{
for(int i=0;i<recipe.length;i++)
{
ItemStack recItem = recipe[i];
if(recItem==null)
{
continue;
}
ItemStack alchStack = alchemyEntity.getStackInSlot(i+1);
if(alchStack!=null&&((!recItem.isItemEqual(alchStack))||alchStack.stackSize>=alchStack.getMaxStackSize()))
{
continue;
}
for(int j=0;j<inputInv2.getSizeInventory();j++)
{
ItemStack curItem = inputInv2.getStackInSlot(j);
if(curItem==null)
{
continue;
}
if(curItem.isItemEqual(recItem))
{
if(alchStack==null)
{
ItemStack copyStack = recItem.copy();
copyStack.stackSize = 1;
alchemyEntity.setInventorySlotContents(i+1, copyStack);
curItem.stackSize--;
if(curItem.stackSize<=0)
{
inputInv2.setInventorySlotContents(j, null);
}else
{
inputInv2.setInventorySlotContents(j, curItem);
}
flag++;
break;
}else
{
alchStack.stackSize++;
alchemyEntity.setInventorySlotContents(i+1, alchStack);
curItem.stackSize--;
if(curItem.stackSize<=0)
{
inputInv2.setInventorySlotContents(j, null);
}else
{
inputInv2.setInventorySlotContents(j, curItem);
}
flag++;
break;
}
}
}
}
if(flag==0&&inputInv1!=null)
{
for(int i=0;i<recipe.length;i++)
{
ItemStack recItem = recipe[i];
if(recItem==null)
{
continue;
}
ItemStack alchStack = alchemyEntity.getStackInSlot(i+1);
if(alchStack!=null&&((!areItemStacksEqualWithWildcard(recItem,alchStack))||alchStack.stackSize>=alchStack.getMaxStackSize()))
{
continue;
}
for(int j=0;j<inputInv1.getSizeInventory();j++)
{
ItemStack curItem = inputInv1.getStackInSlot(j);
if(curItem==null)
{
continue;
}
if(areItemStacksEqualWithWildcard(recItem,curItem))
{
if(alchStack==null)
{
ItemStack copyStack = recItem.copy();
copyStack.stackSize = 1;
alchemyEntity.setInventorySlotContents(i+1, copyStack);
curItem.stackSize--;
if(curItem.stackSize<=0)
{
inputInv1.setInventorySlotContents(j, null);
}else
{
inputInv1.setInventorySlotContents(j, curItem);
}
flag++;
break;
}else
{
alchStack.stackSize++;
alchemyEntity.setInventorySlotContents(i+1, alchStack);
curItem.stackSize--;
if(curItem.stackSize<=0)
{
inputInv1.setInventorySlotContents(j, null);
}else
{
inputInv1.setInventorySlotContents(j, curItem);
}
flag++;
break;
}
}
}
}
}
if(flag==0&&inputInv2!=null)
{
for(int i=0;i<recipe.length;i++)
{
ItemStack recItem = recipe[i];
if(recItem==null)
{
continue;
}
ItemStack alchStack = alchemyEntity.getStackInSlot(i+1);
if(alchStack!=null&&((!areItemStacksEqualWithWildcard(recItem,alchStack))||alchStack.stackSize>=alchStack.getMaxStackSize()))
{
continue;
}
for(int j=0;j<inputInv2.getSizeInventory();j++)
{
ItemStack curItem = inputInv2.getStackInSlot(j);
if(curItem==null)
{
continue;
}
if(areItemStacksEqualWithWildcard(recItem,curItem))
{
if(alchStack==null)
{
ItemStack copyStack = recItem.copy();
copyStack.stackSize = 1;
alchemyEntity.setInventorySlotContents(i+1, copyStack);
curItem.stackSize--;
if(curItem.stackSize<=0)
{
inputInv2.setInventorySlotContents(j, null);
}else
{
inputInv2.setInventorySlotContents(j, curItem);
}
flag++;
break;
}else
{
alchStack.stackSize++;
alchemyEntity.setInventorySlotContents(i+1, alchStack);
curItem.stackSize--;
if(curItem.stackSize<=0)
{
inputInv2.setInventorySlotContents(j, null);
}else
{
inputInv2.setInventorySlotContents(j, curItem);
}
flag++;
break;
}
}
}
}
}
}
}
@ -412,4 +422,9 @@ public class RitualEffectAutoAlchemy extends RitualEffect
autoAlchemyRitual.add(new RitualComponent(2,0,3, RitualComponent.FIRE));
return autoAlchemyRitual;
}
public boolean areItemStacksEqualWithWildcard(ItemStack recipeStack, ItemStack comparedStack)
{
return recipeStack.isItemEqual(comparedStack) || (recipeStack.getItemDamage() == OreDictionary.WILDCARD_VALUE && recipeStack.getItem() == comparedStack.getItem());
}
}

View file

@ -60,6 +60,9 @@ public class RitualEffectCrushing extends RitualEffect
{
return;
}
boolean isSilkTouch = this.isSilkTouch(world, x, y, z);
int fortuneLevel = this.getFortuneLevel(world, x, y, z);
if (currentEssence < this.getCostPerRefresh())
{
@ -73,6 +76,7 @@ public class RitualEffectCrushing extends RitualEffect
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
} else
{
//boolean flag = false;
for (int j = -3; j < 0; j++)
{
@ -90,57 +94,108 @@ public class RitualEffectCrushing extends RitualEffect
{
continue;
}
ArrayList<ItemStack> itemDropList = block.getBlockDropped(world, x + i, y + j, z + k, meta, 0);
if (itemDropList != null)
if(isSilkTouch && block.canSilkHarvest(world, null, x + i, y + j, z + k, meta))
{
int invSize = tileEntity.getSizeInventory();
int invSize = tileEntity.getSizeInventory();
ItemStack item = new ItemStack(block,1,meta);
ItemStack copyStack = item.copyItemStack(item);
for (ItemStack item : itemDropList)
for (int n = 0; n < invSize; n++)
{
ItemStack copyStack = item.copyItemStack(item);
for (int n = 0; n < invSize; n++)
if (tileEntity.isItemValidForSlot(n, copyStack) && copyStack.stackSize != 0)
{
if (tileEntity.isItemValidForSlot(n, copyStack) && copyStack.stackSize != 0)
ItemStack itemStack = tileEntity.getStackInSlot(n);
if (itemStack == null)
{
ItemStack itemStack = tileEntity.getStackInSlot(n);
tileEntity.setInventorySlotContents(n, item);
copyStack.stackSize = 0;
} else
{
if (itemStack.getItem().equals(copyStack.getItem()))
{
int itemSize = itemStack.stackSize;
int copySize = copyStack.stackSize;
int maxSize = itemStack.getMaxStackSize();
if (itemStack == null)
{
tileEntity.setInventorySlotContents(n, copyStack);
copyStack.stackSize = 0;
} else
{
if (itemStack.getItem().equals(copyStack.getItem()))
if (copySize + itemSize < maxSize)
{
int itemSize = itemStack.stackSize;
int copySize = copyStack.stackSize;
int maxSize = itemStack.getMaxStackSize();
if (copySize + itemSize < maxSize)
{
copyStack.stackSize = 0;
itemStack.stackSize = itemSize + copySize;
tileEntity.setInventorySlotContents(n, itemStack);
} else
{
copyStack.stackSize = itemSize + copySize - maxSize;
itemStack.stackSize = maxSize;
}
copyStack.stackSize = 0;
itemStack.stackSize = itemSize + copySize;
tileEntity.setInventorySlotContents(n, itemStack);
} else
{
copyStack.stackSize = itemSize + copySize - maxSize;
itemStack.stackSize = maxSize;
}
}
}
}
if (copyStack.stackSize > 0)
{
world.spawnEntityInWorld(new EntityItem(world, x + 0.4, y + 2, z + 0.5, copyStack));
//flag=true;
}
}
if (copyStack.stackSize > 0)
{
world.spawnEntityInWorld(new EntityItem(world, x + 0.4, y + 2, z + 0.5, copyStack));
//flag=true;
}
}
else
{
ArrayList<ItemStack> itemDropList = block.getBlockDropped(world, x + i, y + j, z + k, meta, fortuneLevel);
if (itemDropList != null)
{
int invSize = tileEntity.getSizeInventory();
for (ItemStack item : itemDropList)
{
ItemStack copyStack = item.copyItemStack(item);
for (int n = 0; n < invSize; n++)
{
if (tileEntity.isItemValidForSlot(n, copyStack) && copyStack.stackSize != 0)
{
ItemStack itemStack = tileEntity.getStackInSlot(n);
if (itemStack == null)
{
tileEntity.setInventorySlotContents(n, item);
copyStack.stackSize = 0;
} else
{
if (itemStack.getItem().equals(copyStack.getItem()))
{
int itemSize = itemStack.stackSize;
int copySize = copyStack.stackSize;
int maxSize = itemStack.getMaxStackSize();
if (copySize + itemSize < maxSize)
{
copyStack.stackSize = 0;
itemStack.stackSize = itemSize + copySize;
tileEntity.setInventorySlotContents(n, itemStack);
} else
{
copyStack.stackSize = itemSize + copySize - maxSize;
itemStack.stackSize = maxSize;
}
}
}
}
}
if (copyStack.stackSize > 0)
{
world.spawnEntityInWorld(new EntityItem(world, x + 0.4, y + 2, z + 0.5, copyStack));
//flag=true;
}
}
}
}
//if(flag)
world.setBlockToAir(x + i, y + j, z + k);
@ -154,6 +209,67 @@ public class RitualEffectCrushing extends RitualEffect
}
}
}
public boolean isSilkTouch(World world, int x, int y, int z)
{
int index = 0;
for(int i=-2; i<=2; i++)
{
for(int j=-2; j<=2; j++)
{
int index1 = Math.abs(i);
int index2 = Math.abs(j);
if((index1 == 2 && (index2 == 2 || index2 == 1)) || (index1 == 1 && index2 == 2))
{
int blockID = world.getBlockId(x + i, y + 1, z + j);
Block block = Block.blocksList[blockID];
if(block == Block.blockGold)
{
index++;
}
}
}
}
return index>=12;
}
public int getFortuneLevel(World world, int x, int y, int z)
{
int index = 0;
for(int i=-2; i<=2; i++)
{
for(int j=-2; j<=2; j++)
{
int index1 = Math.abs(i);
int index2 = Math.abs(j);
if((index1 == 2 && (index2 == 2 || index2 == 1)) || (index1 == 1 && index2 == 2))
{
int blockID = world.getBlockId(x + i, y + 1, z + j);
Block block = Block.blocksList[blockID];
if(block == Block.blockEmerald)
{
index++;
}
}
}
}
if(index>=12)
{
return 3;
}else if(index>=8)
{
return 2;
}else if(index>=4)
{
return 1;
}
return 0;
}
@Override
public int getCostPerRefresh()

View file

@ -751,10 +751,7 @@ public class TEWritingTable extends TileEntity implements ISidedInventory
progress = 0;
this.setInventorySlotContents(6, getResultingItemStack());
for (int i = 0; i < 5; i++)
{
this.decrStackSizeLeaveContainer(i + 1, 1);
}
this.decrementSlots(AlchemyRecipeRegistry.getRecipeForItemStack(getResultingItemStack()));
if (worldObj != null)
{
@ -782,10 +779,7 @@ public class TEWritingTable extends TileEntity implements ISidedInventory
result.stackSize += getStackInSlot(6).stackSize;
this.setInventorySlotContents(6, result);
for (int i = 0; i < 5; i++)
{
this.decrStackSizeLeaveContainer(i + 1, 1);
}
this.decrementSlots(AlchemyRecipeRegistry.getRecipeForItemStack(getResultingItemStack()));
if (worldObj != null)
{
@ -842,4 +836,31 @@ public class TEWritingTable extends TileEntity implements ISidedInventory
{
return true;
}
public void decrementSlots(ItemStack[] recipe)
{
boolean[] decrementedList = new boolean[]{false,false,false,false,false};
for(int i=0; i<(Math.min(recipe.length,5)); i++)
{
ItemStack decStack = recipe[i];
if(decStack == null)
{
continue;
}
for(int j=0; j<5; j++)
{
ItemStack testStack = this.getStackInSlot(j+1);
if(testStack != null && testStack.isItemEqual(decStack) && !(decrementedList[j]))
{
this.decrStackSize(j+1, 1);
decrementedList[j] = true;
break;
}
}
}
}
}

View file

@ -1,11 +1,12 @@
package WayofTime.alchemicalWizardry.common.tileEntity.container;
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
public class ContainerWritingTable extends Container
{
@ -52,7 +53,7 @@ public class ContainerWritingTable extends Container
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot)
{
ItemStack stack = null;
ItemStack stack = null;
Slot slotObject = (Slot) inventorySlots.get(slot);
//null checks and checks if the item can be stacked (maxStackSize > 1)
@ -61,26 +62,23 @@ public class ContainerWritingTable extends Container
ItemStack stackInSlot = slotObject.getStack();
stack = stackInSlot.copy();
if (slot == 7)
//merges the item into player inventory since its in the tileEntity
if (slot <= 6)
{
if (!this.mergeItemStack(stackInSlot, 7, 35, true))
if (!this.mergeItemStack(stackInSlot, 7, 43, true))
{
return null;
}
slotObject.onSlotChange(stackInSlot, stack);
}
//merges the item into player inventory since its in the tileEntity
if (slot < 6)
else if(stack.getItem() instanceof IBloodOrb)
{
if (!this.mergeItemStack(stackInSlot, 7, 35, true))
if (!this.mergeItemStack(stackInSlot, 0, 1, false))
{
return null;
}
}
//places it into the tileEntity is possible since its in the player inventory
else if (!this.mergeItemStack(stackInSlot, 0, 7, false))
else if (!this.mergeItemStack(stackInSlot, 1, 6, false))
{
return null;
}