Run formatter
This commit is contained in:
parent
61c44a831b
commit
08258fd6ef
606 changed files with 13464 additions and 22975 deletions
|
@ -28,115 +28,95 @@ import net.minecraftforge.items.IItemHandler;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class RitualAltarBuilder extends Ritual
|
||||
{
|
||||
public class RitualAltarBuilder extends Ritual {
|
||||
private Iterator<AltarComponent> altarComponentsIterator = new ArrayList<AltarComponent>(EnumAltarTier.SIX.getAltarComponents()).iterator();
|
||||
private boolean cycleDone = false;
|
||||
|
||||
private AltarComponent currentComponent;
|
||||
private BlockPos currentPos;
|
||||
|
||||
public RitualAltarBuilder()
|
||||
{
|
||||
public RitualAltarBuilder() {
|
||||
super("ritualAltarBuilder", 0, 450, "ritual." + BloodMagic.MODID + ".altarBuilderRitual");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
TileEntity tileEntity = world.getTileEntity(masterRitualStone.getBlockPos().up());
|
||||
BlockPos altarPos = masterRitualStone.getBlockPos().up(2);
|
||||
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
if (cycleDone)
|
||||
{
|
||||
if (cycleDone) {
|
||||
altarComponentsIterator = new ArrayList<AltarComponent>(EnumAltarTier.SIX.getAltarComponents()).iterator();
|
||||
}
|
||||
|
||||
if (world.getBlockState(altarPos).getBlock().isReplaceable(world, altarPos) && hasItem(tileEntity, Item.getItemFromBlock(RegistrarBloodMagicBlocks.ALTAR), 0, true))
|
||||
{
|
||||
if (world.getBlockState(altarPos).getBlock().isReplaceable(world, altarPos) && hasItem(tileEntity, Item.getItemFromBlock(RegistrarBloodMagicBlocks.ALTAR), 0, true)) {
|
||||
world.setBlockState(altarPos, RegistrarBloodMagicBlocks.ALTAR.getDefaultState());
|
||||
lightning(world, altarPos);
|
||||
masterRitualStone.getOwnerNetwork().syphon(getRefreshCost());
|
||||
}
|
||||
|
||||
if (altarComponentsIterator.hasNext())
|
||||
{
|
||||
if (altarComponentsIterator.hasNext()) {
|
||||
currentComponent = altarComponentsIterator.next();
|
||||
currentPos = altarPos.add(currentComponent.getOffset());
|
||||
|
||||
if (world.getBlockState(currentPos).getBlock().isReplaceable(world, currentPos))
|
||||
{
|
||||
switch (currentComponent.getComponent())
|
||||
{
|
||||
case NOTAIR:
|
||||
{
|
||||
BlockStack blockStack = getMundaneBlock(tileEntity);
|
||||
if (blockStack != null)
|
||||
{
|
||||
world.setBlockState(currentPos, blockStack.getState(), 3);
|
||||
lightning(world, currentPos);
|
||||
masterRitualStone.getOwnerNetwork().syphon(getRefreshCost());
|
||||
if (world.getBlockState(currentPos).getBlock().isReplaceable(world, currentPos)) {
|
||||
switch (currentComponent.getComponent()) {
|
||||
case NOTAIR: {
|
||||
BlockStack blockStack = getMundaneBlock(tileEntity);
|
||||
if (blockStack != null) {
|
||||
world.setBlockState(currentPos, blockStack.getState(), 3);
|
||||
lightning(world, currentPos);
|
||||
masterRitualStone.getOwnerNetwork().syphon(getRefreshCost());
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BLOODRUNE:
|
||||
{
|
||||
BlockStack blockStack = getBloodRune(tileEntity);
|
||||
if (blockStack != null)
|
||||
{
|
||||
world.setBlockState(currentPos, blockStack.getState(), 3);
|
||||
lightning(world, currentPos);
|
||||
masterRitualStone.getOwnerNetwork().syphon(getRefreshCost());
|
||||
case BLOODRUNE: {
|
||||
BlockStack blockStack = getBloodRune(tileEntity);
|
||||
if (blockStack != null) {
|
||||
world.setBlockState(currentPos, blockStack.getState(), 3);
|
||||
lightning(world, currentPos);
|
||||
masterRitualStone.getOwnerNetwork().syphon(getRefreshCost());
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
BlockStack blockStack = new BlockStack(Utils.getBlockForComponent(currentComponent.getComponent()), 0);
|
||||
if (hasItem(tileEntity, Item.getItemFromBlock(blockStack.getBlock()), blockStack.getMeta(), true))
|
||||
{
|
||||
world.setBlockState(currentPos, blockStack.getState(), 3);
|
||||
lightning(world, currentPos);
|
||||
masterRitualStone.getOwnerNetwork().syphon(getRefreshCost());
|
||||
default: {
|
||||
BlockStack blockStack = new BlockStack(Utils.getBlockForComponent(currentComponent.getComponent()), 0);
|
||||
if (hasItem(tileEntity, Item.getItemFromBlock(blockStack.getBlock()), blockStack.getMeta(), true)) {
|
||||
world.setBlockState(currentPos, blockStack.getState(), 3);
|
||||
lightning(world, currentPos);
|
||||
masterRitualStone.getOwnerNetwork().syphon(getRefreshCost());
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
cycleDone = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 75;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return 12;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
for (int i = -12; i <= -8; i++)
|
||||
{
|
||||
for (int i = -12; i <= -8; i++) {
|
||||
addRune(components, i, -6, 13, EnumRuneType.AIR);
|
||||
addRune(components, i, -6, -13, EnumRuneType.FIRE);
|
||||
|
||||
|
@ -150,8 +130,7 @@ public class RitualAltarBuilder extends Ritual
|
|||
addRune(components, -13, 5, i, EnumRuneType.WATER);
|
||||
}
|
||||
|
||||
for (int i = 8; i <= 12; i++)
|
||||
{
|
||||
for (int i = 8; i <= 12; i++) {
|
||||
addRune(components, i, -6, 13, EnumRuneType.AIR);
|
||||
addRune(components, i, -6, -13, EnumRuneType.FIRE);
|
||||
|
||||
|
@ -165,13 +144,11 @@ public class RitualAltarBuilder extends Ritual
|
|||
addRune(components, -13, 5, i, EnumRuneType.WATER);
|
||||
}
|
||||
|
||||
for (int i = -6; i <= -4; i++)
|
||||
{
|
||||
for (int i = -6; i <= -4; i++) {
|
||||
addCornerRunes(components, 13, i, EnumRuneType.DUSK);
|
||||
}
|
||||
|
||||
for (int i = 3; i <= 5; i++)
|
||||
{
|
||||
for (int i = 3; i <= 5; i++) {
|
||||
addCornerRunes(components, 13, i, EnumRuneType.DUSK);
|
||||
}
|
||||
|
||||
|
@ -179,13 +156,11 @@ public class RitualAltarBuilder extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualAltarBuilder();
|
||||
}
|
||||
|
||||
public void lightning(World world, BlockPos blockPos)
|
||||
{
|
||||
public void lightning(World world, BlockPos blockPos) {
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, blockPos.getX(), blockPos.getY(), blockPos.getZ(), true));
|
||||
}
|
||||
|
||||
|
@ -194,35 +169,25 @@ public class RitualAltarBuilder extends Ritual
|
|||
* These methods are utilities for this ritual. They support both the old
|
||||
* forge inventory system, and the new one.
|
||||
*/
|
||||
public boolean hasItem(TileEntity tileEntity, Item item, int damage, boolean consumeItem)
|
||||
{
|
||||
if (tileEntity != null)
|
||||
{
|
||||
if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN))
|
||||
{
|
||||
public boolean hasItem(TileEntity tileEntity, Item item, int damage, boolean consumeItem) {
|
||||
if (tileEntity != null) {
|
||||
if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN)) {
|
||||
IItemHandler itemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
|
||||
|
||||
if (itemHandler.getSlots() <= 0)
|
||||
{
|
||||
if (itemHandler.getSlots() <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < itemHandler.getSlots(); i++)
|
||||
{
|
||||
if (!itemHandler.getStackInSlot(i).isEmpty() && itemHandler.getStackInSlot(i).getItem() == item && itemHandler.getStackInSlot(i).getItemDamage() == damage && !itemHandler.extractItem(i, 1, !consumeItem).isEmpty())
|
||||
{
|
||||
for (int i = 0; i < itemHandler.getSlots(); i++) {
|
||||
if (!itemHandler.getStackInSlot(i).isEmpty() && itemHandler.getStackInSlot(i).getItem() == item && itemHandler.getStackInSlot(i).getItemDamage() == damage && !itemHandler.extractItem(i, 1, !consumeItem).isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (tileEntity instanceof IInventory)
|
||||
{
|
||||
} else if (tileEntity instanceof IInventory) {
|
||||
IInventory inv = (IInventory) tileEntity;
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++)
|
||||
{
|
||||
if (!inv.getStackInSlot(0).isEmpty() && inv.getStackInSlot(i).getItem() == item && inv.getStackInSlot(i).getItemDamage() == damage)
|
||||
{
|
||||
if (consumeItem)
|
||||
{
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
if (!inv.getStackInSlot(0).isEmpty() && inv.getStackInSlot(i).getItem() == item && inv.getStackInSlot(i).getItemDamage() == damage) {
|
||||
if (consumeItem) {
|
||||
inv.decrStackSize(i, 1);
|
||||
}
|
||||
return true;
|
||||
|
@ -233,35 +198,26 @@ public class RitualAltarBuilder extends Ritual
|
|||
return false;
|
||||
}
|
||||
|
||||
public BlockStack getBloodRune(TileEntity tileEntity)
|
||||
{
|
||||
if (tileEntity != null)
|
||||
{
|
||||
if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN))
|
||||
{
|
||||
public BlockStack getBloodRune(TileEntity tileEntity) {
|
||||
if (tileEntity != null) {
|
||||
if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN)) {
|
||||
IItemHandler itemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
|
||||
|
||||
if (itemHandler.getSlots() <= 0)
|
||||
{
|
||||
if (itemHandler.getSlots() <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (int i = 0; i < itemHandler.getSlots(); i++)
|
||||
{
|
||||
if (!itemHandler.getStackInSlot(i).isEmpty() && itemHandler.getStackInSlot(i).getItem() instanceof ItemBlock && Block.getBlockFromItem(itemHandler.getStackInSlot(i).getItem()) instanceof BlockBloodRune && itemHandler.extractItem(i, 1, true) != null)
|
||||
{
|
||||
for (int i = 0; i < itemHandler.getSlots(); i++) {
|
||||
if (!itemHandler.getStackInSlot(i).isEmpty() && itemHandler.getStackInSlot(i).getItem() instanceof ItemBlock && Block.getBlockFromItem(itemHandler.getStackInSlot(i).getItem()) instanceof BlockBloodRune && itemHandler.extractItem(i, 1, true) != null) {
|
||||
BlockStack blockStack = new BlockStack(Utils.getBlockForComponent(EnumAltarComponent.BLOODRUNE), itemHandler.getStackInSlot(i).getItemDamage());
|
||||
itemHandler.extractItem(i, 1, false);
|
||||
return blockStack;
|
||||
}
|
||||
}
|
||||
} else if (tileEntity instanceof IInventory)
|
||||
{
|
||||
} else if (tileEntity instanceof IInventory) {
|
||||
IInventory inv = (IInventory) tileEntity;
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++)
|
||||
{
|
||||
if (!inv.getStackInSlot(i).isEmpty() && inv.getStackInSlot(i).getItem() instanceof ItemBlock && Block.getBlockFromItem(inv.getStackInSlot(i).getItem()) instanceof BlockBloodRune)
|
||||
{
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
if (!inv.getStackInSlot(i).isEmpty() && inv.getStackInSlot(i).getItem() instanceof ItemBlock && Block.getBlockFromItem(inv.getStackInSlot(i).getItem()) instanceof BlockBloodRune) {
|
||||
BlockStack blockStack = new BlockStack(Utils.getBlockForComponent(EnumAltarComponent.BLOODRUNE), inv.getStackInSlot(i).getItemDamage());
|
||||
inv.decrStackSize(i, 1);
|
||||
return blockStack;
|
||||
|
@ -272,42 +228,31 @@ public class RitualAltarBuilder extends Ritual
|
|||
return null;
|
||||
}
|
||||
|
||||
public BlockStack getMundaneBlock(TileEntity tileEntity)
|
||||
{
|
||||
if (tileEntity != null)
|
||||
{
|
||||
if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN))
|
||||
{
|
||||
public BlockStack getMundaneBlock(TileEntity tileEntity) {
|
||||
if (tileEntity != null) {
|
||||
if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN)) {
|
||||
IItemHandler itemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
|
||||
|
||||
if (itemHandler.getSlots() <= 0)
|
||||
{
|
||||
if (itemHandler.getSlots() <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (int i = 0; i < itemHandler.getSlots(); i++)
|
||||
{
|
||||
if (!itemHandler.getStackInSlot(i).isEmpty() && itemHandler.getStackInSlot(i).getItem() instanceof ItemBlock && !(Block.getBlockFromItem(itemHandler.getStackInSlot(i).getItem()) instanceof BlockBloodRune) && !itemHandler.extractItem(i, 1, true).isEmpty())
|
||||
{
|
||||
for (int i = 0; i < itemHandler.getSlots(); i++) {
|
||||
if (!itemHandler.getStackInSlot(i).isEmpty() && itemHandler.getStackInSlot(i).getItem() instanceof ItemBlock && !(Block.getBlockFromItem(itemHandler.getStackInSlot(i).getItem()) instanceof BlockBloodRune) && !itemHandler.extractItem(i, 1, true).isEmpty()) {
|
||||
Block block = Block.getBlockFromItem(itemHandler.getStackInSlot(i).getItem());
|
||||
if (block != Blocks.AIR && block != Blocks.GLOWSTONE && block != RegistrarBloodMagicBlocks.DECORATIVE_BRICK)
|
||||
{
|
||||
if (block != Blocks.AIR && block != Blocks.GLOWSTONE && block != RegistrarBloodMagicBlocks.DECORATIVE_BRICK) {
|
||||
BlockStack blockStack = new BlockStack(block, itemHandler.getStackInSlot(i).getItemDamage());
|
||||
itemHandler.extractItem(i, 1, false);
|
||||
return blockStack;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (tileEntity instanceof IInventory)
|
||||
{
|
||||
} else if (tileEntity instanceof IInventory) {
|
||||
IInventory inv = (IInventory) tileEntity;
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++)
|
||||
{
|
||||
if (!inv.getStackInSlot(i).isEmpty() && inv.getStackInSlot(i).getItem() instanceof ItemBlock && !(Block.getBlockFromItem(inv.getStackInSlot(i).getItem()) instanceof BlockBloodRune))
|
||||
{
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
if (!inv.getStackInSlot(i).isEmpty() && inv.getStackInSlot(i).getItem() instanceof ItemBlock && !(Block.getBlockFromItem(inv.getStackInSlot(i).getItem()) instanceof BlockBloodRune)) {
|
||||
Block block = Block.getBlockFromItem(inv.getStackInSlot(i).getItem());
|
||||
if (block != Blocks.GLOWSTONE && block != RegistrarBloodMagicBlocks.DECORATIVE_BRICK)
|
||||
{
|
||||
if (block != Blocks.GLOWSTONE && block != RegistrarBloodMagicBlocks.DECORATIVE_BRICK) {
|
||||
BlockStack blockStack = new BlockStack(block, inv.getStackInSlot(i).getItemDamage());
|
||||
inv.decrStackSize(i, 1);
|
||||
return blockStack;
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -16,17 +17,11 @@ import net.minecraft.util.text.ITextComponent;
|
|||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
public class RitualAnimalGrowth extends Ritual
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RitualAnimalGrowth extends Ritual {
|
||||
public static final double rawWillDrain = 0.05;
|
||||
public static final double vengefulWillDrain = 0.02;
|
||||
public static final double steadfastWillDrain = 0.1;
|
||||
|
@ -34,12 +29,10 @@ public class RitualAnimalGrowth extends Ritual
|
|||
|
||||
public static final String GROWTH_RANGE = "growing";
|
||||
public static final String CHEST_RANGE = "chest";
|
||||
|
||||
public int refreshTime = 20;
|
||||
public static int defaultRefreshTime = 20;
|
||||
public int refreshTime = 20;
|
||||
|
||||
public RitualAnimalGrowth()
|
||||
{
|
||||
public RitualAnimalGrowth() {
|
||||
super("ritualAnimalGrowth", 0, 10000, "ritual." + BloodMagic.MODID + ".animalGrowthRitual");
|
||||
addBlockRange(GROWTH_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-2, 1, -2), 5, 2, 5));
|
||||
addBlockRange(CHEST_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1));
|
||||
|
@ -49,13 +42,11 @@ public class RitualAnimalGrowth extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
@ -67,8 +58,7 @@ public class RitualAnimalGrowth extends Ritual
|
|||
AreaDescriptor chestRange = getBlockRange(CHEST_RANGE);
|
||||
TileEntity chest = world.getTileEntity(chestRange.getContainedPositions(pos).get(0));
|
||||
IItemHandler itemHandler = null;
|
||||
if (chest != null)
|
||||
{
|
||||
if (chest != null) {
|
||||
itemHandler = Utils.getInventory(chest, null);
|
||||
}
|
||||
|
||||
|
@ -98,58 +88,42 @@ public class RitualAnimalGrowth extends Ritual
|
|||
|
||||
boolean performedEffect = false;
|
||||
|
||||
for (EntityAnimal animal : animalList)
|
||||
{
|
||||
if (animal.getGrowingAge() < 0)
|
||||
{
|
||||
for (EntityAnimal animal : animalList) {
|
||||
if (animal.getGrowingAge() < 0) {
|
||||
animal.addGrowth(5);
|
||||
totalGrowths++;
|
||||
performedEffect = true;
|
||||
} else if (animal.getGrowingAge() > 0)
|
||||
{
|
||||
if (decreaseBreedTimer)
|
||||
{
|
||||
if (vengefulWill >= vengefulWillDrain)
|
||||
{
|
||||
} else if (animal.getGrowingAge() > 0) {
|
||||
if (decreaseBreedTimer) {
|
||||
if (vengefulWill >= vengefulWillDrain) {
|
||||
animal.setGrowingAge(Math.max(0, animal.getGrowingAge() - getBreedingDecreaseForWill(vengefulWill)));
|
||||
vengefulDrain += vengefulWillDrain;
|
||||
vengefulWill -= vengefulWillDrain;
|
||||
performedEffect = true;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
decreaseBreedTimer = false;
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (kamikaze)
|
||||
{
|
||||
if (destructiveWill >= destructiveWillDrain)
|
||||
{
|
||||
if (!animal.isPotionActive(RegistrarBloodMagic.SACRIFICIAL_LAMB))
|
||||
{
|
||||
} else {
|
||||
if (kamikaze) {
|
||||
if (destructiveWill >= destructiveWillDrain) {
|
||||
if (!animal.isPotionActive(RegistrarBloodMagic.SACRIFICIAL_LAMB)) {
|
||||
animal.addPotionEffect(new PotionEffect(RegistrarBloodMagic.SACRIFICIAL_LAMB, 1200));
|
||||
destructiveDrain += destructiveWillDrain;
|
||||
destructiveWill -= destructiveWillDrain;
|
||||
performedEffect = true;
|
||||
}
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
kamikaze = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (breedAnimals)
|
||||
{
|
||||
if (steadfastWill >= steadfastWillDrain)
|
||||
{
|
||||
if (!animal.isInLove())
|
||||
{
|
||||
for (int slot = 0; slot < itemHandler.getSlots(); slot++)
|
||||
{
|
||||
if (breedAnimals) {
|
||||
if (steadfastWill >= steadfastWillDrain) {
|
||||
if (!animal.isInLove()) {
|
||||
for (int slot = 0; slot < itemHandler.getSlots(); slot++) {
|
||||
ItemStack foodStack = itemHandler.getStackInSlot(slot);
|
||||
if (foodStack != null && animal.isBreedingItem(foodStack) && itemHandler.extractItem(slot, 1, true) != null)
|
||||
{
|
||||
if (foodStack != null && animal.isBreedingItem(foodStack) && itemHandler.extractItem(slot, 1, true) != null) {
|
||||
animal.setInLove(null);
|
||||
itemHandler.extractItem(slot, 1, false);
|
||||
steadfastDrain += steadfastWillDrain;
|
||||
|
@ -159,36 +133,30 @@ public class RitualAnimalGrowth extends Ritual
|
|||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
breedAnimals = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (totalGrowths >= maxGrowths)
|
||||
{
|
||||
if (totalGrowths >= maxGrowths) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (performedEffect && consumeRawWill)
|
||||
{
|
||||
if (performedEffect && consumeRawWill) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DEFAULT, rawWillDrain, true);
|
||||
}
|
||||
|
||||
if (vengefulDrain > 0)
|
||||
{
|
||||
if (vengefulDrain > 0) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.VENGEFUL, vengefulDrain, true);
|
||||
}
|
||||
|
||||
if (steadfastDrain > 0)
|
||||
{
|
||||
if (steadfastDrain > 0) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.STEADFAST, steadfastDrain, true);
|
||||
}
|
||||
|
||||
if (destructiveDrain > 0)
|
||||
{
|
||||
if (destructiveDrain > 0) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DESTRUCTIVE, destructiveDrain, true);
|
||||
}
|
||||
|
||||
|
@ -196,14 +164,12 @@ public class RitualAnimalGrowth extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addParallelRunes(components, 2, 0, EnumRuneType.DUSK);
|
||||
|
@ -221,15 +187,13 @@ public class RitualAnimalGrowth extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualAnimalGrowth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player)
|
||||
{
|
||||
return new ITextComponent[] {
|
||||
public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player) {
|
||||
return new ITextComponent[]{
|
||||
new TextComponentTranslation(this.getUnlocalizedName() + ".info"),
|
||||
new TextComponentTranslation(this.getUnlocalizedName() + ".default.info"),
|
||||
new TextComponentTranslation(this.getUnlocalizedName() + ".corrosive.info"),
|
||||
|
@ -239,15 +203,12 @@ public class RitualAnimalGrowth extends Ritual
|
|||
};
|
||||
}
|
||||
|
||||
public int getBreedingDecreaseForWill(double vengefulWill)
|
||||
{
|
||||
public int getBreedingDecreaseForWill(double vengefulWill) {
|
||||
return (int) (10 + vengefulWill / 5);
|
||||
}
|
||||
|
||||
public int getRefreshTimeForRawWill(double rawWill)
|
||||
{
|
||||
if (rawWill >= rawWillDrain)
|
||||
{
|
||||
public int getRefreshTimeForRawWill(double rawWill) {
|
||||
if (rawWill >= rawWillDrain) {
|
||||
return (int) Math.max(defaultRefreshTime - rawWill / 10, 1);
|
||||
}
|
||||
|
||||
|
@ -255,8 +216,7 @@ public class RitualAnimalGrowth extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return refreshTime;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,23 +14,19 @@ import net.minecraft.world.World;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RitualArmourEvolve extends Ritual
|
||||
{
|
||||
public class RitualArmourEvolve extends Ritual {
|
||||
public static final String CHECK_RANGE = "fillRange";
|
||||
|
||||
public RitualArmourEvolve()
|
||||
{
|
||||
public RitualArmourEvolve() {
|
||||
super("ritualArmourEvolve", 0, 50000, "ritual." + BloodMagic.MODID + ".armourEvolveRitual");
|
||||
addBlockRange(CHECK_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1, 2, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
|
||||
if (world.isRemote)
|
||||
{
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -40,16 +36,12 @@ public class RitualArmourEvolve extends Ritual
|
|||
|
||||
List<EntityPlayer> playerList = world.getEntitiesWithinAABB(EntityPlayer.class, checkRange.getAABB(pos));
|
||||
|
||||
for (EntityPlayer player : playerList)
|
||||
{
|
||||
if (LivingArmour.hasFullSet(player))
|
||||
{
|
||||
for (EntityPlayer player : playerList) {
|
||||
if (LivingArmour.hasFullSet(player)) {
|
||||
ItemStack chestStack = Iterables.toArray(player.getArmorInventoryList(), ItemStack.class)[2];
|
||||
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
|
||||
if (armour != null)
|
||||
{
|
||||
if (armour.maxUpgradePoints < 300)
|
||||
{
|
||||
if (armour != null) {
|
||||
if (armour.maxUpgradePoints < 300) {
|
||||
armour.maxUpgradePoints = 300;
|
||||
((ItemLivingArmour) chestStack.getItem()).setLivingArmour(chestStack, armour, true);
|
||||
|
||||
|
@ -63,20 +55,17 @@ public class RitualArmourEvolve extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addCornerRunes(components, 1, 0, EnumRuneType.DUSK);
|
||||
|
@ -87,8 +76,7 @@ public class RitualArmourEvolve extends Ritual
|
|||
this.addCornerRunes(components, 1, 3, EnumRuneType.DUSK);
|
||||
this.addParallelRunes(components, 1, 4, EnumRuneType.EARTH);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
for (int i = 0; i < 4; i++) {
|
||||
this.addCornerRunes(components, 3, i, EnumRuneType.EARTH);
|
||||
}
|
||||
|
||||
|
@ -96,8 +84,7 @@ public class RitualArmourEvolve extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualArmourEvolve();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,27 +12,23 @@ import net.minecraft.world.World;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class RitualCobblestone extends Ritual
|
||||
{
|
||||
public class RitualCobblestone extends Ritual {
|
||||
|
||||
public static final String COBBLESTONE_RANGE = "cobblestoneRange";
|
||||
|
||||
public RitualCobblestone()
|
||||
{
|
||||
public RitualCobblestone() {
|
||||
super("ritualCobblestone", 0, 500, "ritual." + BloodMagic.MODID + ".cobblestoneRitual");
|
||||
addBlockRange(COBBLESTONE_RANGE, new AreaDescriptor.Cross(new BlockPos(0, 1, 0), 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
TileEntity tileEntity = world.getTileEntity(masterRitualStone.getBlockPos().up());
|
||||
Block block = Blocks.COBBLESTONE;
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
@ -42,44 +38,38 @@ public class RitualCobblestone extends Ritual
|
|||
|
||||
AreaDescriptor cobblestoneRange = getBlockRange(COBBLESTONE_RANGE);
|
||||
|
||||
if (tileEntity != null && tileEntity instanceof TileAlchemyArray)
|
||||
{
|
||||
if (tileEntity != null && tileEntity instanceof TileAlchemyArray) {
|
||||
TileAlchemyArray alchemyArray = (TileAlchemyArray) tileEntity;
|
||||
if (!alchemyArray.getStackInSlot(0).isEmpty() && alchemyArray.getStackInSlot(0).getItem() instanceof ItemComponent)
|
||||
{
|
||||
switch (alchemyArray.getStackInSlot(0).getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
block = Blocks.OBSIDIAN;
|
||||
alchemyArray.decrStackSize(0, 1);
|
||||
world.setBlockToAir(alchemyArray.getPos());
|
||||
break;
|
||||
case 1:
|
||||
block = Blocks.NETHERRACK;
|
||||
alchemyArray.decrStackSize(0, 1);
|
||||
world.setBlockToAir(alchemyArray.getPos());
|
||||
break;
|
||||
if (!alchemyArray.getStackInSlot(0).isEmpty() && alchemyArray.getStackInSlot(0).getItem() instanceof ItemComponent) {
|
||||
switch (alchemyArray.getStackInSlot(0).getItemDamage()) {
|
||||
case 0:
|
||||
block = Blocks.OBSIDIAN;
|
||||
alchemyArray.decrStackSize(0, 1);
|
||||
world.setBlockToAir(alchemyArray.getPos());
|
||||
break;
|
||||
case 1:
|
||||
block = Blocks.NETHERRACK;
|
||||
alchemyArray.decrStackSize(0, 1);
|
||||
world.setBlockToAir(alchemyArray.getPos());
|
||||
break;
|
||||
/*
|
||||
* case 4: block = Blocks.end_stone;
|
||||
* alchemyArray.decrStackSize(0, 1);
|
||||
* world.setBlockToAir(alchemyArray.getPos()); break;
|
||||
*/
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (BlockPos blockPos : cobblestoneRange.getContainedPositions(masterRitualStone.getBlockPos()))
|
||||
{
|
||||
if (world.isAirBlock(blockPos))
|
||||
{
|
||||
for (BlockPos blockPos : cobblestoneRange.getContainedPositions(masterRitualStone.getBlockPos())) {
|
||||
if (world.isAirBlock(blockPos)) {
|
||||
world.setBlockState(blockPos, block.getDefaultState());
|
||||
totalEffects++;
|
||||
}
|
||||
|
||||
if (totalEffects >= maxEffects)
|
||||
{
|
||||
if (totalEffects >= maxEffects) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -88,14 +78,12 @@ public class RitualCobblestone extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 25;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addCornerRunes(components, 1, 1, EnumRuneType.FIRE);
|
||||
|
@ -105,8 +93,7 @@ public class RitualCobblestone extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualCobblestone();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,33 +10,28 @@ import net.minecraft.world.World;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class RitualContainment extends Ritual
|
||||
{
|
||||
public class RitualContainment extends Ritual {
|
||||
public static final String CONTAINMENT_RANGE = "containmentRange";
|
||||
|
||||
public RitualContainment()
|
||||
{
|
||||
public RitualContainment() {
|
||||
super("ritualContainment", 0, 2000, "ritual." + BloodMagic.MODID + ".containmentRitual");
|
||||
addBlockRange(CONTAINMENT_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-3, 0, -3), 7));
|
||||
setMaximumVolumeAndDistanceOfRange(CONTAINMENT_RANGE, 0, 10, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
AreaDescriptor containmentRange = getBlockRange(CONTAINMENT_RANGE);
|
||||
|
||||
for (EntityLivingBase entity : world.getEntitiesWithinAABB(EntityLivingBase.class, containmentRange.getAABB(masterRitualStone.getBlockPos())))
|
||||
{
|
||||
for (EntityLivingBase entity : world.getEntitiesWithinAABB(EntityLivingBase.class, containmentRange.getAABB(masterRitualStone.getBlockPos()))) {
|
||||
if (entity instanceof EntityPlayer && (((EntityPlayer) entity).capabilities.isCreativeMode || PlayerHelper.getUUIDFromPlayer((EntityPlayer) entity).toString().equals(masterRitualStone.getOwner())))
|
||||
continue;
|
||||
|
||||
|
@ -52,20 +47,17 @@ public class RitualContainment extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addParallelRunes(components, 1, 0, EnumRuneType.EARTH);
|
||||
|
@ -77,8 +69,7 @@ public class RitualContainment extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualContainment();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.compress.CompressionRegistry;
|
||||
import WayofTime.bloodmagic.api.recipe.AlchemyTableRecipe;
|
||||
import WayofTime.bloodmagic.api.registry.AlchemyTableRecipeRegistry;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -17,24 +19,15 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import WayofTime.bloodmagic.api.compress.CompressionRegistry;
|
||||
import WayofTime.bloodmagic.api.recipe.AlchemyTableRecipe;
|
||||
import WayofTime.bloodmagic.api.registry.AlchemyTableRecipeRegistry;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class RitualCrushing extends Ritual
|
||||
{
|
||||
public class RitualCrushing extends Ritual {
|
||||
public static final String CRUSHING_RANGE = "crushingRange";
|
||||
public static final String CHEST_RANGE = "chest";
|
||||
|
||||
|
@ -45,12 +38,10 @@ public class RitualCrushing extends Ritual
|
|||
|
||||
public static Map<ItemStack, Integer> cuttingFluidLPMap = new HashMap<ItemStack, Integer>();
|
||||
public static Map<ItemStack, Double> cuttingFluidWillMap = new HashMap<ItemStack, Double>();
|
||||
|
||||
public int refreshTime = 40;
|
||||
public static int defaultRefreshTime = 40;
|
||||
public int refreshTime = 40;
|
||||
|
||||
public RitualCrushing()
|
||||
{
|
||||
public RitualCrushing() {
|
||||
super("ritualCrushing", 0, 5000, "ritual." + BloodMagic.MODID + ".crushingRitual");
|
||||
addBlockRange(CRUSHING_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-1, -3, -1), 3));
|
||||
addBlockRange(CHEST_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1));
|
||||
|
@ -59,20 +50,12 @@ public class RitualCrushing extends Ritual
|
|||
setMaximumVolumeAndDistanceOfRange(CHEST_RANGE, 1, 3, 3);
|
||||
}
|
||||
|
||||
public static void registerCuttingFluid(ItemStack stack, int lpDrain, double willDrain)
|
||||
{
|
||||
cuttingFluidLPMap.put(stack, lpDrain);
|
||||
cuttingFluidWillMap.put(stack, willDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
@ -81,8 +64,7 @@ public class RitualCrushing extends Ritual
|
|||
AreaDescriptor chestRange = getBlockRange(CHEST_RANGE);
|
||||
TileEntity tile = world.getTileEntity(chestRange.getContainedPositions(pos).get(0));
|
||||
|
||||
if (tile != null && Utils.getNumberOfFreeSlots(tile, EnumFacing.DOWN) < 1)
|
||||
{
|
||||
if (tile != null && Utils.getNumberOfFreeSlots(tile, EnumFacing.DOWN) < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -108,39 +90,32 @@ public class RitualCrushing extends Ritual
|
|||
|
||||
double rawDrain = 0;
|
||||
|
||||
for (BlockPos newPos : crushingRange.getContainedPositions(pos))
|
||||
{
|
||||
if (world.isAirBlock(newPos))
|
||||
{
|
||||
for (BlockPos newPos : crushingRange.getContainedPositions(pos)) {
|
||||
if (world.isAirBlock(newPos)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IBlockState state = world.getBlockState(newPos);
|
||||
Block block = state.getBlock();
|
||||
if (block.equals(RegistrarBloodMagicBlocks.RITUAL_CONTROLLER) || block.equals(RegistrarBloodMagicBlocks.RITUAL_STONE) || block.getBlockHardness(state, world, newPos) == -1.0F || Utils.isBlockLiquid(state))
|
||||
{
|
||||
if (block.equals(RegistrarBloodMagicBlocks.RITUAL_CONTROLLER) || block.equals(RegistrarBloodMagicBlocks.RITUAL_STONE) || block.getBlockHardness(state, world, newPos) == -1.0F || Utils.isBlockLiquid(state)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean isBlockClaimed = false;
|
||||
if (useCuttingFluid)
|
||||
{
|
||||
if (useCuttingFluid) {
|
||||
ItemStack checkStack = block.getItem(world, newPos, state);
|
||||
if (checkStack.isEmpty())
|
||||
{
|
||||
if (checkStack.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack copyStack = checkStack.copy();
|
||||
|
||||
for (Entry<ItemStack, Integer> entry : cuttingFluidLPMap.entrySet())
|
||||
{
|
||||
for (Entry<ItemStack, Integer> entry : cuttingFluidLPMap.entrySet()) {
|
||||
ItemStack cuttingStack = entry.getKey();
|
||||
int lpDrain = entry.getValue();
|
||||
double willDrain = cuttingFluidWillMap.containsKey(cuttingStack) ? cuttingFluidWillMap.get(cuttingStack) : 0;
|
||||
|
||||
if (corrosiveWill < willDrain || currentEssence < lpDrain + getRefreshCost())
|
||||
{
|
||||
if (corrosiveWill < willDrain || currentEssence < lpDrain + getRefreshCost()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -150,26 +125,21 @@ public class RitualCrushing extends Ritual
|
|||
input.add(copyStack);
|
||||
|
||||
AlchemyTableRecipe recipe = AlchemyTableRecipeRegistry.getMatchingRecipe(input, world, pos);
|
||||
if (recipe == null)
|
||||
{
|
||||
if (recipe == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack result = recipe.getRecipeOutput(input);
|
||||
if (result.isEmpty())
|
||||
{
|
||||
if (result.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tile != null)
|
||||
{
|
||||
if (tile != null) {
|
||||
result = Utils.insertStackIntoTile(result, tile, EnumFacing.DOWN);
|
||||
if (!result.isEmpty())
|
||||
{
|
||||
if (!result.isEmpty()) {
|
||||
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, result);
|
||||
}
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, result);
|
||||
}
|
||||
|
||||
|
@ -183,22 +153,18 @@ public class RitualCrushing extends Ritual
|
|||
}
|
||||
}
|
||||
|
||||
if (!isBlockClaimed && isSilkTouch && block.canSilkHarvest(world, newPos, state, null))
|
||||
{
|
||||
if (!isBlockClaimed && isSilkTouch && block.canSilkHarvest(world, newPos, state, null)) {
|
||||
ItemStack checkStack = block.getItem(world, newPos, state);
|
||||
if (checkStack.isEmpty())
|
||||
{
|
||||
if (checkStack.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack copyStack = checkStack.copy();
|
||||
|
||||
if (steadfastWill >= steadfastWillDrain)
|
||||
{
|
||||
if (steadfastWill >= steadfastWillDrain) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.STEADFAST, steadfastWillDrain, true);
|
||||
steadfastWill -= steadfastWillDrain;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -207,39 +173,31 @@ public class RitualCrushing extends Ritual
|
|||
else
|
||||
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack);
|
||||
|
||||
if (!copyStack.isEmpty())
|
||||
{
|
||||
if (!copyStack.isEmpty()) {
|
||||
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack);
|
||||
}
|
||||
} else if (!isBlockClaimed)
|
||||
{
|
||||
if (fortune > 0 && destructiveWill < destructiveWillDrain)
|
||||
{
|
||||
} else if (!isBlockClaimed) {
|
||||
if (fortune > 0 && destructiveWill < destructiveWillDrain) {
|
||||
fortune = 0;
|
||||
}
|
||||
|
||||
List<ItemStack> stackList = block.getDrops(world, newPos, state, fortune);
|
||||
|
||||
for (ItemStack item : stackList)
|
||||
{
|
||||
for (ItemStack item : stackList) {
|
||||
ItemStack copyStack = item.copy();
|
||||
|
||||
if (tile != null)
|
||||
{
|
||||
if (tile != null) {
|
||||
copyStack = Utils.insertStackIntoTile(copyStack, tile, EnumFacing.DOWN);
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack);
|
||||
continue;
|
||||
}
|
||||
if (!copyStack.isEmpty())
|
||||
{
|
||||
if (!copyStack.isEmpty()) {
|
||||
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack);
|
||||
}
|
||||
}
|
||||
|
||||
if (fortune > 0)
|
||||
{
|
||||
if (fortune > 0) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DESTRUCTIVE, destructiveWillDrain, true);
|
||||
destructiveWill -= destructiveWillDrain;
|
||||
}
|
||||
|
@ -249,8 +207,7 @@ public class RitualCrushing extends Ritual
|
|||
masterRitualStone.getOwnerNetwork().syphon(getRefreshCost());
|
||||
hasOperated = true;
|
||||
|
||||
if (consumeRawWill)
|
||||
{
|
||||
if (consumeRawWill) {
|
||||
rawDrain += rawWillDrain;
|
||||
rawWill -= rawWillDrain;
|
||||
}
|
||||
|
@ -258,14 +215,11 @@ public class RitualCrushing extends Ritual
|
|||
break;
|
||||
}
|
||||
|
||||
if (hasOperated && tile != null && vengefulWill >= vengefulWillDrain)
|
||||
{
|
||||
if (hasOperated && tile != null && vengefulWill >= vengefulWillDrain) {
|
||||
Pair<ItemStack, Boolean> pair = CompressionRegistry.compressInventory(tile, world);
|
||||
if (pair.getRight())
|
||||
{
|
||||
if (pair.getRight()) {
|
||||
ItemStack returned = pair.getLeft();
|
||||
if (returned != null)
|
||||
{
|
||||
if (returned != null) {
|
||||
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, returned);
|
||||
}
|
||||
|
||||
|
@ -273,16 +227,13 @@ public class RitualCrushing extends Ritual
|
|||
}
|
||||
}
|
||||
|
||||
if (rawDrain > 0)
|
||||
{
|
||||
if (rawDrain > 0) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DEFAULT, rawDrain, true);
|
||||
}
|
||||
}
|
||||
|
||||
public int getRefreshTimeForRawWill(double rawWill)
|
||||
{
|
||||
if (rawWill >= rawWillDrain)
|
||||
{
|
||||
public int getRefreshTimeForRawWill(double rawWill) {
|
||||
if (rawWill >= rawWillDrain) {
|
||||
return Math.max(1, (int) (40 - rawWill / 5));
|
||||
}
|
||||
|
||||
|
@ -290,20 +241,17 @@ public class RitualCrushing extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return refreshTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 7;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addParallelRunes(components, 1, 0, EnumRuneType.EARTH);
|
||||
|
@ -315,9 +263,8 @@ public class RitualCrushing extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player)
|
||||
{
|
||||
return new ITextComponent[] {
|
||||
public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player) {
|
||||
return new ITextComponent[]{
|
||||
new TextComponentTranslation(this.getUnlocalizedName() + ".info"),
|
||||
new TextComponentTranslation(this.getUnlocalizedName() + ".default.info"),
|
||||
new TextComponentTranslation(this.getUnlocalizedName() + ".corrosive.info"),
|
||||
|
@ -328,8 +275,12 @@ public class RitualCrushing extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualCrushing();
|
||||
}
|
||||
|
||||
public static void registerCuttingFluid(ItemStack stack, int lpDrain, double willDrain) {
|
||||
cuttingFluidLPMap.put(stack, lpDrain);
|
||||
cuttingFluidWillMap.put(stack, willDrain);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +1,19 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.tile.TileDemonCrystal;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
||||
import WayofTime.bloodmagic.tile.TileDemonCrystal;
|
||||
|
||||
public class RitualCrystalHarvest extends Ritual
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class RitualCrystalHarvest extends Ritual {
|
||||
public static final String CRYSTAL_RANGE = "crystal";
|
||||
|
||||
public RitualCrystalHarvest()
|
||||
{
|
||||
public RitualCrystalHarvest() {
|
||||
super("ritualCrystalHarvest", 0, 40000, "ritual." + BloodMagic.MODID + ".crystalHarvestRitual");
|
||||
addBlockRange(CRYSTAL_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-3, 2, -3), 7, 5, 7));
|
||||
|
||||
|
@ -27,14 +21,12 @@ public class RitualCrystalHarvest extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
BlockPos pos = masterRitualStone.getBlockPos();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
@ -45,20 +37,16 @@ public class RitualCrystalHarvest extends Ritual
|
|||
AreaDescriptor crystalRange = getBlockRange(CRYSTAL_RANGE);
|
||||
|
||||
crystalRange.resetIterator();
|
||||
while (crystalRange.hasNext())
|
||||
{
|
||||
while (crystalRange.hasNext()) {
|
||||
BlockPos nextPos = crystalRange.next().add(pos);
|
||||
TileEntity tile = world.getTileEntity(nextPos);
|
||||
if (tile instanceof TileDemonCrystal)
|
||||
{
|
||||
if (tile instanceof TileDemonCrystal) {
|
||||
TileDemonCrystal demonCrystal = (TileDemonCrystal) tile;
|
||||
if (demonCrystal.dropSingleCrystal())
|
||||
{
|
||||
if (demonCrystal.dropSingleCrystal()) {
|
||||
IBlockState state = world.getBlockState(nextPos);
|
||||
world.notifyBlockUpdate(nextPos, state, state, 3);
|
||||
totalEffects++;
|
||||
if (totalEffects >= maxEffects)
|
||||
{
|
||||
if (totalEffects >= maxEffects) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -69,20 +57,17 @@ public class RitualCrystalHarvest extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return 25;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 50;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addCornerRunes(components, 1, 0, EnumRuneType.AIR);
|
||||
|
@ -99,8 +84,7 @@ public class RitualCrystalHarvest extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualCrystalHarvest();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.iface.IBindable;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import com.google.common.base.Strings;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -18,36 +19,26 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import WayofTime.bloodmagic.api.iface.IBindable;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class RitualExpulsion extends Ritual
|
||||
{
|
||||
public class RitualExpulsion extends Ritual {
|
||||
public static final String EXPULSION_RANGE = "expulsionRange";
|
||||
|
||||
public RitualExpulsion()
|
||||
{
|
||||
public RitualExpulsion() {
|
||||
super("ritualExpulsion", 0, 10000, "ritual." + BloodMagic.MODID + ".expulsionRitual");
|
||||
addBlockRange(EXPULSION_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-12, 0, -12), 25));
|
||||
setMaximumVolumeAndDistanceOfRange(EXPULSION_RANGE, 0, 12, 12);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
@ -61,16 +52,12 @@ public class RitualExpulsion extends Ritual
|
|||
BlockPos masterPos = masterRitualStone.getBlockPos();
|
||||
TileEntity tile = world.getTileEntity(masterPos.up());
|
||||
|
||||
if (tile != null)
|
||||
{
|
||||
if (tile != null) {
|
||||
IItemHandler handler = Utils.getInventory(tile, null);
|
||||
if (handler != null)
|
||||
{
|
||||
for (int i = 0; i < handler.getSlots(); i++)
|
||||
{
|
||||
if (handler != null) {
|
||||
for (int i = 0; i < handler.getSlots(); i++) {
|
||||
ItemStack itemStack = handler.getStackInSlot(i);
|
||||
if (itemStack != null && itemStack.getItem() instanceof IBindable)
|
||||
{
|
||||
if (itemStack != null && itemStack.getItem() instanceof IBindable) {
|
||||
IBindable bindable = (IBindable) itemStack.getItem();
|
||||
if (!Strings.isNullOrEmpty(bindable.getOwnerName(itemStack)) && !allowedNames.contains(bindable.getOwnerName(itemStack)))
|
||||
allowedNames.add(bindable.getOwnerUUID(itemStack));
|
||||
|
@ -81,8 +68,7 @@ public class RitualExpulsion extends Ritual
|
|||
|
||||
final int teleportDistance = 100;
|
||||
|
||||
for (EntityPlayer player : world.getEntitiesWithinAABB(EntityPlayer.class, expulsionRange.getAABB(masterRitualStone.getBlockPos())))
|
||||
{
|
||||
for (EntityPlayer player : world.getEntitiesWithinAABB(EntityPlayer.class, expulsionRange.getAABB(masterRitualStone.getBlockPos()))) {
|
||||
if (player.capabilities.isCreativeMode || PlayerHelper.getUUIDFromPlayer(player).toString().equals(masterRitualStone.getOwner()) || allowedNames.contains(PlayerHelper.getUUIDFromPlayer(player).toString()))
|
||||
continue;
|
||||
|
||||
|
@ -93,10 +79,8 @@ public class RitualExpulsion extends Ritual
|
|||
allowedNames.clear();
|
||||
}
|
||||
|
||||
public boolean teleportRandomly(EntityLivingBase entityLiving, double distance)
|
||||
{
|
||||
if (entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
public boolean teleportRandomly(EntityLivingBase entityLiving, double distance) {
|
||||
if (entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) entityLiving;
|
||||
if (player.capabilities.isCreativeMode)
|
||||
return false;
|
||||
|
@ -111,8 +95,7 @@ public class RitualExpulsion extends Ritual
|
|||
double randZ = z + (rand.nextDouble() - 0.5D) * distance;
|
||||
int i = 0;
|
||||
|
||||
while (!teleportTo(entityLiving, randX, randY, randZ, x, y, z) && i < 100)
|
||||
{
|
||||
while (!teleportTo(entityLiving, randX, randY, randZ, x, y, z) && i < 100) {
|
||||
randX = x + (rand.nextDouble() - 0.5D) * distance;
|
||||
randY = y + (rand.nextInt((int) distance) - (distance) / 2);
|
||||
randZ = z + (rand.nextDouble() - 0.5D) * distance;
|
||||
|
@ -122,12 +105,10 @@ public class RitualExpulsion extends Ritual
|
|||
return i >= 100;
|
||||
}
|
||||
|
||||
public boolean teleportTo(EntityLivingBase entityLiving, double par1, double par3, double par5, double lastX, double lastY, double lastZ)
|
||||
{
|
||||
public boolean teleportTo(EntityLivingBase entityLiving, double par1, double par3, double par5, double lastX, double lastY, double lastZ) {
|
||||
EnderTeleportEvent event = new EnderTeleportEvent(entityLiving, par1, par3, par5, 0);
|
||||
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
{
|
||||
if (MinecraftForge.EVENT_BUS.post(event)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -138,43 +119,34 @@ public class RitualExpulsion extends Ritual
|
|||
int k = MathHelper.floor(entityLiving.posZ);
|
||||
int l;
|
||||
|
||||
if (!entityLiving.getEntityWorld().isAirBlock(new BlockPos(i, j, k)))
|
||||
{
|
||||
if (!entityLiving.getEntityWorld().isAirBlock(new BlockPos(i, j, k))) {
|
||||
boolean flag1 = false;
|
||||
|
||||
while (!flag1 && j > 0)
|
||||
{
|
||||
while (!flag1 && j > 0) {
|
||||
IBlockState state = entityLiving.getEntityWorld().getBlockState(new BlockPos(i, j - 1, k));
|
||||
|
||||
if (state.getMaterial().blocksMovement())
|
||||
{
|
||||
if (state.getMaterial().blocksMovement()) {
|
||||
flag1 = true;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
--entityLiving.posY;
|
||||
--j;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
if (flag1) {
|
||||
moveEntityViaTeleport(entityLiving, entityLiving.posX, entityLiving.posY, entityLiving.posZ);
|
||||
|
||||
if (!entityLiving.isCollided && !entityLiving.getEntityWorld().containsAnyLiquid(entityLiving.getEntityBoundingBox()))
|
||||
{
|
||||
if (!entityLiving.isCollided && !entityLiving.getEntityWorld().containsAnyLiquid(entityLiving.getEntityBoundingBox())) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
if (!flag) {
|
||||
moveEntityViaTeleport(entityLiving, lastX, lastY, lastZ);
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
for (l = 0; l < 128; ++l)
|
||||
{
|
||||
} else {
|
||||
for (l = 0; l < 128; ++l) {
|
||||
double lengthVal = (double) l / ((double) 128 - 1.0D);
|
||||
float randF1 = (entityLiving.getEntityWorld().rand.nextFloat() - 0.5F) * 0.2F;
|
||||
float randF2 = (entityLiving.getEntityWorld().rand.nextFloat() - 0.5F) * 0.2F;
|
||||
|
@ -189,49 +161,39 @@ public class RitualExpulsion extends Ritual
|
|||
}
|
||||
}
|
||||
|
||||
public void moveEntityViaTeleport(EntityLivingBase entityLiving, double x, double y, double z)
|
||||
{
|
||||
if (entityLiving != null && entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
if (entityLiving instanceof EntityPlayerMP)
|
||||
{
|
||||
public void moveEntityViaTeleport(EntityLivingBase entityLiving, double x, double y, double z) {
|
||||
if (entityLiving != null && entityLiving instanceof EntityPlayer) {
|
||||
if (entityLiving instanceof EntityPlayerMP) {
|
||||
EntityPlayerMP entityplayermp = (EntityPlayerMP) entityLiving;
|
||||
|
||||
if (entityplayermp.getEntityWorld() == entityLiving.getEntityWorld())
|
||||
{
|
||||
if (entityplayermp.getEntityWorld() == entityLiving.getEntityWorld()) {
|
||||
EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, x, y, z, 5.0F);
|
||||
|
||||
if (!MinecraftForge.EVENT_BUS.post(event))
|
||||
{
|
||||
if (entityLiving.isRiding())
|
||||
{
|
||||
if (!MinecraftForge.EVENT_BUS.post(event)) {
|
||||
if (entityLiving.isRiding()) {
|
||||
entityplayermp.mountEntityAndWakeUp();
|
||||
}
|
||||
entityLiving.setPositionAndUpdate(event.getTargetX(), event.getTargetY(), event.getTargetZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (entityLiving != null)
|
||||
{
|
||||
} else if (entityLiving != null) {
|
||||
entityLiving.setPosition(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addCornerRunes(components, 2, 0, EnumRuneType.EARTH);
|
||||
|
@ -275,8 +237,7 @@ public class RitualExpulsion extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualExpulsion();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,17 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.ConfigHandler;
|
||||
import WayofTime.bloodmagic.api.altar.IBloodAltar;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerSacrificeHelper;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSelfSacrifice;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -15,23 +22,11 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.ConfigHandler;
|
||||
import WayofTime.bloodmagic.api.altar.IBloodAltar;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerSacrificeHelper;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSelfSacrifice;
|
||||
|
||||
public class RitualFeatheredKnife extends Ritual
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RitualFeatheredKnife extends Ritual {
|
||||
public static final String ALTAR_RANGE = "altar";
|
||||
public static final String DAMAGE_RANGE = "damage";
|
||||
|
||||
|
@ -40,14 +35,11 @@ public class RitualFeatheredKnife extends Ritual
|
|||
public static double corrosiveWillThreshold = 10;
|
||||
public static double steadfastWillThreshold = 10;
|
||||
public static double vengefulWillThreshold = 10;
|
||||
|
||||
public int refreshTime = 20;
|
||||
public static int defaultRefreshTime = 20;
|
||||
|
||||
public int refreshTime = 20;
|
||||
public BlockPos altarOffsetPos = new BlockPos(0, 0, 0); //TODO: Save!
|
||||
|
||||
public RitualFeatheredKnife()
|
||||
{
|
||||
public RitualFeatheredKnife() {
|
||||
super("ritualFeatheredKnife", 0, 25000, "ritual." + BloodMagic.MODID + ".featheredKnifeRitual");
|
||||
addBlockRange(ALTAR_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-5, -10, -5), 11, 21, 11));
|
||||
addBlockRange(DAMAGE_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-15, -20, -15), 31, 41, 31));
|
||||
|
@ -57,13 +49,11 @@ public class RitualFeatheredKnife extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
@ -91,13 +81,10 @@ public class RitualFeatheredKnife extends Ritual
|
|||
|
||||
AreaDescriptor altarRange = getBlockRange(ALTAR_RANGE);
|
||||
|
||||
if (!altarRange.isWithinArea(altarOffsetPos) || !(tile instanceof IBloodAltar))
|
||||
{
|
||||
for (BlockPos newPos : altarRange.getContainedPositions(pos))
|
||||
{
|
||||
if (!altarRange.isWithinArea(altarOffsetPos) || !(tile instanceof IBloodAltar)) {
|
||||
for (BlockPos newPos : altarRange.getContainedPositions(pos)) {
|
||||
TileEntity nextTile = world.getTileEntity(newPos);
|
||||
if (nextTile instanceof IBloodAltar)
|
||||
{
|
||||
if (nextTile instanceof IBloodAltar) {
|
||||
tile = nextTile;
|
||||
altarOffsetPos = newPos.subtract(pos);
|
||||
|
||||
|
@ -109,8 +96,7 @@ public class RitualFeatheredKnife extends Ritual
|
|||
|
||||
boolean useIncense = corrosiveWill >= corrosiveWillThreshold;
|
||||
|
||||
if (tile instanceof IBloodAltar)
|
||||
{
|
||||
if (tile instanceof IBloodAltar) {
|
||||
IBloodAltar tileAltar = (IBloodAltar) tile;
|
||||
|
||||
AreaDescriptor damageRange = getBlockRange(DAMAGE_RANGE);
|
||||
|
@ -120,12 +106,10 @@ public class RitualFeatheredKnife extends Ritual
|
|||
|
||||
List<EntityPlayer> entities = world.getEntitiesWithinAABB(EntityPlayer.class, range);
|
||||
|
||||
for (EntityPlayer player : entities)
|
||||
{
|
||||
for (EntityPlayer player : entities) {
|
||||
float healthThreshold = steadfastWill >= steadfastWillThreshold ? 0.7f : 0.3f;
|
||||
|
||||
if (vengefulWill >= vengefulWillThreshold && !player.getUniqueID().toString().equals(masterRitualStone.getOwner()))
|
||||
{
|
||||
if (vengefulWill >= vengefulWillThreshold && !player.getUniqueID().toString().equals(masterRitualStone.getOwner())) {
|
||||
healthThreshold = 0.1f;
|
||||
}
|
||||
|
||||
|
@ -135,10 +119,8 @@ public class RitualFeatheredKnife extends Ritual
|
|||
float sacrificedHealth = 1;
|
||||
double lpModifier = 1;
|
||||
|
||||
if ((health / player.getMaxHealth() > healthThreshold) && (!useIncense || !player.isPotionActive(RegistrarBloodMagic.SOUL_FRAY)))
|
||||
{
|
||||
if (useIncense)
|
||||
{
|
||||
if ((health / player.getMaxHealth() > healthThreshold) && (!useIncense || !player.isPotionActive(RegistrarBloodMagic.SOUL_FRAY))) {
|
||||
if (useIncense) {
|
||||
double incenseAmount = PlayerSacrificeHelper.getPlayerIncense(player);
|
||||
|
||||
sacrificedHealth = health - maxHealth * healthThreshold;
|
||||
|
@ -148,23 +130,19 @@ public class RitualFeatheredKnife extends Ritual
|
|||
player.addPotionEffect(new PotionEffect(RegistrarBloodMagic.SOUL_FRAY, PlayerSacrificeHelper.soulFrayDuration));
|
||||
}
|
||||
|
||||
if (destructiveWill >= destructiveWillDrain * sacrificedHealth)
|
||||
{
|
||||
if (destructiveWill >= destructiveWillDrain * sacrificedHealth) {
|
||||
lpModifier *= getLPModifierForWill(destructiveWill);
|
||||
destructiveWill -= destructiveWillDrain * sacrificedHealth;
|
||||
destructiveDrain += destructiveWillDrain * sacrificedHealth;
|
||||
}
|
||||
|
||||
if (LivingArmour.hasFullSet(player))
|
||||
{
|
||||
if (LivingArmour.hasFullSet(player)) {
|
||||
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
|
||||
if (armour != null)
|
||||
{
|
||||
if (armour != null) {
|
||||
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.selfSacrifice", chestStack);
|
||||
|
||||
if (upgrade instanceof LivingArmourUpgradeSelfSacrifice)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeSelfSacrifice) {
|
||||
double modifier = ((LivingArmourUpgradeSelfSacrifice) upgrade).getSacrificeModifier();
|
||||
|
||||
lpModifier *= (1 + modifier);
|
||||
|
@ -178,42 +156,36 @@ public class RitualFeatheredKnife extends Ritual
|
|||
|
||||
totalEffects++;
|
||||
|
||||
if (totalEffects >= maxEffects)
|
||||
{
|
||||
if (totalEffects >= maxEffects) {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (destructiveDrain > 0)
|
||||
{
|
||||
if (destructiveDrain > 0) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.STEADFAST, destructiveDrain, true);
|
||||
}
|
||||
}
|
||||
|
||||
masterRitualStone.getOwnerNetwork().syphon(getRefreshCost() * totalEffects);
|
||||
if (totalEffects > 0 && consumeRawWill)
|
||||
{
|
||||
if (totalEffects > 0 && consumeRawWill) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DEFAULT, rawWillDrain, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return refreshTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addParallelRunes(components, 1, 0, EnumRuneType.DUSK);
|
||||
|
@ -228,26 +200,21 @@ public class RitualFeatheredKnife extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualFeatheredKnife();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player)
|
||||
{
|
||||
return new ITextComponent[] { new TextComponentTranslation(this.getUnlocalizedName() + ".info"), new TextComponentTranslation(this.getUnlocalizedName() + ".default.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".corrosive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".steadfast.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".destructive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".vengeful.info") };
|
||||
public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player) {
|
||||
return new ITextComponent[]{new TextComponentTranslation(this.getUnlocalizedName() + ".info"), new TextComponentTranslation(this.getUnlocalizedName() + ".default.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".corrosive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".steadfast.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".destructive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".vengeful.info")};
|
||||
}
|
||||
|
||||
public double getLPModifierForWill(double destructiveWill)
|
||||
{
|
||||
public double getLPModifierForWill(double destructiveWill) {
|
||||
return 1 + destructiveWill * 0.2 / 100;
|
||||
}
|
||||
|
||||
public int getRefreshTimeForRawWill(double rawWill)
|
||||
{
|
||||
if (rawWill >= rawWillDrain)
|
||||
{
|
||||
public int getRefreshTimeForRawWill(double rawWill) {
|
||||
if (rawWill >= rawWillDrain) {
|
||||
return 10;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
@ -17,8 +17,7 @@ import javax.annotation.Nullable;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class RitualFelling extends Ritual
|
||||
{
|
||||
public class RitualFelling extends Ritual {
|
||||
public static final String FELLING_RANGE = "fellingRange";
|
||||
public static final String CHEST_RANGE = "chest";
|
||||
|
||||
|
@ -28,8 +27,7 @@ public class RitualFelling extends Ritual
|
|||
private boolean cached = false;
|
||||
private BlockPos currentPos;
|
||||
|
||||
public RitualFelling()
|
||||
{
|
||||
public RitualFelling() {
|
||||
super("ritualFelling", 0, 20000, "ritual." + BloodMagic.MODID + ".fellingRitual");
|
||||
addBlockRange(FELLING_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-10, -3, -10), new BlockPos(11, 27, 11)));
|
||||
addBlockRange(CHEST_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1));
|
||||
|
@ -41,8 +39,7 @@ public class RitualFelling extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
|
||||
|
@ -50,19 +47,15 @@ public class RitualFelling extends Ritual
|
|||
AreaDescriptor chestRange = getBlockRange(CHEST_RANGE);
|
||||
TileEntity tileInventory = world.getTileEntity(chestRange.getContainedPositions(masterPos).get(0));
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cached || treePartsCache.isEmpty())
|
||||
{
|
||||
for (BlockPos blockPos : getBlockRange(FELLING_RANGE).getContainedPositions(masterRitualStone.getBlockPos()))
|
||||
{
|
||||
if (!cached || treePartsCache.isEmpty()) {
|
||||
for (BlockPos blockPos : getBlockRange(FELLING_RANGE).getContainedPositions(masterRitualStone.getBlockPos())) {
|
||||
if (!treePartsCache.contains(blockPos))
|
||||
if (!world.isAirBlock(blockPos) && (world.getBlockState(blockPos).getBlock().isWood(world, blockPos) || world.getBlockState(blockPos).getBlock().isLeaves(world.getBlockState(blockPos), world, blockPos)))
|
||||
{
|
||||
if (!world.isAirBlock(blockPos) && (world.getBlockState(blockPos).getBlock().isWood(world, blockPos) || world.getBlockState(blockPos).getBlock().isLeaves(world.getBlockState(blockPos), world, blockPos))) {
|
||||
treePartsCache.add(blockPos);
|
||||
}
|
||||
}
|
||||
|
@ -71,8 +64,7 @@ public class RitualFelling extends Ritual
|
|||
blockPosIterator = treePartsCache.iterator();
|
||||
}
|
||||
|
||||
if (blockPosIterator.hasNext() && tileInventory != null)
|
||||
{
|
||||
if (blockPosIterator.hasNext() && tileInventory != null) {
|
||||
masterRitualStone.getOwnerNetwork().syphon(getRefreshCost());
|
||||
currentPos = blockPosIterator.next();
|
||||
IItemHandler inventory = Utils.getInventory(tileInventory, EnumFacing.DOWN);
|
||||
|
@ -83,20 +75,17 @@ public class RitualFelling extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
addCornerRunes(components, 1, 0, EnumRuneType.EARTH);
|
||||
|
@ -106,18 +95,15 @@ public class RitualFelling extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualFelling();
|
||||
}
|
||||
|
||||
private void placeInInventory(IBlockState choppedState, World world, BlockPos choppedPos, @Nullable IItemHandler inventory)
|
||||
{
|
||||
private void placeInInventory(IBlockState choppedState, World world, BlockPos choppedPos, @Nullable IItemHandler inventory) {
|
||||
if (inventory == null)
|
||||
return;
|
||||
|
||||
for (ItemStack stack : choppedState.getBlock().getDrops(world, choppedPos, world.getBlockState(choppedPos), 0))
|
||||
{
|
||||
for (ItemStack stack : choppedState.getBlock().getDrops(world, choppedPos, world.getBlockState(choppedPos), 0)) {
|
||||
ItemStack remainder = ItemHandlerHelper.insertItem(inventory, stack, false);
|
||||
if (!remainder.isEmpty())
|
||||
world.spawnEntity(new EntityItem(world, choppedPos.getX() + 0.4, choppedPos.getY() + 2, choppedPos.getZ() + 0.4, remainder));
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api_impl.BloodMagicAPI;
|
||||
import WayofTime.bloodmagic.tile.TileDemonCrystal;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -14,18 +13,13 @@ import net.minecraft.util.DamageSource;
|
|||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.ConfigHandler;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
||||
import WayofTime.bloodmagic.tile.TileDemonCrystal;
|
||||
import net.minecraftforge.fml.common.registry.EntityEntry;
|
||||
import net.minecraftforge.fml.common.registry.EntityRegistry;
|
||||
|
||||
public class RitualForsakenSoul extends Ritual
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RitualForsakenSoul extends Ritual {
|
||||
public static final String CRYSTAL_RANGE = "crystal";
|
||||
public static final String DAMAGE_RANGE = "damage";
|
||||
public static final int MAX_UNIQUENESS = 10;
|
||||
|
@ -37,8 +31,7 @@ public class RitualForsakenSoul extends Ritual
|
|||
|
||||
public List<Integer> keyList = new ArrayList<Integer>();
|
||||
|
||||
public RitualForsakenSoul()
|
||||
{
|
||||
public RitualForsakenSoul() {
|
||||
super("ritualForsakenSoul", 0, 40000, "ritual." + BloodMagic.MODID + ".forsakenSoulRitual");
|
||||
addBlockRange(CRYSTAL_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-3, 2, -3), 7, 5, 7));
|
||||
addBlockRange(DAMAGE_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-10, -10, -10), 21));
|
||||
|
@ -48,48 +41,41 @@ public class RitualForsakenSoul extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
super.readFromNBT(tag);
|
||||
|
||||
willBuffer = tag.getDouble("willBuffer");
|
||||
crystalBuffer = tag.getDouble("crystalBuffer");
|
||||
|
||||
keyList.clear();
|
||||
for (int i = 0; i < MAX_UNIQUENESS; i++)
|
||||
{
|
||||
for (int i = 0; i < MAX_UNIQUENESS; i++) {
|
||||
String key = "uniq" + i;
|
||||
if (tag.hasKey(key))
|
||||
{
|
||||
if (tag.hasKey(key)) {
|
||||
keyList.add(tag.getInteger(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
super.writeToNBT(tag);
|
||||
|
||||
tag.setDouble("willBuffer", willBuffer);
|
||||
tag.setDouble("crystalBuffer", crystalBuffer);
|
||||
|
||||
for (int i = 0; i < Math.min(MAX_UNIQUENESS, keyList.size()); i++)
|
||||
{
|
||||
for (int i = 0; i < Math.min(MAX_UNIQUENESS, keyList.size()); i++) {
|
||||
String key = "uniq" + i;
|
||||
tag.setInteger(key, keyList.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
BlockPos pos = masterRitualStone.getBlockPos();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
@ -102,12 +88,10 @@ public class RitualForsakenSoul extends Ritual
|
|||
AreaDescriptor crystalRange = getBlockRange(CRYSTAL_RANGE);
|
||||
|
||||
crystalRange.resetIterator();
|
||||
while (crystalRange.hasNext())
|
||||
{
|
||||
while (crystalRange.hasNext()) {
|
||||
BlockPos nextPos = crystalRange.next().add(pos);
|
||||
TileEntity tile = world.getTileEntity(nextPos);
|
||||
if (tile instanceof TileDemonCrystal)
|
||||
{
|
||||
if (tile instanceof TileDemonCrystal) {
|
||||
crystalList.add((TileDemonCrystal) tile);
|
||||
}
|
||||
}
|
||||
|
@ -117,23 +101,18 @@ public class RitualForsakenSoul extends Ritual
|
|||
|
||||
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, range);
|
||||
|
||||
for (EntityLivingBase entity : entities)
|
||||
{
|
||||
for (EntityLivingBase entity : entities) {
|
||||
EntityEntry entityEntry = EntityRegistry.getEntry(entity.getClass());
|
||||
|
||||
if (BloodMagicAPI.INSTANCE.getBlacklist().getSacrifice().contains(entityEntry.getRegistryName()))
|
||||
continue;
|
||||
|
||||
if (entity.isEntityAlive() && !(entity instanceof EntityPlayer))
|
||||
{
|
||||
if (entity.attackEntityFrom(DamageSource.OUT_OF_WORLD, 1))
|
||||
{
|
||||
if (!entity.isEntityAlive())
|
||||
{
|
||||
if (entity.isEntityAlive() && !(entity instanceof EntityPlayer)) {
|
||||
if (entity.attackEntityFrom(DamageSource.OUT_OF_WORLD, 1)) {
|
||||
if (!entity.isEntityAlive()) {
|
||||
int uniqueness = calculateUniqueness(entity);
|
||||
double modifier = 1;
|
||||
if (entity instanceof EntityAnimal && !entity.isCollided)
|
||||
{
|
||||
if (entity instanceof EntityAnimal && !entity.isCollided) {
|
||||
modifier = 4;
|
||||
}
|
||||
|
||||
|
@ -141,8 +120,7 @@ public class RitualForsakenSoul extends Ritual
|
|||
crystalBuffer += modifier * entity.getMaxHealth() / HEALTH_THRESHOLD;
|
||||
|
||||
totalEffects++;
|
||||
if (totalEffects >= maxEffects)
|
||||
{
|
||||
if (totalEffects >= maxEffects) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -150,14 +128,12 @@ public class RitualForsakenSoul extends Ritual
|
|||
}
|
||||
}
|
||||
|
||||
if (crystalList.size() > 0 && crystalBuffer > 0)
|
||||
{
|
||||
if (crystalList.size() > 0 && crystalBuffer > 0) {
|
||||
double growth = Math.min(crystalBuffer, 1);
|
||||
double willSyphonAmount = growth * willBuffer / crystalBuffer;
|
||||
TileDemonCrystal chosenCrystal = crystalList.get(world.rand.nextInt(crystalList.size()));
|
||||
double percentageGrowth = chosenCrystal.growCrystalWithWillAmount(growth * willBuffer / crystalBuffer, growth);
|
||||
if (percentageGrowth > 0)
|
||||
{
|
||||
if (percentageGrowth > 0) {
|
||||
crystalBuffer -= percentageGrowth;
|
||||
willBuffer -= percentageGrowth * willSyphonAmount;
|
||||
}
|
||||
|
@ -167,24 +143,19 @@ public class RitualForsakenSoul extends Ritual
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param mob
|
||||
* @return The amount of uniqueness to the last 10 mobs killed
|
||||
*/
|
||||
public int calculateUniqueness(EntityLivingBase mob)
|
||||
{
|
||||
public int calculateUniqueness(EntityLivingBase mob) {
|
||||
int key = mob.getClass().hashCode();
|
||||
keyList.add(key);
|
||||
if (keyList.size() > MAX_UNIQUENESS)
|
||||
{
|
||||
if (keyList.size() > MAX_UNIQUENESS) {
|
||||
keyList.remove(0);
|
||||
}
|
||||
|
||||
List<Integer> uniquenessList = new ArrayList<Integer>();
|
||||
for (int value : keyList)
|
||||
{
|
||||
if (!uniquenessList.contains(value))
|
||||
{
|
||||
for (int value : keyList) {
|
||||
if (!uniquenessList.contains(value)) {
|
||||
uniquenessList.add(value);
|
||||
}
|
||||
}
|
||||
|
@ -192,26 +163,22 @@ public class RitualForsakenSoul extends Ritual
|
|||
return Math.min(uniquenessList.size(), MAX_UNIQUENESS);
|
||||
}
|
||||
|
||||
public double getWillForUniqueness(int uniqueness)
|
||||
{
|
||||
public double getWillForUniqueness(int uniqueness) {
|
||||
return Math.max(50 - 15 * Math.sqrt(uniqueness), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return 25;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addCornerRunes(components, 1, 0, EnumRuneType.AIR);
|
||||
|
@ -228,8 +195,7 @@ public class RitualForsakenSoul extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualForsakenSoul();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,20 +8,18 @@ import net.minecraft.item.ItemFood;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.FoodStats;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RitualFullStomach extends Ritual
|
||||
{
|
||||
public class RitualFullStomach extends Ritual {
|
||||
public static final String FILL_RANGE = "fillRange";
|
||||
public static final String CHEST_RANGE = "chest";
|
||||
|
||||
public RitualFullStomach()
|
||||
{
|
||||
public RitualFullStomach() {
|
||||
super("ritualFullStomach", 0, 100000, "ritual." + BloodMagic.MODID + ".fullStomachRitual");
|
||||
addBlockRange(FILL_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-25, -25, -25), 51));
|
||||
addBlockRange(CHEST_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1));
|
||||
|
@ -31,8 +29,7 @@ public class RitualFullStomach extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
|
||||
|
@ -43,8 +40,7 @@ public class RitualFullStomach extends Ritual
|
|||
|
||||
AreaDescriptor chestRange = getBlockRange(CHEST_RANGE);
|
||||
TileEntity tile = world.getTileEntity(chestRange.getContainedPositions(pos).get(0));
|
||||
if (!(tile instanceof IInventory))
|
||||
{
|
||||
if (!(tile instanceof IInventory)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -56,23 +52,19 @@ public class RitualFullStomach extends Ritual
|
|||
|
||||
List<EntityPlayer> playerList = world.getEntitiesWithinAABB(EntityPlayer.class, fillingRange.getAABB(pos));
|
||||
|
||||
for (EntityPlayer player : playerList)
|
||||
{
|
||||
for (EntityPlayer player : playerList) {
|
||||
FoodStats foodStats = player.getFoodStats();
|
||||
float satLevel = foodStats.getSaturationLevel();
|
||||
|
||||
for (int i = lastSlot; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
for (int i = lastSlot; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
if (!stack.isEmpty() && stack.getItem() instanceof ItemFood)
|
||||
{
|
||||
if (!stack.isEmpty() && stack.getItem() instanceof ItemFood) {
|
||||
ItemFood foodItem = (ItemFood) stack.getItem();
|
||||
|
||||
int healAmount = foodItem.getHealAmount(stack);
|
||||
float saturationAmount = foodItem.getSaturationModifier(stack) * healAmount * 2.0f;
|
||||
|
||||
if (saturationAmount + satLevel <= 20)
|
||||
{
|
||||
if (saturationAmount + satLevel <= 20) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
foodStats.writeNBT(nbt);
|
||||
nbt.setFloat("foodSaturationLevel", saturationAmount + satLevel);
|
||||
|
@ -86,8 +78,7 @@ public class RitualFullStomach extends Ritual
|
|||
}
|
||||
}
|
||||
|
||||
if (totalEffects >= maxEffects)
|
||||
{
|
||||
if (totalEffects >= maxEffects) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
break;
|
||||
}
|
||||
|
@ -97,20 +88,17 @@ public class RitualFullStomach extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addParallelRunes(components, 3, 0, EnumRuneType.FIRE);
|
||||
|
@ -123,8 +111,7 @@ public class RitualFullStomach extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualFullStomach();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.soul.DemonWillHolder;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api_impl.BloodMagicAPI;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFarmland;
|
||||
import net.minecraft.block.IGrowable;
|
||||
|
@ -20,19 +21,12 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
||||
import WayofTime.bloodmagic.api.soul.DemonWillHolder;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
public class RitualGreenGrove extends Ritual
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class RitualGreenGrove extends Ritual {
|
||||
public static final String GROW_RANGE = "growing";
|
||||
public static final String LEECH_RANGE = "leech";
|
||||
public static final String HYDRATE_RANGE = "hydrate";
|
||||
|
@ -41,16 +35,12 @@ public class RitualGreenGrove extends Ritual
|
|||
public static double rawWillDrain = 0.05;
|
||||
public static double vengefulWillDrain = 0.05;
|
||||
public static double steadfastWillDrain = 0.05;
|
||||
|
||||
public int refreshTime = 20;
|
||||
public static int defaultRefreshTime = 20;
|
||||
|
||||
public static double defaultGrowthChance = 0.3;
|
||||
|
||||
public static IBlockState farmlandState = Blocks.FARMLAND.getDefaultState().withProperty(BlockFarmland.MOISTURE, 7);
|
||||
public int refreshTime = 20;
|
||||
|
||||
public RitualGreenGrove()
|
||||
{
|
||||
public RitualGreenGrove() {
|
||||
super("ritualGreenGrove", 0, 5000, "ritual." + BloodMagic.MODID + ".greenGroveRitual");
|
||||
addBlockRange(GROW_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-1, 2, -1), 3, 1, 3));
|
||||
addBlockRange(LEECH_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 0, 0), 1));
|
||||
|
@ -61,14 +51,12 @@ public class RitualGreenGrove extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
BlockPos pos = masterRitualStone.getBlockPos();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
@ -96,34 +84,26 @@ public class RitualGreenGrove extends Ritual
|
|||
AreaDescriptor growingRange = getBlockRange(GROW_RANGE);
|
||||
|
||||
int maxGrowthVolume = getMaxVolumeForRange(GROW_RANGE, willConfig, holder);
|
||||
if (!growingRange.isWithinRange(getMaxVerticalRadiusForRange(GROW_RANGE, willConfig, holder), getMaxHorizontalRadiusForRange(GROW_RANGE, willConfig, holder)) || (maxGrowthVolume != 0 && growingRange.getVolume() > maxGrowthVolume))
|
||||
{
|
||||
if (!growingRange.isWithinRange(getMaxVerticalRadiusForRange(GROW_RANGE, willConfig, holder), getMaxHorizontalRadiusForRange(GROW_RANGE, willConfig, holder)) || (maxGrowthVolume != 0 && growingRange.getVolume() > maxGrowthVolume)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (BlockPos newPos : growingRange.getContainedPositions(pos))
|
||||
{
|
||||
for (BlockPos newPos : growingRange.getContainedPositions(pos)) {
|
||||
IBlockState state = world.getBlockState(newPos);
|
||||
|
||||
if (!BloodMagicAPI.INSTANCE.getBlacklist().getGreenGrove().contains(state))
|
||||
{
|
||||
if (state.getBlock() instanceof IGrowable)
|
||||
{
|
||||
if (world.rand.nextDouble() < growthChance)
|
||||
{
|
||||
if (!BloodMagicAPI.INSTANCE.getBlacklist().getGreenGrove().contains(state)) {
|
||||
if (state.getBlock() instanceof IGrowable) {
|
||||
if (world.rand.nextDouble() < growthChance) {
|
||||
state.getBlock().updateTick(world, newPos, state, new Random());
|
||||
IBlockState newState = world.getBlockState(newPos);
|
||||
if (!newState.equals(state))
|
||||
{
|
||||
if (!newState.equals(state)) {
|
||||
totalGrowths++;
|
||||
if (consumeRawWill)
|
||||
{
|
||||
if (consumeRawWill) {
|
||||
rawWill -= rawWillDrain;
|
||||
rawDrain += rawWillDrain;
|
||||
}
|
||||
|
||||
if (consumeVengefulWill)
|
||||
{
|
||||
if (consumeVengefulWill) {
|
||||
vengefulWill -= vengefulWillDrain;
|
||||
vengefulDrain += vengefulWillDrain;
|
||||
}
|
||||
|
@ -132,35 +112,29 @@ public class RitualGreenGrove extends Ritual
|
|||
}
|
||||
}
|
||||
|
||||
if (totalGrowths >= maxGrowths || (consumeRawWill && rawWill < rawWillDrain) || (consumeVengefulWill && vengefulWill < vengefulWillDrain))
|
||||
{
|
||||
if (totalGrowths >= maxGrowths || (consumeRawWill && rawWill < rawWillDrain) || (consumeVengefulWill && vengefulWill < vengefulWillDrain)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (rawDrain > 0)
|
||||
{
|
||||
if (rawDrain > 0) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DEFAULT, rawDrain, true);
|
||||
}
|
||||
|
||||
if (vengefulDrain > 0)
|
||||
{
|
||||
if (vengefulDrain > 0) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.VENGEFUL, vengefulDrain, true);
|
||||
}
|
||||
|
||||
AreaDescriptor hydrateRange = getBlockRange(HYDRATE_RANGE);
|
||||
|
||||
double steadfastDrain = 0;
|
||||
if (steadfastWill > steadfastWillDrain)
|
||||
{
|
||||
if (steadfastWill > steadfastWillDrain) {
|
||||
AxisAlignedBB aabb = hydrateRange.getAABB(pos);
|
||||
steadfastDrain += steadfastWillDrain * Utils.plantSeedsInArea(world, aabb, 2, 1);
|
||||
steadfastWill -= steadfastDrain;
|
||||
|
||||
for (BlockPos newPos : hydrateRange.getContainedPositions(pos))
|
||||
{
|
||||
if (steadfastWill < steadfastWillDrain)
|
||||
{
|
||||
for (BlockPos newPos : hydrateRange.getContainedPositions(pos)) {
|
||||
if (steadfastWill < steadfastWillDrain) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -168,53 +142,43 @@ public class RitualGreenGrove extends Ritual
|
|||
Block block = state.getBlock();
|
||||
|
||||
boolean hydratedBlock = false;
|
||||
if (block == Blocks.DIRT || block == Blocks.GRASS)
|
||||
{
|
||||
if (block == Blocks.DIRT || block == Blocks.GRASS) {
|
||||
world.setBlockState(newPos, farmlandState);
|
||||
hydratedBlock = true;
|
||||
} else if (block == Blocks.FARMLAND)
|
||||
{
|
||||
} else if (block == Blocks.FARMLAND) {
|
||||
int meta = block.getMetaFromState(state);
|
||||
if (meta < 7)
|
||||
{
|
||||
if (meta < 7) {
|
||||
world.setBlockState(newPos, farmlandState);
|
||||
hydratedBlock = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (hydratedBlock)
|
||||
{
|
||||
if (hydratedBlock) {
|
||||
steadfastWill -= steadfastWillDrain;
|
||||
steadfastDrain += steadfastWillDrain;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (steadfastDrain > 0)
|
||||
{
|
||||
if (steadfastDrain > 0) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.STEADFAST, steadfastDrain, true);
|
||||
}
|
||||
|
||||
double corrosiveDrain = 0;
|
||||
if (corrosiveWill > corrosiveWillDrain)
|
||||
{
|
||||
if (corrosiveWill > corrosiveWillDrain) {
|
||||
AreaDescriptor leechRange = getBlockRange(LEECH_RANGE);
|
||||
AxisAlignedBB mobArea = leechRange.getAABB(pos);
|
||||
List<EntityLivingBase> entityList = world.getEntitiesWithinAABB(EntityLivingBase.class, mobArea);
|
||||
for (EntityLivingBase entityLiving : entityList)
|
||||
{
|
||||
if (corrosiveWill < corrosiveWillDrain)
|
||||
{
|
||||
for (EntityLivingBase entityLiving : entityList) {
|
||||
if (corrosiveWill < corrosiveWillDrain) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
if (entityLiving instanceof EntityPlayer) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (entityLiving.isPotionActive(RegistrarBloodMagic.PLANT_LEECH) || !entityLiving.isPotionApplicable(new PotionEffect(RegistrarBloodMagic.PLANT_LEECH)))
|
||||
{
|
||||
if (entityLiving.isPotionActive(RegistrarBloodMagic.PLANT_LEECH) || !entityLiving.isPotionApplicable(new PotionEffect(RegistrarBloodMagic.PLANT_LEECH))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -224,8 +188,7 @@ public class RitualGreenGrove extends Ritual
|
|||
corrosiveDrain += corrosiveWillDrain;
|
||||
}
|
||||
|
||||
if (corrosiveDrain > 0)
|
||||
{
|
||||
if (corrosiveDrain > 0) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.CORROSIVE, corrosiveDrain, true);
|
||||
}
|
||||
}
|
||||
|
@ -233,20 +196,16 @@ public class RitualGreenGrove extends Ritual
|
|||
masterRitualStone.getOwnerNetwork().syphon(totalGrowths * getRefreshCost());
|
||||
}
|
||||
|
||||
public double getPlantGrowthChanceForWill(double will)
|
||||
{
|
||||
if (will > 0)
|
||||
{
|
||||
public double getPlantGrowthChanceForWill(double will) {
|
||||
if (will > 0) {
|
||||
return 0.3 + will / 200;
|
||||
}
|
||||
|
||||
return defaultGrowthChance;
|
||||
}
|
||||
|
||||
public int getRefreshTimeForRawWill(double rawWill)
|
||||
{
|
||||
if (rawWill > 0)
|
||||
{
|
||||
public int getRefreshTimeForRawWill(double rawWill) {
|
||||
if (rawWill > 0) {
|
||||
return 10;
|
||||
}
|
||||
|
||||
|
@ -254,19 +213,15 @@ public class RitualGreenGrove extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return refreshTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxVolumeForRange(String range, List<EnumDemonWillType> activeTypes, DemonWillHolder holder)
|
||||
{
|
||||
if (GROW_RANGE.equals(range) && activeTypes.contains(EnumDemonWillType.DESTRUCTIVE))
|
||||
{
|
||||
public int getMaxVolumeForRange(String range, List<EnumDemonWillType> activeTypes, DemonWillHolder holder) {
|
||||
if (GROW_RANGE.equals(range) && activeTypes.contains(EnumDemonWillType.DESTRUCTIVE)) {
|
||||
double destructiveWill = holder.getWill(EnumDemonWillType.DESTRUCTIVE);
|
||||
if (destructiveWill > 0)
|
||||
{
|
||||
if (destructiveWill > 0) {
|
||||
return 81 + (int) Math.pow(destructiveWill / 4, 1.5);
|
||||
}
|
||||
}
|
||||
|
@ -275,13 +230,10 @@ public class RitualGreenGrove extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMaxVerticalRadiusForRange(String range, List<EnumDemonWillType> activeTypes, DemonWillHolder holder)
|
||||
{
|
||||
if (GROW_RANGE.equals(range) && activeTypes.contains(EnumDemonWillType.DESTRUCTIVE))
|
||||
{
|
||||
public int getMaxVerticalRadiusForRange(String range, List<EnumDemonWillType> activeTypes, DemonWillHolder holder) {
|
||||
if (GROW_RANGE.equals(range) && activeTypes.contains(EnumDemonWillType.DESTRUCTIVE)) {
|
||||
double destructiveWill = holder.getWill(EnumDemonWillType.DESTRUCTIVE);
|
||||
if (destructiveWill > 0)
|
||||
{
|
||||
if (destructiveWill > 0) {
|
||||
return (int) (4 + destructiveWill / 10d);
|
||||
}
|
||||
}
|
||||
|
@ -290,13 +242,10 @@ public class RitualGreenGrove extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMaxHorizontalRadiusForRange(String range, List<EnumDemonWillType> activeTypes, DemonWillHolder holder)
|
||||
{
|
||||
if (GROW_RANGE.equals(range) && activeTypes.contains(EnumDemonWillType.DESTRUCTIVE))
|
||||
{
|
||||
public int getMaxHorizontalRadiusForRange(String range, List<EnumDemonWillType> activeTypes, DemonWillHolder holder) {
|
||||
if (GROW_RANGE.equals(range) && activeTypes.contains(EnumDemonWillType.DESTRUCTIVE)) {
|
||||
double destructiveWill = holder.getWill(EnumDemonWillType.DESTRUCTIVE);
|
||||
if (destructiveWill > 0)
|
||||
{
|
||||
if (destructiveWill > 0) {
|
||||
return (int) (4 + destructiveWill / 10d);
|
||||
}
|
||||
}
|
||||
|
@ -305,14 +254,12 @@ public class RitualGreenGrove extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 20; //TODO: Need to find a way to balance this
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addCornerRunes(components, 1, 0, EnumRuneType.EARTH);
|
||||
|
@ -322,14 +269,12 @@ public class RitualGreenGrove extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player)
|
||||
{
|
||||
return new ITextComponent[] { new TextComponentTranslation(this.getUnlocalizedName() + ".info"), new TextComponentTranslation(this.getUnlocalizedName() + ".default.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".corrosive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".steadfast.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".destructive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".vengeful.info") };
|
||||
public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player) {
|
||||
return new ITextComponent[]{new TextComponentTranslation(this.getUnlocalizedName() + ".info"), new TextComponentTranslation(this.getUnlocalizedName() + ".default.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".corrosive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".steadfast.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".destructive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".vengeful.info")};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualGreenGrove();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,34 +12,30 @@ import java.util.ArrayList;
|
|||
|
||||
/**
|
||||
* This ritual uses registered {@link IHarvestHandler}'s to harvest blocks.
|
||||
*
|
||||
* <p>
|
||||
* To register a new Handler for this ritual use
|
||||
* {@link HarvestRegistry#registerHandler(IHarvestHandler)}
|
||||
*
|
||||
* <p>
|
||||
* This ritual includes a way to change the range based on what block is above
|
||||
* the MasterRitualStone. You can use
|
||||
* {@link HarvestRegistry#registerRangeAmplifier(BlockStack, int)} to register a
|
||||
* new amplifier.
|
||||
*/
|
||||
public class RitualHarvest extends Ritual
|
||||
{
|
||||
public class RitualHarvest extends Ritual {
|
||||
public static final String HARVEST_RANGE = "harvestRange";
|
||||
|
||||
public RitualHarvest()
|
||||
{
|
||||
public RitualHarvest() {
|
||||
super("ritualHarvest", 0, 20000, "ritual." + BloodMagic.MODID + ".harvestRitual");
|
||||
addBlockRange(HARVEST_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-4, 1, -4), 9, 5, 9));
|
||||
setMaximumVolumeAndDistanceOfRange(HARVEST_RANGE, 0, 15, 15);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
BlockPos pos = masterRitualStone.getBlockPos();
|
||||
|
||||
if (masterRitualStone.getOwnerNetwork().getCurrentEssence() < getRefreshCost())
|
||||
{
|
||||
if (masterRitualStone.getOwnerNetwork().getCurrentEssence() < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
@ -49,11 +45,9 @@ public class RitualHarvest extends Ritual
|
|||
AreaDescriptor harvestArea = getBlockRange(HARVEST_RANGE);
|
||||
|
||||
harvestArea.resetIterator();
|
||||
while (harvestArea.hasNext())
|
||||
{
|
||||
while (harvestArea.hasNext()) {
|
||||
BlockPos nextPos = harvestArea.next().add(pos);
|
||||
if (harvestBlock(world, nextPos))
|
||||
{
|
||||
if (harvestBlock(world, nextPos)) {
|
||||
harvested++;
|
||||
}
|
||||
}
|
||||
|
@ -62,20 +56,17 @@ public class RitualHarvest extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
components.add(new RitualComponent(new BlockPos(1, 0, 1), EnumRuneType.DUSK));
|
||||
|
@ -107,13 +98,11 @@ public class RitualHarvest extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualHarvest();
|
||||
}
|
||||
|
||||
public static boolean harvestBlock(World world, BlockPos pos)
|
||||
{
|
||||
public static boolean harvestBlock(World world, BlockPos pos) {
|
||||
BlockStack harvestStack = BlockStack.getStackFromPos(world, pos);
|
||||
|
||||
for (IHarvestHandler handler : HarvestRegistry.getHandlerList())
|
||||
|
|
|
@ -10,33 +10,28 @@ import net.minecraft.world.World;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class RitualInterdiction extends Ritual
|
||||
{
|
||||
public class RitualInterdiction extends Ritual {
|
||||
public static final String INTERDICTION_RANGE = "interdictionRange";
|
||||
|
||||
public RitualInterdiction()
|
||||
{
|
||||
public RitualInterdiction() {
|
||||
super("ritualInterdiction", 0, 1000, "ritual." + BloodMagic.MODID + ".interdictionRitual");
|
||||
addBlockRange(INTERDICTION_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-2, 0, -2), 5));
|
||||
setMaximumVolumeAndDistanceOfRange(INTERDICTION_RANGE, 0, 10, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
AreaDescriptor interdictionRange = getBlockRange(INTERDICTION_RANGE);
|
||||
|
||||
for (EntityLivingBase entity : world.getEntitiesWithinAABB(EntityLivingBase.class, interdictionRange.getAABB(masterRitualStone.getBlockPos())))
|
||||
{
|
||||
for (EntityLivingBase entity : world.getEntitiesWithinAABB(EntityLivingBase.class, interdictionRange.getAABB(masterRitualStone.getBlockPos()))) {
|
||||
if (entity instanceof EntityPlayer && (((EntityPlayer) entity).capabilities.isCreativeMode || PlayerHelper.getUUIDFromPlayer((EntityPlayer) entity).toString().equals(masterRitualStone.getOwner())))
|
||||
continue;
|
||||
|
||||
|
@ -49,28 +44,24 @@ public class RitualInterdiction extends Ritual
|
|||
entity.motionZ = 0.1 * zDif;
|
||||
entity.fallDistance = 0;
|
||||
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
if (entity instanceof EntityPlayer) {
|
||||
entity.velocityChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addCornerRunes(components, 1, 0, EnumRuneType.AIR);
|
||||
|
@ -80,8 +71,7 @@ public class RitualInterdiction extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualInterdiction();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,25 +11,21 @@ import net.minecraft.world.World;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RitualJumping extends Ritual
|
||||
{
|
||||
public class RitualJumping extends Ritual {
|
||||
public static final String JUMP_RANGE = "jumpRange";
|
||||
|
||||
public RitualJumping()
|
||||
{
|
||||
public RitualJumping() {
|
||||
super("ritualJump", 0, 5000, "ritual." + BloodMagic.MODID + ".jumpRitual");
|
||||
addBlockRange(JUMP_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-1, 1, -1), 3, 1, 3));
|
||||
setMaximumVolumeAndDistanceOfRange(JUMP_RANGE, 0, 5, 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
@ -39,26 +35,22 @@ public class RitualJumping extends Ritual
|
|||
|
||||
AreaDescriptor jumpRange = getBlockRange(JUMP_RANGE);
|
||||
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, jumpRange.getAABB(masterRitualStone.getBlockPos()));
|
||||
for (EntityLivingBase entity : entities)
|
||||
{
|
||||
if (totalEffects >= maxEffects)
|
||||
{
|
||||
for (EntityLivingBase entity : entities) {
|
||||
if (totalEffects >= maxEffects) {
|
||||
break;
|
||||
}
|
||||
|
||||
double motionY = 1.5;
|
||||
|
||||
entity.fallDistance = 0;
|
||||
if (entity.isSneaking())
|
||||
{
|
||||
if (entity.isSneaking()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
entity.motionY = motionY;
|
||||
totalEffects++;
|
||||
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
if (entity instanceof EntityPlayer) {
|
||||
Utils.setPlayerSpeedFromServer((EntityPlayer) entity, entity.motionX, entity.motionY, entity.motionZ);
|
||||
}
|
||||
}
|
||||
|
@ -67,20 +59,17 @@ public class RitualJumping extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
for (int i = -1; i <= 1; i++)
|
||||
|
@ -90,8 +79,7 @@ public class RitualJumping extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualJumping();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.soul.DemonWillHolder;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -21,19 +24,11 @@ import net.minecraftforge.fluids.FluidRegistry;
|
|||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
||||
import WayofTime.bloodmagic.api.soul.DemonWillHolder;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
public class RitualLava extends Ritual
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RitualLava extends Ritual {
|
||||
public static final String LAVA_RANGE = "lavaRange";
|
||||
public static final String FIRE_FUSE_RANGE = "fireFuse";
|
||||
public static final String FIRE_RESIST_RANGE = "fireResist";
|
||||
|
@ -43,12 +38,10 @@ public class RitualLava extends Ritual
|
|||
public static final double vengefulWillDrain = 1;
|
||||
public static final double steadfastWillDrain = 0.5;
|
||||
public static final double corrosiveWillDrain = 0.2;
|
||||
|
||||
public int timer = 0;
|
||||
public static final int corrosiveRefreshTime = 20;
|
||||
public int timer = 0;
|
||||
|
||||
public RitualLava()
|
||||
{
|
||||
public RitualLava() {
|
||||
super("ritualLava", 0, 10000, "ritual." + BloodMagic.MODID + ".lavaRitual");
|
||||
addBlockRange(LAVA_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1));
|
||||
addBlockRange(FIRE_FUSE_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-2, -2, -2), 5));
|
||||
|
@ -64,15 +57,13 @@ public class RitualLava extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
timer++;
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
int lpDrain = 0;
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
@ -87,26 +78,21 @@ public class RitualLava extends Ritual
|
|||
AreaDescriptor lavaRange = getBlockRange(LAVA_RANGE);
|
||||
|
||||
int maxLavaVolume = getMaxVolumeForRange(LAVA_RANGE, willConfig, holder);
|
||||
if (!lavaRange.isWithinRange(getMaxVerticalRadiusForRange(LAVA_RANGE, willConfig, holder), getMaxHorizontalRadiusForRange(LAVA_RANGE, willConfig, holder)) || (maxLavaVolume != 0 && lavaRange.getVolume() > maxLavaVolume))
|
||||
{
|
||||
if (!lavaRange.isWithinRange(getMaxVerticalRadiusForRange(LAVA_RANGE, willConfig, holder), getMaxHorizontalRadiusForRange(LAVA_RANGE, willConfig, holder)) || (maxLavaVolume != 0 && lavaRange.getVolume() > maxLavaVolume)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (BlockPos newPos : lavaRange.getContainedPositions(pos))
|
||||
{
|
||||
for (BlockPos newPos : lavaRange.getContainedPositions(pos)) {
|
||||
IBlockState state = world.getBlockState(newPos);
|
||||
if (world.isAirBlock(newPos) || Utils.isFlowingLiquid(world, newPos, state))
|
||||
{
|
||||
if (world.isAirBlock(newPos) || Utils.isFlowingLiquid(world, newPos, state)) {
|
||||
int lpCost = getLPCostForRawWill(rawWill);
|
||||
if (currentEssence < lpCost)
|
||||
{
|
||||
if (currentEssence < lpCost) {
|
||||
break;
|
||||
}
|
||||
world.setBlockState(newPos, Blocks.FLOWING_LAVA.getDefaultState());
|
||||
currentEssence -= lpCost;
|
||||
lpDrain += lpCost;
|
||||
if (rawWill > 0)
|
||||
{
|
||||
if (rawWill > 0) {
|
||||
double drain = getWillCostForRawWill(rawWill);
|
||||
rawWill -= drain;
|
||||
rawDrained += drain;
|
||||
|
@ -114,19 +100,15 @@ public class RitualLava extends Ritual
|
|||
}
|
||||
}
|
||||
|
||||
if (rawWill > 0)
|
||||
{
|
||||
if (rawWill > 0) {
|
||||
AreaDescriptor chestRange = getBlockRange(LAVA_TANK_RANGE);
|
||||
TileEntity tile = world.getTileEntity(chestRange.getContainedPositions(pos).get(0));
|
||||
double drain = getWillCostForRawWill(rawWill);
|
||||
int lpCost = getLPCostForRawWill(rawWill);
|
||||
|
||||
if (rawWill >= drain && currentEssence >= lpCost)
|
||||
{
|
||||
if (tile != null)
|
||||
{
|
||||
if (tile.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null))
|
||||
{
|
||||
if (rawWill >= drain && currentEssence >= lpCost) {
|
||||
if (tile != null) {
|
||||
if (tile.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null)) {
|
||||
IFluidHandler handler = tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null);
|
||||
double filled = handler.fill(new FluidStack(FluidRegistry.LAVA, 1000), true);
|
||||
|
||||
|
@ -146,28 +128,23 @@ public class RitualLava extends Ritual
|
|||
double steadfastWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.STEADFAST, willConfig);
|
||||
double corrosiveWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.CORROSIVE, willConfig);
|
||||
|
||||
if (vengefulWill >= vengefulWillDrain)
|
||||
{
|
||||
if (vengefulWill >= vengefulWillDrain) {
|
||||
double vengefulDrained = 0;
|
||||
AreaDescriptor fuseRange = getBlockRange(FIRE_FUSE_RANGE);
|
||||
|
||||
AxisAlignedBB fuseArea = fuseRange.getAABB(pos);
|
||||
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, fuseArea);
|
||||
|
||||
for (EntityLivingBase entity : entities)
|
||||
{
|
||||
if (vengefulWill < vengefulWillDrain)
|
||||
{
|
||||
for (EntityLivingBase entity : entities) {
|
||||
if (vengefulWill < vengefulWillDrain) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
if (entity instanceof EntityPlayer) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!entity.isPotionActive(RegistrarBloodMagic.FIRE_FUSE))
|
||||
{
|
||||
if (!entity.isPotionActive(RegistrarBloodMagic.FIRE_FUSE)) {
|
||||
entity.addPotionEffect(new PotionEffect(RegistrarBloodMagic.FIRE_FUSE, 100, 0));
|
||||
|
||||
vengefulDrained += vengefulWillDrain;
|
||||
|
@ -175,14 +152,12 @@ public class RitualLava extends Ritual
|
|||
}
|
||||
}
|
||||
|
||||
if (vengefulDrained > 0)
|
||||
{
|
||||
if (vengefulDrained > 0) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.VENGEFUL, vengefulDrained, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (steadfastWill >= steadfastWillDrain)
|
||||
{
|
||||
if (steadfastWill >= steadfastWillDrain) {
|
||||
double steadfastDrained = 0;
|
||||
AreaDescriptor resistRange = getBlockRange(FIRE_RESIST_RANGE);
|
||||
|
||||
|
@ -191,14 +166,11 @@ public class RitualLava extends Ritual
|
|||
AxisAlignedBB resistArea = resistRange.getAABB(pos);
|
||||
List<EntityPlayer> entities = world.getEntitiesWithinAABB(EntityPlayer.class, resistArea);
|
||||
|
||||
for (EntityPlayer entity : entities)
|
||||
{
|
||||
if (steadfastWill < steadfastWillDrain)
|
||||
{
|
||||
for (EntityPlayer entity : entities) {
|
||||
if (steadfastWill < steadfastWillDrain) {
|
||||
break;
|
||||
}
|
||||
if (!entity.isPotionActive(MobEffects.FIRE_RESISTANCE) || (entity.getActivePotionEffect(MobEffects.FIRE_RESISTANCE).getDuration() < 2))
|
||||
{
|
||||
if (!entity.isPotionActive(MobEffects.FIRE_RESISTANCE) || (entity.getActivePotionEffect(MobEffects.FIRE_RESISTANCE).getDuration() < 2)) {
|
||||
entity.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, 100, 0));
|
||||
|
||||
steadfastDrained += steadfastWillDrain;
|
||||
|
@ -206,14 +178,12 @@ public class RitualLava extends Ritual
|
|||
}
|
||||
}
|
||||
|
||||
if (steadfastDrained > 0)
|
||||
{
|
||||
if (steadfastDrained > 0) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.STEADFAST, steadfastDrained, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (timer % corrosiveRefreshTime == 0 && corrosiveWill >= corrosiveWillDrain)
|
||||
{
|
||||
if (timer % corrosiveRefreshTime == 0 && corrosiveWill >= corrosiveWillDrain) {
|
||||
double corrosiveDrained = 0;
|
||||
AreaDescriptor resistRange = getBlockRange(FIRE_DAMAGE_RANGE);
|
||||
|
||||
|
@ -222,31 +192,25 @@ public class RitualLava extends Ritual
|
|||
AxisAlignedBB damageArea = resistRange.getAABB(pos);
|
||||
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, damageArea);
|
||||
|
||||
for (EntityLivingBase entity : entities)
|
||||
{
|
||||
if (corrosiveWill < corrosiveWillDrain)
|
||||
{
|
||||
for (EntityLivingBase entity : entities) {
|
||||
if (corrosiveWill < corrosiveWillDrain) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!entity.isDead && entity.hurtTime <= 0 && Utils.isImmuneToFireDamage(entity))
|
||||
{
|
||||
if (entity.attackEntityFrom(BloodMagicAPI.damageSource, damage))
|
||||
{
|
||||
if (!entity.isDead && entity.hurtTime <= 0 && Utils.isImmuneToFireDamage(entity)) {
|
||||
if (entity.attackEntityFrom(BloodMagicAPI.damageSource, damage)) {
|
||||
corrosiveDrained += corrosiveWillDrain;
|
||||
corrosiveWill -= corrosiveWillDrain;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (corrosiveDrained > 0)
|
||||
{
|
||||
if (corrosiveDrained > 0) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.CORROSIVE, corrosiveDrained, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (rawDrained > 0)
|
||||
{
|
||||
if (rawDrained > 0) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DEFAULT, rawDrained, true);
|
||||
}
|
||||
|
||||
|
@ -254,26 +218,22 @@ public class RitualLava extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player)
|
||||
{
|
||||
return new ITextComponent[] { new TextComponentTranslation(this.getUnlocalizedName() + ".info"), new TextComponentTranslation(this.getUnlocalizedName() + ".default.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".corrosive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".steadfast.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".destructive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".vengeful.info") };
|
||||
public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player) {
|
||||
return new ITextComponent[]{new TextComponentTranslation(this.getUnlocalizedName() + ".info"), new TextComponentTranslation(this.getUnlocalizedName() + ".default.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".corrosive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".steadfast.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".destructive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".vengeful.info")};
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addParallelRunes(components, 1, 0, EnumRuneType.FIRE);
|
||||
|
@ -282,19 +242,15 @@ public class RitualLava extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualLava();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxVolumeForRange(String range, List<EnumDemonWillType> activeTypes, DemonWillHolder holder)
|
||||
{
|
||||
if (LAVA_RANGE.equals(range) && activeTypes.contains(EnumDemonWillType.DESTRUCTIVE))
|
||||
{
|
||||
public int getMaxVolumeForRange(String range, List<EnumDemonWillType> activeTypes, DemonWillHolder holder) {
|
||||
if (LAVA_RANGE.equals(range) && activeTypes.contains(EnumDemonWillType.DESTRUCTIVE)) {
|
||||
double destructiveWill = holder.getWill(EnumDemonWillType.DESTRUCTIVE);
|
||||
if (destructiveWill > 0)
|
||||
{
|
||||
if (destructiveWill > 0) {
|
||||
return 9 + (int) Math.pow(destructiveWill / 10, 1.5);
|
||||
}
|
||||
}
|
||||
|
@ -303,13 +259,10 @@ public class RitualLava extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMaxVerticalRadiusForRange(String range, List<EnumDemonWillType> activeTypes, DemonWillHolder holder)
|
||||
{
|
||||
if (LAVA_RANGE.equals(range) && activeTypes.contains(EnumDemonWillType.DESTRUCTIVE))
|
||||
{
|
||||
public int getMaxVerticalRadiusForRange(String range, List<EnumDemonWillType> activeTypes, DemonWillHolder holder) {
|
||||
if (LAVA_RANGE.equals(range) && activeTypes.contains(EnumDemonWillType.DESTRUCTIVE)) {
|
||||
double destructiveWill = holder.getWill(EnumDemonWillType.DESTRUCTIVE);
|
||||
if (destructiveWill > 0)
|
||||
{
|
||||
if (destructiveWill > 0) {
|
||||
return (int) (3 + destructiveWill / 10d);
|
||||
}
|
||||
}
|
||||
|
@ -318,13 +271,10 @@ public class RitualLava extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMaxHorizontalRadiusForRange(String range, List<EnumDemonWillType> activeTypes, DemonWillHolder holder)
|
||||
{
|
||||
if (LAVA_RANGE.equals(range) && activeTypes.contains(EnumDemonWillType.DESTRUCTIVE))
|
||||
{
|
||||
public int getMaxHorizontalRadiusForRange(String range, List<EnumDemonWillType> activeTypes, DemonWillHolder holder) {
|
||||
if (LAVA_RANGE.equals(range) && activeTypes.contains(EnumDemonWillType.DESTRUCTIVE)) {
|
||||
double destructiveWill = holder.getWill(EnumDemonWillType.DESTRUCTIVE);
|
||||
if (destructiveWill > 0)
|
||||
{
|
||||
if (destructiveWill > 0) {
|
||||
return (int) (3 + destructiveWill / 10d);
|
||||
}
|
||||
}
|
||||
|
@ -332,23 +282,19 @@ public class RitualLava extends Ritual
|
|||
return horizontalRangeMap.get(range);
|
||||
}
|
||||
|
||||
public int getFireResistForWill(double steadfastWill)
|
||||
{
|
||||
public int getFireResistForWill(double steadfastWill) {
|
||||
return (int) (200 + steadfastWill * 3);
|
||||
}
|
||||
|
||||
public float getCorrosiveDamageForWill(double corrosiveWill)
|
||||
{
|
||||
public float getCorrosiveDamageForWill(double corrosiveWill) {
|
||||
return (float) (1 + corrosiveWill * 0.05);
|
||||
}
|
||||
|
||||
public int getLPCostForRawWill(double raw)
|
||||
{
|
||||
public int getLPCostForRawWill(double raw) {
|
||||
return Math.max((int) (500 - raw), 0);
|
||||
}
|
||||
|
||||
public double getWillCostForRawWill(double raw)
|
||||
{
|
||||
public double getWillCostForRawWill(double raw) {
|
||||
return Math.min(1, raw / 500);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.recipe.LivingArmourDowngradeRecipe;
|
||||
import WayofTime.bloodmagic.api.registry.LivingArmourDowngradeRecipeRegistry;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.util.ChatUtil;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.item.EntityItemFrame;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -17,38 +22,25 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.recipe.LivingArmourDowngradeRecipe;
|
||||
import WayofTime.bloodmagic.api.registry.LivingArmourDowngradeRecipeRegistry;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
||||
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.util.ChatUtil;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
public class RitualLivingArmourDowngrade extends Ritual
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RitualLivingArmourDowngrade extends Ritual {
|
||||
public static final String DOWNGRADE_RANGE = "containmentRange";
|
||||
private int internalTimer = 0;
|
||||
|
||||
public RitualLivingArmourDowngrade()
|
||||
{
|
||||
public RitualLivingArmourDowngrade() {
|
||||
super("ritualDowngrade", 0, 10000, "ritual." + BloodMagic.MODID + ".downgradeRitual");
|
||||
addBlockRange(DOWNGRADE_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-3, 0, -3), 7));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
@ -58,65 +50,50 @@ public class RitualLivingArmourDowngrade extends Ritual
|
|||
AreaDescriptor downgradeRange = getBlockRange(DOWNGRADE_RANGE);
|
||||
|
||||
boolean isActivatorPresent = false;
|
||||
for (EntityPlayer player : world.getEntitiesWithinAABB(EntityPlayer.class, downgradeRange.getAABB(masterRitualStone.getBlockPos())))
|
||||
{
|
||||
if (player.getUniqueID().toString().equals(masterRitualStone.getOwner()))
|
||||
{
|
||||
for (EntityPlayer player : world.getEntitiesWithinAABB(EntityPlayer.class, downgradeRange.getAABB(masterRitualStone.getBlockPos()))) {
|
||||
if (player.getUniqueID().toString().equals(masterRitualStone.getOwner())) {
|
||||
ItemStack keyStack = getStackFromItemFrame(world, masterPos, masterRitualStone.getDirection());
|
||||
if (keyStack.isEmpty())
|
||||
{
|
||||
if (keyStack.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<ITextComponent> textList = LivingArmourDowngradeRecipeRegistry.getDialogForProcessTick(keyStack, internalTimer);
|
||||
if (textList != null)
|
||||
{
|
||||
if (textList != null) {
|
||||
ChatUtil.sendChat(player, textList.toArray(new ITextComponent[textList.size()]));
|
||||
}
|
||||
|
||||
internalTimer++;
|
||||
|
||||
if (player.isSneaking())
|
||||
{
|
||||
if (player.isSneaking()) {
|
||||
double distance2 = masterPos.offset(EnumFacing.UP).distanceSqToCenter(player.posX, player.posY, player.posZ);
|
||||
if (distance2 > 1)
|
||||
{
|
||||
if (distance2 > 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
BlockPos chestPos = masterPos.offset(masterRitualStone.getDirection(), 2).offset(EnumFacing.UP);
|
||||
TileEntity tile = world.getTileEntity(chestPos);
|
||||
if (tile == null)
|
||||
{
|
||||
if (tile == null) {
|
||||
return;
|
||||
}
|
||||
IItemHandler inv = Utils.getInventory(tile, null);
|
||||
if (inv != null)
|
||||
{
|
||||
if (inv != null) {
|
||||
List<ItemStack> recipeList = new ArrayList<ItemStack>();
|
||||
for (int i = 0; i < inv.getSlots(); i++)
|
||||
{
|
||||
for (int i = 0; i < inv.getSlots(); i++) {
|
||||
ItemStack invStack = inv.getStackInSlot(i);
|
||||
if (!invStack.isEmpty())
|
||||
{
|
||||
if (!invStack.isEmpty()) {
|
||||
recipeList.add(invStack);
|
||||
}
|
||||
}
|
||||
|
||||
LivingArmourDowngradeRecipe recipe = LivingArmourDowngradeRecipeRegistry.getMatchingRecipe(keyStack, recipeList, world, masterPos);
|
||||
if (recipe != null)
|
||||
{
|
||||
if (recipe != null) {
|
||||
LivingArmourUpgrade upgrade = recipe.getRecipeOutput();
|
||||
if (LivingArmour.hasFullSet(player))
|
||||
{
|
||||
if (LivingArmour.hasFullSet(player)) {
|
||||
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
|
||||
if (armour != null)
|
||||
{
|
||||
if (armour.canApplyUpgrade(player, upgrade))
|
||||
{
|
||||
if (armour.upgradeArmour(player, upgrade))
|
||||
{
|
||||
if (armour != null) {
|
||||
if (armour.canApplyUpgrade(player, upgrade)) {
|
||||
if (armour.upgradeArmour(player, upgrade)) {
|
||||
ItemLivingArmour.setLivingArmour(chestStack, armour);
|
||||
|
||||
recipe.consumeInventory(inv);
|
||||
|
@ -126,8 +103,7 @@ public class RitualLivingArmourDowngrade extends Ritual
|
|||
|
||||
masterRitualStone.setActive(false);
|
||||
}
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
//TODO: You are not able to receive my blessing...
|
||||
//TODO: Need to add a timer that will stop it from working.
|
||||
}
|
||||
|
@ -141,39 +117,33 @@ public class RitualLivingArmourDowngrade extends Ritual
|
|||
}
|
||||
}
|
||||
|
||||
if (!isActivatorPresent)
|
||||
{
|
||||
if (!isActivatorPresent) {
|
||||
internalTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
super.readFromNBT(tag);
|
||||
|
||||
this.internalTimer = tag.getInteger("internalTimer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
super.writeToNBT(tag);
|
||||
|
||||
tag.setInteger("internalTimer", internalTimer);
|
||||
}
|
||||
|
||||
public ItemStack getStackFromItemFrame(World world, BlockPos masterPos, EnumFacing direction)
|
||||
{
|
||||
public ItemStack getStackFromItemFrame(World world, BlockPos masterPos, EnumFacing direction) {
|
||||
BlockPos offsetPos = new BlockPos(0, 3, 0);
|
||||
offsetPos = offsetPos.offset(direction, 2);
|
||||
|
||||
AxisAlignedBB bb = new AxisAlignedBB(masterPos.add(offsetPos));
|
||||
List<EntityItemFrame> frames = world.getEntitiesWithinAABB(EntityItemFrame.class, bb);
|
||||
for (EntityItemFrame frame : frames)
|
||||
{
|
||||
if (!frame.getDisplayedItem().isEmpty())
|
||||
{
|
||||
for (EntityItemFrame frame : frames) {
|
||||
if (!frame.getDisplayedItem().isEmpty()) {
|
||||
return frame.getDisplayedItem();
|
||||
}
|
||||
}
|
||||
|
@ -182,20 +152,17 @@ public class RitualLivingArmourDowngrade extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addRune(components, 0, 0, -1, EnumRuneType.AIR);
|
||||
|
@ -208,8 +175,7 @@ public class RitualLivingArmourDowngrade extends Ritual
|
|||
for (int i = 1; i <= 3; i++)
|
||||
this.addRune(components, 0, 0, i, EnumRuneType.AIR);
|
||||
|
||||
for (int sgn = -1; sgn <= 1; sgn += 2)
|
||||
{
|
||||
for (int sgn = -1; sgn <= 1; sgn += 2) {
|
||||
this.addRune(components, sgn, 0, 4, EnumRuneType.AIR);
|
||||
this.addRune(components, sgn * 2, 0, 2, EnumRuneType.AIR);
|
||||
this.addRune(components, sgn * 3, 0, 2, EnumRuneType.AIR);
|
||||
|
@ -239,8 +205,7 @@ public class RitualLivingArmourDowngrade extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualLivingArmourDowngrade();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.BlockStack;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockOre;
|
||||
import net.minecraft.block.BlockRedstoneOre;
|
||||
|
@ -16,81 +15,29 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import WayofTime.bloodmagic.api.BlockStack;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
public class RitualMagnetic extends Ritual
|
||||
{
|
||||
private static final Map<BlockStack, Boolean> oreBlockCache = new HashMap<BlockStack, Boolean>();
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class RitualMagnetic extends Ritual {
|
||||
public static final String PLACEMENT_RANGE = "placementRange";
|
||||
private static final Map<BlockStack, Boolean> oreBlockCache = new HashMap<BlockStack, Boolean>();
|
||||
// public static final String SEARCH_RANGE = "searchRange";
|
||||
|
||||
public BlockPos lastPos; // An offset
|
||||
|
||||
public RitualMagnetic()
|
||||
{
|
||||
public RitualMagnetic() {
|
||||
super("ritualMagnetic", 0, 5000, "ritual." + BloodMagic.MODID + ".magneticRitual");
|
||||
addBlockRange(PLACEMENT_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-1, 1, -1), 3));
|
||||
setMaximumVolumeAndDistanceOfRange(PLACEMENT_RANGE, 50, 4, 4);
|
||||
}
|
||||
|
||||
public static boolean isBlockOre(Block block, int meta)
|
||||
{
|
||||
if (block == null)
|
||||
return false;
|
||||
|
||||
if (block instanceof BlockOre || block instanceof BlockRedstoneOre)
|
||||
return true;
|
||||
|
||||
if (Item.getItemFromBlock(block) == Items.AIR)
|
||||
return false;
|
||||
|
||||
BlockStack type = new BlockStack(block, meta);
|
||||
Boolean result = oreBlockCache.get(type);
|
||||
if (result == null)
|
||||
{
|
||||
result = computeIsItemOre(type);
|
||||
oreBlockCache.put(type, result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static boolean computeIsItemOre(BlockStack type)
|
||||
{
|
||||
ItemStack stack = new ItemStack(type.getBlock(), type.getMeta());
|
||||
return isBlockOre(stack);
|
||||
}
|
||||
|
||||
public static boolean isBlockOre(ItemStack stack)
|
||||
{
|
||||
if (stack.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int id : OreDictionary.getOreIDs(stack))
|
||||
{
|
||||
String oreName = OreDictionary.getOreName(id);
|
||||
if (oreName.contains("ore"))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
@ -102,10 +49,8 @@ public class RitualMagnetic extends Ritual
|
|||
BlockPos replacement = pos;
|
||||
boolean replace = false;
|
||||
|
||||
for (BlockPos offset : placementRange.getContainedPositions(pos))
|
||||
{
|
||||
if (world.isAirBlock(offset))
|
||||
{
|
||||
for (BlockPos offset : placementRange.getContainedPositions(pos)) {
|
||||
if (world.isAirBlock(offset)) {
|
||||
replacement = offset;
|
||||
replace = true;
|
||||
break;
|
||||
|
@ -117,40 +62,33 @@ public class RitualMagnetic extends Ritual
|
|||
|
||||
int radius = getRadius(downBlock);
|
||||
|
||||
if (replace)
|
||||
{
|
||||
if (replace) {
|
||||
int j = -1;
|
||||
int i = -radius;
|
||||
int k = -radius;
|
||||
|
||||
if (lastPos != null)
|
||||
{
|
||||
if (lastPos != null) {
|
||||
j = lastPos.getY();
|
||||
i = Math.min(radius, Math.max(-radius, lastPos.getX()));
|
||||
k = Math.min(radius, Math.max(-radius, lastPos.getZ()));
|
||||
}
|
||||
|
||||
while (j + pos.getY() >= 0)
|
||||
{
|
||||
while (i <= radius)
|
||||
{
|
||||
while (k <= radius)
|
||||
{
|
||||
while (j + pos.getY() >= 0) {
|
||||
while (i <= radius) {
|
||||
while (k <= radius) {
|
||||
BlockPos newPos = pos.add(i, j, k);
|
||||
IBlockState state = world.getBlockState(newPos);
|
||||
Block block = state.getBlock();
|
||||
ItemStack checkStack = block.getItem(world, newPos, state);
|
||||
// int meta = block.getMetaFromState(state);
|
||||
|
||||
if (isBlockOre(checkStack))
|
||||
{
|
||||
if (isBlockOre(checkStack)) {
|
||||
Utils.swapLocations(world, newPos, world, replacement);
|
||||
masterRitualStone.getOwnerNetwork().syphon(getRefreshCost());
|
||||
k++;
|
||||
this.lastPos = new BlockPos(i, j, k);
|
||||
return;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
k++;
|
||||
}
|
||||
}
|
||||
|
@ -170,20 +108,16 @@ public class RitualMagnetic extends Ritual
|
|||
|
||||
}
|
||||
|
||||
public int getRadius(Block block)
|
||||
{
|
||||
if (block == Blocks.IRON_BLOCK)
|
||||
{
|
||||
public int getRadius(Block block) {
|
||||
if (block == Blocks.IRON_BLOCK) {
|
||||
return 7;
|
||||
}
|
||||
|
||||
if (block == Blocks.GOLD_BLOCK)
|
||||
{
|
||||
if (block == Blocks.GOLD_BLOCK) {
|
||||
return 15;
|
||||
}
|
||||
|
||||
if (block == Blocks.DIAMOND_BLOCK)
|
||||
{
|
||||
if (block == Blocks.DIAMOND_BLOCK) {
|
||||
return 31;
|
||||
}
|
||||
|
||||
|
@ -191,20 +125,17 @@ public class RitualMagnetic extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return 40;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 50;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addCornerRunes(components, 1, 0, EnumRuneType.EARTH);
|
||||
|
@ -216,8 +147,44 @@ public class RitualMagnetic extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualMagnetic();
|
||||
}
|
||||
|
||||
public static boolean isBlockOre(Block block, int meta) {
|
||||
if (block == null)
|
||||
return false;
|
||||
|
||||
if (block instanceof BlockOre || block instanceof BlockRedstoneOre)
|
||||
return true;
|
||||
|
||||
if (Item.getItemFromBlock(block) == Items.AIR)
|
||||
return false;
|
||||
|
||||
BlockStack type = new BlockStack(block, meta);
|
||||
Boolean result = oreBlockCache.get(type);
|
||||
if (result == null) {
|
||||
result = computeIsItemOre(type);
|
||||
oreBlockCache.put(type, result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static boolean computeIsItemOre(BlockStack type) {
|
||||
ItemStack stack = new ItemStack(type.getBlock(), type.getMeta());
|
||||
return isBlockOre(stack);
|
||||
}
|
||||
|
||||
public static boolean isBlockOre(ItemStack stack) {
|
||||
if (stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int id : OreDictionary.getOreIDs(stack)) {
|
||||
String oreName = OreDictionary.getOreName(id);
|
||||
if (oreName.contains("ore"))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,38 +1,31 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
import WayofTime.bloodmagic.entity.projectile.EntityMeteor;
|
||||
import WayofTime.bloodmagic.meteor.MeteorRegistry;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class RitualMeteor extends Ritual
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RitualMeteor extends Ritual {
|
||||
public static final String ITEM_RANGE = "itemRange";
|
||||
public static final double destructiveWillDrain = 50;
|
||||
|
||||
public RitualMeteor()
|
||||
{
|
||||
public RitualMeteor() {
|
||||
super("ritualMeteor", 0, 1000000, "ritual." + BloodMagic.MODID + ".meteorRitual");
|
||||
addBlockRange(ITEM_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1));
|
||||
setMaximumVolumeAndDistanceOfRange(ITEM_RANGE, 0, 10, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
|
||||
|
@ -55,22 +48,18 @@ public class RitualMeteor extends Ritual
|
|||
|
||||
boolean successful = false;
|
||||
|
||||
for (EntityItem entityItem : itemList)
|
||||
{
|
||||
for (EntityItem entityItem : itemList) {
|
||||
ItemStack stack = entityItem.getItem();
|
||||
if (MeteorRegistry.hasMeteorForItem(stack))
|
||||
{
|
||||
if (MeteorRegistry.hasMeteorForItem(stack)) {
|
||||
EntityMeteor meteor = new EntityMeteor(world, pos.getX(), 260, pos.getZ(), 0, -0.1, 0, radiusModifier, explosionModifier, fillerChance);
|
||||
meteor.setMeteorStack(stack.copy());
|
||||
world.spawnEntity(meteor);
|
||||
|
||||
entityItem.setDead();
|
||||
|
||||
if (destructiveWill >= destructiveWillDrain && currentEssence >= 1000000000)
|
||||
{
|
||||
if (destructiveWill >= destructiveWillDrain && currentEssence >= 1000000000) {
|
||||
masterRitualStone.getOwnerNetwork().syphon(1000000);
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
masterRitualStone.setActive(false);
|
||||
}
|
||||
successful = true;
|
||||
|
@ -78,40 +67,33 @@ public class RitualMeteor extends Ritual
|
|||
}
|
||||
}
|
||||
|
||||
if (successful)
|
||||
{
|
||||
if (rawWill > 0)
|
||||
{
|
||||
if (successful) {
|
||||
if (rawWill > 0) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DEFAULT, rawWill, true);
|
||||
}
|
||||
|
||||
if (corrosiveWill > 0)
|
||||
{
|
||||
if (corrosiveWill > 0) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.CORROSIVE, corrosiveWill, true);
|
||||
}
|
||||
|
||||
if (steadfastWill > 0)
|
||||
{
|
||||
if (steadfastWill > 0) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.STEADFAST, steadfastWill, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addParallelRunes(components, 2, 0, EnumRuneType.FIRE);
|
||||
|
@ -120,8 +102,7 @@ public class RitualMeteor extends Ritual
|
|||
this.addOffsetRunes(components, 5, 3, 0, EnumRuneType.DUSK);
|
||||
this.addCornerRunes(components, 4, 0, EnumRuneType.DUSK);
|
||||
|
||||
for (int i = 4; i <= 6; i++)
|
||||
{
|
||||
for (int i = 4; i <= 6; i++) {
|
||||
this.addParallelRunes(components, 4, 0, EnumRuneType.EARTH);
|
||||
}
|
||||
|
||||
|
@ -145,23 +126,19 @@ public class RitualMeteor extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualMeteor();
|
||||
}
|
||||
|
||||
public double getRadiusModifier(double rawWill)
|
||||
{
|
||||
public double getRadiusModifier(double rawWill) {
|
||||
return Math.pow(1 + rawWill / 100, 1 / 3);
|
||||
}
|
||||
|
||||
public double getFillerChance(double corrosiveWill)
|
||||
{
|
||||
public double getFillerChance(double corrosiveWill) {
|
||||
return corrosiveWill / 200;
|
||||
}
|
||||
|
||||
public double getExplosionModifier(double steadfastWill)
|
||||
{
|
||||
public double getExplosionModifier(double steadfastWill) {
|
||||
return Math.max(Math.pow(0.4, steadfastWill / 100), 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,21 +7,19 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class RitualPlacer extends Ritual
|
||||
{
|
||||
public class RitualPlacer extends Ritual {
|
||||
public static final String PLACER_RANGE = "placerRange";
|
||||
public static final String CHEST_RANGE = "chest";
|
||||
|
||||
public RitualPlacer()
|
||||
{
|
||||
public RitualPlacer() {
|
||||
super("ritualPlacer", 0, 5000, "ritual." + BloodMagic.MODID + ".placerRitual");
|
||||
addBlockRange(PLACER_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-2, 0, -2), 5, 1, 5));
|
||||
addBlockRange(CHEST_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1));
|
||||
|
@ -31,8 +29,7 @@ public class RitualPlacer extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
BlockPos masterPos = masterRitualStone.getBlockPos();
|
||||
AreaDescriptor chestRange = getBlockRange(CHEST_RANGE);
|
||||
|
@ -40,33 +37,27 @@ public class RitualPlacer extends Ritual
|
|||
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
AreaDescriptor areaDescriptor = getBlockRange(PLACER_RANGE);
|
||||
|
||||
if (tileEntity != null)
|
||||
{
|
||||
if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN))
|
||||
{
|
||||
if (tileEntity != null) {
|
||||
if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN)) {
|
||||
IItemHandler itemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
|
||||
|
||||
if (itemHandler.getSlots() <= 0)
|
||||
{
|
||||
if (itemHandler.getSlots() <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
posLoop:
|
||||
for (BlockPos blockPos : areaDescriptor.getContainedPositions(masterRitualStone.getBlockPos()))
|
||||
{
|
||||
for (BlockPos blockPos : areaDescriptor.getContainedPositions(masterRitualStone.getBlockPos())) {
|
||||
if (!world.getBlockState(blockPos).getBlock().isReplaceable(world, blockPos))
|
||||
continue;
|
||||
|
||||
for (int invSlot = 0; invSlot < itemHandler.getSlots(); invSlot++)
|
||||
{
|
||||
for (int invSlot = 0; invSlot < itemHandler.getSlots(); invSlot++) {
|
||||
ItemStack stack = itemHandler.extractItem(invSlot, 1, true);
|
||||
if (stack.isEmpty() || !(stack.getItem() instanceof ItemBlock))
|
||||
continue;
|
||||
|
@ -84,14 +75,12 @@ public class RitualPlacer extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 50;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
addRune(components, 3, 0, 3, EnumRuneType.EARTH);
|
||||
|
@ -112,8 +101,7 @@ public class RitualPlacer extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualPlacer();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,30 +12,26 @@ import WayofTime.bloodmagic.tile.TileDimensionalPortal;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class RitualPortal extends Ritual
|
||||
{
|
||||
|
||||
private NBTTagCompound portalRitualTag;
|
||||
public class RitualPortal extends Ritual {
|
||||
|
||||
public static final String PORTAL_NBT_TAG = "PortalRitualTag";
|
||||
public static final String PORTAL_ID_TAG = "PortalRitualID";
|
||||
private NBTTagCompound portalRitualTag;
|
||||
|
||||
public RitualPortal()
|
||||
{
|
||||
public RitualPortal() {
|
||||
super("ritualPortal", 0, 50000, "ritual." + BloodMagic.MODID + ".portalRitual");
|
||||
portalRitualTag = new NBTTagCompound();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean activateRitual(IMasterRitualStone masterRitualStone, EntityPlayer player, String owner)
|
||||
{
|
||||
public boolean activateRitual(IMasterRitualStone masterRitualStone, EntityPlayer player, String owner) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int x = masterRitualStone.getBlockPos().getX();
|
||||
int y = masterRitualStone.getBlockPos().getY();
|
||||
|
@ -45,72 +41,54 @@ public class RitualPortal extends Ritual
|
|||
String name = owner;
|
||||
IBlockState blockState;
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
portalRitualTag.removeTag(PORTAL_ID_TAG);
|
||||
|
||||
if (direction == EnumFacing.NORTH || direction == EnumFacing.SOUTH)
|
||||
{
|
||||
for (int i = x - 3; i <= x + 3; i++)
|
||||
{
|
||||
for (int k = z - 2; k <= z + 2; k++)
|
||||
{
|
||||
if (!world.isAirBlock(new BlockPos(i, y, k)) && !(getBlockState(world, i, y, k).getBlock() == RegistrarBloodMagicBlocks.RITUAL_STONE))
|
||||
{
|
||||
if (direction == EnumFacing.NORTH || direction == EnumFacing.SOUTH) {
|
||||
for (int i = x - 3; i <= x + 3; i++) {
|
||||
for (int k = z - 2; k <= z + 2; k++) {
|
||||
if (!world.isAirBlock(new BlockPos(i, y, k)) && !(getBlockState(world, i, y, k).getBlock() == RegistrarBloodMagicBlocks.RITUAL_STONE)) {
|
||||
blockState = getBlockState(world, i, y, k);
|
||||
name = addStringToEnd(name, ForgeRegistries.BLOCKS.getKey(blockState.getBlock()) + String.valueOf(blockState.getBlock().getMetaFromState(blockState)));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int j = y + 1; j <= y + 5; j++)
|
||||
{
|
||||
if (!world.isAirBlock(new BlockPos(x - 3, j, z)) && !(getBlockState(world, x - 3, j, z).getBlock() == RegistrarBloodMagicBlocks.RITUAL_STONE))
|
||||
{
|
||||
for (int j = y + 1; j <= y + 5; j++) {
|
||||
if (!world.isAirBlock(new BlockPos(x - 3, j, z)) && !(getBlockState(world, x - 3, j, z).getBlock() == RegistrarBloodMagicBlocks.RITUAL_STONE)) {
|
||||
blockState = getBlockState(world, x - 3, j, z);
|
||||
name = addStringToEnd(name, ForgeRegistries.BLOCKS.getKey(blockState.getBlock()) + String.valueOf(blockState.getBlock().getMetaFromState(blockState)));
|
||||
}
|
||||
}
|
||||
for (int j = y + 1; j <= y + 5; j++)
|
||||
{
|
||||
if (!world.isAirBlock(new BlockPos(x + 3, j, z)) && !(getBlockState(world, x + 3, j, z) == RegistrarBloodMagicBlocks.RITUAL_STONE))
|
||||
{
|
||||
for (int j = y + 1; j <= y + 5; j++) {
|
||||
if (!world.isAirBlock(new BlockPos(x + 3, j, z)) && !(getBlockState(world, x + 3, j, z) == RegistrarBloodMagicBlocks.RITUAL_STONE)) {
|
||||
blockState = getBlockState(world, x + 3, j, z);
|
||||
name = addStringToEnd(name, ForgeRegistries.BLOCKS.getKey(blockState.getBlock()) + String.valueOf(blockState.getBlock().getMetaFromState(blockState)));
|
||||
}
|
||||
}
|
||||
} else if (direction == EnumFacing.EAST || direction == EnumFacing.WEST)
|
||||
{
|
||||
for (int k = z - 3; k <= z + 3; k++)
|
||||
{
|
||||
for (int i = x - 2; i <= x + 2; i++)
|
||||
{
|
||||
if (!world.isAirBlock(new BlockPos(i, y, k)) && !(getBlockState(world, i, y, k).getBlock() == RegistrarBloodMagicBlocks.RITUAL_STONE))
|
||||
{
|
||||
} else if (direction == EnumFacing.EAST || direction == EnumFacing.WEST) {
|
||||
for (int k = z - 3; k <= z + 3; k++) {
|
||||
for (int i = x - 2; i <= x + 2; i++) {
|
||||
if (!world.isAirBlock(new BlockPos(i, y, k)) && !(getBlockState(world, i, y, k).getBlock() == RegistrarBloodMagicBlocks.RITUAL_STONE)) {
|
||||
blockState = getBlockState(world, i, y, k);
|
||||
name = addStringToEnd(name, ForgeRegistries.BLOCKS.getKey(blockState.getBlock()) + String.valueOf(blockState.getBlock().getMetaFromState(blockState)));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int j = y + 1; j <= y + 5; j++)
|
||||
{
|
||||
if (!world.isAirBlock(new BlockPos(x, j, z - 3)) && !(getBlockState(world, x, j, z - 3).getBlock() == RegistrarBloodMagicBlocks.RITUAL_STONE))
|
||||
{
|
||||
for (int j = y + 1; j <= y + 5; j++) {
|
||||
if (!world.isAirBlock(new BlockPos(x, j, z - 3)) && !(getBlockState(world, x, j, z - 3).getBlock() == RegistrarBloodMagicBlocks.RITUAL_STONE)) {
|
||||
blockState = getBlockState(world, x, j, z - 3);
|
||||
name = addStringToEnd(name, ForgeRegistries.BLOCKS.getKey(blockState.getBlock()) + String.valueOf(blockState.getBlock().getMetaFromState(blockState)));
|
||||
}
|
||||
}
|
||||
for (int j = y + 1; j <= y + 5; j++)
|
||||
{
|
||||
if (!world.isAirBlock(new BlockPos(x, j, z + 3)) && !(getBlockState(world, x, j, z + 3).getBlock() == RegistrarBloodMagicBlocks.RITUAL_STONE))
|
||||
{
|
||||
for (int j = y + 1; j <= y + 5; j++) {
|
||||
if (!world.isAirBlock(new BlockPos(x, j, z + 3)) && !(getBlockState(world, x, j, z + 3).getBlock() == RegistrarBloodMagicBlocks.RITUAL_STONE)) {
|
||||
blockState = getBlockState(world, x, j, z + 3);
|
||||
name = addStringToEnd(name, ForgeRegistries.BLOCKS.getKey(blockState.getBlock()) + String.valueOf(blockState.getBlock().getMetaFromState(blockState)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (LocationsHandler.getLocationsHandler().addLocation(name, new PortalLocation(x, y + 1, z, world.provider.getDimension())))
|
||||
{
|
||||
if (LocationsHandler.getLocationsHandler().addLocation(name, new PortalLocation(x, y + 1, z, world.provider.getDimension()))) {
|
||||
portalRitualTag.setString(PORTAL_ID_TAG, name);
|
||||
return true;
|
||||
}
|
||||
|
@ -119,11 +97,9 @@ public class RitualPortal extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
if (world.isRemote)
|
||||
{
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -132,21 +108,16 @@ public class RitualPortal extends Ritual
|
|||
int z = masterRitualStone.getBlockPos().getZ();
|
||||
EnumFacing direction = masterRitualStone.getDirection();
|
||||
|
||||
if (direction == EnumFacing.NORTH || direction == EnumFacing.SOUTH)
|
||||
{
|
||||
for (int i = x - 1; i <= x + 1; i++)
|
||||
{
|
||||
for (int j = y + 1; j <= y + 3; j++)
|
||||
{
|
||||
if (direction == EnumFacing.NORTH || direction == EnumFacing.SOUTH) {
|
||||
for (int i = x - 1; i <= x + 1; i++) {
|
||||
for (int j = y + 1; j <= y + 3; j++) {
|
||||
BlockPos tempPos = new BlockPos(i, j, z);
|
||||
|
||||
if (world.isAirBlock(tempPos))
|
||||
{
|
||||
if (world.isAirBlock(tempPos)) {
|
||||
IBlockState blockState = RegistrarBloodMagicBlocks.DIMENSIONAL_PORTAL.getStateFromMeta(0);
|
||||
world.setBlockState(tempPos, blockState, 3);
|
||||
|
||||
if (world.getTileEntity(tempPos) != null && world.getTileEntity(tempPos) instanceof TileDimensionalPortal)
|
||||
{
|
||||
if (world.getTileEntity(tempPos) != null && world.getTileEntity(tempPos) instanceof TileDimensionalPortal) {
|
||||
TileDimensionalPortal tile = (TileDimensionalPortal) world.getTileEntity(tempPos);
|
||||
tile.setMasterStonePos(masterRitualStone.getBlockPos());
|
||||
tile.portalID = portalRitualTag.getString(PORTAL_ID_TAG);
|
||||
|
@ -154,20 +125,15 @@ public class RitualPortal extends Ritual
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (direction == EnumFacing.EAST || direction == EnumFacing.WEST)
|
||||
{
|
||||
for (int k = z - 1; k <= z + 1; k++)
|
||||
{
|
||||
for (int j = y + 1; j <= y + 3; j++)
|
||||
{
|
||||
} else if (direction == EnumFacing.EAST || direction == EnumFacing.WEST) {
|
||||
for (int k = z - 1; k <= z + 1; k++) {
|
||||
for (int j = y + 1; j <= y + 3; j++) {
|
||||
BlockPos tempPos = new BlockPos(x, j, k);
|
||||
if (world.isAirBlock(tempPos))
|
||||
{
|
||||
if (world.isAirBlock(tempPos)) {
|
||||
IBlockState blockState = RegistrarBloodMagicBlocks.DIMENSIONAL_PORTAL.getStateFromMeta(1);
|
||||
world.setBlockState(tempPos, blockState, 3);
|
||||
|
||||
if (world.getTileEntity(tempPos) != null && world.getTileEntity(tempPos) instanceof TileDimensionalPortal)
|
||||
{
|
||||
if (world.getTileEntity(tempPos) != null && world.getTileEntity(tempPos) instanceof TileDimensionalPortal) {
|
||||
TileDimensionalPortal tile = (TileDimensionalPortal) world.getTileEntity(tempPos);
|
||||
tile.setMasterStonePos(masterRitualStone.getBlockPos());
|
||||
tile.portalID = portalRitualTag.getString(PORTAL_ID_TAG);
|
||||
|
@ -180,8 +146,7 @@ public class RitualPortal extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public void stopRitual(IMasterRitualStone masterRitualStone, BreakType breakType)
|
||||
{
|
||||
public void stopRitual(IMasterRitualStone masterRitualStone, BreakType breakType) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int x = masterRitualStone.getBlockPos().getX();
|
||||
int y = masterRitualStone.getBlockPos().getY();
|
||||
|
@ -190,26 +155,18 @@ public class RitualPortal extends Ritual
|
|||
|
||||
LocationsHandler.getLocationsHandler().removeLocation(portalRitualTag.getString(PORTAL_ID_TAG), new PortalLocation(x, y + 1, z, world.provider.getDimension()));
|
||||
|
||||
if (direction == EnumFacing.NORTH || direction == EnumFacing.SOUTH)
|
||||
{
|
||||
for (int i = x - 2; i <= x + 2; i++)
|
||||
{
|
||||
for (int j = y + 1; j <= y + 3; j++)
|
||||
{
|
||||
if (getBlockState(world, i, j, z).getBlock() == RegistrarBloodMagicBlocks.DIMENSIONAL_PORTAL)
|
||||
{
|
||||
if (direction == EnumFacing.NORTH || direction == EnumFacing.SOUTH) {
|
||||
for (int i = x - 2; i <= x + 2; i++) {
|
||||
for (int j = y + 1; j <= y + 3; j++) {
|
||||
if (getBlockState(world, i, j, z).getBlock() == RegistrarBloodMagicBlocks.DIMENSIONAL_PORTAL) {
|
||||
world.setBlockToAir(new BlockPos(i, j, z));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (direction == EnumFacing.EAST || direction == EnumFacing.WEST)
|
||||
{
|
||||
for (int k = z - 2; k <= z + 2; k++)
|
||||
{
|
||||
for (int j = y + 1; j <= y + 3; j++)
|
||||
{
|
||||
if (getBlockState(world, x, j, k).getBlock() == RegistrarBloodMagicBlocks.DIMENSIONAL_PORTAL)
|
||||
{
|
||||
} else if (direction == EnumFacing.EAST || direction == EnumFacing.WEST) {
|
||||
for (int k = z - 2; k <= z + 2; k++) {
|
||||
for (int j = y + 1; j <= y + 3; j++) {
|
||||
if (getBlockState(world, x, j, k).getBlock() == RegistrarBloodMagicBlocks.DIMENSIONAL_PORTAL) {
|
||||
world.setBlockToAir(new BlockPos(x, j, k));
|
||||
}
|
||||
}
|
||||
|
@ -220,14 +177,12 @@ public class RitualPortal extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
addRune(components, 1, 0, 0, EnumRuneType.AIR);
|
||||
|
@ -252,34 +207,29 @@ public class RitualPortal extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualPortal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
super.readFromNBT(tag);
|
||||
|
||||
portalRitualTag = tag.getCompoundTag(PORTAL_NBT_TAG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
super.writeToNBT(tag);
|
||||
|
||||
tag.setTag(PORTAL_NBT_TAG, portalRitualTag);
|
||||
}
|
||||
|
||||
public IBlockState getBlockState(World world, int x, int y, int z)
|
||||
{
|
||||
public IBlockState getBlockState(World world, int x, int y, int z) {
|
||||
return world.getBlockState(new BlockPos(x, y, z));
|
||||
}
|
||||
|
||||
public String addStringToEnd(String input, String toAdd)
|
||||
{
|
||||
public String addStringToEnd(String input, String toAdd) {
|
||||
return input + toAdd;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ import net.minecraft.block.BlockLiquid;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
|
@ -22,15 +22,13 @@ import java.util.ArrayList;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class RitualPump extends Ritual
|
||||
{
|
||||
public class RitualPump extends Ritual {
|
||||
public static final String PUMP_RANGE = "pumpRange";
|
||||
|
||||
private List<Pair<BlockPos, FluidStack>> liquidsCache;
|
||||
private Iterator<Pair<BlockPos, FluidStack>> blockPosIterator;
|
||||
|
||||
public RitualPump()
|
||||
{
|
||||
public RitualPump() {
|
||||
super("ritualPump", 0, 500, "ritual." + BloodMagic.MODID + ".pumpRitual");
|
||||
addBlockRange(PUMP_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-16, -16, -16), new BlockPos(17, 17, 17)));
|
||||
|
||||
|
@ -39,14 +37,12 @@ public class RitualPump extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
TileEntity tileEntity = world.getTileEntity(masterRitualStone.getBlockPos().up());
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
@ -90,14 +86,12 @@ public class RitualPump extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 25;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
addRune(components, 1, 0, 1, EnumRuneType.WATER);
|
||||
|
@ -111,8 +105,7 @@ public class RitualPump extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualPump();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
|
@ -12,18 +13,12 @@ import net.minecraft.potion.PotionEffect;
|
|||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
public class RitualRegeneration extends Ritual
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class RitualRegeneration extends Ritual {
|
||||
public static final String HEAL_RANGE = "heal";
|
||||
public static final String VAMPIRE_RANGE = "vampire";
|
||||
|
||||
|
@ -31,8 +26,7 @@ public class RitualRegeneration extends Ritual
|
|||
|
||||
public static final double corrosiveWillDrain = 0.04;
|
||||
|
||||
public RitualRegeneration()
|
||||
{
|
||||
public RitualRegeneration() {
|
||||
super("ritualRegeneration", 0, 25000, "ritual." + BloodMagic.MODID + ".regenerationRitual");
|
||||
addBlockRange(HEAL_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-15, -15, -15), 31));
|
||||
addBlockRange(VAMPIRE_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-15, -15, -15), 31));
|
||||
|
@ -42,13 +36,11 @@ public class RitualRegeneration extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
@ -88,18 +80,13 @@ public class RitualRegeneration extends Ritual
|
|||
List<EntityPlayer> players = world.getEntitiesWithinAABB(EntityPlayer.class, healRange);
|
||||
List<EntityLivingBase> damagedEntities = world.getEntitiesWithinAABB(EntityLivingBase.class, damageRange);
|
||||
|
||||
if (syphonHealth)
|
||||
{
|
||||
for (EntityPlayer player : players)
|
||||
{
|
||||
if (player.getHealth() <= player.getMaxHealth() - 1)
|
||||
{
|
||||
if (syphonHealth) {
|
||||
for (EntityPlayer player : players) {
|
||||
if (player.getHealth() <= player.getMaxHealth() - 1) {
|
||||
float syphonedHealthAmount = getSyphonAmountForWill(corrosiveWill);
|
||||
Collections.shuffle(damagedEntities);
|
||||
for (EntityLivingBase damagedEntity : damagedEntities)
|
||||
{
|
||||
if (damagedEntity instanceof EntityPlayer)
|
||||
{
|
||||
for (EntityLivingBase damagedEntity : damagedEntities) {
|
||||
if (damagedEntity instanceof EntityPlayer) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -108,8 +95,7 @@ public class RitualRegeneration extends Ritual
|
|||
damagedEntity.attackEntityFrom(BloodMagicAPI.damageSource, Math.min(player.getMaxHealth() - player.getHealth(), syphonedHealthAmount));
|
||||
|
||||
float healthDifference = currentHealth - damagedEntity.getHealth();
|
||||
if (healthDifference > 0)
|
||||
{
|
||||
if (healthDifference > 0) {
|
||||
corrosiveDrain += corrosiveWillDrain;
|
||||
corrosiveWill -= corrosiveWillDrain;
|
||||
player.heal(healthDifference);
|
||||
|
@ -121,19 +107,14 @@ public class RitualRegeneration extends Ritual
|
|||
}
|
||||
}
|
||||
|
||||
for (EntityLivingBase entity : entities)
|
||||
{
|
||||
for (EntityLivingBase entity : entities) {
|
||||
float health = entity.getHealth();
|
||||
if (health <= entity.getMaxHealth() - 1)
|
||||
{
|
||||
if (entity.isPotionApplicable(new PotionEffect(MobEffects.REGENERATION)))
|
||||
{
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
if (health <= entity.getMaxHealth() - 1) {
|
||||
if (entity.isPotionApplicable(new PotionEffect(MobEffects.REGENERATION))) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
totalCost += getRefreshCost();
|
||||
currentEssence -= getRefreshCost();
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
totalCost += getRefreshCost() / 10;
|
||||
currentEssence -= getRefreshCost() / 10;
|
||||
}
|
||||
|
@ -142,23 +123,19 @@ public class RitualRegeneration extends Ritual
|
|||
|
||||
totalEffects++;
|
||||
|
||||
if (totalEffects >= maxEffects)
|
||||
{
|
||||
if (totalEffects >= maxEffects) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (applyAbsorption && entity instanceof EntityPlayer)
|
||||
{
|
||||
if (applyAbsorption)
|
||||
{
|
||||
if (applyAbsorption && entity instanceof EntityPlayer) {
|
||||
if (applyAbsorption) {
|
||||
float added = Utils.addAbsorptionToMaximum(entity, absorptionRate, maxAbsorption, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (corrosiveDrain > 0)
|
||||
{
|
||||
if (corrosiveDrain > 0) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.CORROSIVE, corrosiveDrain, true);
|
||||
}
|
||||
|
||||
|
@ -166,20 +143,17 @@ public class RitualRegeneration extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return 50;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return SACRIFICE_AMOUNT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
components.add(new RitualComponent(new BlockPos(4, 0, 0), EnumRuneType.AIR));
|
||||
|
@ -204,13 +178,11 @@ public class RitualRegeneration extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualRegeneration();
|
||||
}
|
||||
|
||||
public float getSyphonAmountForWill(double corrosiveWill)
|
||||
{
|
||||
public float getSyphonAmountForWill(double corrosiveWill) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
@ -11,38 +12,29 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
public class RitualSpeed extends Ritual
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RitualSpeed extends Ritual {
|
||||
public static final String SPEED_RANGE = "sanicRange";
|
||||
|
||||
public static final double vengefulWillDrain = 0.05;
|
||||
public static final double destructiveWillDrain = 0.05;
|
||||
public static final double rawWillDrain = 0.1;
|
||||
|
||||
public RitualSpeed()
|
||||
{
|
||||
public RitualSpeed() {
|
||||
super("ritualSpeed", 0, 1000, "ritual." + BloodMagic.MODID + ".speedRitual");
|
||||
addBlockRange(SPEED_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-2, 1, -2), new BlockPos(2, 5, 2)));
|
||||
setMaximumVolumeAndDistanceOfRange(SPEED_RANGE, 0, 2, 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
@ -63,37 +55,31 @@ public class RitualSpeed extends Ritual
|
|||
double destructiveDrain = 0;
|
||||
double rawDrain = 0;
|
||||
|
||||
if (rawWill < rawWillDrain)
|
||||
{
|
||||
if (rawWill < rawWillDrain) {
|
||||
rawWill = 0; //Simplifies later calculations
|
||||
}
|
||||
|
||||
for (EntityLivingBase entity : world.getEntitiesWithinAABB(EntityLivingBase.class, speedRange.getAABB(masterRitualStone.getBlockPos())))
|
||||
{
|
||||
for (EntityLivingBase entity : world.getEntitiesWithinAABB(EntityLivingBase.class, speedRange.getAABB(masterRitualStone.getBlockPos()))) {
|
||||
if (entity.isSneaking())
|
||||
continue;
|
||||
|
||||
boolean transportChildren = destructiveWill < destructiveWillDrain;
|
||||
boolean transportAdults = vengefulWill < vengefulWillDrain;
|
||||
|
||||
if ((entity.isChild() && !transportChildren) || (!entity.isChild() && !transportAdults))
|
||||
{
|
||||
if ((entity.isChild() && !transportChildren) || (!entity.isChild() && !transportAdults)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (entity instanceof EntityPlayer && (transportChildren ^ transportAdults))
|
||||
{
|
||||
if (entity instanceof EntityPlayer && (transportChildren ^ transportAdults)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!transportChildren)
|
||||
{
|
||||
if (!transportChildren) {
|
||||
destructiveWill -= destructiveWillDrain;
|
||||
destructiveDrain += destructiveWillDrain;
|
||||
}
|
||||
|
||||
if (!transportAdults)
|
||||
{
|
||||
if (!transportAdults) {
|
||||
vengefulWill -= vengefulWillDrain;
|
||||
vengefulDrain += vengefulWillDrain;
|
||||
}
|
||||
|
@ -102,8 +88,7 @@ public class RitualSpeed extends Ritual
|
|||
double speed = getHorizontalSpeedForWill(rawWill);
|
||||
EnumFacing direction = masterRitualStone.getDirection();
|
||||
|
||||
if (rawWill >= rawWillDrain)
|
||||
{
|
||||
if (rawWill >= rawWillDrain) {
|
||||
rawWill -= rawWillDrain;
|
||||
rawDrain += rawWillDrain;
|
||||
}
|
||||
|
@ -111,79 +96,70 @@ public class RitualSpeed extends Ritual
|
|||
entity.motionY = motionY;
|
||||
entity.fallDistance = 0;
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case NORTH:
|
||||
entity.motionX = 0;
|
||||
entity.motionY = motionY;
|
||||
entity.motionZ = -speed;
|
||||
break;
|
||||
switch (direction) {
|
||||
case NORTH:
|
||||
entity.motionX = 0;
|
||||
entity.motionY = motionY;
|
||||
entity.motionZ = -speed;
|
||||
break;
|
||||
|
||||
case SOUTH:
|
||||
entity.motionX = 0;
|
||||
entity.motionY = motionY;
|
||||
entity.motionZ = speed;
|
||||
break;
|
||||
case SOUTH:
|
||||
entity.motionX = 0;
|
||||
entity.motionY = motionY;
|
||||
entity.motionZ = speed;
|
||||
break;
|
||||
|
||||
case WEST:
|
||||
entity.motionX = -speed;
|
||||
entity.motionY = motionY;
|
||||
entity.motionZ = 0;
|
||||
break;
|
||||
case WEST:
|
||||
entity.motionX = -speed;
|
||||
entity.motionY = motionY;
|
||||
entity.motionZ = 0;
|
||||
break;
|
||||
|
||||
case EAST:
|
||||
entity.motionX = speed;
|
||||
entity.motionY = motionY;
|
||||
entity.motionZ = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case EAST:
|
||||
entity.motionX = speed;
|
||||
entity.motionY = motionY;
|
||||
entity.motionZ = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
if (entity instanceof EntityPlayer) {
|
||||
Utils.setPlayerSpeedFromServer((EntityPlayer) entity, entity.motionX, entity.motionY, entity.motionZ);
|
||||
}
|
||||
}
|
||||
|
||||
if (rawDrain > 0)
|
||||
{
|
||||
if (rawDrain > 0) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DEFAULT, rawDrain, true);
|
||||
}
|
||||
|
||||
if (vengefulDrain > 0)
|
||||
{
|
||||
if (vengefulDrain > 0) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.VENGEFUL, vengefulDrain, true);
|
||||
}
|
||||
|
||||
if (destructiveDrain > 0)
|
||||
{
|
||||
if (destructiveDrain > 0) {
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DESTRUCTIVE, destructiveDrain, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addRune(components, 0, 0, -2, EnumRuneType.DUSK);
|
||||
this.addRune(components, 1, 0, -1, EnumRuneType.AIR);
|
||||
this.addRune(components, -1, 0, -1, EnumRuneType.AIR);
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
for (int i = 0; i < 3; i++) {
|
||||
this.addRune(components, 2, 0, i, EnumRuneType.AIR);
|
||||
this.addRune(components, -2, 0, i, EnumRuneType.AIR);
|
||||
}
|
||||
|
@ -192,24 +168,20 @@ public class RitualSpeed extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualSpeed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player)
|
||||
{
|
||||
return new ITextComponent[] { new TextComponentTranslation(this.getUnlocalizedName() + ".info"), new TextComponentTranslation(this.getUnlocalizedName() + ".default.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".corrosive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".steadfast.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".destructive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".vengeful.info") };
|
||||
public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player) {
|
||||
return new ITextComponent[]{new TextComponentTranslation(this.getUnlocalizedName() + ".info"), new TextComponentTranslation(this.getUnlocalizedName() + ".default.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".corrosive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".steadfast.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".destructive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".vengeful.info")};
|
||||
}
|
||||
|
||||
public double getVerticalSpeedForWill(double rawWill)
|
||||
{
|
||||
public double getVerticalSpeedForWill(double rawWill) {
|
||||
return 1.2 + rawWill / 200;
|
||||
}
|
||||
|
||||
public double getHorizontalSpeedForWill(double rawWill)
|
||||
{
|
||||
public double getHorizontalSpeedForWill(double rawWill) {
|
||||
return 3 + rawWill / 40;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,38 +1,30 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.tile.TileSpectralBlock;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
||||
import WayofTime.bloodmagic.tile.TileSpectralBlock;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
public class RitualSuppression extends Ritual
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class RitualSuppression extends Ritual {
|
||||
public static final String SUPPRESSION_RANGE = "suppressionRange";
|
||||
|
||||
public RitualSuppression()
|
||||
{
|
||||
public RitualSuppression() {
|
||||
super("ritualSuppression", 0, 10000, "ritual." + BloodMagic.MODID + ".suppressionRitual");
|
||||
addBlockRange(SUPPRESSION_RANGE, new AreaDescriptor.HemiSphere(new BlockPos(0, 0, 0), 10));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
@ -40,14 +32,12 @@ public class RitualSuppression extends Ritual
|
|||
final int refresh = 100;
|
||||
AreaDescriptor suppressionRange = getBlockRange(SUPPRESSION_RANGE);
|
||||
|
||||
for (BlockPos blockPos : suppressionRange.getContainedPositions(masterRitualStone.getBlockPos()))
|
||||
{
|
||||
for (BlockPos blockPos : suppressionRange.getContainedPositions(masterRitualStone.getBlockPos())) {
|
||||
IBlockState state = world.getBlockState(blockPos);
|
||||
|
||||
if (Utils.isBlockLiquid(state) && world.getTileEntity(blockPos) == null)
|
||||
TileSpectralBlock.createSpectralBlock(world, blockPos, refresh);
|
||||
else
|
||||
{
|
||||
else {
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
if (tile instanceof TileSpectralBlock)
|
||||
((TileSpectralBlock) tile).resetDuration(refresh);
|
||||
|
@ -56,20 +46,17 @@ public class RitualSuppression extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addCornerRunes(components, 2, 0, EnumRuneType.WATER);
|
||||
|
@ -86,8 +73,7 @@ public class RitualSuppression extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualSuppression();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,48 +1,39 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.util.helper.ItemHelper.LivingUpgrades;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
|
||||
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import com.google.common.collect.Iterables;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
||||
import WayofTime.bloodmagic.api.util.helper.ItemHelper.LivingUpgrades;
|
||||
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class RitualUpgradeRemove extends Ritual
|
||||
{
|
||||
public class RitualUpgradeRemove extends Ritual {
|
||||
public static final String CHECK_RANGE = "fillRange";
|
||||
|
||||
public RitualUpgradeRemove()
|
||||
{
|
||||
public RitualUpgradeRemove() {
|
||||
super("ritualUpgradeRemove", 0, 25000, "ritual." + BloodMagic.MODID + ".upgradeRemoveRitual");
|
||||
addBlockRange(CHECK_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1, 2, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
|
||||
if (world.isRemote)
|
||||
{
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -52,21 +43,17 @@ public class RitualUpgradeRemove extends Ritual
|
|||
|
||||
List<EntityPlayer> playerList = world.getEntitiesWithinAABB(EntityPlayer.class, checkRange.getAABB(pos));
|
||||
|
||||
for (EntityPlayer player : playerList)
|
||||
{
|
||||
if (LivingArmour.hasFullSet(player))
|
||||
{
|
||||
for (EntityPlayer player : playerList) {
|
||||
if (LivingArmour.hasFullSet(player)) {
|
||||
boolean removedUpgrade = false;
|
||||
|
||||
ItemStack chestStack = Iterables.toArray(player.getArmorInventoryList(), ItemStack.class)[2];
|
||||
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
|
||||
if (armour != null)
|
||||
{
|
||||
if (armour != null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
HashMap<String, LivingArmourUpgrade> upgradeMap = (HashMap<String, LivingArmourUpgrade>) armour.upgradeMap.clone();
|
||||
|
||||
for (Entry<String, LivingArmourUpgrade> entry : upgradeMap.entrySet())
|
||||
{
|
||||
for (Entry<String, LivingArmourUpgrade> entry : upgradeMap.entrySet()) {
|
||||
LivingArmourUpgrade upgrade = entry.getValue();
|
||||
String upgradeKey = entry.getKey();
|
||||
|
||||
|
@ -76,17 +63,13 @@ public class RitualUpgradeRemove extends Ritual
|
|||
|
||||
boolean successful = armour.removeUpgrade(player, upgrade);
|
||||
|
||||
if (successful)
|
||||
{
|
||||
if (successful) {
|
||||
removedUpgrade = true;
|
||||
world.spawnEntity(new EntityItem(world, player.posX, player.posY, player.posZ, upgradeStack));
|
||||
for (Entry<String, StatTracker> trackerEntry : armour.trackerMap.entrySet())
|
||||
{
|
||||
for (Entry<String, StatTracker> trackerEntry : armour.trackerMap.entrySet()) {
|
||||
StatTracker tracker = trackerEntry.getValue();
|
||||
if (tracker != null)
|
||||
{
|
||||
if (tracker.providesUpgrade(upgradeKey))
|
||||
{
|
||||
if (tracker != null) {
|
||||
if (tracker.providesUpgrade(upgradeKey)) {
|
||||
tracker.resetTracker(); //Resets the tracker if the upgrade corresponding to it was removed.
|
||||
}
|
||||
}
|
||||
|
@ -94,8 +77,7 @@ public class RitualUpgradeRemove extends Ritual
|
|||
}
|
||||
}
|
||||
|
||||
if (removedUpgrade)
|
||||
{
|
||||
if (removedUpgrade) {
|
||||
((ItemLivingArmour) chestStack.getItem()).setLivingArmour(chestStack, armour, true);
|
||||
ItemLivingArmour.setLivingArmour(chestStack, armour);
|
||||
armour.recalculateUpgradePoints();
|
||||
|
@ -111,20 +93,17 @@ public class RitualUpgradeRemove extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addCornerRunes(components, 1, 0, EnumRuneType.DUSK);
|
||||
|
@ -135,8 +114,7 @@ public class RitualUpgradeRemove extends Ritual
|
|||
this.addCornerRunes(components, 1, 3, EnumRuneType.WATER);
|
||||
this.addParallelRunes(components, 1, 4, EnumRuneType.AIR);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
for (int i = 0; i < 4; i++) {
|
||||
this.addCornerRunes(components, 3, i, EnumRuneType.EARTH);
|
||||
}
|
||||
|
||||
|
@ -144,8 +122,7 @@ public class RitualUpgradeRemove extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualUpgradeRemove();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,25 +8,21 @@ import net.minecraft.world.World;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class RitualWater extends Ritual
|
||||
{
|
||||
public class RitualWater extends Ritual {
|
||||
public static final String WATER_RANGE = "waterRange";
|
||||
|
||||
public RitualWater()
|
||||
{
|
||||
public RitualWater() {
|
||||
super("ritualWater", 0, 500, "ritual." + BloodMagic.MODID + ".waterRitual");
|
||||
addBlockRange(WATER_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1));
|
||||
setMaximumVolumeAndDistanceOfRange(WATER_RANGE, 9, 3, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
@ -36,16 +32,13 @@ public class RitualWater extends Ritual
|
|||
|
||||
AreaDescriptor waterRange = getBlockRange(WATER_RANGE);
|
||||
|
||||
for (BlockPos newPos : waterRange.getContainedPositions(masterRitualStone.getBlockPos()))
|
||||
{
|
||||
if (world.isAirBlock(newPos))
|
||||
{
|
||||
for (BlockPos newPos : waterRange.getContainedPositions(masterRitualStone.getBlockPos())) {
|
||||
if (world.isAirBlock(newPos)) {
|
||||
world.setBlockState(newPos, Blocks.FLOWING_WATER.getDefaultState());
|
||||
totalEffects++;
|
||||
}
|
||||
|
||||
if (totalEffects >= maxEffects)
|
||||
{
|
||||
if (totalEffects >= maxEffects) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -54,20 +47,17 @@ public class RitualWater extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 25;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addCornerRunes(components, 1, 0, EnumRuneType.WATER);
|
||||
|
@ -76,8 +66,7 @@ public class RitualWater extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualWater();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.ConfigHandler;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api_impl.BloodMagicAPI;
|
||||
import WayofTime.bloodmagic.tile.TileAltar;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.EntityEntry;
|
||||
import net.minecraftforge.fml.common.registry.EntityRegistry;
|
||||
|
@ -18,8 +17,7 @@ import net.minecraftforge.fml.common.registry.EntityRegistry;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RitualWellOfSuffering extends Ritual
|
||||
{
|
||||
public class RitualWellOfSuffering extends Ritual {
|
||||
public static final String ALTAR_RANGE = "altar";
|
||||
public static final String DAMAGE_RANGE = "damage";
|
||||
|
||||
|
@ -27,8 +25,7 @@ public class RitualWellOfSuffering extends Ritual
|
|||
|
||||
public BlockPos altarOffsetPos = new BlockPos(0, 0, 0); //TODO: Save!
|
||||
|
||||
public RitualWellOfSuffering()
|
||||
{
|
||||
public RitualWellOfSuffering() {
|
||||
super("ritualWellOfSuffering", 0, 40000, "ritual." + BloodMagic.MODID + ".wellOfSufferingRitual");
|
||||
addBlockRange(ALTAR_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-5, -10, -5), 11, 21, 11));
|
||||
addBlockRange(DAMAGE_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-10, -10, -10), 21));
|
||||
|
@ -38,13 +35,11 @@ public class RitualWellOfSuffering extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
@ -60,13 +55,10 @@ public class RitualWellOfSuffering extends Ritual
|
|||
|
||||
AreaDescriptor altarRange = getBlockRange(ALTAR_RANGE);
|
||||
|
||||
if (!altarRange.isWithinArea(altarOffsetPos) || !(tile instanceof TileAltar))
|
||||
{
|
||||
for (BlockPos newPos : altarRange.getContainedPositions(pos))
|
||||
{
|
||||
if (!altarRange.isWithinArea(altarOffsetPos) || !(tile instanceof TileAltar)) {
|
||||
for (BlockPos newPos : altarRange.getContainedPositions(pos)) {
|
||||
TileEntity nextTile = world.getTileEntity(newPos);
|
||||
if (nextTile instanceof TileAltar)
|
||||
{
|
||||
if (nextTile instanceof TileAltar) {
|
||||
tile = nextTile;
|
||||
altarOffsetPos = newPos.subtract(pos);
|
||||
|
||||
|
@ -76,8 +68,7 @@ public class RitualWellOfSuffering extends Ritual
|
|||
}
|
||||
}
|
||||
|
||||
if (tile instanceof TileAltar)
|
||||
{
|
||||
if (tile instanceof TileAltar) {
|
||||
TileAltar tileAltar = (TileAltar) tile;
|
||||
|
||||
AreaDescriptor damageRange = getBlockRange(DAMAGE_RANGE);
|
||||
|
@ -85,8 +76,7 @@ public class RitualWellOfSuffering extends Ritual
|
|||
|
||||
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, range);
|
||||
|
||||
for (EntityLivingBase entity : entities)
|
||||
{
|
||||
for (EntityLivingBase entity : entities) {
|
||||
EntityEntry entityEntry = EntityRegistry.getEntry(entity.getClass());
|
||||
|
||||
if (BloodMagicAPI.INSTANCE.getBlacklist().getSacrifice().contains(entityEntry.getRegistryName()))
|
||||
|
@ -97,10 +87,8 @@ public class RitualWellOfSuffering extends Ritual
|
|||
if (lifeEssenceRatio <= 0)
|
||||
continue;
|
||||
|
||||
if (entity.isEntityAlive() && !(entity instanceof EntityPlayer))
|
||||
{
|
||||
if (entity.attackEntityFrom(DamageSource.OUT_OF_WORLD, 1))
|
||||
{
|
||||
if (entity.isEntityAlive() && !(entity instanceof EntityPlayer)) {
|
||||
if (entity.attackEntityFrom(DamageSource.OUT_OF_WORLD, 1)) {
|
||||
if (entity.isChild())
|
||||
lifeEssenceRatio *= 0.5F;
|
||||
|
||||
|
@ -108,8 +96,7 @@ public class RitualWellOfSuffering extends Ritual
|
|||
|
||||
totalEffects++;
|
||||
|
||||
if (totalEffects >= maxEffects)
|
||||
{
|
||||
if (totalEffects >= maxEffects) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -121,20 +108,17 @@ public class RitualWellOfSuffering extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return 25;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addCornerRunes(components, 1, 0, EnumRuneType.FIRE);
|
||||
|
@ -149,8 +133,7 @@ public class RitualWellOfSuffering extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualWellOfSuffering();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,29 +1,23 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
public class RitualZephyr extends Ritual
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RitualZephyr extends Ritual {
|
||||
public static final String ZEPHYR_RANGE = "zephyrRange";
|
||||
public static final String CHEST_RANGE = "chest";
|
||||
|
||||
public RitualZephyr()
|
||||
{
|
||||
public RitualZephyr() {
|
||||
super("ritualZephyr", 0, 1000, "ritual." + BloodMagic.MODID + ".zephyrRitual");
|
||||
addBlockRange(ZEPHYR_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-5, -5, -5), 11));
|
||||
addBlockRange(CHEST_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1));
|
||||
|
@ -33,17 +27,14 @@ public class RitualZephyr extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
BlockPos masterPos = masterRitualStone.getBlockPos();
|
||||
AreaDescriptor chestRange = getBlockRange(CHEST_RANGE);
|
||||
TileEntity tileInventory = world.getTileEntity(chestRange.getContainedPositions(masterPos).get(0));
|
||||
if (!masterRitualStone.getWorldObj().isRemote && tileInventory != null)
|
||||
{
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (!masterRitualStone.getWorldObj().isRemote && tileInventory != null) {
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
@ -53,10 +44,8 @@ public class RitualZephyr extends Ritual
|
|||
List<EntityItem> itemList = world.getEntitiesWithinAABB(EntityItem.class, zephyrRange.getAABB(masterRitualStone.getBlockPos()));
|
||||
int count = 0;
|
||||
|
||||
for (EntityItem entityItem : itemList)
|
||||
{
|
||||
if (entityItem.isDead)
|
||||
{
|
||||
for (EntityItem entityItem : itemList) {
|
||||
if (entityItem.isDead) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -64,8 +53,7 @@ public class RitualZephyr extends Ritual
|
|||
int originalAmount = copyStack.getCount();
|
||||
ItemStack newStack = Utils.insertStackIntoTile(copyStack, tileInventory, EnumFacing.DOWN);
|
||||
|
||||
if (!newStack.isEmpty() && newStack.getCount() < originalAmount)
|
||||
{
|
||||
if (!newStack.isEmpty() && newStack.getCount() < originalAmount) {
|
||||
count++;
|
||||
if (newStack.isEmpty())
|
||||
entityItem.setDead();
|
||||
|
@ -73,8 +61,7 @@ public class RitualZephyr extends Ritual
|
|||
entityItem.getItem().setCount(newStack.getCount());
|
||||
}
|
||||
|
||||
if (newStack.isEmpty())
|
||||
{
|
||||
if (newStack.isEmpty()) {
|
||||
entityItem.setDead();
|
||||
}
|
||||
}
|
||||
|
@ -84,20 +71,17 @@ public class RitualZephyr extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addParallelRunes(components, 2, 0, EnumRuneType.AIR);
|
||||
|
@ -108,8 +92,7 @@ public class RitualZephyr extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualZephyr();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
package WayofTime.bloodmagic.ritual.harvest;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.BlockStack;
|
||||
import WayofTime.bloodmagic.api.iface.IHarvestHandler;
|
||||
|
@ -21,6 +17,9 @@ import net.minecraftforge.fml.common.Loader;
|
|||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -29,10 +28,8 @@ import java.util.List;
|
|||
* Register a new crop for this handler with
|
||||
* {@link HarvestRegistry#registerStandardCrop(Block, int)}
|
||||
*/
|
||||
public class HarvestHandlerPlantable implements IHarvestHandler
|
||||
{
|
||||
public HarvestHandlerPlantable()
|
||||
{
|
||||
public class HarvestHandlerPlantable implements IHarvestHandler {
|
||||
public HarvestHandlerPlantable() {
|
||||
HarvestRegistry.registerStandardCrop(Blocks.CARROTS, 7);
|
||||
HarvestRegistry.registerStandardCrop(Blocks.WHEAT, 7);
|
||||
HarvestRegistry.registerStandardCrop(Blocks.POTATOES, 7);
|
||||
|
@ -57,8 +54,7 @@ public class HarvestHandlerPlantable implements IHarvestHandler
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean harvestAndPlant(World world, BlockPos pos, BlockStack blockStack)
|
||||
{
|
||||
public boolean harvestAndPlant(World world, BlockPos pos, BlockStack blockStack) {
|
||||
if (!HarvestRegistry.getStandardCrops().containsKey(blockStack.getBlock()))
|
||||
return false;
|
||||
|
||||
|
@ -70,30 +66,25 @@ public class HarvestHandlerPlantable implements IHarvestHandler
|
|||
List<ItemStack> drops = blockStack.getBlock().getDrops(world, pos, blockStack.getState(), 0);
|
||||
boolean foundSeed = false;
|
||||
|
||||
for (ItemStack stack : drops)
|
||||
{
|
||||
for (ItemStack stack : drops) {
|
||||
if (stack.isEmpty())
|
||||
continue;
|
||||
|
||||
if (stack.getItem() instanceof IPlantable)
|
||||
{
|
||||
if (stack.getItem() instanceof IPlantable) {
|
||||
stack.shrink(1);
|
||||
foundSeed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (foundSeed)
|
||||
{
|
||||
if (foundSeed) {
|
||||
world.setBlockState(pos, blockStack.getBlock().getDefaultState());
|
||||
world.playEvent(2001, pos, Block.getStateId(blockStack.getState()));
|
||||
for (ItemStack stack : drops)
|
||||
{
|
||||
for (ItemStack stack : drops) {
|
||||
if (stack.isEmpty())
|
||||
continue;
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
EntityItem toDrop = new EntityItem(world, pos.getX(), pos.getY() + 0.5, pos.getZ(), stack);
|
||||
world.spawnEntity(toDrop);
|
||||
}
|
||||
|
@ -105,8 +96,7 @@ public class HarvestHandlerPlantable implements IHarvestHandler
|
|||
return false;
|
||||
}
|
||||
|
||||
private static void addThirdPartyCrop(String modid, String regName, int matureMeta)
|
||||
{
|
||||
private static void addThirdPartyCrop(String modid, String regName, int matureMeta) {
|
||||
if (!Loader.isModLoaded(modid))
|
||||
return;
|
||||
|
||||
|
@ -115,8 +105,7 @@ public class HarvestHandlerPlantable implements IHarvestHandler
|
|||
HarvestRegistry.registerStandardCrop(block, matureMeta);
|
||||
}
|
||||
|
||||
private static void addPamCrops()
|
||||
{
|
||||
private static void addPamCrops() {
|
||||
if (!Loader.isModLoaded("harvestcraft"))
|
||||
return;
|
||||
|
||||
|
@ -126,7 +115,7 @@ public class HarvestHandlerPlantable implements IHarvestHandler
|
|||
Class<?> registry = ReflectionHelper.getClass(loader, className);
|
||||
Field names = ReflectionHelper.findField(registry, "cropNames");
|
||||
Method getCrop = registry.getMethod("getCrop", String.class);
|
||||
for (String name : (String[])names.get(null)) {
|
||||
for (String name : (String[]) names.get(null)) {
|
||||
BlockCrops crop = (BlockCrops) getCrop.invoke(null, name);
|
||||
HarvestRegistry.registerStandardCrop(crop, crop.getMaxAge());
|
||||
}
|
||||
|
|
|
@ -23,32 +23,26 @@ import java.util.List;
|
|||
* Register a new crop for this handler with
|
||||
* {@link HarvestRegistry#registerStemCrop(BlockStack, BlockStack)}
|
||||
*/
|
||||
public class HarvestHandlerStem implements IHarvestHandler
|
||||
{
|
||||
public HarvestHandlerStem()
|
||||
{
|
||||
public class HarvestHandlerStem implements IHarvestHandler {
|
||||
public HarvestHandlerStem() {
|
||||
HarvestRegistry.registerStemCrop(new BlockStack(Blocks.PUMPKIN, OreDictionary.WILDCARD_VALUE), new BlockStack(Blocks.PUMPKIN_STEM, 7));
|
||||
HarvestRegistry.registerStemCrop(new BlockStack(Blocks.MELON_BLOCK), new BlockStack(Blocks.MELON_STEM, 7));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean harvestAndPlant(World world, BlockPos pos, BlockStack blockStack)
|
||||
{
|
||||
public boolean harvestAndPlant(World world, BlockPos pos, BlockStack blockStack) {
|
||||
boolean retFlag = false;
|
||||
List<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
BlockPos cropPos = pos;
|
||||
if (HarvestRegistry.getStemCrops().containsKey(blockStack))
|
||||
{
|
||||
if (HarvestRegistry.getStemCrops().containsKey(blockStack)) {
|
||||
EnumFacing cropDir = blockStack.getBlock().getActualState(blockStack.getState(), world, pos).getValue(BlockStem.FACING);
|
||||
|
||||
if (cropDir != EnumFacing.UP)
|
||||
{
|
||||
if (cropDir != EnumFacing.UP) {
|
||||
cropPos = pos.offset(cropDir);
|
||||
BlockStack probableCrop = BlockStack.getStackFromPos(world, cropPos);
|
||||
BlockStack regCrop = HarvestRegistry.getStemCrops().get(blockStack);
|
||||
|
||||
if ((regCrop.getMeta() == OreDictionary.WILDCARD_VALUE && regCrop.getBlock() == probableCrop.getBlock()) || regCrop.equals(probableCrop))
|
||||
{
|
||||
if ((regCrop.getMeta() == OreDictionary.WILDCARD_VALUE && regCrop.getBlock() == probableCrop.getBlock()) || regCrop.equals(probableCrop)) {
|
||||
drops = probableCrop.getBlock().getDrops(world, cropPos, probableCrop.getState(), 0);
|
||||
world.destroyBlock(cropPos, false);
|
||||
retFlag = true;
|
||||
|
@ -56,10 +50,8 @@ public class HarvestHandlerStem implements IHarvestHandler
|
|||
}
|
||||
}
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
for (ItemStack drop : drops)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
for (ItemStack drop : drops) {
|
||||
EntityItem item = new EntityItem(world, cropPos.getX(), cropPos.getY() + 0.5, cropPos.getZ(), drop);
|
||||
world.spawnEntity(item);
|
||||
}
|
||||
|
|
|
@ -17,35 +17,28 @@ import java.util.List;
|
|||
* Register a new crop for this handler with
|
||||
* {@link HarvestRegistry#registerTallCrop(BlockStack)}
|
||||
*/
|
||||
public class HarvestHandlerTall implements IHarvestHandler
|
||||
{
|
||||
public HarvestHandlerTall()
|
||||
{
|
||||
public class HarvestHandlerTall implements IHarvestHandler {
|
||||
public HarvestHandlerTall() {
|
||||
HarvestRegistry.registerTallCrop(new BlockStack(Blocks.REEDS));
|
||||
HarvestRegistry.registerTallCrop(new BlockStack(Blocks.CACTUS));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean harvestAndPlant(World world, BlockPos pos, BlockStack blockStack)
|
||||
{
|
||||
public boolean harvestAndPlant(World world, BlockPos pos, BlockStack blockStack) {
|
||||
boolean retFlag = false;
|
||||
|
||||
List<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
if (HarvestRegistry.getTallCrops().contains(blockStack))
|
||||
{
|
||||
if (HarvestRegistry.getTallCrops().contains(blockStack)) {
|
||||
BlockStack up = BlockStack.getStackFromPos(world, pos.up());
|
||||
if (up.equals(blockStack))
|
||||
{
|
||||
if (up.equals(blockStack)) {
|
||||
drops = up.getBlock().getDrops(world, pos.up(), up.getState(), 0);
|
||||
world.destroyBlock(pos.up(), false);
|
||||
retFlag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
for (ItemStack drop : drops)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
for (ItemStack drop : drops) {
|
||||
EntityItem item = new EntityItem(world, pos.getX(), pos.getY() + 0.5, pos.getZ(), drop);
|
||||
world.spawnEntity(item);
|
||||
}
|
||||
|
|
|
@ -7,16 +7,13 @@ import WayofTime.bloodmagic.api.ritual.imperfect.ImperfectRitual;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
||||
public class ImperfectRitualDay extends ImperfectRitual
|
||||
{
|
||||
public ImperfectRitualDay()
|
||||
{
|
||||
public class ImperfectRitualDay extends ImperfectRitual {
|
||||
public ImperfectRitualDay() {
|
||||
super("day", new BlockStack(Blocks.GOLD_BLOCK), 5000, true, "ritual." + BloodMagic.MODID + ".imperfect.day");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivate(IImperfectRitualStone imperfectRitualStone, EntityPlayer player)
|
||||
{
|
||||
public boolean onActivate(IImperfectRitualStone imperfectRitualStone, EntityPlayer player) {
|
||||
|
||||
if (!imperfectRitualStone.getRitualWorld().isRemote)
|
||||
imperfectRitualStone.getRitualWorld().setWorldTime((imperfectRitualStone.getRitualWorld().getWorldTime() / 24000) * 24000);
|
||||
|
|
|
@ -7,16 +7,13 @@ import WayofTime.bloodmagic.api.ritual.imperfect.ImperfectRitual;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
||||
public class ImperfectRitualNight extends ImperfectRitual
|
||||
{
|
||||
public ImperfectRitualNight()
|
||||
{
|
||||
public class ImperfectRitualNight extends ImperfectRitual {
|
||||
public ImperfectRitualNight() {
|
||||
super("night", new BlockStack(Blocks.LAPIS_BLOCK), 100, true, "ritual." + BloodMagic.MODID + ".imperfect.night");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivate(IImperfectRitualStone imperfectRitualStone, EntityPlayer player)
|
||||
{
|
||||
public boolean onActivate(IImperfectRitualStone imperfectRitualStone, EntityPlayer player) {
|
||||
|
||||
if (!imperfectRitualStone.getRitualWorld().isRemote)
|
||||
imperfectRitualStone.getRitualWorld().setWorldTime((imperfectRitualStone.getRitualWorld().getWorldTime() / 24000) * 24000 + 13800);
|
||||
|
|
|
@ -7,23 +7,18 @@ import WayofTime.bloodmagic.api.ritual.imperfect.ImperfectRitual;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
||||
public class ImperfectRitualRain extends ImperfectRitual
|
||||
{
|
||||
public ImperfectRitualRain()
|
||||
{
|
||||
public class ImperfectRitualRain extends ImperfectRitual {
|
||||
public ImperfectRitualRain() {
|
||||
super("rain", new BlockStack(Blocks.WATER), 5000, true, "ritual." + BloodMagic.MODID + ".imperfect.rain");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivate(IImperfectRitualStone imperfectRitualStone, EntityPlayer player)
|
||||
{
|
||||
if (!imperfectRitualStone.getRitualWorld().isRemote)
|
||||
{
|
||||
public boolean onActivate(IImperfectRitualStone imperfectRitualStone, EntityPlayer player) {
|
||||
if (!imperfectRitualStone.getRitualWorld().isRemote) {
|
||||
imperfectRitualStone.getRitualWorld().getWorldInfo().setRaining(true);
|
||||
}
|
||||
|
||||
if (imperfectRitualStone.getRitualWorld().isRemote)
|
||||
{
|
||||
if (imperfectRitualStone.getRitualWorld().isRemote) {
|
||||
imperfectRitualStone.getRitualWorld().setRainStrength(1.0F);
|
||||
imperfectRitualStone.getRitualWorld().setThunderStrength(1.0F);
|
||||
}
|
||||
|
|
|
@ -9,16 +9,13 @@ import net.minecraft.init.Blocks;
|
|||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
|
||||
public class ImperfectRitualResistance extends ImperfectRitual
|
||||
{
|
||||
public ImperfectRitualResistance()
|
||||
{
|
||||
public class ImperfectRitualResistance extends ImperfectRitual {
|
||||
public ImperfectRitualResistance() {
|
||||
super("resistance", new BlockStack(Blocks.BEDROCK), 5000, "ritual." + BloodMagic.MODID + ".imperfect.resistance");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivate(IImperfectRitualStone imperfectRitualStone, EntityPlayer player)
|
||||
{
|
||||
public boolean onActivate(IImperfectRitualStone imperfectRitualStone, EntityPlayer player) {
|
||||
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, 1200, 1));
|
||||
|
||||
|
|
|
@ -10,16 +10,13 @@ import net.minecraft.init.Blocks;
|
|||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
|
||||
public class ImperfectRitualZombie extends ImperfectRitual
|
||||
{
|
||||
public ImperfectRitualZombie()
|
||||
{
|
||||
public class ImperfectRitualZombie extends ImperfectRitual {
|
||||
public ImperfectRitualZombie() {
|
||||
super("zombie", new BlockStack(Blocks.COAL_BLOCK), 5000, "ritual." + BloodMagic.MODID + ".imperfect.zombie");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivate(IImperfectRitualStone imperfectRitualStone, EntityPlayer player)
|
||||
{
|
||||
public boolean onActivate(IImperfectRitualStone imperfectRitualStone, EntityPlayer player) {
|
||||
EntityZombie zombie = new EntityZombie(imperfectRitualStone.getRitualWorld());
|
||||
zombie.setPosition(imperfectRitualStone.getRitualPos().getX() + 0.5, imperfectRitualStone.getRitualPos().getY() + 2.1, imperfectRitualStone.getRitualPos().getZ() + 0.5);
|
||||
zombie.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, 2000));
|
||||
|
|
|
@ -9,48 +9,75 @@ import java.io.*;
|
|||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class LocationsHandler implements Serializable
|
||||
{
|
||||
public class LocationsHandler implements Serializable {
|
||||
|
||||
public static final long serialVersionUID = 10102001;
|
||||
private static final String fileName = String.valueOf(DimensionManager.getCurrentSaveRootDirectory()) + "/" + BloodMagic.MODID + "/PortalLocations.dat";
|
||||
private static HashMap<String, ArrayList<PortalLocation>> portals;
|
||||
private static LocationsHandler locationsHandler;
|
||||
|
||||
private LocationsHandler()
|
||||
{
|
||||
private LocationsHandler() {
|
||||
portals = new HashMap<String, ArrayList<PortalLocation>>();
|
||||
}
|
||||
|
||||
public static LocationsHandler getLocationsHandler()
|
||||
{
|
||||
if (locationsHandler == null || loadFile() == null)
|
||||
{
|
||||
public boolean addLocation(String name, PortalLocation location) {
|
||||
ArrayList<PortalLocation> portalLocations = portals.get(name);
|
||||
if (portalLocations == null) {
|
||||
portals.put(name, new ArrayList<PortalLocation>());
|
||||
updateFile(fileName, portals);
|
||||
}
|
||||
if (!portals.get(name).isEmpty() && portals.get(name).size() >= 2) {
|
||||
BloodMagicAPI.logger.info("Location " + name + " already exists.");
|
||||
updateFile(fileName, portals);
|
||||
return false;
|
||||
} else {
|
||||
portals.get(name).add(location);
|
||||
BloodMagicAPI.logger.info("Adding " + name);
|
||||
updateFile(fileName, portals);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean removeLocation(String name, PortalLocation location) {
|
||||
if (portals.get(name) != null && !portals.get(name).isEmpty()) {
|
||||
if (portals.get(name).contains(location)) {
|
||||
portals.get(name).remove(location);
|
||||
BloodMagicAPI.logger.info("Removing " + name);
|
||||
updateFile(fileName, portals);
|
||||
return true;
|
||||
} else {
|
||||
BloodMagicAPI.logger.info("No location matching " + name);
|
||||
updateFile(fileName, portals);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ArrayList<PortalLocation> getLinkedLocations(String name) {
|
||||
return portals.get(name);
|
||||
}
|
||||
|
||||
public static LocationsHandler getLocationsHandler() {
|
||||
if (locationsHandler == null || loadFile() == null) {
|
||||
locationsHandler = new LocationsHandler();
|
||||
return locationsHandler;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
portals = loadFile();
|
||||
return locationsHandler;
|
||||
}
|
||||
}
|
||||
|
||||
private static HashMap<String, ArrayList<PortalLocation>> loadFile()
|
||||
{
|
||||
private static HashMap<String, ArrayList<PortalLocation>> loadFile() {
|
||||
HashMap<String, ArrayList<PortalLocation>> map;
|
||||
File file = new File(fileName);
|
||||
try
|
||||
{
|
||||
if (!file.exists())
|
||||
{
|
||||
if (file.getParentFile().mkdir())
|
||||
{
|
||||
if (file.createNewFile())
|
||||
{
|
||||
try {
|
||||
if (!file.exists()) {
|
||||
if (file.getParentFile().mkdir()) {
|
||||
if (file.createNewFile()) {
|
||||
BloodMagicAPI.logger.info("Creating " + fileName + " in " + String.valueOf(DimensionManager.getCurrentSaveRootDirectory()));
|
||||
}
|
||||
} else if (file.createNewFile())
|
||||
{
|
||||
} else if (file.createNewFile()) {
|
||||
BloodMagicAPI.logger.info("Creating " + fileName + " in " + String.valueOf(DimensionManager.getCurrentSaveRootDirectory()));
|
||||
}
|
||||
}
|
||||
|
@ -60,74 +87,22 @@ public class LocationsHandler implements Serializable
|
|||
in.close();
|
||||
fileIn.close();
|
||||
return map;
|
||||
} catch (IOException e)
|
||||
{
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
} catch (ClassNotFoundException e)
|
||||
{
|
||||
} catch (ClassNotFoundException e) {
|
||||
BloodMagicAPI.logger.error(String.valueOf(file) + " was not found in " + String.valueOf(DimensionManager.getCurrentSaveRootDirectory()));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void updateFile(String file, HashMap<String, ArrayList<PortalLocation>> object)
|
||||
{
|
||||
try
|
||||
{
|
||||
private static void updateFile(String file, HashMap<String, ArrayList<PortalLocation>> object) {
|
||||
try {
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
ObjectOutputStream oos = new ObjectOutputStream(fos);
|
||||
oos.writeObject(object);
|
||||
oos.close();
|
||||
} catch (IOException e)
|
||||
{
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean addLocation(String name, PortalLocation location)
|
||||
{
|
||||
ArrayList<PortalLocation> portalLocations = portals.get(name);
|
||||
if (portalLocations == null)
|
||||
{
|
||||
portals.put(name, new ArrayList<PortalLocation>());
|
||||
updateFile(fileName, portals);
|
||||
}
|
||||
if (!portals.get(name).isEmpty() && portals.get(name).size() >= 2)
|
||||
{
|
||||
BloodMagicAPI.logger.info("Location " + name + " already exists.");
|
||||
updateFile(fileName, portals);
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
portals.get(name).add(location);
|
||||
BloodMagicAPI.logger.info("Adding " + name);
|
||||
updateFile(fileName, portals);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean removeLocation(String name, PortalLocation location)
|
||||
{
|
||||
if (portals.get(name) != null && !portals.get(name).isEmpty())
|
||||
{
|
||||
if (portals.get(name).contains(location))
|
||||
{
|
||||
portals.get(name).remove(location);
|
||||
BloodMagicAPI.logger.info("Removing " + name);
|
||||
updateFile(fileName, portals);
|
||||
return true;
|
||||
} else
|
||||
{
|
||||
BloodMagicAPI.logger.info("No location matching " + name);
|
||||
updateFile(fileName, portals);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ArrayList<PortalLocation> getLinkedLocations(String name)
|
||||
{
|
||||
return portals.get(name);
|
||||
}
|
||||
}
|
|
@ -20,33 +20,25 @@ import net.minecraft.world.WorldServer;
|
|||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
|
||||
public class Teleports
|
||||
{
|
||||
public class Teleports {
|
||||
|
||||
public static class TeleportSameDim extends Teleport
|
||||
{
|
||||
public static class TeleportSameDim extends Teleport {
|
||||
private final boolean teleposer;
|
||||
|
||||
public TeleportSameDim(int x, int y, int z, Entity entity, String networkToDrain, boolean teleposer)
|
||||
{
|
||||
public TeleportSameDim(int x, int y, int z, Entity entity, String networkToDrain, boolean teleposer) {
|
||||
this(new BlockPos(x, y, z), entity, networkToDrain, teleposer);
|
||||
}
|
||||
|
||||
public TeleportSameDim(BlockPos blockPos, Entity entity, String networkToDrain, boolean teleposer)
|
||||
{
|
||||
public TeleportSameDim(BlockPos blockPos, Entity entity, String networkToDrain, boolean teleposer) {
|
||||
super(blockPos, entity, networkToDrain);
|
||||
this.teleposer = teleposer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void teleport()
|
||||
{
|
||||
if (entity != null)
|
||||
{
|
||||
if (entity.timeUntilPortal <= 0)
|
||||
{
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
public void teleport() {
|
||||
if (entity != null) {
|
||||
if (entity.timeUntilPortal <= 0) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
SoulNetwork network = NetworkHelper.getSoulNetwork(networkToDrain);
|
||||
if (network.getCurrentEssence() < getTeleportCost())
|
||||
return;
|
||||
|
@ -67,8 +59,7 @@ public class Teleports
|
|||
player.getEntityWorld().playSound(x, y, z, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.AMBIENT, 1.0F, 1.0F, false);
|
||||
if (teleposer)
|
||||
MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent.Post(entity, entity.getEntityWorld(), entity.getPosition(), entity.getEntityWorld(), new BlockPos(x, y, z)));
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
SoulNetwork network = NetworkHelper.getSoulNetwork(networkToDrain);
|
||||
if (network.getCurrentEssence() < (getTeleportCost() / 10))
|
||||
return;
|
||||
|
@ -94,25 +85,21 @@ public class Teleports
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getTeleportCost()
|
||||
{
|
||||
public int getTeleportCost() {
|
||||
return 1000;
|
||||
}
|
||||
}
|
||||
|
||||
public static class TeleportToDim extends Teleport
|
||||
{
|
||||
public static class TeleportToDim extends Teleport {
|
||||
private World oldWorld;
|
||||
private int newWorldID;
|
||||
private boolean teleposer;
|
||||
|
||||
public TeleportToDim(int x, int y, int z, Entity entity, String networkToDrain, World oldWorld, int newWorld, boolean teleposer)
|
||||
{
|
||||
public TeleportToDim(int x, int y, int z, Entity entity, String networkToDrain, World oldWorld, int newWorld, boolean teleposer) {
|
||||
this(new BlockPos(x, y, z), entity, networkToDrain, oldWorld, newWorld, teleposer);
|
||||
}
|
||||
|
||||
public TeleportToDim(BlockPos blockPos, Entity entity, String networkToDrain, World oldWorld, int newWorldID, boolean teleposer)
|
||||
{
|
||||
public TeleportToDim(BlockPos blockPos, Entity entity, String networkToDrain, World oldWorld, int newWorldID, boolean teleposer) {
|
||||
super(blockPos, entity, networkToDrain);
|
||||
this.oldWorld = oldWorld;
|
||||
this.newWorldID = newWorldID;
|
||||
|
@ -120,22 +107,17 @@ public class Teleports
|
|||
}
|
||||
|
||||
@Override
|
||||
public void teleport()
|
||||
{
|
||||
if (entity != null)
|
||||
{
|
||||
if (entity.timeUntilPortal <= 0)
|
||||
{
|
||||
public void teleport() {
|
||||
if (entity != null) {
|
||||
if (entity.timeUntilPortal <= 0) {
|
||||
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||
WorldServer oldWorldServer = server.getWorld(entity.dimension);
|
||||
WorldServer newWorldServer = server.getWorld(newWorldID);
|
||||
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
if (entity instanceof EntityPlayer) {
|
||||
EntityPlayerMP player = (EntityPlayerMP) entity;
|
||||
|
||||
if (!player.getEntityWorld().isRemote)
|
||||
{
|
||||
if (!player.getEntityWorld().isRemote) {
|
||||
SoulNetwork network = NetworkHelper.getSoulNetwork(networkToDrain);
|
||||
if (network.getCurrentEssence() < getTeleportCost())
|
||||
return;
|
||||
|
@ -155,8 +137,7 @@ public class Teleports
|
|||
MinecraftForge.EVENT_BUS.post(new TeleposeEvent.Ent.Post(entity, entity.getEntityWorld(), entity.getPosition(), newWorldServer, new BlockPos(x, y, z)));
|
||||
}
|
||||
|
||||
} else if (!entity.getEntityWorld().isRemote)
|
||||
{
|
||||
} else if (!entity.getEntityWorld().isRemote) {
|
||||
SoulNetwork network = NetworkHelper.getSoulNetwork(networkToDrain);
|
||||
if (network.getCurrentEssence() < (getTeleportCost() / 10))
|
||||
return;
|
||||
|
@ -174,8 +155,7 @@ public class Teleports
|
|||
oldWorld.playSound(entity.posX, entity.posY, entity.posZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.AMBIENT, 1.0F, 1.0F, false);
|
||||
|
||||
Entity teleportedEntity = EntityList.createEntityFromNBT(tag, newWorldServer);
|
||||
if (teleportedEntity != null)
|
||||
{
|
||||
if (teleportedEntity != null) {
|
||||
teleportedEntity.setLocationAndAngles(x + 0.5, y + 0.5, z + 0.5, entity.rotationYaw, entity.rotationPitch);
|
||||
teleportedEntity.forceSpawn = true;
|
||||
newWorldServer.spawnEntity(teleportedEntity);
|
||||
|
@ -195,8 +175,7 @@ public class Teleports
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getTeleportCost()
|
||||
{
|
||||
public int getTeleportCost() {
|
||||
return 10000;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue