Merge pull request #143 from Arcaratus/master

Added a Creative Dagger
This commit is contained in:
WayofTime 2014-11-02 11:52:10 -05:00
commit e7657f7429
2 changed files with 108 additions and 0 deletions

View file

@ -87,6 +87,7 @@ public class ModItems
public static Item armourInhibitor;
public static Item creativeFiller;
public static Item demonPlacer;
public static Item creativeDagger;
public static Item baseItems;
public static Item baseAlchemyItems;
@ -192,6 +193,7 @@ public class ModItems
armourInhibitor = new ArmourInhibitor().setUnlocalizedName("armourInhibitor");
creativeFiller = new CheatyItem().setUnlocalizedName("cheatyItem");
demonPlacer = new DemonPlacer().setUnlocalizedName("demonPlacer");
creativeDagger = new CreativeDagger().setUnlocalizedName("creativeDagger");
weakFillingAgent = new WeakFillingAgent().setUnlocalizedName("weakFillingAgent");
standardFillingAgent = new StandardFillingAgent().setUnlocalizedName("standardFillingAgent");
enhancedFillingAgent = new EnhancedFillingAgent().setUnlocalizedName("enhancedFillingAgent");
@ -286,6 +288,7 @@ public class ModItems
GameRegistry.registerItem(ModItems.armourInhibitor, "armourInhibitor");
GameRegistry.registerItem(ModItems.creativeFiller, "creativeFiller");
GameRegistry.registerItem(ModItems.demonPlacer, "demonPlacer");
GameRegistry.registerItem(ModItems.creativeDagger, "creativeDagger");
GameRegistry.registerItem(ModItems.weakFillingAgent, "weakFillingAgent");
GameRegistry.registerItem(ModItems.standardFillingAgent, "standardFillingAgent");

View file

@ -0,0 +1,105 @@
package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import com.arc.bloodarsenal.BloodArsenal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.FakePlayer;
public classCreativeDagger extends Item
{
public CreativeDagger()
{
super();
setTextureName("AlchemicalWizardry:SacrificialDagger");
setMaxStackSize(1);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
setFull3D();
}
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (par3EntityPlayer instanceof FakePlayer)
{
return par1ItemStack;
}
double posX = par3EntityPlayer.posX;
double posY = par3EntityPlayer.posY;
double posZ = par3EntityPlayer.posZ;
par2World.playSoundEffect((double) ((float) posX + 0.5F), (double) ((float) posY + 0.5F), (double) ((float) posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.8F);
float f = (float) 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)
{
par2World.spawnParticle("reddust", posX + Math.random() - Math.random(), posY + Math.random() - Math.random(), posZ + Math.random() - Math.random(), f1, f2, f3);
}
if (!par2World.isRemote && SpellHelper.isFakePlayer(par2World, par3EntityPlayer))
{
return par1ItemStack;
}
findAndFillAltar(par2World, par3EntityPlayer, Integer.MAX_VALUE);
return par1ItemStack;
}
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);
TEAltar altarEntity = getAltar(world, posX, posY, posZ);
if (altarEntity == null)
{
return;
}
altarEntity.sacrificialDaggerCall(amount, false);
altarEntity.startCycle();
}
public TEAltar 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 TEAltar))
{
return (TEAltar) tileEntity;
}
}
if ((tileEntity instanceof TEAltar))
{
return (TEAltar) tileEntity;
}
}
if ((tileEntity instanceof TEAltar))
{
return (TEAltar) tileEntity;
}
}
if ((tileEntity instanceof TEAltar))
{
return (TEAltar) tileEntity;
}
return null;
}