Added variable incense - issue with build needs to be resolved in build.gradle

This commit is contained in:
WayofTime 2015-05-01 18:56:16 -04:00
parent f1ebade718
commit c71edfb937
13 changed files with 360 additions and 32 deletions

View file

@ -41,6 +41,7 @@ repositories {
url 'http://dvs1.progwml6.com/files/maven'
}
maven {
name 'TehNut Repo'
url 'http://tehnut.info/maven/'
}
ivy {

View file

@ -8,6 +8,6 @@ nei_version=1.0.3.64
package_group=com.wayoftime.bloodmagic
mod_version=1.3.2aBeta
minetweaker_version=Dev-1.7.10-3.0.9B
guideapi_version=1.0-10
guideapi_version=1.0-13
mc_version=1.7.10
build_number=3

View file

@ -10,10 +10,12 @@ import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLivingBase;
import net.minecraftforge.common.config.Configuration;
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
import WayofTime.alchemicalWizardry.api.sacrifice.PlayerSacrificeHandler;
import WayofTime.alchemicalWizardry.client.renderer.ColourThreshold;
import WayofTime.alchemicalWizardry.client.renderer.RenderHelper;
import WayofTime.alchemicalWizardry.common.demonVillage.DemonVillagePath;
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
import WayofTime.alchemicalWizardry.common.items.ItemIncense;
import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorParadigm;
import cpw.mods.fml.common.FMLCommonHandler;
@ -163,6 +165,13 @@ public class BloodMagicConfiguration
AlchemicalWizardry.isDemonRitualCreativeOnly = config.get(tempDemonConfigs, "IsDemonRitualCreativeOnly", false).getBoolean();
BoundArmour.tryComplexRendering = config.get("WimpySettings", "UseFancyBoundArmour", true).getBoolean(true);
ItemIncense.itemDuration = config.get("TestIncenseSettings", "ItemDuration", 100).getInt();
ItemIncense.minValue = config.get("TestIncenseSettings", "MinValue", 0).getInt();
ItemIncense.maxValue = config.get("TestIncenseSettings", "MaxValue", 100).getInt();
PlayerSacrificeHandler.scalingOfSacrifice = (float) config.get("TestIncenseSettings", "ScalingFactor", 0.0025f).getDouble();
PlayerSacrificeHandler.soulFrayDuration = config.get("TestIncenseSettings", "SoulFrayDuration", 400).getInt();
Side side = FMLCommonHandler.instance().getSide();
if (side == Side.CLIENT)

View file

@ -36,6 +36,7 @@ import WayofTime.alchemicalWizardry.common.items.ItemBloodLetterPack;
import WayofTime.alchemicalWizardry.common.items.ItemComplexSpellCrystal;
import WayofTime.alchemicalWizardry.common.items.ItemComponents;
import WayofTime.alchemicalWizardry.common.items.ItemDiabloKey;
import WayofTime.alchemicalWizardry.common.items.ItemIncense;
import WayofTime.alchemicalWizardry.common.items.ItemMailOrderCatalogue;
import WayofTime.alchemicalWizardry.common.items.ItemRitualDiviner;
import WayofTime.alchemicalWizardry.common.items.LavaCrystal;
@ -240,6 +241,8 @@ public class ModItems
public static Item outputRoutingFocus;
public static Item itemMailCatalogue;
public static Item itemIncense;
public static void init()
{
@ -370,6 +373,8 @@ public class ModItems
outputRoutingFocus = new OutputRoutingFocus().setUnlocalizedName("outputRoutingFocus");
itemMailCatalogue = new ItemMailOrderCatalogue().setUnlocalizedName("itemMailCatalogue");
itemIncense = new ItemIncense().setUnlocalizedName("bloodMagicIncenseItem");
}
public static void registerItems()
@ -505,6 +510,7 @@ public class ModItems
GameRegistry.registerItem(ModItems.outputRoutingFocus, "outputRoutingFocus");
GameRegistry.registerItem(ModItems.itemMailCatalogue, "itemMailCatalogue");
GameRegistry.registerItem(ModItems.itemIncense, "bloodMagicIncenseItem");
//GameRegistry.registerItem(ModItems.itemBloodFrame, "itemBloodFrame");
}
}

View file

@ -1,36 +1,116 @@
package WayofTime.alchemicalWizardry.api.sacrifice;
import WayofTime.alchemicalWizardry.api.spell.APISpellHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.PotionEffect;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.spell.APISpellHelper;
import WayofTime.alchemicalWizardry.api.tile.IBloodAltar;
public class PlayerSacrificeHandler
{
public int getPlayerIncense(EntityPlayer player)
public static float scalingOfSacrifice = 0.0025f;
public static int soulFrayDuration = 400;
public static int getPlayerIncense(EntityPlayer player)
{
return APISpellHelper.getCurrentIncense(player);
}
public void setPlayerIncense(EntityPlayer player, int amount)
public static void setPlayerIncense(EntityPlayer player, int amount)
{
APISpellHelper.setCurrentIncense(player, amount);
}
public boolean incrementIncense(EntityPlayer player, int min, int max)
public static boolean incrementIncense(EntityPlayer player, int min, int max)
{
int amount = this.getPlayerIncense(player);
int amount = getPlayerIncense(player);
if(amount < min || amount >= max)
{
return false;
}
amount++;
setPlayerIncense(player, amount);
return true;
}
public boolean sacrificePlayerHealth(EntityPlayer player)
public static boolean sacrificePlayerHealth(EntityPlayer player)
{
if(player.isPotionActive(AlchemicalWizardry.customPotionSoulFray))
{
return false;
}
int amount = getPlayerIncense(player);
if(amount >= 0)
{
float health = player.getHealth();
float maxHealth = player.getMaxHealth();
if(health > maxHealth/10.0)
{
float sacrificedHealth = health - maxHealth/10.0f;
if(findAndFillAltar(player.getEntityWorld(), player, (int)(sacrificedHealth * 100f * getModifier(amount))))
{
player.setHealth(maxHealth/10.0f);
setPlayerIncense(player, 0);
player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionSoulFray.id, soulFrayDuration));
return true;
}
}
}
return false;
}
public static float getModifier(int incense)
{
return 1 + incense*scalingOfSacrifice;
}
public static boolean findAndFillAltar(World world, EntityPlayer player, int amount)
{
int posX = (int) Math.round(player.posX - 0.5f);
int posY = (int) player.posY;
int posZ = (int) Math.round(player.posZ - 0.5f);
IBloodAltar altarEntity = getAltar(world, posX, posY, posZ);
if (altarEntity == null)
{
return false;
}
altarEntity.sacrificialDaggerCall(amount, false);
altarEntity.startCycle();
return true;
}
public static IBloodAltar getAltar(World world, int x, int y, int z)
{
TileEntity tileEntity = null;
for (int i = -2; i <= 2; i++)
{
for (int j = -2; j <= 2; j++)
{
for (int k = -2; k <= 1; k++)
{
tileEntity = world.getTileEntity(i + x, k + y, j + z);
if(tileEntity instanceof IBloodAltar)
{
return (IBloodAltar)tileEntity;
}
}
}
}
return null;
}
}

View file

@ -16,6 +16,8 @@ public class BlockCrucible extends BlockContainer
public BlockCrucible()
{
super(Material.anvil);
this.setHardness(2.0f);
this.setResistance(1.5f);
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("blockCrucible");
}
@ -29,7 +31,7 @@ public class BlockCrucible extends BlockContainer
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z)
{
this.setBlockBounds(0.4F, 0.0F, 0.4F, 0.6F, 0.8F, 0.6F);
this.setBlockBounds(0.4F, 0.0F, 0.4F, 0.6F, 0.6F, 0.6F);
}
@Override

View file

@ -0,0 +1,115 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.sacrifice.IIncense;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemIncense extends Item implements IIncense
{
private static final String[] ITEM_NAMES = new String[]{"Woodash"};
@SideOnly(Side.CLIENT)
private IIcon[] icons;
public static int minValue;
public static int maxValue;
public static int itemDuration;
public ItemIncense()
{
super();
this.maxStackSize = 64;
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.hasSubtypes = true;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
icons = new IIcon[ITEM_NAMES.length];
for (int i = 0; i < ITEM_NAMES.length; ++i)
{
icons[i] = iconRegister.registerIcon("AlchemicalWizardry:" + "baseIncenseItem" + ITEM_NAMES[i]);
}
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
list.add(StatCollector.translateToLocal("tooltip.alchemy.usedinincense"));
}
@Override
public String getUnlocalizedName(ItemStack itemStack)
{
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, ITEM_NAMES.length - 1);
return ("" + "item.bloodMagicIncenseItem." + ITEM_NAMES[meta]);
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int meta)
{
int j = MathHelper.clamp_int(meta, 0, ITEM_NAMES.length - 1);
return icons[j];
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item id, CreativeTabs creativeTab, List list)
{
for (int meta = 0; meta < ITEM_NAMES.length; ++meta)
{
list.add(new ItemStack(id, 1, meta));
}
}
@Override
public int getMinLevel(ItemStack stack)
{
return 0;
}
@Override
public int getMaxLevel(ItemStack stack)
{
return 100;
}
@Override
public int getIncenseDuration(ItemStack stack)
{
return 200;
}
@Override
public float getRedColour(ItemStack stack)
{
return 1.0f;
}
@Override
public float getGreenColour(ItemStack stack)
{
return 0;
}
@Override
public float getBlueColour(ItemStack stack)
{
return 0;
}
}

View file

@ -9,7 +9,6 @@ import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.util.StatCollector;
@ -18,6 +17,7 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.FakePlayer;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.event.SacrificeKnifeUsedEvent;
import WayofTime.alchemicalWizardry.api.sacrifice.PlayerSacrificeHandler;
import WayofTime.alchemicalWizardry.api.tile.IBloodAltar;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.relauncher.Side;
@ -65,12 +65,12 @@ public class SacrificialDagger extends Item
@Override
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int itemInUseCount)
{
if(itemInUseCount < 32)
{
return;
}
// if(itemInUseCount < 32)
// {
// return;
// }
PlayerSacrificeHandler.sacrificePlayerHealth(player);
}
@Override
@ -211,7 +211,7 @@ public class SacrificialDagger extends Item
public boolean isPlayerPreparedForSacrifice(World world, EntityPlayer player)
{
return !world.isRemote && player.isPotionActive(Potion.regeneration);
return !world.isRemote && (PlayerSacrificeHandler.getPlayerIncense(player) > 0);
}
public boolean canUseForSacrifice(ItemStack stack)

View file

@ -125,7 +125,6 @@ public class DivinationSigil extends Item implements ArmourUpgrade, IReagentMani
@Override
public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack)
{
player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 400, 9, true));
}
@Override

View file

@ -6,17 +6,20 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityBloodLightProjectile;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemBloodLightSigil extends EnergyItems implements IHolding
public class ItemBloodLightSigil extends EnergyItems implements IHolding, ArmourUpgrade
{
private int tickDelay = 100;
@ -117,4 +120,22 @@ public class ItemBloodLightSigil extends EnergyItems implements IHolding
return par1ItemStack;
}
@Override
public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack)
{
player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 400, 9, true));
}
@Override
public boolean isUpgrade()
{
return true;
}
@Override
public int getEnergyForTenSeconds()
{
return 25;
}
}

View file

@ -1,7 +1,9 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import java.util.List;
import java.util.Random;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
@ -9,6 +11,8 @@ import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.sacrifice.IIncense;
import WayofTime.alchemicalWizardry.api.sacrifice.PlayerSacrificeHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class TECrucible extends TEInventory
{
@ -17,6 +21,10 @@ public class TECrucible extends TEInventory
public float bColour;
public int ticksRemaining = 0;
public int minValue = 0;
public int maxValue = 0;
public int state = 0; //0 is when it gives off gray particles, 1 is when it gives off white particles (player can't use this incense anymore), 2 is the normal colour of the incense, 3 means no particles (it is out)
public TECrucible()
{
@ -33,6 +41,9 @@ public class TECrucible extends TEInventory
@Override
public void updateEntity()
{
if(worldObj.isRemote)
return;
if(ticksRemaining <= 0)
{
ItemStack stack = this.getStackInSlot(0);
@ -45,28 +56,100 @@ public class TECrucible extends TEInventory
bColour = incense.getBlueColour(stack);
ticksRemaining = incense.getIncenseDuration(stack);
minValue = incense.getMinLevel(stack);
maxValue = incense.getMaxLevel(stack);
stack.stackSize--;
if(stack.stackSize <= 0)
{
this.setInventorySlotContents(0, null);
}
}
}
if(ticksRemaining > 0)
{
List<EntityPlayer> playerList = SpellHelper.getPlayersInRange(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 3, 3);
if(playerList != null && !playerList.isEmpty())
{
boolean stateChanged = false;
boolean allAreGood = true;
for(EntityPlayer player : playerList)
{
if(ticksRemaining > 0 && PlayerSacrificeHandler.incrementIncense(player, minValue, maxValue))
{
ticksRemaining--;
if(state != 2)
{
state = 2;
stateChanged = true;
}
allAreGood = false;
}
}
if(allAreGood && state != 1)
{
state = 1;
stateChanged = true;
}
if(stateChanged)
{
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}else
{
if(state != 0)
{
state = 0;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
}else
{
ticksRemaining--;
if(state != 0)
{
state = 0;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
}
public void spawnClientParticle(World world, int x, int y, int z, Random rand)
{
world.spawnParticle("reddust", x + 0.5D + rand.nextGaussian() / 8, y + 0.5D, z + 0.5D + rand.nextGaussian() / 8, rColour, gColour, bColour);
switch(state)
{
case 0:
world.spawnParticle("reddust", x + 0.5D + rand.nextGaussian() / 8, y + 0.5D, z + 0.5D + rand.nextGaussian() / 8, 0.15, 0.15, 0.15);
break;
case 1:
world.spawnParticle("reddust", x + 0.5D + rand.nextGaussian() / 8, y + 0.5D, z + 0.5D + rand.nextGaussian() / 8, 0.9, 0.9, 0.9);
break;
case 2:
world.spawnParticle("reddust", x + 0.5D + rand.nextGaussian() / 8, y + 0.5D, z + 0.5D + rand.nextGaussian() / 8, rColour, gColour, bColour);
break;
case 3:
//No particles - it is out
break;
}
}
@Override
public void writeToNBT(NBTTagCompound tag)
{
super.writeToNBT(tag);
tag.setInteger("ticksRemaining", ticksRemaining);
tag.setInteger("minValue", minValue);
tag.setInteger("maxValue", maxValue);
this.writeClientNBT(tag);
}
@ -74,16 +157,12 @@ public class TECrucible extends TEInventory
public void readFromNBT(NBTTagCompound tag)
{
super.readFromNBT(tag);
this.readClientNBT(tag);
}
public void readClientNBT(NBTTagCompound tag)
{
rColour = tag.getFloat("rColour");
gColour = tag.getFloat("gColour");
bColour = tag.getFloat("bColour");
ticksRemaining = tag.getInteger("ticksRemaining");
minValue = tag.getInteger("minValue");
maxValue = tag.getInteger("maxValue");
this.readClientNBT(tag);
}
public void writeClientNBT(NBTTagCompound tag)
@ -91,10 +170,18 @@ public class TECrucible extends TEInventory
tag.setFloat("rColour", rColour);
tag.setFloat("gColour", gColour);
tag.setFloat("bColour", bColour);
tag.setInteger("ticksRemaining", ticksRemaining);
tag.setInteger("state", state);
}
public void readClientNBT(NBTTagCompound tag)
{
rColour = tag.getFloat("rColour");
gColour = tag.getFloat("gColour");
bColour = tag.getFloat("bColour");
state = tag.getInteger("state");
}
@Override
public Packet getDescriptionPacket()
{
@ -107,7 +194,7 @@ public class TECrucible extends TEInventory
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
{
super.onDataPacket(net, packet);
readClientNBT(packet.func_148857_g());
readClientNBT(packet.func_148857_g());
}
@Override
@ -115,4 +202,10 @@ public class TECrucible extends TEInventory
{
return "TECrucible";
}
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack)
{
return stack != null ? stack.getItem() instanceof IIncense : false;
}
}

View file

@ -235,6 +235,8 @@ item.boundPlateWater.name=Water Omega Plate
item.boundLeggingsWater.name=Water Omega Leggings
item.boundBootsWater.name=Water Omega Boots
item.bloodMagicIncenseItem.Woodash.name=Testing Incense
#Creative Tab
itemGroup.tabBloodMagic=Blood Magic

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B