mirror of
https://github.com/GTNewHorizons/BloodArsenal.git
synced 2026-11-18 19:39:14 +00:00
1.1-10 Update
This commit is contained in:
1 parent
c28150cb96
commit
995014c35d
20 files changed
+532
-33
No files matched your search
@@ -41,7 +41,7 @@ import java.util.Calendar;
|
||||
public class BloodArsenal
|
||||
{
|
||||
public final static String MODID = "BloodArsenal";
|
||||
public final static String VERSION = "1.1-9";
|
||||
public final static String VERSION = "1.1-10";
|
||||
|
||||
@SidedProxy(clientSide = "com.arc.bloodarsenal.ClientProxy", serverSide = "com.arc.bloodarsenal.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
@@ -59,6 +59,7 @@ public class BloodArsenal
|
||||
|
||||
public static ItemArmor.ArmorMaterial vampireArmor = EnumHelper.addArmorMaterial("VampireArmor", 0, new int[]{2, 7, 4, 2}, 0);
|
||||
public static ItemArmor.ArmorMaterial lifeImbuedArmor = EnumHelper.addArmorMaterial("ImbuedArmor", 0, new int[]{4, 10, 8, 4}, 7);
|
||||
public static ItemArmor.ArmorMaterial glassArmor = EnumHelper.addArmorMaterial("GlassArmor", 0, new int[]{1, 4, 3, 1}, 4);
|
||||
|
||||
public static Logger logger = LogManager.getLogger(MODID);
|
||||
public static CreativeTabs BA_TAB = new CreativeTabs("BA_TAB")
|
||||
|
||||
@@ -5,11 +5,13 @@ import baubles.common.lib.PlayerHandler;
|
||||
import baubles.common.network.PacketHandler;
|
||||
import baubles.common.network.PacketSyncBauble;
|
||||
import com.arc.bloodarsenal.items.ModItems;
|
||||
import com.arc.bloodarsenal.items.armor.GlassArmor;
|
||||
import com.arc.bloodarsenal.items.bauble.EmpoweredSacrificeAmulet;
|
||||
import com.arc.bloodarsenal.items.bauble.EmpoweredSelfSacrificeAmulet;
|
||||
import com.arc.bloodarsenal.items.bauble.SacrificeAmulet;
|
||||
import com.arc.bloodarsenal.items.bauble.SelfSacrificeAmulet;
|
||||
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -35,7 +37,7 @@ import java.util.Random;
|
||||
|
||||
public class BloodArsenalEventHooks
|
||||
{
|
||||
public static double rand = Math.random();
|
||||
public static Random rand = new Random();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityDamaged(LivingAttackEvent event)
|
||||
@@ -69,10 +71,24 @@ public class BloodArsenalEventHooks
|
||||
}
|
||||
}
|
||||
|
||||
if (BloodArsenalConfig.baublesIntegration)
|
||||
if (BloodArsenalConfig.baublesIntegration && Loader.isModLoaded("Baubles"))
|
||||
{
|
||||
selfSacrificeHandler(event);
|
||||
}
|
||||
|
||||
EntityPlayer player = (EntityPlayer) entityAttacked;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
ItemStack armorStack = player.inventory.armorInventory[3 - i];
|
||||
|
||||
if (armorStack.getItem() instanceof GlassArmor)
|
||||
{
|
||||
if (entityAttacking instanceof EntityLivingBase)
|
||||
{
|
||||
((EntityLivingBase) entityAttacking).addPotionEffect(new PotionEffect(BloodArsenalConfig.bleedingID, rand.nextInt(5) * 20, rand.nextInt(1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,7 +103,7 @@ public class BloodArsenalEventHooks
|
||||
{
|
||||
Entity killer = event.source.getEntity();
|
||||
|
||||
if (killer != null && killer instanceof EntityPlayer && BloodArsenalConfig.baublesIntegration)
|
||||
if (killer != null && killer instanceof EntityPlayer && BloodArsenalConfig.baublesIntegration && Loader.isModLoaded("Baubles"))
|
||||
{
|
||||
sacrificeHandler(event);
|
||||
}
|
||||
@@ -104,7 +120,7 @@ public class BloodArsenalEventHooks
|
||||
{
|
||||
int amplifier = entityLiving.getActivePotionEffect(BloodArsenal.bleeding).getAmplifier();
|
||||
int duration = entityLiving.getActivePotionEffect(BloodArsenal.bleeding).getDuration();
|
||||
int damage = ((int)(rand * rand) * (amplifier + 1) + 3);
|
||||
int damage = (rand.nextInt(5) * (amplifier + 1) + 3);
|
||||
|
||||
if (entityLiving.worldObj.getWorldTime() % (20 / (amplifier + 1)) == 0)
|
||||
{
|
||||
@@ -195,7 +211,7 @@ public class BloodArsenalEventHooks
|
||||
{
|
||||
event.drops.add(new ItemStack(ModItems.glass_shard));
|
||||
}
|
||||
event.dropChance = 0.5F;
|
||||
event.dropChance = 0.25F;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,6 +228,7 @@ public class BloodArsenalEventHooks
|
||||
}
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Baubles")
|
||||
private void sacrificeHandler(LivingDeathEvent event)
|
||||
{
|
||||
Entity killer = event.source.getEntity();
|
||||
@@ -262,6 +279,7 @@ public class BloodArsenalEventHooks
|
||||
}
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Baubles")
|
||||
private void selfSacrificeHandler(LivingAttackEvent event)
|
||||
{
|
||||
EntityLivingBase entityAttacked = event.entityLiving;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class BloodArsenalRecipes
|
||||
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModBlocks.blood_infused_wood), new ItemStack(Blocks.log), 2, 3000, 5, 5, false);
|
||||
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModBlocks.blood_infused_iron_block), new ItemStack(Blocks.iron_block), 3, 54000, 5, 5, false);
|
||||
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.item_blood_cake), new ItemStack(Items.cake), 3, 10000, 5, 5, false);
|
||||
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.blood_infused_iron), new ItemStack(Items.iron_ingot), 3, 6000, 5, 5, false);
|
||||
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.blood_infused_iron), new ItemStack(Items.iron_ingot), 2, 6000, 5, 5, false);
|
||||
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.blood_orange), new ItemStack(Items.dye, 1, 14), 1, 200, 5, 5, false);
|
||||
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.blood_infused_diamond_active), new ItemStack(ModItems.blood_infused_diamond_unactive), 4, 80000, 5, 5, false);
|
||||
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.soul_fragment), new ItemStack(ModItems.heart), 4, 75000, 5, 5, false);
|
||||
@@ -93,6 +93,12 @@ public class BloodArsenalRecipes
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_burned_string, 4), "aaa", "aba", "aaa", 'a', Items.string, 'b', weakOrb);
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModItems.sigil_of_augmented_holding), "aba", "cde", "fgf", 'a', demonicSlate, 'b', masterOrb, 'c', Items.blaze_rod, 'd', WayofTime.alchemicalWizardry.ModItems.sigilOfHolding, 'e', Items.ghast_tear, 'f', ModItems.blood_infused_iron, 'g', Blocks.chest);
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModItems.sigil_of_lightning), "aba", "cdc", "efg", 'a', new ItemStack(ModBlocks.blood_stone, 1, 3), 'b', Blocks.iron_block, 'c', ModBlocks.blood_infused_iron_block, 'd', etherealSlate, 'e', Items.nether_star, 'f', archmageOrb, 'g', ModItems.blood_infused_diamond_bound);
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModItems.glass_sacrificial_dagger), "aaa", "aba", "cdc", 'a', ModItems.glass_shard, 'b', WayofTime.alchemicalWizardry.ModItems.sacrificialDagger, 'c', ModItems.blood_infused_iron, 'd', magicianOrb);
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModItems.glass_dagger_of_sacrifice), "aaa", "aba", "cdc", 'a', ModItems.glass_shard, 'b', WayofTime.alchemicalWizardry.ModItems.daggerOfSacrifice, 'c', ModItems.blood_infused_iron, 'd', magicianOrb);
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModItems.glass_helmet), "aaa", "aba", 'a', ModItems.glass_shard, 'b', apprenticeOrb);
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModItems.glass_chestplate), "aba", "aaa", "aaa", 'a', ModItems.glass_shard, 'b', apprenticeOrb);
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModItems.glass_leggings), "aaa", "aba", "a a", 'a', ModItems.glass_shard, 'b', apprenticeOrb);
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModItems.glass_boots), "a a", "aba", 'a', ModItems.glass_shard, 'b', apprenticeOrb);
|
||||
|
||||
addOreDictRecipe(new ItemStack(ModBlocks.blood_stone), "aaa", "aaa", "aaa", 'a', blankSlate);
|
||||
addOreDictRecipe(new ItemStack(ModBlocks.blood_stone, 1, 1), "aaa", "aaa", "aaa", 'a', reinforcedSlate);
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.arc.bloodarsenal.items;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import com.arc.bloodarsenal.BloodArsenal;
|
||||
import com.arc.bloodarsenal.block.ModBlocks;
|
||||
import com.arc.bloodarsenal.items.armor.GlassArmor;
|
||||
import com.arc.bloodarsenal.items.armor.VampireCostume;
|
||||
import com.arc.bloodarsenal.items.bauble.*;
|
||||
import com.arc.bloodarsenal.items.sigil.*;
|
||||
@@ -66,6 +67,12 @@ public class ModItems
|
||||
public static Item empowered_self_sacrifice_amulet;
|
||||
public static Item sigil_of_augmented_holding;
|
||||
public static Item sigil_of_lightning;
|
||||
public static Item glass_sacrificial_dagger;
|
||||
public static Item glass_dagger_of_sacrifice;
|
||||
public static Item glass_helmet;
|
||||
public static Item glass_chestplate;
|
||||
public static Item glass_leggings;
|
||||
public static Item glass_boots;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
@@ -94,7 +101,7 @@ public class ModItems
|
||||
blood_infused_sword_diamond = registerItem(new InfusedDiamondSword(), "blood_infused_sword_diamond");
|
||||
heart = registerItem(new ItemBloodArsenal(), "heart");
|
||||
soul_fragment = registerItem(new ItemBloodArsenal(), "soul_fragment");
|
||||
bound_igniter = registerItem(new BoundIgniter(), "bound_flint_and_steel");
|
||||
bound_igniter = registerItem(new BoundIgniter(), "bound_igniter");
|
||||
soul_booster = registerItem(new ItemSoulBooster(), "soul_booster");
|
||||
soul_nullifier = registerItem(new ItemSoulNullifier(), "soul_nullifier");
|
||||
blood_cookie = registerItem(new ItemBloodCookie(), "blood_cookie");
|
||||
@@ -116,6 +123,12 @@ public class ModItems
|
||||
glass_shard = registerItem(new ItemBloodArsenal(), "glass_shard");
|
||||
sigil_of_augmented_holding = registerItem(new SigilAugmentedHolding(), "sigil_of_augmented_holding");
|
||||
sigil_of_lightning = registerItem(new SigilLightning(), "sigil_of_lightning");
|
||||
glass_sacrificial_dagger = registerItem(new GlassSacrificialDagger(), "glass_sacrificial_dagger");
|
||||
glass_dagger_of_sacrifice = registerItem(new GlassDaggerOfSacrifice(), "glass_dagger_of_sacrifice");
|
||||
glass_helmet = registerItem(new GlassArmor(0), "glass_helmet");
|
||||
glass_chestplate = registerItem(new GlassArmor(1), "glass_chestplate");
|
||||
glass_leggings = registerItem(new GlassArmor(2), "glass_leggings");
|
||||
glass_boots = registerItem(new GlassArmor(3), "glass_boots");
|
||||
|
||||
vampire_ring = new VampireRing();
|
||||
self_sacrifice_amulet = new SelfSacrificeAmulet();
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.arc.bloodarsenal.items.armor;
|
||||
|
||||
import com.arc.bloodarsenal.BloodArsenal;
|
||||
import com.arc.bloodarsenal.items.ModItems;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GlassArmor extends ItemArmor
|
||||
{
|
||||
public GlassArmor(int armorType)
|
||||
{
|
||||
super(BloodArsenal.glassArmor, 1, armorType);
|
||||
setMaxDamage(42); // The answer to everything in the universe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.armor.glassArmor"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
|
||||
{
|
||||
if (this == ModItems.glass_helmet || this == ModItems.glass_chestplate || this == ModItems.glass_boots)
|
||||
{
|
||||
return "BloodArsenal:models/armor/glass_layer_1.png";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "BloodArsenal:models/armor/glass_layer_2.png";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
|
||||
{
|
||||
return super.onItemRightClick(par1ItemStack, par2World, par3EntityPlayer);
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,6 @@ public class VampireCostume extends ItemArmor
|
||||
{
|
||||
super(BloodArsenal.vampireArmor, 0, armorType);
|
||||
setMaxDamage(0);
|
||||
setCreativeTab(BloodArsenal.BA_TAB);
|
||||
}
|
||||
|
||||
ModelBiped model1 = null;
|
||||
@@ -118,6 +117,7 @@ public class VampireCostume extends ItemArmor
|
||||
bootsIcon = iconRegister.registerIcon("BloodArsenal:vampire_boots");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int par1)
|
||||
{
|
||||
@@ -142,7 +142,7 @@ public class VampireCostume extends ItemArmor
|
||||
@Override
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
|
||||
{
|
||||
if (this.tryComplexRendering)
|
||||
if (tryComplexRendering)
|
||||
{
|
||||
return "BloodArsenal:models/armor/VampireCostume.png";
|
||||
}
|
||||
@@ -190,26 +190,6 @@ public class VampireCostume extends ItemArmor
|
||||
return super.onItemRightClick(par1ItemStack, par2World, par3EntityPlayer);
|
||||
}
|
||||
|
||||
public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot)
|
||||
{
|
||||
if (armor.equals(ModItems.vampire_cape))
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
if (armor.equals(ModItems.vampire_greaves))
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
if (armor.equals(ModItems.vampire_boots))
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack armor)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
package com.arc.bloodarsenal.items.tool;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.tile.IBloodAltar;
|
||||
import WayofTime.alchemicalWizardry.common.IDemon;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import com.arc.bloodarsenal.BloodArsenal;
|
||||
import com.arc.bloodarsenal.BloodArsenalConfig;
|
||||
import com.google.common.collect.Multimap;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.boss.IBossDisplayData;
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
import net.minecraft.entity.monster.EntitySlime;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GlassDaggerOfSacrifice extends EnergyItems
|
||||
{
|
||||
private float weaponDamage;
|
||||
|
||||
public GlassDaggerOfSacrifice()
|
||||
{
|
||||
super();
|
||||
setMaxStackSize(1);
|
||||
setEnergyUsed(100);
|
||||
setFull3D();
|
||||
setMaxDamage(100);
|
||||
weaponDamage = 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase)
|
||||
{
|
||||
if (par3EntityLivingBase == null || par2EntityLivingBase == null || par3EntityLivingBase.worldObj.isRemote || (par3EntityLivingBase instanceof EntityPlayer && SpellHelper.isFakePlayer(par3EntityLivingBase.worldObj, (EntityPlayer) par3EntityLivingBase)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(par2EntityLivingBase instanceof IHoardDemon)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (par2EntityLivingBase.isChild() || par2EntityLivingBase instanceof EntityPlayer || par2EntityLivingBase instanceof IBossDisplayData)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
World world = par2EntityLivingBase.worldObj;
|
||||
|
||||
if (par2EntityLivingBase.isDead || par2EntityLivingBase.getHealth() < 0.5f)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (par2EntityLivingBase instanceof IDemon)
|
||||
{
|
||||
((IDemon)par2EntityLivingBase).setDropCrystal(false);
|
||||
this.findAndNotifyAltarOfDemon(world, par2EntityLivingBase);
|
||||
}
|
||||
|
||||
int lifeEssence = 500;
|
||||
if (par2EntityLivingBase instanceof EntityVillager) lifeEssence = 3000;
|
||||
else if (par2EntityLivingBase instanceof EntitySlime) lifeEssence = 225;
|
||||
else if (par2EntityLivingBase instanceof EntityEnderman) lifeEssence = 300;
|
||||
else if (par2EntityLivingBase instanceof EntityAnimal) lifeEssence = 375;
|
||||
|
||||
if (findAndFillAltar(par2EntityLivingBase.worldObj, par2EntityLivingBase, lifeEssence))
|
||||
{
|
||||
double posX = par2EntityLivingBase.posX;
|
||||
double posY = par2EntityLivingBase.posY;
|
||||
double posZ = par2EntityLivingBase.posZ;
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(world, posX, posY, posZ, 20, world.provider.dimensionId, 1, posX, posY, posZ);
|
||||
}
|
||||
|
||||
par2EntityLivingBase.setHealth(-1);
|
||||
par2EntityLivingBase.onDeath(BloodArsenal.deathFromBlood);
|
||||
}
|
||||
|
||||
if (!par2EntityLivingBase.isDead)
|
||||
{
|
||||
par2EntityLivingBase.addPotionEffect(new PotionEffect(BloodArsenalConfig.bleedingID, 20, 0));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.tool.glassDaggerOfSacrifice"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public float func_150893_a(ItemStack par1ItemStack, Block par2Block)
|
||||
{
|
||||
if (par2Block == Blocks.web)
|
||||
{
|
||||
return 15.0F;
|
||||
} else
|
||||
{
|
||||
Material material = par2Block.getMaterial();
|
||||
return material != Material.plants && material != Material.vine && material != Material.coral && material != Material.leaves && material != Material.gourd ? 1.0F : 1.5F;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap getItemAttributeModifiers()
|
||||
{
|
||||
Multimap multimap = super.getItemAttributeModifiers();
|
||||
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Tool modifier", 1.0d, 0));
|
||||
return multimap;
|
||||
}
|
||||
|
||||
public boolean findAndNotifyAltarOfDemon(World world, EntityLivingBase sacrifice)
|
||||
{
|
||||
int posX = (int) Math.round(sacrifice.posX - 0.5f);
|
||||
int posY = (int) sacrifice.posY;
|
||||
int posZ = (int) Math.round(sacrifice.posZ - 0.5f);
|
||||
IBloodAltar altarEntity = this.getAltar(world, posX, posY, posZ);
|
||||
|
||||
if (altarEntity == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
altarEntity.addToDemonBloodDuration(50);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean findAndFillAltar(World world, EntityLivingBase sacrifice, int amount)
|
||||
{
|
||||
int posX = (int) Math.round(sacrifice.posX - 0.5f);
|
||||
int posY = (int) sacrifice.posY;
|
||||
int posZ = (int) Math.round(sacrifice.posZ - 0.5f);
|
||||
IBloodAltar altarEntity = this.getAltar(world, posX, posY, posZ);
|
||||
|
||||
if (altarEntity == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
altarEntity.sacrificialDaggerCall(amount, true);
|
||||
altarEntity.startCycle();
|
||||
return true;
|
||||
}
|
||||
|
||||
public IBloodAltar getAltar(World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tileEntity;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,229 @@
|
||||
package com.arc.bloodarsenal.items.tool;
|
||||
|
||||
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 com.arc.bloodarsenal.BloodArsenal;
|
||||
import com.arc.bloodarsenal.BloodArsenalConfig;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class GlassSacrificialDagger extends Item
|
||||
{
|
||||
public GlassSacrificialDagger()
|
||||
{
|
||||
super();
|
||||
setMaxStackSize(1);
|
||||
setFull3D();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister)
|
||||
{
|
||||
if (AlchemicalWizardry.wimpySettings)
|
||||
{
|
||||
this.itemIcon = iconRegister.registerIcon("BloodArsenal:glass_sacrificial_orb");
|
||||
} else
|
||||
{
|
||||
this.itemIcon = iconRegister.registerIcon("BloodArsenal:glass_sacrificial_dagger");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.tool.glassSacrificeDagger"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (this.canUseForSacrifice(stack))
|
||||
{
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
SacrificeKnifeUsedEvent evt = new SacrificeKnifeUsedEvent(player, true, true, 2);
|
||||
if(MinecraftForge.EVENT_BUS.post(evt))
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
if(evt.shouldDrainHealth)
|
||||
{
|
||||
player.setHealth(player.getHealth() - 2);
|
||||
}
|
||||
|
||||
if(!evt.shouldFillAltar)
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
if (player instanceof FakePlayer)
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
double posX = player.posX;
|
||||
double posY = player.posY;
|
||||
double posZ = player.posZ;
|
||||
world.playSoundEffect((double) ((float) posX + 0.5F), (double) ((float) posY + 0.5F), (double) ((float) posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
|
||||
float f = 1.0F;
|
||||
float f1 = f * 0.6F + 0.4F;
|
||||
float f2 = f * f * 0.7F - 0.5F;
|
||||
float f3 = f * f * 0.6F - 0.7F;
|
||||
|
||||
for (int l = 0; l < 8; ++l)
|
||||
{
|
||||
world.spawnParticle("reddust", posX + Math.random() - Math.random(), posY + Math.random() - Math.random(), posZ + Math.random() - Math.random(), f1, f2, f3);
|
||||
}
|
||||
|
||||
if (!world.isRemote && SpellHelper.isFakePlayer(world, player))
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (player.isPotionActive(AlchemicalWizardry.customPotionSoulFray))
|
||||
{
|
||||
findAndFillAltar(world, player, 20);
|
||||
} else
|
||||
{
|
||||
findAndFillAltar(world, player, 200);
|
||||
}
|
||||
|
||||
if (player.getHealth() <= 0.001f)
|
||||
{
|
||||
player.onDeath(BloodArsenal.deathFromBlood);
|
||||
}
|
||||
|
||||
Random random = new Random();
|
||||
if (random.nextInt() + 18 <= 22)
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(BloodArsenalConfig.bleedingID, random.nextInt(5) * 20, 0));
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int itemInUseCount)
|
||||
{
|
||||
PlayerSacrificeHandler.sacrificePlayerHealth(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration(ItemStack stack)
|
||||
{
|
||||
return 72000;
|
||||
}
|
||||
|
||||
public void 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;
|
||||
}
|
||||
|
||||
altarEntity.sacrificialDaggerCall(amount, false);
|
||||
altarEntity.startCycle();
|
||||
}
|
||||
|
||||
public IBloodAltar getAltar(World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tileEntity;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
if (!world.isRemote && entity instanceof EntityPlayer)
|
||||
{
|
||||
this.setUseForSacrifice(stack, this.isPlayerPreparedForSacrifice(world, (EntityPlayer)entity));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack)
|
||||
{
|
||||
if (AlchemicalWizardry.wimpySettings)
|
||||
{
|
||||
return "Glass Sacrificial Orb";
|
||||
}
|
||||
return super.getItemStackDisplayName(stack);
|
||||
}
|
||||
|
||||
public boolean isPlayerPreparedForSacrifice(World world, EntityPlayer player)
|
||||
{
|
||||
return !world.isRemote && (PlayerSacrificeHandler.getPlayerIncense(player) > 0);
|
||||
}
|
||||
|
||||
public boolean canUseForSacrifice(ItemStack stack)
|
||||
{
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
return tag != null && tag.getBoolean("sacrifice");
|
||||
}
|
||||
|
||||
public void setUseForSacrifice(ItemStack stack, boolean sacrifice)
|
||||
{
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if(tag == null)
|
||||
{
|
||||
tag = new NBTTagCompound();
|
||||
stack.setTagCompound(tag);
|
||||
}
|
||||
|
||||
tag.setBoolean("sacrifice", sacrifice);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean hasEffect(ItemStack stack, int pass)
|
||||
{
|
||||
return this.canUseForSacrifice(stack) || super.hasEffect(stack, pass);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user