Big commitment~
This commit is contained in:
parent
a92efa364d
commit
4f9fad22c5
1.7.10/main
java/WayofTime/alchemicalWizardry
AlchemicalWizardry.javaBloodMagicConfiguration.java
common
resources/assets/alchemicalwizardry/schematics/building
|
@ -60,6 +60,7 @@ import WayofTime.alchemicalWizardry.common.entity.mob.EntitySmallEarthGolem;
|
|||
import WayofTime.alchemicalWizardry.common.entity.mob.EntityWaterElemental;
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.EntityWingedFireDemon;
|
||||
import WayofTime.alchemicalWizardry.common.harvest.BloodMagicHarvestHandler;
|
||||
import WayofTime.alchemicalWizardry.common.harvest.CactusReedHarvestHandler;
|
||||
import WayofTime.alchemicalWizardry.common.harvest.GourdHarvestHandler;
|
||||
import WayofTime.alchemicalWizardry.common.items.ItemRitualDiviner;
|
||||
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHolding;
|
||||
|
@ -75,11 +76,14 @@ import WayofTime.alchemicalWizardry.common.potion.PotionInhibit;
|
|||
import WayofTime.alchemicalWizardry.common.potion.PotionPlanarBinding;
|
||||
import WayofTime.alchemicalWizardry.common.potion.PotionProjectileProtect;
|
||||
import WayofTime.alchemicalWizardry.common.potion.PotionReciprocation;
|
||||
import WayofTime.alchemicalWizardry.common.potion.PotionSoulFray;
|
||||
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectAnimalGrowth;
|
||||
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectAutoAlchemy;
|
||||
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectBiomeChanger;
|
||||
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectContainment;
|
||||
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectCrushing;
|
||||
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectEllipsoid;
|
||||
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectEvaporation;
|
||||
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectExpulsion;
|
||||
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectFeatheredEarth;
|
||||
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectFeatheredKnife;
|
||||
|
@ -122,6 +126,7 @@ import WayofTime.alchemicalWizardry.common.tileEntity.TEPedestal;
|
|||
import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESchematicSaver;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESocket;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralBlock;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralContainer;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEffectBlock;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEnhancementBlock;
|
||||
|
@ -171,6 +176,7 @@ public class AlchemicalWizardry
|
|||
public static Potion customPotionHeavyHeart;
|
||||
public static Potion customPotionFireFuse;
|
||||
public static Potion customPotionPlanarBinding;
|
||||
public static Potion customPotionSoulFray;
|
||||
|
||||
public static int customPotionDrowningID;
|
||||
public static int customPotionBoostID;
|
||||
|
@ -183,12 +189,13 @@ public class AlchemicalWizardry
|
|||
public static int customPotionHeavyHeartID;
|
||||
public static int customPotionFireFuseID;
|
||||
public static int customPotionPlanarBindingID;
|
||||
public static int customPotionSoulFrayID;
|
||||
|
||||
public static boolean isThaumcraftLoaded;
|
||||
public static boolean isForestryLoaded;
|
||||
|
||||
public static boolean wimpySettings;
|
||||
public static boolean respawnWithLowerHealth;
|
||||
public static boolean respawnWithDebuff;
|
||||
|
||||
public static CreativeTabs tabBloodMagic = new CreativeTabs("tabBloodMagic")
|
||||
{
|
||||
|
@ -414,7 +421,7 @@ public class AlchemicalWizardry
|
|||
ItemStack runeOfSelfSacrificeStack = new ItemStack(ModBlocks.runeOfSelfSacrifice);
|
||||
ItemStack miningSigilStackCrafted = new ItemStack(ModItems.sigilOfTheFastMiner);
|
||||
ItemStack divinationSigilStackCrafted = new ItemStack(ModItems.divinationSigil);
|
||||
ItemStack seerSigilStack = new ItemStack(ModItems.itemSeerSigil);
|
||||
ItemStack seerSigilStackCrafted = new ItemStack(ModItems.itemSeerSigil);
|
||||
// ItemStack elementalInkWaterStack = new ItemStack(elementalInkWater);
|
||||
// ItemStack elementalInkFireStack = new ItemStack(elementalInkFire);
|
||||
// ItemStack elementalInkEarthStack = new ItemStack(elementalInkEarth);
|
||||
|
@ -482,12 +489,14 @@ public class AlchemicalWizardry
|
|||
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.bloodRune, 1, 1), "sbs", "bob", "srs", 's', stoneStack, 'o', magicianBloodOrbStack, 'b', emptyBucketStack, 'r', new ItemStack(ModItems.imbuedSlate)));
|
||||
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.bloodRune, 1, 2), "sbs", "bob", "srs", 's', stoneStack, 'o', magicianBloodOrbStack, 'b', waterBucketStack, 'r', new ItemStack(ModItems.imbuedSlate)));
|
||||
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.bloodRune, 1, 3), "sws", "ror", "sws", 's', stoneStack, 'o', new ItemStack(ModItems.masterBloodOrb), 'w', weakBloodOrbStack, 'r', new ItemStack(ModItems.demonicSlate)));
|
||||
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.bloodRune, 1, 4), "srs", "beb", "sos", 's', obsidianStack, 'o', new ItemStack(ModItems.masterBloodOrb), 'r', new ItemStack(ModItems.demonicSlate), 'b', emptyBucketStack,'e',new ItemStack(ModBlocks.bloodRune, 1, 1)));
|
||||
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(airSigilStack, "fgf", "fsf", "fof", 'f', featherStack, 'g', ghastTearStack, 's', reinforcedSlateStack, 'o', apprenticeBloodOrbStack));
|
||||
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(miningSigilStackCrafted, "sps", "hra", "sos", 'o', apprenticeBloodOrbStack, 's', stoneStack, 'p', ironPickaxeStack, 'h', ironShovelStack, 'a', ironAxeStack, 'r', reinforcedSlateStack));
|
||||
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(runeOfSacrificeStack, "srs", "gog", "srs", 's', stoneStack, 'g', goldIngotStack, 'o', apprenticeBloodOrbStack, 'r', reinforcedSlateStack));
|
||||
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(runeOfSelfSacrificeStack, "srs", "gog", "srs", 's', stoneStack, 'g', glowstoneDustStack, 'o', apprenticeBloodOrbStack, 'r', reinforcedSlateStack));
|
||||
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(divinationSigilStackCrafted, "ggg", "gsg", "gog", 'g', glassStack, 's', blankSlateStack, 'o', weakBloodOrbStack));
|
||||
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(seerSigilStack, "gbg", "gsg", "gog", 'g', glassStack, 's', divinationSigilStackCrafted, 'o', apprenticeBloodOrbStack,'b', new ItemStack(ModItems.bucketLife)));
|
||||
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(seerSigilStackCrafted, "gbg", "gsg", "gog", 'g', glassStack, 's', divinationSigilStackCrafted, 'o', apprenticeBloodOrbStack, 'b', new ItemStack(ModItems.bucketLife)));
|
||||
|
||||
// GameRegistry.addRecipe(waterScribeToolStack, "f", "i", 'f', featherStack, 'i', elementalInkWaterStack);
|
||||
// GameRegistry.addRecipe(fireScribeToolStack, "f", "i", 'f', featherStack, 'i', elementalInkFireStack);
|
||||
// GameRegistry.addRecipe(earthScribeToolStack, "f", "i", 'f', featherStack, 'i', elementalInkEarthStack);
|
||||
|
@ -535,6 +544,7 @@ public class AlchemicalWizardry
|
|||
customPotionHeavyHeart = (new PotionHeavyHeart(customPotionHeavyHeartID,true,0).setIconIndex(0, 0).setPotionName("Heavy Heart"));
|
||||
customPotionFireFuse = (new PotionFireFuse(customPotionFireFuseID,true,0).setIconIndex(0, 0).setPotionName("Fire Fuse"));
|
||||
customPotionPlanarBinding = (new PotionPlanarBinding(customPotionPlanarBindingID,true,0).setIconIndex(0,0).setPotionName("Planar Binding"));
|
||||
customPotionSoulFray = (new PotionSoulFray(customPotionSoulFrayID,true,0).setIconIndex(0,0).setPotionName("Soul Fray"));
|
||||
|
||||
ItemStack masterBloodOrbStack = new ItemStack(ModItems.masterBloodOrb);
|
||||
|
||||
|
@ -570,6 +580,7 @@ public class AlchemicalWizardry
|
|||
GameRegistry.registerTileEntity(TESpectralContainer.class,"spectralContainerTileEntity");
|
||||
GameRegistry.registerTileEntity(TEDemonPortal.class, "containerDemonPortal");
|
||||
GameRegistry.registerTileEntity(TESchematicSaver.class, "containerSchematicSaver");
|
||||
GameRegistry.registerTileEntity(TESpectralBlock.class, "containerSpectralBlock");
|
||||
//GameRegistry.registerBlock(ModBlocks.blockSpellEffect,"blockSpellEffect");
|
||||
ModBlocks.bloodRune.setHarvestLevel("pickaxe", 2);
|
||||
ModBlocks.speedRune.setHarvestLevel("pickaxe", 2);
|
||||
|
@ -916,6 +927,7 @@ public class AlchemicalWizardry
|
|||
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.feather), AlchemicalWizardry.customPotionFlight.id, 1 * 60 * 20);
|
||||
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.arrow), AlchemicalWizardry.customPotionReciprocation.id, 1 * 60 * 20);
|
||||
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.ender_pearl),AlchemicalWizardry.customPotionPlanarBinding.id,1*60*20);
|
||||
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Blocks.soul_sand),AlchemicalWizardry.customPotionSoulFray.id,30*20);
|
||||
}
|
||||
|
||||
public static void initAltarRecipes()
|
||||
|
@ -978,6 +990,8 @@ public class AlchemicalWizardry
|
|||
Rituals.registerRitual("AW023Zephyr", 1, 25000, new RitualEffectItemSuction(),"Call of the Zephyr");
|
||||
Rituals.registerRitual("AW024Harvest", 1, 20000, new RitualEffectHarvest(), "Reap of the Harvest Moon");
|
||||
Rituals.registerRitual("AW025Conduit", 2, 2000000, new RitualEffectLifeConduit(), "Cry of the Eternal Soul");
|
||||
Rituals.registerRitual("AW026Ellipsoid", 1, 25000, new RitualEffectEllipsoid(), "Ellipsoid");
|
||||
Rituals.registerRitual("AW027Evaporation", 1, 1000, new RitualEffectEvaporation(), "Evaporation");
|
||||
//Rituals.registerRitual(1,100,new RitualEffectApiaryOverclock(),"Apiary Overclock"));
|
||||
}
|
||||
|
||||
|
@ -994,5 +1008,6 @@ public class AlchemicalWizardry
|
|||
{
|
||||
HarvestRegistry.registerHarvestHandler(new BloodMagicHarvestHandler());
|
||||
HarvestRegistry.registerHarvestHandler(new GourdHarvestHandler());
|
||||
HarvestRegistry.registerHarvestHandler(new CactusReedHarvestHandler());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ public class BloodMagicConfiguration
|
|||
AlchemicalWizardry.customPotionHeavyHeartID = config.get("Potion ID","HeavyHeart",108).getInt();
|
||||
AlchemicalWizardry.customPotionFireFuseID = config.get("Potion ID","FireFuse",109).getInt();
|
||||
AlchemicalWizardry.customPotionPlanarBindingID = config.get("Potion ID","PlanarBinding",110).getInt();
|
||||
AlchemicalWizardry.customPotionSoulFrayID = config.get("Potion ID","SoulFray",111).getInt();
|
||||
|
||||
MeteorParadigm.maxChance = config.get("meteor", "maxChance", 1000).getInt();
|
||||
AlchemicalWizardry.doMeteorsDestroyBlocks = config.get("meteor", "doMeteorsDestroyBlocks", true).getBoolean(true);
|
||||
|
@ -64,7 +65,7 @@ public class BloodMagicConfiguration
|
|||
AlchemicalWizardry.allowedCrushedOresArray = config.get("oreCrushing", "allowedOres", new String[]{"iron","gold","copper","tin","lead","silver","osmium"}).getStringList();
|
||||
|
||||
AlchemicalWizardry.wimpySettings = config.get("WimpySettings","IDontLikeFun",false).getBoolean(false);
|
||||
AlchemicalWizardry.respawnWithLowerHealth = config.get("WimpySettings", "RespawnWithLowerHealth", true).getBoolean();
|
||||
AlchemicalWizardry.respawnWithDebuff = config.get("WimpySettings", "RespawnWithDebuff", true).getBoolean();
|
||||
|
||||
} catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.entity.player.PlayerCapabilities;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
@ -36,9 +37,9 @@ public class AlchemicalWizardryEventHooks
|
|||
@SubscribeEvent
|
||||
public void onPlayerRespawnEvent(PlayerRespawnEvent event)
|
||||
{
|
||||
if(AlchemicalWizardry.respawnWithLowerHealth)
|
||||
if(AlchemicalWizardry.respawnWithDebuff)
|
||||
{
|
||||
event.player.setHealth(6);
|
||||
event.player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionSoulFray.id, 20*60*5,0));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,4 +13,10 @@ public class Int3
|
|||
this.yCoord = yCoord;
|
||||
this.zCoord = zCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
return o instanceof Int3 ? ((Int3)o).xCoord == this.xCoord && ((Int3)o).yCoord == this.yCoord && ((Int3)o).zCoord == this.zCoord : false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,16 +3,22 @@ package WayofTime.alchemicalWizardry.common.block;
|
|||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
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.init.Blocks;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Facing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralBlock;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class SpectralBlock extends Block
|
||||
public class SpectralBlock extends BlockContainer
|
||||
{
|
||||
public SpectralBlock()
|
||||
{
|
||||
|
@ -26,15 +32,6 @@ public class SpectralBlock extends Block
|
|||
// return 10;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Ticks the block if it's been scheduled
|
||||
*/
|
||||
@Override
|
||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
|
||||
{
|
||||
//if(!par1World.isRemote)
|
||||
par1World.setBlockToAir(par2, par3, par4);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -46,6 +43,7 @@ public class SpectralBlock extends Block
|
|||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
Block d;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -54,6 +52,24 @@ public class SpectralBlock extends Block
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_)
|
||||
{
|
||||
Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
|
||||
|
||||
if (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) != p_149646_1_.getBlockMetadata(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (block == this)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return block == this ? false : super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
/**
|
||||
|
@ -96,9 +112,9 @@ public class SpectralBlock extends Block
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
par1World.scheduleBlockUpdate(par2, par3, par4, this, 100);
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
return new TESpectralBlock();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.Int3;
|
||||
|
||||
public class BuildingSchematic
|
||||
|
@ -84,12 +85,65 @@ public class BuildingSchematic
|
|||
return new Int3(gridX, doorY, gridZ);
|
||||
}
|
||||
|
||||
public List<Int3> getGriddedPositions(ForgeDirection dir)
|
||||
{
|
||||
List<Int3> positionList = new ArrayList();
|
||||
|
||||
for(BlockSet blockSet : blockList)
|
||||
{
|
||||
for(Int3 pos : blockSet.getPositions())
|
||||
{
|
||||
int xOff = pos.xCoord;
|
||||
int zOff = pos.zCoord;
|
||||
|
||||
switch(dir)
|
||||
{
|
||||
case SOUTH:
|
||||
xOff *= -1;
|
||||
zOff *= -1;
|
||||
break;
|
||||
case WEST:
|
||||
int temp = zOff;
|
||||
zOff = xOff * -1;
|
||||
xOff = temp;
|
||||
break;
|
||||
case EAST:
|
||||
int temp2 = zOff * -1;
|
||||
zOff = xOff;
|
||||
xOff = temp2;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
Int3 nextPos = new Int3(xOff, 0, zOff);
|
||||
if(!positionList.contains(nextPos))
|
||||
{
|
||||
positionList.add(nextPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return positionList;
|
||||
}
|
||||
|
||||
public void destroyAllInField(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir)
|
||||
{
|
||||
GridSpaceHolder grid = this.createGSH();
|
||||
GridSpaceHolder grid = this.createGSH(); //GridSpaceHolder is not aware of the buildings - need to use the schematic
|
||||
|
||||
List<Int3> positionList = getGriddedPositions(dir);
|
||||
|
||||
for(int i=this.getMinY(); i<=this.getMaxY(); i++)
|
||||
{
|
||||
grid.destroyAllInGridSpaces(world, xCoord, yCoord + i, zCoord, dir);
|
||||
for(Int3 pos : positionList)
|
||||
{
|
||||
Block block = world.getBlock(xCoord + pos.xCoord, yCoord + i, zCoord + pos.zCoord);
|
||||
if(block != ModBlocks.blockDemonPortal)
|
||||
{
|
||||
world.setBlockToAir(xCoord + pos.xCoord, yCoord + i, zCoord + pos.zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
//grid.destroyAllInGridSpaces(world, xCoord, yCoord + i, zCoord, dir); //Deprecated method
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -90,6 +90,8 @@ public class BloodMagicHarvestHandler implements IHarvestHandler
|
|||
int plantMeta = seed.getPlantMetadata(world, xCoord, yCoord, zCoord);
|
||||
Block plantBlock = seed.getPlant(world, xCoord, yCoord, zCoord);
|
||||
|
||||
world.func_147480_a(xCoord, yCoord, zCoord, false);
|
||||
|
||||
world.setBlock(xCoord, yCoord, zCoord, plantBlock, plantMeta, 3);
|
||||
|
||||
for(ItemStack stack : list)
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package WayofTime.alchemicalWizardry.common.harvest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import WayofTime.alchemicalWizardry.api.harvest.IHarvestHandler;
|
||||
|
||||
public class CactusReedHarvestHandler implements IHarvestHandler
|
||||
{
|
||||
public boolean canHandleBlock(Block block)
|
||||
{
|
||||
return block == Blocks.reeds || block == Blocks.cactus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta)
|
||||
{
|
||||
if(!this.canHandleBlock(block))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(world.getBlock(xCoord, yCoord-1, zCoord) != block || world.getBlock(xCoord, yCoord-2, zCoord) != block)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
world.func_147480_a(xCoord, yCoord, zCoord, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -26,19 +26,8 @@ public class GourdHarvestHandler implements IHarvestHandler
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int fortune = 0;
|
||||
|
||||
List<ItemStack> list = block.getDrops(world, xCoord, yCoord, zCoord, meta, fortune);
|
||||
|
||||
world.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
|
||||
for(ItemStack stack : list)
|
||||
{
|
||||
EntityItem itemEnt = new EntityItem(world, xCoord, yCoord, zCoord, stack);
|
||||
|
||||
world.spawnEntityInWorld(itemEnt);
|
||||
}
|
||||
|
||||
world.func_147480_a(xCoord, yCoord, zCoord, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -117,12 +117,19 @@ public class BoundArmour extends ItemArmor implements ISpecialArmor,IBindable ,I
|
|||
return new ArmorProperties(-1, 0, 0);
|
||||
}
|
||||
|
||||
if (helmet.getItem().equals(ModItems.boundHelmet) || plate.getItem().equals(ModItems.boundPlate) || leggings.getItem().equals(ModItems.boundLeggings) || boots.getItem().equals(ModItems.boundBoots))
|
||||
if (helmet.getItem().equals(ModItems.boundHelmet) && plate.getItem().equals(ModItems.boundPlate) && leggings.getItem().equals(ModItems.boundLeggings) && boots.getItem().equals(ModItems.boundBoots))
|
||||
{
|
||||
if (source.isUnblockable())
|
||||
{
|
||||
return new ArmorProperties(-1, 3, 4);
|
||||
}
|
||||
|
||||
if(player.isPotionActive(AlchemicalWizardry.customPotionSoulFray))
|
||||
{
|
||||
int i = player.getActivePotionEffect(AlchemicalWizardry.customPotionSoulFray).getAmplifier() + 1;
|
||||
|
||||
return new ArmorProperties(-1, 3, (int)(25*(1.0f - 0.15f*i)));
|
||||
}
|
||||
|
||||
return new ArmorProperties(-1, 3, 100000);
|
||||
}
|
||||
|
@ -209,7 +216,7 @@ public class BoundArmour extends ItemArmor implements ISpecialArmor,IBindable ,I
|
|||
//TODO Make the armour invisible when the player has Invisibility on.
|
||||
if (entity instanceof EntityLivingBase)
|
||||
{
|
||||
if (((EntityLivingBase) entity).isPotionActive(Potion.invisibility.id))
|
||||
if (this.getIsInvisible(stack))
|
||||
{
|
||||
if (this== ModItems.boundHelmet || this == ModItems.boundPlate || this == ModItems.boundBoots)
|
||||
{
|
||||
|
@ -265,6 +272,8 @@ public class BoundArmour extends ItemArmor implements ISpecialArmor,IBindable ,I
|
|||
{
|
||||
tickInternalInventory(itemStack, world, player, 0, false);
|
||||
}
|
||||
|
||||
this.setIsInvisible(itemStack, player.isPotionActive(Potion.invisibility.id));
|
||||
|
||||
if (itemStack.getItemDamage() > 0)
|
||||
{
|
||||
|
@ -577,6 +586,30 @@ public class BoundArmour extends ItemArmor implements ISpecialArmor,IBindable ,I
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean getIsInvisible(ItemStack armourStack)
|
||||
{
|
||||
NBTTagCompound tag = armourStack.getTagCompound();
|
||||
if(tag != null)
|
||||
{
|
||||
return tag.getBoolean("invisible");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setIsInvisible(ItemStack armourStack, boolean invisible)
|
||||
{
|
||||
NBTTagCompound tag = armourStack.getTagCompound();
|
||||
|
||||
if(tag == null)
|
||||
{
|
||||
armourStack.setTagCompound(new NBTTagCompound());
|
||||
tag = armourStack.getTagCompound();
|
||||
}
|
||||
|
||||
tag.setBoolean("invisible", invisible);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "Thaumcraft")
|
||||
|
|
|
@ -82,7 +82,13 @@ public class SacrificialDagger extends Item
|
|||
return par1ItemStack;
|
||||
}
|
||||
|
||||
findAndFillAltar(par2World, par3EntityPlayer, 200);
|
||||
if(par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionSoulFray))
|
||||
{
|
||||
findAndFillAltar(par2World, par3EntityPlayer, 20);
|
||||
}else
|
||||
{
|
||||
findAndFillAltar(par2World, par3EntityPlayer, 200);
|
||||
}
|
||||
|
||||
if (par3EntityPlayer.getHealth() <= 0.001f)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package WayofTime.alchemicalWizardry.common.items.sigil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -21,6 +22,8 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.Int3;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -32,7 +35,8 @@ public class ItemFluidSigil extends Item implements IFluidContainerItem
|
|||
private static final int STATE_PLACE = 2;
|
||||
private static final int STATE_INPUT_TANK = 3;
|
||||
private static final int STATE_DRAIN_TANK = 4;
|
||||
private static final int maxNumOfStates = 5;
|
||||
private static final int STATE_BEAST_DRAIN = 5;
|
||||
private static final int maxNumOfStates = 6;
|
||||
|
||||
public ItemFluidSigil()
|
||||
{
|
||||
|
@ -68,6 +72,9 @@ public class ItemFluidSigil extends Item implements IFluidContainerItem
|
|||
case STATE_DRAIN_TANK:
|
||||
par3List.add("Drain Tank Mode");
|
||||
break;
|
||||
case STATE_BEAST_DRAIN:
|
||||
par3List.add("Beast Mode");
|
||||
break;
|
||||
}
|
||||
|
||||
FluidStack fluid = this.getFluid(par1ItemStack);
|
||||
|
@ -118,6 +125,8 @@ public class ItemFluidSigil extends Item implements IFluidContainerItem
|
|||
return this.fillSelectedTank(par1ItemStack, par2World, par3EntityPlayer);
|
||||
case STATE_DRAIN_TANK:
|
||||
return this.drainSelectedTank(par1ItemStack, par2World, par3EntityPlayer);
|
||||
case STATE_BEAST_DRAIN:
|
||||
return this.fillItemFromBeastWorld(par1ItemStack, par2World, par3EntityPlayer, true);
|
||||
}
|
||||
|
||||
return par1ItemStack;
|
||||
|
@ -181,11 +190,216 @@ public class ItemFluidSigil extends Item implements IFluidContainerItem
|
|||
case STATE_DRAIN_TANK:
|
||||
cmc.appendText("Now in Drain Tank Mode");
|
||||
break;
|
||||
case STATE_BEAST_DRAIN:
|
||||
cmc.appendText("Now in Beast Mode");
|
||||
break;
|
||||
}
|
||||
player.addChatComponentMessage(cmc);
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack fillItemFromBeastWorld(ItemStack container, World world, EntityPlayer player, boolean forceFill)
|
||||
{
|
||||
if(world.isRemote)
|
||||
{
|
||||
return container;
|
||||
}
|
||||
int range = 5;
|
||||
|
||||
float f = 1.0F;
|
||||
double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double)f;
|
||||
double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double)f + 1.62D - (double)player.yOffset;
|
||||
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double)f;
|
||||
boolean flag = true;
|
||||
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, flag);
|
||||
|
||||
if (movingobjectposition == null)
|
||||
{
|
||||
return container;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
int x = movingobjectposition.blockX;
|
||||
int y = movingobjectposition.blockY;
|
||||
int z = movingobjectposition.blockZ;
|
||||
|
||||
if (!world.canMineBlock(player, x, y, z))
|
||||
{
|
||||
return container;
|
||||
}
|
||||
|
||||
if (!player.canPlayerEdit(x, y, z, movingobjectposition.sideHit, container))
|
||||
{
|
||||
return container;
|
||||
}
|
||||
|
||||
boolean[][][] boolList = new boolean[range * 2 + 1][range * 2 + 1][range * 2 + 1];
|
||||
|
||||
for (int i = 0; i < 2 * range + 1; i++)
|
||||
{
|
||||
for (int j = 0; j < 2 * range + 1; j++)
|
||||
{
|
||||
for(int k = 0; k < 2 * range + 1; k++)
|
||||
{
|
||||
boolList[i][j][k] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<Int3> positionList = new ArrayList();
|
||||
|
||||
boolList[range][range][range] = true;
|
||||
positionList.add(new Int3(range, range, range));
|
||||
boolean isReady = false;
|
||||
|
||||
while (!isReady)
|
||||
{
|
||||
isReady = true;
|
||||
|
||||
for (int i = 0; i < 2 * range + 1; i++)
|
||||
{
|
||||
for (int j = 0; j < 2 * range + 1; j++)
|
||||
{
|
||||
for(int k=0; k < 2*range+1;k++)
|
||||
{
|
||||
if (boolList[i][j][k])
|
||||
{
|
||||
if (i - 1 >= 0 && !boolList[i - 1][j][k])
|
||||
{
|
||||
Block block = world.getBlock(x - range + i - 1, y - range + j, z - range + k);
|
||||
Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
|
||||
|
||||
if (fluid != null)
|
||||
{
|
||||
boolList[i - 1][j][k] = true;
|
||||
positionList.add(new Int3(i-1,j,k));
|
||||
isReady = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (j - 1 >= 0 && !boolList[i][j - 1][k])
|
||||
{
|
||||
Block block = world.getBlock(x - range + i, y - range + j - 1, z - range + k);
|
||||
Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
|
||||
|
||||
if (fluid != null)
|
||||
{
|
||||
boolList[i][j - 1][k] = true;
|
||||
positionList.add(new Int3(i,j-1,k));
|
||||
isReady = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(k - 1 >=0 && !boolList[i][j][k - 1])
|
||||
{
|
||||
Block block = world.getBlock(x - range + i, y - range + j, z - range + k - 1);
|
||||
Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
|
||||
|
||||
if (fluid != null)
|
||||
{
|
||||
boolList[i][j][k - 1] = true;
|
||||
positionList.add(new Int3(i,j,k-1));
|
||||
isReady = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (i + 1 <= 2 * range && !boolList[i + 1][j][k])
|
||||
{
|
||||
Block block = world.getBlock(x - range + i + 1, y - range + j, z - range + k);
|
||||
Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
|
||||
|
||||
if (fluid != null)
|
||||
{
|
||||
boolList[i + 1][j][k] = true;
|
||||
positionList.add(new Int3(i+1,j,k));
|
||||
isReady = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (j + 1 <= 2 * range && !boolList[i][j + 1][k])
|
||||
{
|
||||
Block block = world.getBlock(x - range + i, y - range + j + 1, z - range + k);
|
||||
Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
|
||||
|
||||
if (fluid != null)
|
||||
{
|
||||
boolList[i][j + 1][k] = true;
|
||||
positionList.add(new Int3(i,j+1,k));
|
||||
isReady = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(k + 1 <= 2*range && !boolList[i][j][k+1])
|
||||
{
|
||||
Block block = world.getBlock(x - range + i, y - range + j, z - range + k + 1);
|
||||
Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
|
||||
|
||||
if (fluid != null)
|
||||
{
|
||||
boolList[i][j][k+1] = true;
|
||||
positionList.add(new Int3(i,j,k+1));
|
||||
isReady = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(Int3 pos : positionList)
|
||||
{
|
||||
int i = pos.xCoord;
|
||||
int j = pos.yCoord;
|
||||
int k = pos.zCoord;
|
||||
|
||||
if(!boolList[i][j][k])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (world.getBlock(x+i-range, y+j-range, z+k-range) != null && world.getBlock(x+i-range, y+j-range, z+k-range).getMaterial() instanceof MaterialLiquid)
|
||||
{
|
||||
//world.setBlockToAir(x+i-range, y+j-range, z+k-range);
|
||||
Block block = world.getBlock(x+i-range, y+j-range, z+k-range);
|
||||
if(block == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
|
||||
|
||||
System.out.println("x: " + (i-range) + " y: " + (j-range) + " z: " + (k-range));
|
||||
|
||||
|
||||
if(fluid==null || world.getBlockMetadata(x+i-range, y+j-range, z+k-range) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
FluidStack fillStack = new FluidStack(fluid,1000);
|
||||
|
||||
int amount = this.fill(container, fillStack, false);
|
||||
|
||||
if((amount > 0 && forceFill) || (amount >=1000 && !forceFill))
|
||||
{
|
||||
//if(!player.capabilities.isCreativeMode)
|
||||
{
|
||||
world.setBlockToAir(x+i-range, y+j-range, z+k-range);
|
||||
|
||||
}
|
||||
|
||||
this.fill(container, new FluidStack(fluid,1000), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return container;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack fillItemFromWorld(ItemStack container, World world, EntityPlayer player, boolean forceFill)
|
||||
{
|
||||
float f = 1.0F;
|
||||
|
|
|
@ -131,6 +131,11 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade
|
|||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
|
||||
{
|
||||
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
|
||||
|
||||
if(par2World.isRemote)
|
||||
{
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (par3EntityPlayer.isSneaking())
|
||||
{
|
||||
|
@ -259,6 +264,11 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade
|
|||
@Override
|
||||
public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack)
|
||||
{
|
||||
if(world.isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int range = 5;
|
||||
int verticalRange = 2;
|
||||
int posX = (int) Math.round(player.posX - 0.5f);
|
||||
|
|
|
@ -2,20 +2,20 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.Icon;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralBlock;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -205,16 +205,28 @@ public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade
|
|||
//for(int iy=posY-verticalRange;iy<=posY+verticalRange;iy++)
|
||||
{
|
||||
Block block = par2World.getBlock(ix, posY + verticalOffset, iz);
|
||||
|
||||
|
||||
|
||||
if (par2World.isAirBlock(ix, posY + verticalOffset, iz))
|
||||
{
|
||||
par2World.setBlock(ix, posY + verticalOffset, iz, ModBlocks.spectralBlock, 0, 3);
|
||||
|
||||
TileEntity tile = par2World.getTileEntity(ix, posY + verticalOffset, iz);
|
||||
if(tile instanceof TESpectralBlock)
|
||||
{
|
||||
((TESpectralBlock) tile).setDuration(100);
|
||||
}
|
||||
|
||||
if (par2World.rand.nextInt(2) == 0)
|
||||
{
|
||||
incremented++;
|
||||
}
|
||||
}else if(block == ModBlocks.spectralBlock)
|
||||
{
|
||||
TileEntity tile = par2World.getTileEntity(ix, posY + verticalOffset, iz);
|
||||
if(tile instanceof TESpectralBlock)
|
||||
{
|
||||
((TESpectralBlock) tile).setDuration(100);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -284,12 +296,24 @@ public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade
|
|||
{
|
||||
//for(int iy=posY-verticalRange;iy<=posY+verticalRange;iy++)
|
||||
{
|
||||
Block block = world.getBlock(ix, posY + verticalOffset, iz);
|
||||
Block block = world.getBlock(ix, posY + verticalOffset, iz);
|
||||
|
||||
|
||||
if (world.isAirBlock(ix, posY + verticalOffset, iz))
|
||||
{
|
||||
world.setBlock(ix, posY + verticalOffset, iz, ModBlocks.spectralBlock, 0, 3);
|
||||
|
||||
TileEntity tile = world.getTileEntity(ix, posY + verticalOffset, iz);
|
||||
if(tile instanceof TESpectralBlock)
|
||||
{
|
||||
((TESpectralBlock) tile).setDuration(100);
|
||||
}
|
||||
}else if(block == ModBlocks.spectralBlock)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(ix, posY + verticalOffset, iz);
|
||||
if(tile instanceof TESpectralBlock)
|
||||
{
|
||||
((TESpectralBlock) tile).setDuration(100);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package WayofTime.alchemicalWizardry.common.potion;
|
||||
|
||||
import net.minecraft.potion.Potion;
|
||||
|
||||
public class PotionSoulFray extends Potion
|
||||
{
|
||||
public PotionSoulFray(int par1, boolean par2, int par3)
|
||||
{
|
||||
super(par1, par2, par3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Potion setIconIndex(int par1, int par2)
|
||||
{
|
||||
super.setIconIndex(par1, par2);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,182 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralBlock;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralContainer;
|
||||
|
||||
public class RitualEffectEllipsoid extends RitualEffect
|
||||
{
|
||||
@Override
|
||||
public void performEffect(IMasterRitualStone ritualStone)
|
||||
{
|
||||
String owner = ritualStone.getOwner();
|
||||
World worldSave = MinecraftServer.getServer().worldServers[0];
|
||||
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = new LifeEssenceNetwork(owner);
|
||||
worldSave.setItemData(owner, data);
|
||||
}
|
||||
|
||||
int currentEssence = data.currentEssence;
|
||||
World world = ritualStone.getWorld();
|
||||
int x = ritualStone.getXCoord();
|
||||
int y = ritualStone.getYCoord();
|
||||
int z = ritualStone.getZCoord();
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y+1, z);
|
||||
|
||||
|
||||
if(((IInventory) tile).getSizeInventory() < 3)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(!(tile instanceof IInventory) || ((IInventory)tile).getSizeInventory() < 3)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack item1 = ((IInventory) tile).getStackInSlot(0);
|
||||
ItemStack item2 = ((IInventory) tile).getStackInSlot(1);
|
||||
ItemStack item3 = ((IInventory) tile).getStackInSlot(2);
|
||||
|
||||
int xSize = item1 == null ? 0 : item1.stackSize;
|
||||
int ySize = item2 == null ? 0 : item2.stackSize;
|
||||
int zSize = item3 == null ? 0 : item3.stackSize;
|
||||
|
||||
int cost = (int)Math.pow((xSize+1)*(ySize+1)*(zSize+1),0.333);
|
||||
|
||||
if (currentEssence < cost)
|
||||
{
|
||||
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
} else
|
||||
{
|
||||
//if(tile instanceof IInventory)
|
||||
{
|
||||
int refresh = 1000;
|
||||
|
||||
int j = (int)(world.getWorldTime()%(ySize*2+1)) - ySize;
|
||||
|
||||
for (int i = -xSize; i <= xSize; i++)
|
||||
{
|
||||
// for (int j = -ySize; j <= ySize; j++)
|
||||
{
|
||||
for(int k = -zSize; k <= zSize; k++)
|
||||
{
|
||||
if (Math.pow(i*(ySize - 0.50f)*(zSize - 0.50f),2) + Math.pow(j*(xSize - 0.50f)*(zSize - 0.50f),2) + Math.pow(k*(xSize - 0.50f)*(ySize - 0.50f),2) <= Math.pow((xSize - 1 + 0.50f)*(ySize - 1 + 0.50f)*(zSize - 1 + 0.50f), 2))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Math.pow(i*(ySize + 0.50f)*(zSize + 0.50f),2) + Math.pow(j*(xSize + 0.50f)*(zSize + 0.50f),2) + Math.pow(k*(xSize + 0.50f)*(ySize + 0.50f),2) >= Math.pow((xSize + 0.50f)*(ySize + 0.50f)*(zSize + 0.50f), 2))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Block block = world.getBlock(x+i, y+j, z+k);
|
||||
|
||||
if(block.isAir(world, x+i, y+j, z+k))
|
||||
{
|
||||
//world.setBlock(x+i, y+j, z+k, Blocks.stone);
|
||||
TESpectralBlock.createSpectralBlockAtLocation(world, x+i, y+j, z+k, refresh);
|
||||
}
|
||||
else
|
||||
{
|
||||
TileEntity tile1 = world.getTileEntity(x+i, y+j, z+k);
|
||||
if(tile instanceof TESpectralBlock)
|
||||
{
|
||||
((TESpectralBlock) tile1).resetDuration(refresh);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data.currentEssence = currentEssence - cost;
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RitualComponent> getRitualComponentList()
|
||||
{
|
||||
ArrayList<RitualComponent> ellipsoidRitual = new ArrayList();
|
||||
|
||||
ellipsoidRitual.add(new RitualComponent(-1,0,-1,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-1,0,1,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(1,0,-1,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(1,0,1,RitualComponent.DUSK));
|
||||
|
||||
ellipsoidRitual.add(new RitualComponent(4,0,0,RitualComponent.FIRE));
|
||||
ellipsoidRitual.add(new RitualComponent(5,0,0,RitualComponent.FIRE));
|
||||
ellipsoidRitual.add(new RitualComponent(5,0,-1,RitualComponent.FIRE));
|
||||
ellipsoidRitual.add(new RitualComponent(5,0,-2,RitualComponent.FIRE));
|
||||
ellipsoidRitual.add(new RitualComponent(-4,0,0,RitualComponent.FIRE));
|
||||
ellipsoidRitual.add(new RitualComponent(-5,0,0,RitualComponent.FIRE));
|
||||
ellipsoidRitual.add(new RitualComponent(-5,0,1,RitualComponent.FIRE));
|
||||
ellipsoidRitual.add(new RitualComponent(-5,0,2,RitualComponent.FIRE));
|
||||
|
||||
ellipsoidRitual.add(new RitualComponent(0,0,4,RitualComponent.AIR));
|
||||
ellipsoidRitual.add(new RitualComponent(0,0,5,RitualComponent.AIR));
|
||||
ellipsoidRitual.add(new RitualComponent(1,0,5,RitualComponent.AIR));
|
||||
ellipsoidRitual.add(new RitualComponent(2,0,5,RitualComponent.AIR));
|
||||
ellipsoidRitual.add(new RitualComponent(0,0,-4,RitualComponent.AIR));
|
||||
ellipsoidRitual.add(new RitualComponent(0,0,-5,RitualComponent.AIR));
|
||||
ellipsoidRitual.add(new RitualComponent(-1,0,-5,RitualComponent.AIR));
|
||||
ellipsoidRitual.add(new RitualComponent(-2,0,-5,RitualComponent.AIR));
|
||||
|
||||
ellipsoidRitual.add(new RitualComponent(3,0,1,RitualComponent.EARTH));
|
||||
ellipsoidRitual.add(new RitualComponent(3,0,2,RitualComponent.EARTH));
|
||||
ellipsoidRitual.add(new RitualComponent(3,0,3,RitualComponent.EARTH));
|
||||
ellipsoidRitual.add(new RitualComponent(2,0,3,RitualComponent.EARTH));
|
||||
ellipsoidRitual.add(new RitualComponent(-3,0,-1,RitualComponent.EARTH));
|
||||
ellipsoidRitual.add(new RitualComponent(-3,0,-2,RitualComponent.EARTH));
|
||||
ellipsoidRitual.add(new RitualComponent(-3,0,-3,RitualComponent.EARTH));
|
||||
ellipsoidRitual.add(new RitualComponent(-2,0,-3,RitualComponent.EARTH));
|
||||
|
||||
ellipsoidRitual.add(new RitualComponent(1,0,-3,RitualComponent.WATER));
|
||||
ellipsoidRitual.add(new RitualComponent(2,0,-3,RitualComponent.WATER));
|
||||
ellipsoidRitual.add(new RitualComponent(3,0,-3,RitualComponent.WATER));
|
||||
ellipsoidRitual.add(new RitualComponent(3,0,-2,RitualComponent.WATER));
|
||||
ellipsoidRitual.add(new RitualComponent(-1,0,3,RitualComponent.WATER));
|
||||
ellipsoidRitual.add(new RitualComponent(-2,0,3,RitualComponent.WATER));
|
||||
ellipsoidRitual.add(new RitualComponent(-3,0,3,RitualComponent.WATER));
|
||||
ellipsoidRitual.add(new RitualComponent(-3,0,2,RitualComponent.WATER));
|
||||
|
||||
return ellipsoidRitual;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,266 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.MaterialLiquid;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralBlock;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralContainer;
|
||||
|
||||
public class RitualEffectEvaporation extends RitualEffect
|
||||
{
|
||||
@Override
|
||||
public void performEffect(IMasterRitualStone ritualStone)
|
||||
{
|
||||
String owner = ritualStone.getOwner();
|
||||
World worldSave = MinecraftServer.getServer().worldServers[0];
|
||||
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = new LifeEssenceNetwork(owner);
|
||||
worldSave.setItemData(owner, data);
|
||||
}
|
||||
|
||||
int currentEssence = data.currentEssence;
|
||||
World world = ritualStone.getWorld();
|
||||
int x = ritualStone.getXCoord();
|
||||
int y = ritualStone.getYCoord();
|
||||
int z = ritualStone.getZCoord();
|
||||
|
||||
if (currentEssence < 0)
|
||||
{
|
||||
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
} else
|
||||
{
|
||||
Block block1 = world.getBlock(x, y-1, z);
|
||||
int range = this.getRadiusForModifierBlock(block1);
|
||||
|
||||
boolean[][][] boolList = new boolean[range * 2 + 1][range * 2 + 1][range * 2 + 1];
|
||||
|
||||
for (int i = 0; i < 2 * range + 1; i++)
|
||||
{
|
||||
for (int j = 0; j < 2 * range + 1; j++)
|
||||
{
|
||||
for(int k = 0; k < 2 * range + 1; k++)
|
||||
{
|
||||
boolList[i][j][k] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolList[range][range][range] = true;
|
||||
boolean isReady = false;
|
||||
|
||||
while (!isReady)
|
||||
{
|
||||
isReady = true;
|
||||
|
||||
for (int i = 0; i < 2 * range + 1; i++)
|
||||
{
|
||||
for (int j = 0; j < 2 * range + 1; j++)
|
||||
{
|
||||
for(int k=0; k<2*range+1;k++)
|
||||
{
|
||||
if (boolList[i][j][k])
|
||||
{
|
||||
if (i - 1 >= 0 && !boolList[i - 1][j][k])
|
||||
{
|
||||
Block block = world.getBlock(x - range + i - 1, y - range + j, z - range + k);
|
||||
if(world.isAirBlock(x - range + i - 1, y - range + j, z - range + k) || block == ModBlocks.blockSpectralContainer)
|
||||
{
|
||||
boolList[i - 1][j][k] = true;
|
||||
isReady = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (j - 1 >= 0 && !boolList[i][j - 1][k])
|
||||
{
|
||||
Block block = world.getBlock(x - range + i, y - range + j - 1, z - range + k);
|
||||
if(world.isAirBlock(x - range + i, y - range + j - 1, z - range + k) || block == ModBlocks.blockSpectralContainer)
|
||||
{
|
||||
boolList[i][j - 1][k] = true;
|
||||
isReady = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(k - 1 >=0 && !boolList[i][j][k - 1])
|
||||
{
|
||||
Block block = world.getBlock(x - range + i, y - range + j, z - range + k - 1);
|
||||
if(world.isAirBlock(x - range + i, y - range + j, z - range + k - 1) || block == ModBlocks.blockSpectralContainer)
|
||||
{
|
||||
boolList[i][j][k - 1] = true;
|
||||
isReady = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (i + 1 <= 2 * range && !boolList[i + 1][j][k])
|
||||
{
|
||||
Block block = world.getBlock(x - range + i + 1, y - range + j, z - range + k);
|
||||
if(world.isAirBlock(x - range + i + 1, y - range + j, z - range + k) || block == ModBlocks.blockSpectralContainer)
|
||||
{
|
||||
boolList[i + 1][j][k] = true;
|
||||
isReady = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (j + 1 <= 2 * range && !boolList[i][j + 1][k])
|
||||
{
|
||||
Block block = world.getBlock(x - range + i, y - range + j + 1, z - range + k);
|
||||
if(world.isAirBlock(x - range + i, y - range + j + 1, z - range + k) || block == ModBlocks.blockSpectralContainer)
|
||||
{
|
||||
boolList[i][j + 1][k] = true;
|
||||
isReady = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(k + 1 <= 2*range && !boolList[i][j][k+1])
|
||||
{
|
||||
Block block = world.getBlock(x - range + i, y - range + j, z - range + k + 1);
|
||||
if(world.isAirBlock(x - range + i, y - range + j, z - range + k + 1) || block == ModBlocks.blockSpectralContainer)
|
||||
{
|
||||
boolList[i][j][k+1] = true;
|
||||
isReady = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2 * range + 1; i++)
|
||||
{
|
||||
for (int j = 0; j < 2 * range + 1; j++)
|
||||
{
|
||||
for(int k=0; k<2*range+1;k++)
|
||||
{
|
||||
if(!boolList[i][j][k])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Block block = world.getBlock(x+i-range, y+j-range, z+k-range);
|
||||
|
||||
if(block == ModBlocks.blockSpectralContainer)
|
||||
{
|
||||
world.setBlockToAir(x+i-range, y+j-range, z+k-range);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
|
||||
ritualStone.setActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RitualComponent> getRitualComponentList()
|
||||
{
|
||||
ArrayList<RitualComponent> ellipsoidRitual = new ArrayList();
|
||||
|
||||
ellipsoidRitual.add(new RitualComponent(-1,0,-1,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-1,0,1,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(1,0,-1,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(1,0,1,RitualComponent.DUSK));
|
||||
|
||||
ellipsoidRitual.add(new RitualComponent(4,0,0,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(5,0,0,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(5,0,-1,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(5,0,-2,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-4,0,0,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-5,0,0,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-5,0,1,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-5,0,2,RitualComponent.DUSK));
|
||||
|
||||
ellipsoidRitual.add(new RitualComponent(0,0,4,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(0,0,5,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(1,0,5,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(2,0,5,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(0,0,-4,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(0,0,-5,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-1,0,-5,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-2,0,-5,RitualComponent.DUSK));
|
||||
|
||||
ellipsoidRitual.add(new RitualComponent(3,0,1,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(3,0,2,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(3,0,3,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(2,0,3,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-3,0,-1,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-3,0,-2,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-3,0,-3,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-2,0,-3,RitualComponent.DUSK));
|
||||
|
||||
ellipsoidRitual.add(new RitualComponent(1,0,-3,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(2,0,-3,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(3,0,-3,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(3,0,-2,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-1,0,3,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-2,0,3,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-3,0,3,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-3,0,2,RitualComponent.DUSK));
|
||||
|
||||
return ellipsoidRitual;
|
||||
}
|
||||
|
||||
public int getRadiusForModifierBlock(Block block)
|
||||
{
|
||||
if(block == null)
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
if(block == Blocks.diamond_block)
|
||||
{
|
||||
return 30;
|
||||
}
|
||||
|
||||
if(block == Blocks.gold_block)
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
if(block == Blocks.iron_block)
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
|
||||
return 10;
|
||||
}
|
||||
}
|
|
@ -37,7 +37,7 @@ public class RitualEffectGrowth extends RitualEffect
|
|||
int y = ritualStone.getYCoord();
|
||||
int z = ritualStone.getZCoord();
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
if (currentEssence < this.getCostPerRefresh()*9)
|
||||
{
|
||||
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class RitualEffectGrowth extends RitualEffect
|
|||
return;
|
||||
}
|
||||
|
||||
boolean flag = false;
|
||||
int flag = 0;
|
||||
|
||||
for (int i = -1; i <= 1; i++)
|
||||
{
|
||||
|
@ -67,15 +67,15 @@ public class RitualEffectGrowth extends RitualEffect
|
|||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(world, x, y, z, 20, world.provider.dimensionId, 3, x, y, z);
|
||||
block.updateTick(world, x + i, y + 2, z + j, world.rand);
|
||||
flag = true;
|
||||
flag++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flag)
|
||||
if (flag > 0)
|
||||
{
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh()*flag;
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public class RitualEffectGrowth extends RitualEffect
|
|||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
return 100;
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
@ -37,7 +38,7 @@ public class RitualEffectHarvest extends RitualEffect
|
|||
int x = ritualStone.getXCoord();
|
||||
int y = ritualStone.getYCoord();
|
||||
int z = ritualStone.getZCoord();
|
||||
int maxCount = 9;
|
||||
int maxCount = 100;
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh() * maxCount)
|
||||
{
|
||||
|
@ -51,21 +52,23 @@ public class RitualEffectHarvest extends RitualEffect
|
|||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
} else
|
||||
{
|
||||
if (world.getWorldTime() % 20 != 0)
|
||||
if (world.getWorldTime() % 5 != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Block block = world.getBlock(x, y-1, z);
|
||||
int flag = 0;
|
||||
int range = 4;
|
||||
int range = this.getRadiusForModifierBlock(block);
|
||||
int vertRange = 4;
|
||||
|
||||
for (int i = -range; i <= range; i++)
|
||||
{
|
||||
for (int j = -range; j <= range; j++)
|
||||
for (int j = -vertRange; j <= vertRange; j++)
|
||||
{
|
||||
for(int k = -range; k<=range; k++)
|
||||
{
|
||||
if(HarvestRegistry.harvestBlock(world, x + i, y + j, z + k))
|
||||
if(HarvestRegistry.harvestBlock(world, x + i, y + j, z + k) && flag < maxCount)
|
||||
{
|
||||
flag++;
|
||||
}
|
||||
|
@ -87,6 +90,31 @@ public class RitualEffectHarvest extends RitualEffect
|
|||
return 20;
|
||||
}
|
||||
|
||||
public int getRadiusForModifierBlock(Block block)
|
||||
{
|
||||
if(block == null)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
if(block == Blocks.diamond_block)
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
|
||||
if(block == Blocks.gold_block)
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
if(block == Blocks.iron_block)
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RitualComponent> getRitualComponentList()
|
||||
{
|
||||
|
|
|
@ -1,112 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class RitualEffectSummonPlayer extends RitualEffect //Summons a player via the bound item
|
||||
{
|
||||
@Override
|
||||
public void performEffect(IMasterRitualStone ritualStone)
|
||||
{
|
||||
String owner = ritualStone.getOwner();
|
||||
World worldSave = MinecraftServer.getServer().worldServers[0];
|
||||
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = new LifeEssenceNetwork(owner);
|
||||
worldSave.setItemData(owner, data);
|
||||
}
|
||||
|
||||
int currentEssence = data.currentEssence;
|
||||
World world = ritualStone.getWorld();
|
||||
int x = ritualStone.getXCoord();
|
||||
int y = ritualStone.getYCoord();
|
||||
int z = ritualStone.getZCoord();
|
||||
|
||||
if (ritualStone.getCooldown() > 0)
|
||||
{
|
||||
ritualStone.setCooldown(0);
|
||||
}
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
{
|
||||
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
} else
|
||||
{
|
||||
List<EntityItem> entities = world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x, y + 1, z, x + 1, y + 2, z + 1));
|
||||
|
||||
if (entities == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (EntityItem entityItem : entities)
|
||||
{
|
||||
if (entityItem != null && entityItem.getEntityItem().getItem() instanceof IBindable)
|
||||
{
|
||||
String str = EnergyItems.getOwnerName(entityItem.getEntityItem());
|
||||
|
||||
EntityPlayer entityPlayer = SpellHelper.getPlayerForUsername(str);
|
||||
if(entityPlayer!=null)
|
||||
{
|
||||
entityPlayer.posX = x;
|
||||
entityPlayer.posY = y+1;
|
||||
entityPlayer.posZ = z;
|
||||
|
||||
if(entityPlayer instanceof EntityPlayerMP)
|
||||
{
|
||||
((EntityPlayerMP)entityPlayer).mcServer.getConfigurationManager().transferPlayerToDimension(((EntityPlayerMP)entityPlayer), 0);
|
||||
}
|
||||
|
||||
entityItem.setDead();
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// EnergyBlastProjectile proj = new EnergyBlastProjectile(world, x, y+20, z);
|
||||
// proj.motionX = 0.0d;
|
||||
// proj.motionZ = 0.0d;
|
||||
// proj.motionY = -1.0d;
|
||||
// world.spawnEntityInWorld(proj);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RitualComponent> getRitualComponentList() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -77,7 +77,7 @@ public class RitualEffectWellOfSuffering extends RitualEffect
|
|||
|
||||
//tileAltar = (TEAltar)world.getBlockTileEntity(x,y-1,z);
|
||||
int d0 = 10;
|
||||
int vertRange = 5;
|
||||
int vertRange = 10;
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y, (double) z, (double) (x + 1), (double) (y + 1), (double) (z + 1)).expand(d0, vertRange, d0);
|
||||
List list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
|
||||
Iterator iterator1 = list.iterator();
|
||||
|
|
|
@ -39,6 +39,8 @@ public class TEDemonPortal extends TileEntity
|
|||
public static int buildingGridDelay = 25;
|
||||
public static int roadGridDelay = 10;
|
||||
|
||||
public static int[] tierCostList = new int[]{1000,50000}; //Cost to get to NEXT tier
|
||||
|
||||
public static List<DemonBuilding> buildingList = new ArrayList();
|
||||
public Random rand = new Random();
|
||||
private GridSpace[][] area;
|
||||
|
@ -55,6 +57,9 @@ public class TEDemonPortal extends TileEntity
|
|||
public int tier; //Tier of the demon portal - Should select buildings 2 below to this
|
||||
public int totalPoints;
|
||||
|
||||
public int yLevelDestination;
|
||||
public boolean hasLocationChanged;
|
||||
|
||||
public TEDemonPortal()
|
||||
{
|
||||
super();
|
||||
|
@ -82,6 +87,10 @@ public class TEDemonPortal extends TileEntity
|
|||
|
||||
this.houseCooldown = 0;
|
||||
this.roadCooldown = 0;
|
||||
this.tier = 0;
|
||||
|
||||
this.yLevelDestination = 0;
|
||||
this.hasLocationChanged = false;
|
||||
}
|
||||
|
||||
public void initialize()
|
||||
|
@ -122,12 +131,24 @@ public class TEDemonPortal extends TileEntity
|
|||
return;
|
||||
}
|
||||
|
||||
if(this.hasLocationChanged)
|
||||
{
|
||||
if(this.changePortalLocation())
|
||||
{
|
||||
return;
|
||||
}else
|
||||
{
|
||||
this.hasLocationChanged = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(this.roadCooldown <= 0)
|
||||
{
|
||||
int roadsMade = this.createRandomRoad();
|
||||
if(roadsMade > 0)
|
||||
{
|
||||
this.roadCooldown = TEDemonPortal.roadGridDelay * roadsMade;
|
||||
this.totalPoints += this.roadCooldown;
|
||||
}
|
||||
}
|
||||
else if(this.houseCooldown <= 0)
|
||||
|
@ -136,10 +157,20 @@ public class TEDemonPortal extends TileEntity
|
|||
if(gridsUsed > 0)
|
||||
{
|
||||
this.houseCooldown = TEDemonPortal.buildingGridDelay * gridsUsed;
|
||||
this.totalPoints += this.houseCooldown;
|
||||
}
|
||||
}
|
||||
|
||||
this.houseCooldown = Math.max(0, this.houseCooldown - 1);
|
||||
if(this.tier < this.tierCostList.length && this.totalPoints > this.tierCostList[this.tier])
|
||||
{
|
||||
this.tier++;
|
||||
|
||||
if(this.createRandomBuilding(DemonBuilding.BUILDING_PORTAL, tier+1) >= 1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
this.houseCooldown = Math.max(0, this.houseCooldown - 1); //Current dummy implementation of the increasing costs
|
||||
this.roadCooldown = Math.max(0, this.roadCooldown - 1);
|
||||
}
|
||||
|
||||
|
@ -175,6 +206,8 @@ public class TEDemonPortal extends TileEntity
|
|||
|
||||
this.tier = par1NBTTagCompound.getInteger("tier");
|
||||
this.totalPoints = par1NBTTagCompound.getInteger("totalPoints");
|
||||
this.yLevelDestination = par1NBTTagCompound.getInteger("yLevelDestination");
|
||||
this.hasLocationChanged = par1NBTTagCompound.getBoolean("hasLocationChanged");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -213,9 +246,11 @@ public class TEDemonPortal extends TileEntity
|
|||
|
||||
par1NBTTagCompound.setTag("Grid", gridList);
|
||||
|
||||
par1NBTTagCompound.setBoolean("init", isInitialized);
|
||||
par1NBTTagCompound.setBoolean("init", this.isInitialized);
|
||||
par1NBTTagCompound.setInteger("tier", this.tier);
|
||||
par1NBTTagCompound.setInteger("totalPoints", this.totalPoints);
|
||||
par1NBTTagCompound.setInteger("yLevelDestination", this.yLevelDestination);
|
||||
par1NBTTagCompound.setBoolean("hasLocationChanged", this.hasLocationChanged);
|
||||
}
|
||||
|
||||
public int createRandomRoad() //Return the number of road spaces
|
||||
|
@ -870,15 +905,17 @@ public class TEDemonPortal extends TileEntity
|
|||
Int3 portalSpace = build.getDoorSpace(chosenDirection);
|
||||
int yOffset = portalSpace.yCoord;
|
||||
|
||||
for(int i=0; i<256; i++)
|
||||
{
|
||||
Block block = worldObj.getBlock(xCoord + (x)*5, i, zCoord + (z)*5);
|
||||
if(block == ModBlocks.blockDemonPortal)
|
||||
{
|
||||
BlockTeleposer.swapBlocks(worldObj, worldObj, xCoord, i, zCoord, xCoord, yLevel + yOffset, zCoord);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//TODO
|
||||
|
||||
// for(int i=0; i<256; i++)
|
||||
// {
|
||||
// Block block = worldObj.getBlock(xCoord + (x)*5, i, zCoord + (z)*5);
|
||||
// if(block == ModBlocks.blockDemonPortal)
|
||||
// {
|
||||
// BlockTeleposer.swapBlocks(worldObj, worldObj, xCoord, i, zCoord, xCoord, yLevel + yOffset, zCoord);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
build.buildAll(worldObj, xCoord + (x)*5, yLevel, zCoord + (z)*5, chosenDirection.getOpposite());
|
||||
build.setAllGridSpaces(x, z, yLevel, chosenDirection.getOpposite(), GridSpace.MAIN_PORTAL, grid);
|
||||
|
@ -1198,4 +1235,25 @@ public class TEDemonPortal extends TileEntity
|
|||
{
|
||||
this.totalPoints += addition;
|
||||
}
|
||||
|
||||
public void setPortalDestination(int yLevel)
|
||||
{
|
||||
if(yLevel != this.yCoord)
|
||||
{
|
||||
this.hasLocationChanged = true;
|
||||
this.yLevelDestination = yLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean changePortalLocation()
|
||||
{
|
||||
if(yLevelDestination == yCoord)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockTeleposer.swapBlocks(worldObj, worldObj, xCoord, yCoord, zCoord, xCoord, yLevelDestination, zCoord);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
package WayofTime.alchemicalWizardry.common.tileEntity;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
|
||||
public class TESpectralBlock extends TileEntity
|
||||
{
|
||||
private int ticksRemaining;
|
||||
|
||||
public TESpectralBlock()
|
||||
{
|
||||
ticksRemaining = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
|
||||
ticksRemaining = par1NBTTagCompound.getInteger("ticksRemaining");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
|
||||
par1NBTTagCompound.setInteger("ticksRemaining", ticksRemaining);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
|
||||
if(worldObj.isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.ticksRemaining--;
|
||||
|
||||
if(this.ticksRemaining<=0)
|
||||
{
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean createSpectralBlockAtLocation(World world, int x, int y, int z, int duration)
|
||||
{
|
||||
if(!world.isAirBlock(x, y, z))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//if(world.getTileEntity(x, y, z)==null)
|
||||
{
|
||||
world.setBlock(x, y, z, ModBlocks.spectralBlock);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof TESpectralBlock)
|
||||
{
|
||||
((TESpectralBlock) tile).setDuration(duration);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setDuration(int dur)
|
||||
{
|
||||
this.ticksRemaining = dur;
|
||||
}
|
||||
|
||||
public void resetDuration(int dur)
|
||||
{
|
||||
if(this.ticksRemaining<dur)
|
||||
{
|
||||
this.ticksRemaining = dur;
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Loading…
Reference in a new issue