Added the method to create the Omega armours, though it wasn't a secret for a while! :D
Added the ability to enchant omega armour in such a way that there won't be a single best method A bunch of other stuff I can't remember. Fun times!
This commit is contained in:
parent
afa3988a21
commit
b725f7b814
34 changed files with 477 additions and 146 deletions
|
@ -1,14 +1,21 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
|
@ -23,7 +30,9 @@ import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
|||
|
||||
public class RitualEffectOmegaTest extends RitualEffect
|
||||
{
|
||||
public static final int tickDuration = 1 * 60 * 20;
|
||||
public static final boolean isTesting = true;
|
||||
public static final int drainTotal = 32 * 1000;
|
||||
|
||||
@Override
|
||||
public void performEffect(IMasterRitualStone ritualStone)
|
||||
{
|
||||
|
@ -43,27 +52,106 @@ public class RitualEffectOmegaTest extends RitualEffect
|
|||
OmegaStructureParameters param = OmegaStructureHandler.getStructureStabilityFactor(world, x, y, z, 5, new Int3(0,1,0));
|
||||
int stab = param.stability;
|
||||
int enchantability = param.enchantability;
|
||||
int enchantmentLevel = param.enchantmentLevel;
|
||||
|
||||
System.out.println("Stability: " + stab);
|
||||
System.out.println("Stability: " + stab + ", Enchantability: " + enchantability + ", Enchantment Level: " + enchantmentLevel);
|
||||
|
||||
double range = 0.5;
|
||||
|
||||
List<EntityPlayer> playerList = SpellHelper.getPlayersInRange(world, x + 0.5, y + 1.5, z + 0.5, range, range);
|
||||
|
||||
Reagent reagent = null;
|
||||
|
||||
Map<Reagent, Integer> reagentMap = new HashMap();
|
||||
for(int i=0; i<4; i++)
|
||||
{
|
||||
Int3 jarLoc = this.getJarLocation(i);
|
||||
TileEntity tile = world.getTileEntity(x + jarLoc.xCoord, y + jarLoc.yCoord, z + jarLoc.zCoord);
|
||||
if(tile instanceof IReagentHandler)
|
||||
{
|
||||
IReagentHandler container = (IReagentHandler)tile;
|
||||
ReagentContainerInfo[] containerInfoArray = container.getContainerInfo(ForgeDirection.UP);
|
||||
if(containerInfoArray == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for(ReagentContainerInfo containerInfo : containerInfoArray)
|
||||
{
|
||||
ReagentStack containedReagent = containerInfo.reagent;
|
||||
if(containedReagent == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Reagent rea = containedReagent.reagent;
|
||||
int amt = containedReagent.amount;
|
||||
if(reagentMap.containsKey(rea))
|
||||
{
|
||||
reagentMap.put(rea, reagentMap.get(rea) + amt);
|
||||
}else
|
||||
{
|
||||
reagentMap.put(rea, amt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(Entry<Reagent, Integer> entry : reagentMap.entrySet())
|
||||
{
|
||||
if(entry.getValue() >= drainTotal)
|
||||
{
|
||||
reagent = entry.getKey();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(reagent == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int tickDuration = isTesting ? 20 * 30 : 15 * 20 * 60 + (int)((15 * 20 * 60) * Math.sqrt(stab / 700));
|
||||
|
||||
int affinity = 0;
|
||||
|
||||
for(EntityPlayer player : playerList)
|
||||
{
|
||||
Reagent reagent = ReagentRegistry.aetherReagent;
|
||||
|
||||
int affinity = 0;
|
||||
|
||||
OmegaParadigm waterParadigm = OmegaRegistry.getParadigmForReagent(reagent);
|
||||
if(waterParadigm != null && waterParadigm.convertPlayerArmour(player, x, y, z, stab, affinity, enchantability))
|
||||
if(waterParadigm != null && waterParadigm.convertPlayerArmour(player, x, y, z, stab, affinity, enchantability, enchantmentLevel))
|
||||
{
|
||||
APISpellHelper.setPlayerCurrentReagentAmount(player, tickDuration);
|
||||
APISpellHelper.setPlayerMaxReagentAmount(player, tickDuration);
|
||||
APISpellHelper.setPlayerReagentType(player, reagent);
|
||||
APISpellHelper.setCurrentAdditionalMaxHP(player, waterParadigm.getMaxAdditionalHealth());
|
||||
NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getReagentBarPacket(reagent, APISpellHelper.getPlayerCurrentReagentAmount(player), APISpellHelper.getPlayerMaxReagentAmount(player)), (EntityPlayerMP)player);
|
||||
|
||||
if(!isTesting)
|
||||
{
|
||||
int drainLeft = this.drainTotal;
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
if(drainLeft <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
Int3 jarLoc = this.getJarLocation(i);
|
||||
TileEntity tile = world.getTileEntity(x + jarLoc.xCoord, y + jarLoc.yCoord, z + jarLoc.zCoord);
|
||||
if(tile instanceof IReagentHandler)
|
||||
{
|
||||
IReagentHandler container = (IReagentHandler)tile;
|
||||
ReagentStack drained = container.drain(ForgeDirection.UP, new ReagentStack(reagent, drainLeft), true);
|
||||
if(drained != null)
|
||||
{
|
||||
drainLeft -= drained.amount;
|
||||
world.markBlockForUpdate(x + jarLoc.xCoord, y + jarLoc.yCoord, z + jarLoc.zCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ritualStone.setActive(false);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -102,13 +190,13 @@ public class RitualEffectOmegaTest extends RitualEffect
|
|||
switch(i)
|
||||
{
|
||||
case 0:
|
||||
return new Int3(-3,1,0);
|
||||
return new Int3(-3,0,0);
|
||||
case 1:
|
||||
return new Int3(3,1,0);
|
||||
return new Int3(3,0,0);
|
||||
case 2:
|
||||
return new Int3(0,1,-3);
|
||||
return new Int3(0,0,-3);
|
||||
case 3:
|
||||
return new Int3(0,1,3);
|
||||
return new Int3(0,0,3);
|
||||
default:
|
||||
return new Int3(0,0,0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue