Hoot Hoot

This commit is contained in:
Jeremy Diamond committed 2014-08-14 02:59:39 -07:00
1 parent 42818ad270
commit 20bc79edfc
22 files changed
+449 -14

No files matched your search

@@ -24,6 +24,8 @@ public class Config {
public static int corruptingEnchID;
public static int eternalEnchID;
public static int bloodSealPotionID = 70;
public static int thaumcraftTaintBiomeID;
public static int thaumcraftTaintPotionID;
public static ItemStack thaumcraftResource;
@@ -72,6 +74,7 @@ public class Config {
wrathEff = 4;
wrathCrazy = conf.get("general", "Wrath Cage Cries Havoc", wrathCrazy, "Enable to let the Wrath Cage imprint on ANY non-boss mob. May break your game or make your game Awesome.").getBoolean(false);
spork = conf.get("silly", "Spork of Doom", spork, "What is this? I don't even...").getBoolean(false);
bloodSealPotionID = conf.get("potions", "Blood Seal", bloodSealPotionID).getInt(bloodSealPotionID);
} catch (Exception e) {
LogHandler.log(Level.ERROR, e, "Had a problem loading its configuration.");
} finally {
@@ -1,12 +1,12 @@
package fox.spiteful.forbidden;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.Random;
import java.util.*;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import fox.spiteful.forbidden.blocks.BlockBlackFlower;
import fox.spiteful.forbidden.compat.Compat;
import fox.spiteful.forbidden.items.ItemTaintPickaxe;
import fox.spiteful.forbidden.potions.DarkPotions;
import net.minecraft.block.Block;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
@@ -24,6 +24,7 @@ import net.minecraft.entity.monster.EntitySilverfish;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
@@ -38,10 +39,8 @@ import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.event.entity.living.*;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.event.entity.player.BonemealEvent;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
@@ -50,6 +49,7 @@ import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent;
import org.apache.logging.log4j.Level;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.entities.ITaintedMob;
import thaumcraft.common.items.wands.ItemWandCasting;
import thaumcraft.common.lib.Utils;
@@ -64,6 +64,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class FMEventHandler {
Random randy = new Random();
final Aspect[] primals = { Aspect.ENTROPY, Aspect.ORDER, Aspect.FIRE, Aspect.WATER, Aspect.EARTH, Aspect.AIR };
HashMap<String, Integer> lastLP = new HashMap<String, Integer>();
@SubscribeEvent
public void onPlayerBreaking(BreakSpeed event) {
@@ -89,7 +90,21 @@ public class FMEventHandler {
@SubscribeEvent
public void onLivingDrops(LivingDropsEvent event) {
if (Config.silverfishEmeralds && event.entityLiving instanceof EntitySilverfish) {
if (event.source.getDamageType().equals("player") && event.entityLiving instanceof ITaintedMob)
{
PotionEffect effect = event.entityLiving.getActivePotionEffect(Potion.weakness);
if (effect != null)
{
if (effect.getAmplifier() >= 2) {
double rand = Math.random();
if (rand < 0.50d) {
addDrop(event, new ItemStack(ForbiddenItems.resource, 1, 3));
}
}
}
}
if (Config.silverfishEmeralds && event.entityLiving instanceof EntitySilverfish) {
if (event.entityLiving.worldObj.getBiomeGenForCoords((int) event.entityLiving.posX, (int) event.entityLiving.posZ).biomeID == BiomeGenBase.extremeHills.biomeID) {
if (event.recentlyHit && event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer && randy.nextInt(30) <= (2 + event.lootingLevel * 2))
addDrop(event, new ItemStack(ForbiddenItems.resource, 1, 0));
@@ -395,4 +410,27 @@ public class FMEventHandler {
}
}
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event){
if(Compat.bm && event.entityLiving != null && event.entityLiving instanceof EntityPlayer && !event.entityLiving.worldObj.isRemote){
EntityPlayer player = (EntityPlayer)event.entityLiving;
String name = player.getDisplayName();
if(player.isPotionActive(DarkPotions.bloodSeal)){
try {
if (lastLP.containsKey(name)) {
if (SoulNetworkHandler.getCurrentEssence(name) > lastLP.get(name))
SoulNetworkHandler.setCurrentEssence(name, lastLP.get(name));
else
lastLP.put(name, SoulNetworkHandler.getCurrentEssence(name));
}
else
lastLP.put(name, SoulNetworkHandler.getCurrentEssence(name));
}
catch(Throwable e){}
}
else if(lastLP.containsKey(name))
lastLP.remove(name);
}
}
}
@@ -1,5 +1,6 @@
package fox.spiteful.forbidden;
import fox.spiteful.forbidden.potions.DarkPotions;
import net.minecraft.init.Blocks;
import net.minecraftforge.common.MinecraftForge;
import thaumcraft.api.wands.WandTriggerRegistry;
@@ -39,6 +40,8 @@ public class Forbidden {
ForbiddenItems.addItems();
ForbiddenBlocks.addBlocks();
DarkEnchantments.hex();
if(Compat.bm)
DarkPotions.alchemize();
proxy.registerRenderInfo();
}
@@ -0,0 +1,240 @@
package fox.spiteful.forbidden.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBush;
import net.minecraft.block.IGrowable;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.IShearable;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class BlockRoseBush extends BlockBush implements IGrowable
{
@SideOnly(Side.CLIENT)
public IIcon top;
@SideOnly(Side.CLIENT)
public IIcon bottom;
public BlockRoseBush()
{
super(Material.plants);
this.setHardness(0.0F);
this.setStepSound(soundTypeGrass);
this.setBlockName("blackRoseBush");
}
/**
* The type of render function that is called for this block
*/
public int getRenderType()
{
return 40;
}
/**
* Updates the blocks bounds based on its current state. Args: world, x, y, z
*/
public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_)
{
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
/**
* Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z
*/
public boolean canPlaceBlockAt(World world, int x, int y, int z)
{
return super.canPlaceBlockAt(world, x, y, z) && world.isAirBlock(x, y + 1, z);
}
/**
* checks if the block can stay, if not drop as item
*/
protected void checkAndDropBlock(World p_149855_1_, int p_149855_2_, int p_149855_3_, int p_149855_4_)
{
/*if (!this.canBlockStay(p_149855_1_, p_149855_2_, p_149855_3_, p_149855_4_))
{
int l = p_149855_1_.getBlockMetadata(p_149855_2_, p_149855_3_, p_149855_4_);
if (!func_149887_c(l))
{
this.dropBlockAsItem(p_149855_1_, p_149855_2_, p_149855_3_, p_149855_4_, l, 0);
if (p_149855_1_.getBlock(p_149855_2_, p_149855_3_ + 1, p_149855_4_) == this)
{
p_149855_1_.setBlock(p_149855_2_, p_149855_3_ + 1, p_149855_4_, Blocks.air, 0, 2);
}
}
p_149855_1_.setBlock(p_149855_2_, p_149855_3_, p_149855_4_, Blocks.air, 0, 2);
}*/
}
/**
* Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants.
*/
public boolean canBlockStay(World world, int x, int y, int z)
{
if (world.getBlock(x, y, z) != this) return super.canBlockStay(world, x, y, z); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check.
int l = world.getBlockMetadata(x, y, z);
return l == 1 ? world.getBlock(x, y - 1, z) == this : world.getBlock(x, y + 1, z) == this && super.canBlockStay(world, x, y, z);
}
public Item getItemDropped(int metadata, Random rand, int fortune)
{
if (metadata != 0)
{
return null;
}
else
{
return Item.getItemFromBlock(this);
}
}
/**
* Gets the block's texture. Args: side, meta
*/
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta)
{
if(meta == 0)
return bottom;
else
return top;
}
/**
* Called when the block is placed in the world.
*/
public void onBlockPlacedBy(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, EntityLivingBase p_149689_5_, ItemStack p_149689_6_)
{
int l = ((MathHelper.floor_double((double) (p_149689_5_.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3) + 2) % 4;
p_149689_1_.setBlock(p_149689_2_, p_149689_3_ + 1, p_149689_4_, this, 8 | l, 2);
}
/**
* Called when the player destroys a block with an item that can harvest it. (i, j, k) are the coordinates of the
* block and l is the block's subtype/damage.
*/
public void harvestBlock(World p_149636_1_, EntityPlayer p_149636_2_, int p_149636_3_, int p_149636_4_, int p_149636_5_, int p_149636_6_)
{
/*if (p_149636_1_.isRemote || p_149636_2_.getCurrentEquippedItem() == null || p_149636_2_.getCurrentEquippedItem().getItem() != Items.shears || func_149887_c(p_149636_6_) || !this.func_149886_b(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_, p_149636_2_))
{
super.harvestBlock(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_);
}*/
}
/**
* Called when the block is attempted to be harvested
*/
public void onBlockHarvested(World p_149681_1_, int p_149681_2_, int p_149681_3_, int p_149681_4_, int p_149681_5_, EntityPlayer p_149681_6_)
{
/*if (func_149887_c(p_149681_5_))
{
if (p_149681_1_.getBlock(p_149681_2_, p_149681_3_ - 1, p_149681_4_) == this)
{
if (!p_149681_6_.capabilities.isCreativeMode)
{
int i1 = p_149681_1_.getBlockMetadata(p_149681_2_, p_149681_3_ - 1, p_149681_4_);
int j1 = func_149890_d(i1);
if (j1 != 3 && j1 != 2)
{
p_149681_1_.func_147480_a(p_149681_2_, p_149681_3_ - 1, p_149681_4_, true);
}
else
{
if (!p_149681_1_.isRemote && p_149681_6_.getCurrentEquippedItem() != null && p_149681_6_.getCurrentEquippedItem().getItem() == Items.shears)
{
this.func_149886_b(p_149681_1_, p_149681_2_, p_149681_3_, p_149681_4_, i1, p_149681_6_);
}
p_149681_1_.setBlockToAir(p_149681_2_, p_149681_3_ - 1, p_149681_4_);
}
}
else
{
p_149681_1_.setBlockToAir(p_149681_2_, p_149681_3_ - 1, p_149681_4_);
}
}
}
else if (p_149681_6_.capabilities.isCreativeMode && p_149681_1_.getBlock(p_149681_2_, p_149681_3_ + 1, p_149681_4_) == this)
{
p_149681_1_.setBlock(p_149681_2_, p_149681_3_ + 1, p_149681_4_, Blocks.air, 0, 2);
}
super.onBlockHarvested(p_149681_1_, p_149681_2_, p_149681_3_, p_149681_4_, p_149681_5_, p_149681_6_);*/
}
private boolean func_149886_b(World p_149886_1_, int p_149886_2_, int p_149886_3_, int p_149886_4_, int p_149886_5_, EntityPlayer p_149886_6_)
{
/*int i1 = func_149890_d(p_149886_5_);
if (i1 != 3 && i1 != 2)
{
return false;
}
else
{
p_149886_6_.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1);
byte b0 = 1;
if (i1 == 3)
{
b0 = 2;
}
this.dropBlockAsItem(p_149886_1_, p_149886_2_, p_149886_3_, p_149886_4_, new ItemStack(Blocks.tallgrass, 2, b0));*/
return true;
//}
}
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister register)
{
this.top = register.registerIcon("forbidden:umbral_rose_top");
this.bottom = register.registerIcon("forbidden:umbral_rose_bottom");
}
@Override
/* Whether the plant isn't fully grown? Who knows? Aside from Mojang. */
public boolean func_149851_a(World world, int p_149851_2_, int p_149851_3_, int p_149851_4_, boolean p_149851_5_)
{
return true;
}
@Override
/* Whether it can accept bonemeal? Who knows? Aside from Mojang. */
public boolean func_149852_a(World p_149852_1_, Random p_149852_2_, int p_149852_3_, int p_149852_4_, int p_149852_5_)
{
return true;
}
@Override
/* What happens when the block is bonemealed? Maybe? Fuck Obfuscation. */
public void func_149853_b(World world, Random rand, int x, int y, int z)
{
//int l = this.func_149885_e(world, x, y, z);
//this.dropBlockAsItem(world, x, y, z, new ItemStack(this, 1, l));
}
}
@@ -1,7 +1,9 @@
package fox.spiteful.forbidden.compat;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemicalPotionCreationHandler;
import fox.spiteful.forbidden.DarkAspects;
import fox.spiteful.forbidden.LogHandler;
import fox.spiteful.forbidden.potions.DarkPotions;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -15,6 +17,7 @@ import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.crafting.IArcaneRecipe;
import thaumcraft.api.crafting.InfusionRecipe;
import thaumcraft.api.potions.PotionFluxTaint;
import thaumcraft.api.research.ResearchPage;
import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry;
@@ -23,11 +26,16 @@ import fox.spiteful.forbidden.items.ForbiddenItems;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.registry.GameRegistry;
import thaumcraft.common.lib.potions.PotionWarpWard;
public class BloodMagic {
public static void stab() {
try {
AspectList list;
AlchemicalPotionCreationHandler.addPotion(ItemApi.getItem("itemResource", 14), PotionWarpWard.instance.getId(), 1800);
AlchemicalPotionCreationHandler.addPotion(ItemApi.getItem("itemResource", 11), PotionFluxTaint.instance.getId(), 450);
AlchemicalPotionCreationHandler.addPotion(new ItemStack(ForbiddenItems.resource, 1, 3), DarkPotions.bloodSeal.getId(), 1200);
AspectList list;
Item masterOrb = GameRegistry.findItem("AWWayofTime", "masterBloodOrb");
Item archmasterOrb = GameRegistry.findItem("AWWayofTime", "archmageBloodOrb");
Item imbuedSlate = GameRegistry.findItem("AWWayofTime", "imbuedSlate");
@@ -58,6 +66,10 @@ public class BloodMagic {
IArcaneRecipe blood_staff = ThaumcraftApi.addArcaneCraftingRecipe("ROD_blood_staff", new ItemStack(ForbiddenItems.wandCore, 1, 9), (new AspectList()).add(Aspect.ENTROPY, 26).add(Aspect.FIRE, 26).add(Aspect.WATER, 26).add(Aspect.AIR, 26).add(Aspect.EARTH, 26).add(Aspect.ORDER, 26), new Object[] { "__D", "_B_", "B__", Character.valueOf('B'), new ItemStack(ForbiddenItems.wandCore, 1, 3), Character.valueOf('D'), new ItemStack(demonShard) });
(new DarkResearchItem("ROD_blood_staff", "FORBIDDEN", "[BM]", (new AspectList()).add(Aspect.LIFE, 8).add(Aspect.WATER, 7).add(Aspect.WEAPON, 6), -5, -7, 5, new ItemStack(ForbiddenItems.wandCore, 1, 9))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.ROD_blood_staff.1"), new ResearchPage(blood_staff) }).setParents(new String[] { "ROD_silverwood_staff", "ROD_blood" }).setSpecial().setConcealed().registerResearchItem();
InfusionRecipe blood_rapier = ThaumcraftApi.addInfusionCraftingRecipe("BLOODRAPIER", new ItemStack(ForbiddenItems.bloodRapier, 1, 0), 8, (new AspectList()).add(Aspect.LIFE, 18).add(Aspect.HUNGER, 32).add(Aspect.WEAPON, 8), ItemApi.getItem("itemSwordThaumium", 0), new ItemStack[] { ItemApi.getItem("itemResource", 12), new ItemStack(ForbiddenItems.deadlyShards, 1, 0), new ItemStack(ForbiddenItems.gluttonyShard, 1, 0), new ItemStack(Items.feather), ItemApi.getItem("itemResource", 6) });
(new DarkResearchItem("BLOODRAPIER", "FORBIDDEN", "[BM]", (new AspectList()).add(Aspect.LIFE, 16).add(Aspect.HUNGER, 12).add(Aspect.WEAPON, 12).add(Aspect.MAGIC, 12), -9, 8, 4, new ItemStack(ForbiddenItems.bloodRapier, 1, 0))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.BLOODRAPIER.1"), new ResearchPage(blood_rapier) }).setParents(new String[] { "INFAUXSION" }).setConcealed().registerResearchItem();
ThaumcraftApi.addWarpToResearch("BLOODRAPIER", 3);
if (Compat.kami) {
try {
@@ -51,6 +51,7 @@ public class ForbiddenItems {
public static Item ridingCrop;
public static Item divinewell;
public static Item boundShears;
public static Item bloodRapier;
public static Item bloodwell;
public static Item bloodOrb;
@@ -171,6 +172,9 @@ public class ForbiddenItems {
divinewell = new ItemDivinewell().setUnlocalizedName("Divinewell");
GameRegistry.registerItem(divinewell, "Divinewell");
bloodRapier = new ItemBloodRapier().setUnlocalizedName("BloodRapier");
GameRegistry.registerItem(bloodRapier, "BloodRapier");
// boundShears = new ItemBoundShears(Config.boundShearsID,
// ThaumcraftApi.toolMatThaumium).setUnlocalizedName("BoundShears");
// GameRegistry.registerItem(boundShears, "BoundSHears");
@@ -0,0 +1,61 @@
package fox.spiteful.forbidden.items;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import fox.spiteful.forbidden.compat.Compat;
import fox.spiteful.forbidden.potions.DarkPotions;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.EnumHelper;
import thaumcraft.api.IRepairable;
public class ItemBloodRapier extends ItemSword implements IRepairable{
static final ToolMaterial bloodsucker = EnumHelper.addToolMaterial("BLOODSUCKER", 3, 1500, 10F, -3F, 18);
private IIcon icon;
public ItemBloodRapier(){
super(bloodsucker);
}
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase victim, EntityLivingBase player) {
stack.damageItem(1, player);
victim.motionY *= 0.8;
if (victim.hurtResistantTime > 18)
victim.hurtResistantTime -= 5;
if (Compat.bm & victim instanceof EntityPlayer) {
try {
String target = ((EntityPlayer) victim).getDisplayName();
int lp = SoulNetworkHandler.getCurrentEssence(target);
int damage = Math.max(4000, lp / 4);
if (lp >= damage)
lp -= damage;
else
lp = 0;
SoulNetworkHandler.setCurrentEssence(target, lp);
}
catch(Throwable e){}
victim.addPotionEffect(new PotionEffect(DarkPotions.bloodSeal.getId(), 1200));
}
return true;
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int par1) {
return this.icon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister ir) {
this.icon = ir.registerIcon("forbidden:blood_rapier");
}
}
@@ -30,29 +30,31 @@ public class ItemResource extends Item {
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister ir) {
icons = new IIcon[3];
icons = new IIcon[4];
icons[0] = ir.registerIcon("forbidden:emerald_nugget");
icons[1] = ir.registerIcon("forbidden:dye_powder_black");
icons[2] = ir.registerIcon("forbidden:nuggetmanasteel");
icons[3] = ir.registerIcon("forbidden:tainted_blood_shard");
}
@SideOnly(Side.CLIENT)
@Override
public IIcon getIconFromDamage(int dam) {
return this.icons[dam];
return this.icons[dam % icons.length];
}
@Override
public String getUnlocalizedName(ItemStack stack) {
int i = MathHelper.clamp_int(stack.getItemDamage(), 0, 2);
//int i = MathHelper.clamp_int(stack.getItemDamage(), 0, 3);
int i = stack.getItemDamage();
return super.getUnlocalizedName() + "." + i;
}
@SideOnly(Side.CLIENT)
@Override
public void getSubItems(Item par1, CreativeTabs xCreativeTabs, List list) {
for (int j = 0; j < 3; ++j) {
for (int j = 0; j < 4; ++j) {
list.add(new ItemStack(par1, 1, j));
}
}
@@ -0,0 +1,38 @@
package fox.spiteful.forbidden.potions;
import fox.spiteful.forbidden.Config;
import net.minecraft.potion.Potion;
import net.minecraft.util.ResourceLocation;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
public class DarkPotions {
public static final ResourceLocation icons = new ResourceLocation("forbidden", "textures/misc/potions.png");
public static Potion bloodSeal;
public static void alchemize(){
if(Potion.potionTypes.length < 256) {
Potion[] potionTypes = null;
for (Field f : Potion.class.getDeclaredFields()) {
f.setAccessible(true);
try {
if (f.getName().equals("potionTypes") || f.getName().equals("field_76425_a")) {
Field modfield = Field.class.getDeclaredField("modifiers");
modfield.setAccessible(true);
modfield.setInt(f, f.getModifiers() & ~Modifier.FINAL);
potionTypes = (Potion[]) f.get(null);
final Potion[] newPotionTypes = new Potion[256];
System.arraycopy(potionTypes, 0, newPotionTypes, 0, potionTypes.length);
f.set(null, newPotionTypes);
}
} catch (Exception e) {
System.err.println("Severe error, please report this to the mod author:");
System.err.println(e);
}
}
}
bloodSeal = new PotionBloodSeal(Config.bloodSealPotionID);
}
}
@@ -0,0 +1,20 @@
package fox.spiteful.forbidden.potions;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.potion.Potion;
public class PotionBloodSeal extends Potion {
public PotionBloodSeal(int id){
super(id, true, 0xAC1919);
this.setPotionName("potion.blood_seal");
this.setIconIndex(4, 0);
}
@SideOnly(Side.CLIENT)
public int getStatusIconIndex() {
Minecraft.getMinecraft().renderEngine.bindTexture(DarkPotions.icons);
return super.getStatusIconIndex();
}
}