Added Ritual: Song of the Cleansing Soul to remove Living Armour upgrades from the armour.

This commit is contained in:
WayofTime 2016-02-15 15:27:39 -05:00
parent b5c8c2242a
commit 7610329d0a
12 changed files with 256 additions and 65 deletions

View file

@ -4,6 +4,8 @@ Version 2.0.0-18
- Fixed issue with lava crystal working even their is no LP available.
- Added upgrade trainer
- Fixed step height issue with C&B stuff. Apparently step height is now 0.6 by default instead of 0.5.
- Added Ritual: Song of the Cleansing Soul to remove Living Armour upgrades from the armour.
------------------------------------------------------
Version 2.0.0-17
------------------------------------------------------

View file

@ -1,21 +1,21 @@
package WayofTime.bloodmagic;
import WayofTime.bloodmagic.api.BlockStack;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.util.helper.RitualHelper;
import WayofTime.bloodmagic.registry.ModPotions;
import WayofTime.bloodmagic.util.Utils;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.block.Block;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.OreDictionary;
import java.io.File;
import java.lang.reflect.Array;
import java.util.*;
import WayofTime.bloodmagic.api.BlockStack;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.util.Utils;
public class ConfigHandler
{
@ -27,8 +27,8 @@ public class ConfigHandler
public static ArrayList<BlockStack> teleposerBlacklist = new ArrayList<BlockStack>();
// Item/Block Disabling
public static List itemBlacklist;
public static List blockBlacklist;
public static List<String> itemBlacklist;
public static List<String> blockBlacklist;
// Well of Suffering Blacklist
public static List<String> wellOfSufferingBlacklist;
@ -56,6 +56,7 @@ public class ConfigHandler
public static boolean ritualWater;
public static boolean ritualWellOfSuffering;
public static boolean ritualZephyr;
public static boolean ritualUpgradeRemove;
// Imperfect Rituals
public static boolean imperfectRitualNight;
@ -152,7 +153,7 @@ public class ConfigHandler
category = "Blood Altar Sacrificial Values";
config.addCustomCategoryComment(category, "Entity Sacrificial Value Settings");
entitySacrificeValuesList = config.getStringList("entitySacrificeValues", category, new String[] {"EntityVillager;2000", "EntitySlime;150", "EntityEnderman;200", "EntityCow;250", "EntityChicken;250", "EntityHorse;250", "EntitySheep;250", "EntityWolf;250", "EntityOcelot;250", "EntityPig;250", "EntityRabbit;250"}, "Used to edit the amount of LP gained per sacrifice of the given entity.\nSetting an entity to 0 effectively blacklists it.\nIf a mod modifies an entity via the API, it will take precedence over this config.\nSyntax: EntityClassName;LPPerSacrifice");
entitySacrificeValuesList = config.getStringList("entitySacrificeValues", category, new String[] { "EntityVillager;2000", "EntitySlime;150", "EntityEnderman;200", "EntityCow;250", "EntityChicken;250", "EntityHorse;250", "EntitySheep;250", "EntityWolf;250", "EntityOcelot;250", "EntityPig;250", "EntityRabbit;250" }, "Used to edit the amount of LP gained per sacrifice of the given entity.\nSetting an entity to 0 effectively blacklists it.\nIf a mod modifies an entity via the API, it will take precedence over this config.\nSyntax: EntityClassName;LPPerSacrifice");
buildEntitySacrificeValues();
category = "Potions";
@ -234,6 +235,7 @@ public class ConfigHandler
ritualWater = config.get(category, "ritualWater", true).getBoolean();
ritualWellOfSuffering = config.get(category, "ritualWellOfSuffering", true).getBoolean();
ritualZephyr = config.get(category, "ritualZephyr", true).getBoolean();
ritualUpgradeRemove = config.get(category, "ritualRemove", true).getBoolean();
category = "Rituals.Imperfect";
imperfectRitualNight = config.get(category, "imperfectRitualNight", true).getBoolean();

View file

@ -19,6 +19,8 @@ public interface ILivingArmour
public boolean upgradeArmour(EntityPlayer user, LivingArmourUpgrade upgrade);
public boolean removeUpgrade(EntityPlayer user, LivingArmourUpgrade upgrade);
public void notifyPlayerOfUpgrade(EntityPlayer user, LivingArmourUpgrade upgrade);
/**

View file

@ -89,7 +89,7 @@ public class BlockRitualController extends BlockStringContainer
TileEntity tile = world.getTileEntity(pos);
IBlockState state = world.getBlockState(pos);
if (getMetaFromState(state) == 0 && tile instanceof TileMasterRitualStone)
if (state.getBlock() == this && getMetaFromState(state) == 0 && tile instanceof TileMasterRitualStone)
((TileMasterRitualStone) tile).stopRitual(Ritual.BreakType.EXPLOSION);
}

View file

@ -5,10 +5,6 @@ import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import WayofTime.bloodmagic.BloodMagic;
@ -16,7 +12,6 @@ import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.iface.IBindable;
import WayofTime.bloodmagic.api.network.SoulNetwork;
import WayofTime.bloodmagic.api.util.helper.BindableHelper;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;

View file

@ -1,18 +1,16 @@
package WayofTime.bloodmagic.item;
import com.google.common.base.Strings;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.IFuelHandler;
import net.minecraftforge.fml.relauncher.Side;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import com.google.common.base.Strings;
public class ItemLavaCrystal extends ItemBindable implements IFuelHandler
{
public ItemLavaCrystal()
@ -51,8 +49,6 @@ public class ItemLavaCrystal extends ItemBindable implements IFuelHandler
if (fuelItem instanceof ItemLavaCrystal)
{
System.out.println("Test get burn time: Side = " + FMLCommonHandler.instance().getSide());
//
// if (FMLCommonHandler.instance().getSide() == Side.CLIENT)
// {
// return 200;

View file

@ -298,4 +298,18 @@ public class LivingArmour implements ILivingArmour
return true;
}
@Override
public boolean removeUpgrade(EntityPlayer user, LivingArmourUpgrade upgrade)
{
String key = upgrade.getUniqueIdentifier();
if (upgradeMap.containsKey(key))
{
upgradeMap.remove(key);
return true;
}
return false;
}
}

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.registry;
import net.minecraft.init.Blocks;
import WayofTime.bloodmagic.ConfigHandler;
import WayofTime.bloodmagic.api.BlockStack;
import WayofTime.bloodmagic.api.registry.HarvestRegistry;
@ -7,12 +8,32 @@ import WayofTime.bloodmagic.api.registry.ImperfectRitualRegistry;
import WayofTime.bloodmagic.api.registry.RitualRegistry;
import WayofTime.bloodmagic.api.ritual.Ritual;
import WayofTime.bloodmagic.api.ritual.imperfect.ImperfectRitual;
import WayofTime.bloodmagic.ritual.*;
import WayofTime.bloodmagic.ritual.RitualAnimalGrowth;
import WayofTime.bloodmagic.ritual.RitualContainment;
import WayofTime.bloodmagic.ritual.RitualCrushing;
import WayofTime.bloodmagic.ritual.RitualExpulsion;
import WayofTime.bloodmagic.ritual.RitualFeatheredKnife;
import WayofTime.bloodmagic.ritual.RitualFullStomach;
import WayofTime.bloodmagic.ritual.RitualGreenGrove;
import WayofTime.bloodmagic.ritual.RitualHarvest;
import WayofTime.bloodmagic.ritual.RitualInterdiction;
import WayofTime.bloodmagic.ritual.RitualJumping;
import WayofTime.bloodmagic.ritual.RitualLava;
import WayofTime.bloodmagic.ritual.RitualMagnetic;
import WayofTime.bloodmagic.ritual.RitualRegeneration;
import WayofTime.bloodmagic.ritual.RitualSpeed;
import WayofTime.bloodmagic.ritual.RitualSuppression;
import WayofTime.bloodmagic.ritual.RitualUpgradeRemove;
import WayofTime.bloodmagic.ritual.RitualWater;
import WayofTime.bloodmagic.ritual.RitualWellOfSuffering;
import WayofTime.bloodmagic.ritual.RitualZephyr;
import WayofTime.bloodmagic.ritual.harvest.HarvestHandlerPlantable;
import WayofTime.bloodmagic.ritual.harvest.HarvestHandlerStem;
import WayofTime.bloodmagic.ritual.harvest.HarvestHandlerTall;
import WayofTime.bloodmagic.ritual.imperfect.*;
import net.minecraft.init.Blocks;
import WayofTime.bloodmagic.ritual.imperfect.ImperfectRitualNight;
import WayofTime.bloodmagic.ritual.imperfect.ImperfectRitualRain;
import WayofTime.bloodmagic.ritual.imperfect.ImperfectRitualResistance;
import WayofTime.bloodmagic.ritual.imperfect.ImperfectRitualZombie;
public class ModRituals
{
@ -34,6 +55,7 @@ public class ModRituals
public static Ritual suppressionRitual;
public static Ritual expulsionRitual;
public static Ritual zephyrRitual;
public static Ritual upgradeRemoveRitual;
public static ImperfectRitual imperfectNight;
public static ImperfectRitual imperfectRain;
@ -79,6 +101,8 @@ public class ModRituals
RitualRegistry.registerRitual(zephyrRitual, ConfigHandler.ritualZephyr);
expulsionRitual = new RitualExpulsion();
RitualRegistry.registerRitual(expulsionRitual, ConfigHandler.ritualExpulsion);
upgradeRemoveRitual = new RitualUpgradeRemove();
RitualRegistry.registerRitual(upgradeRemoveRitual, ConfigHandler.ritualUpgradeRemove);
}
public static void initImperfectRituals()

View file

@ -1,13 +1,9 @@
package WayofTime.bloodmagic.ritual;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.iface.IBindable;
import WayofTime.bloodmagic.api.network.SoulNetwork;
import WayofTime.bloodmagic.api.ritual.*;
import WayofTime.bloodmagic.api.util.helper.BindableHelper;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import com.google.common.base.Strings;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@ -20,10 +16,18 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.iface.IBindable;
import WayofTime.bloodmagic.api.network.SoulNetwork;
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.NetworkHelper;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import com.google.common.base.Strings;
public class RitualExpulsion extends Ritual
{
@ -140,8 +144,7 @@ public class RitualExpulsion extends Ritual
if (block != null && block.getMaterial().blocksMovement())
{
flag1 = true;
}
else
} else
{
--entityLiving.posY;
--j;
@ -163,8 +166,7 @@ public class RitualExpulsion extends Ritual
{
moveEntityViaTeleport(entityLiving, lastX, lastY, lastZ);
return false;
}
else
} else
{
for (l = 0; l < 128; ++l)
{
@ -204,8 +206,7 @@ public class RitualExpulsion extends Ritual
}
}
}
}
else if (entityLiving != null)
} else if (entityLiving != null)
{
entityLiving.setPosition(x, y, z);
}

View file

@ -1,15 +1,19 @@
package WayofTime.bloodmagic.ritual;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.network.SoulNetwork;
import WayofTime.bloodmagic.api.ritual.*;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import java.util.ArrayList;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import java.util.ArrayList;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.network.SoulNetwork;
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.NetworkHelper;
public class RitualSpeed extends Ritual
{
@ -38,7 +42,8 @@ public class RitualSpeed extends Ritual
for (EntityLivingBase entity : world.getEntitiesWithinAABB(EntityLivingBase.class, speedRange.getAABB(masterRitualStone.getBlockPos())))
{
if (entity.isSneaking()) continue;
if (entity.isSneaking())
continue;
double motionY = 1.2;
double speed = 3;
@ -64,6 +69,8 @@ public class RitualSpeed extends Ritual
case EAST:
entity.setVelocity(speed, motionY, 0);
break;
default:
break;
}
}

View file

@ -0,0 +1,147 @@
package WayofTime.bloodmagic.ritual;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
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.BlockPos;
import net.minecraft.world.World;
import WayofTime.bloodmagic.api.Constants;
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.item.ItemUpgradeTome;
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.registry.ModItems;
public class RitualUpgradeRemove extends Ritual
{
public static final String CHECK_RANGE = "fillRange";
public RitualUpgradeRemove()
{
super("ritualUpgradeRemove", 0, 25000, "ritual." + Constants.Mod.MODID + ".fullUpgradeRemove");
addBlockRange(CHECK_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1, 2, 1));
}
@Override
public void performRitual(IMasterRitualStone masterRitualStone)
{
World world = masterRitualStone.getWorldObj();
if (world.isRemote)
{
return;
}
BlockPos pos = masterRitualStone.getBlockPos();
AreaDescriptor checkRange = getBlockRange(CHECK_RANGE);
List<EntityPlayer> playerList = world.getEntitiesWithinAABB(EntityPlayer.class, checkRange.getAABB(pos));
for (EntityPlayer player : playerList)
{
if (LivingArmour.hasFullSet(player))
{
boolean removedUpgrade = false;
ItemStack chestStack = player.getCurrentArmor(2);
LivingArmour armour = ItemLivingArmour.armourMap.get(chestStack);
if (armour != null)
{
@SuppressWarnings("unchecked")
HashMap<String, LivingArmourUpgrade> upgradeMap = (HashMap<String, LivingArmourUpgrade>) armour.upgradeMap.clone();
for (Entry<String, LivingArmourUpgrade> entry : upgradeMap.entrySet())
{
LivingArmourUpgrade upgrade = entry.getValue();
String upgradeKey = entry.getKey();
ItemStack upgradeStack = new ItemStack(ModItems.upgradeTome);
ItemUpgradeTome.setKey(upgradeStack, upgradeKey);
ItemUpgradeTome.setLevel(upgradeStack, upgrade.getUpgradeLevel());
boolean successful = armour.removeUpgrade(player, upgrade);
if (successful)
{
removedUpgrade = true;
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, upgradeStack));
for (Entry<String, StatTracker> trackerEntry : armour.trackerMap.entrySet())
{
StatTracker tracker = trackerEntry.getValue();
if (tracker != null)
{
if (tracker.providesUpgrade(upgradeKey))
{
tracker.resetTracker(); //Resets the tracker if the upgrade corresponding to it was removed.
}
}
}
}
}
if (removedUpgrade)
{
((ItemLivingArmour) chestStack.getItem()).setLivingArmour(chestStack, armour, true);
masterRitualStone.setActive(false);
world.spawnEntityInWorld(new EntityLightningBolt(world, pos.getX(), pos.getY() - 1, pos.getZ()));
}
}
}
}
}
@Override
public int getRefreshTime()
{
return 1;
}
@Override
public int getRefreshCost()
{
return 0;
}
@Override
public ArrayList<RitualComponent> getComponents()
{
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
this.addCornerRunes(components, 1, 0, EnumRuneType.DUSK);
this.addCornerRunes(components, 2, 0, EnumRuneType.FIRE);
this.addOffsetRunes(components, 1, 2, 0, EnumRuneType.FIRE);
this.addCornerRunes(components, 1, 1, EnumRuneType.WATER);
this.addParallelRunes(components, 4, 0, EnumRuneType.EARTH);
this.addCornerRunes(components, 1, 3, EnumRuneType.WATER);
this.addParallelRunes(components, 1, 4, EnumRuneType.AIR);
for (int i = 0; i < 4; i++)
{
this.addCornerRunes(components, 3, i, EnumRuneType.EARTH);
}
return components;
}
@Override
public Ritual getNewCopy()
{
return new RitualUpgradeRemove();
}
}

View file

@ -325,6 +325,7 @@ ritual.BloodMagic.speedRitual=Ritual of Speed
ritual.BloodMagic.suppressionRitual=Ritual of Suppression
ritual.BloodMagic.expulsionRitual=Aura of Expulsion
ritual.BloodMagic.zephyrRitual=Call of the Zephyr
ritual.BloodMagic.fullUpgradeRemove=Sound of the Cleansing Soul
# Chat
chat.BloodMagic.altarMaker.setTier=Set Tier to: %d