Added Dusk and Dawn ritual diviners. Finished the majority of diviner logic.
This commit is contained in:
parent
9a610cc023
commit
7eee77ffe1
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -14,6 +15,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
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;
|
||||
|
@ -34,6 +36,7 @@ import WayofTime.bloodmagic.util.helper.TextHelper;
|
|||
|
||||
public class ItemRitualDiviner extends Item
|
||||
{
|
||||
public static String[] names = { "normal", "dusk", "dawn" };
|
||||
|
||||
public static final String tooltipBase = "tooltip.BloodMagic.diviner.";
|
||||
|
||||
|
@ -45,10 +48,28 @@ public class ItemRitualDiviner extends Item
|
|||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack)
|
||||
{
|
||||
return super.getUnlocalizedName(stack) + names[stack.getItemDamage()];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
|
||||
{
|
||||
for (int i = 0; i < names.length; i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
}
|
||||
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (addRuneToRitual(stack, world, pos, player))
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
spawnParticles(world, pos.up(), 15);
|
||||
}
|
||||
// TODO: Have the diviner automagically build the ritual
|
||||
}
|
||||
|
||||
|
@ -123,6 +144,11 @@ public class ItemRitualDiviner extends Item
|
|||
// TODO: Make this work for any IRitualStone
|
||||
public boolean consumeStone(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (player.capabilities.isCreativeMode)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
ItemStack[] inventory = player.inventory.mainInventory;
|
||||
for (int i = 0; i < inventory.length; i++)
|
||||
{
|
||||
|
@ -330,6 +356,12 @@ public class ItemRitualDiviner extends Item
|
|||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
int dir = tag.getInteger(Constants.NBT.DIRECTION);
|
||||
if (dir == 0)
|
||||
{
|
||||
return EnumFacing.NORTH;
|
||||
}
|
||||
|
||||
return EnumFacing.VALUES[tag.getInteger(Constants.NBT.DIRECTION)];
|
||||
}
|
||||
|
||||
|
@ -440,6 +472,20 @@ public class ItemRitualDiviner extends Item
|
|||
|
||||
public boolean canDivinerPerformRitual(ItemStack stack, Ritual ritual)
|
||||
{
|
||||
if (ritual == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ArrayList<RitualComponent> components = ritual.getComponents();
|
||||
for (RitualComponent component : components)
|
||||
{
|
||||
if (!canPlaceRitualStone(component.getRuneType(), stack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -494,4 +540,31 @@ public class ItemRitualDiviner extends Item
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void spawnParticles(World worldIn, BlockPos pos, int amount)
|
||||
{
|
||||
Block block = worldIn.getBlockState(pos).getBlock();
|
||||
|
||||
if (block.isAir(worldIn, pos))
|
||||
{
|
||||
block.setBlockBoundsBasedOnState(worldIn, pos);
|
||||
|
||||
for (int i = 0; i < amount; ++i)
|
||||
{
|
||||
double d0 = itemRand.nextGaussian() * 0.02D;
|
||||
double d1 = itemRand.nextGaussian() * 0.02D;
|
||||
double d2 = itemRand.nextGaussian() * 0.02D;
|
||||
worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double) ((float) pos.getX() + itemRand.nextFloat()), (double) pos.getY() + (double) itemRand.nextFloat() * block.getBlockBoundsMaxY(), (double) ((float) pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]);
|
||||
}
|
||||
} else
|
||||
{
|
||||
for (int i1 = 0; i1 < amount; ++i1)
|
||||
{
|
||||
double d0 = itemRand.nextGaussian() * 0.02D;
|
||||
double d1 = itemRand.nextGaussian() * 0.02D;
|
||||
double d2 = itemRand.nextGaussian() * 0.02D;
|
||||
worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double) ((float) pos.getX() + itemRand.nextFloat()), (double) pos.getY() + (double) itemRand.nextFloat() * 1.0f, (double) ((float) pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -182,6 +182,8 @@ public class ModItems
|
|||
renderHelper.itemRender(daggerOfSacrifice);
|
||||
|
||||
renderHelper.itemRender(ritualDiviner, 0);
|
||||
renderHelper.itemRender(ritualDiviner, 1);
|
||||
renderHelper.itemRender(ritualDiviner, 2);
|
||||
|
||||
renderHelper.itemRender(lavaCrystal);
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ public class ModRecipes
|
|||
GameRegistry.addRecipe(new ItemStack(ModItems.packSelfSacrifice), "aba", "cdc", "aea", 'a', Blocks.glass, 'b', Items.bucket, 'c', Items.flint, 'd', Items.leather_chestplate, 'e', ModItems.slate);
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.packSacrifice), "aba", "cdc", "aea", 'a', Blocks.glass, 'b', Items.bucket, 'c', Items.iron_ingot, 'd', Items.leather_chestplate, 'e', ModItems.slate);
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.ritualDiviner), "dfd", "ase", "dwd", 'f', EnumRuneType.FIRE.getScribeStack(), 'a', EnumRuneType.AIR.getScribeStack(), 'w', EnumRuneType.WATER.getScribeStack(), 'e', EnumRuneType.EARTH.getScribeStack(), 'd', new ItemStack(Items.diamond), 's', new ItemStack(Items.stick));
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.ritualDiviner, 1, 1), " S ", "tdt", " S ", 'S', new ItemStack(ModItems.slate, 1, 3), 't', EnumRuneType.DUSK.getScribeStack(), 'd', new ItemStack(ModItems.ritualDiviner));
|
||||
GameRegistry.addRecipe(new ItemStack(ModBlocks.bloodStoneBrick), "aa", "aa", 'a', new ItemStack(ModBlocks.bloodStoneBrick, 1, 1));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModBlocks.bloodStoneBrick, 1, 1), Blocks.stone, ModItems.bloodShard);
|
||||
|
||||
|
|
|
@ -100,7 +100,9 @@ item.BloodMagic.sigil.enderSeverance.name=Sigil of Ender Severance
|
|||
|
||||
item.BloodMagic.altarMaker.name=Altar Maker
|
||||
|
||||
item.BloodMagic.ritualDiviner.name=Ritual Diviner
|
||||
item.BloodMagic.ritualDivinernormal.name=Ritual Diviner
|
||||
item.BloodMagic.ritualDivinerdusk.name=Ritual Diviner [Dusk]
|
||||
item.BloodMagic.ritualDivinerdawn.name=Ritual Diviner [Dawn]
|
||||
|
||||
# Blocks
|
||||
tile.BloodMagic.fluid.lifeEssence.name=Life Essence
|
||||
|
@ -207,8 +209,9 @@ tooltip.BloodMagic.telepositionFocus.dimension=Dimension ID: %d
|
|||
ritual.BloodMagic.testRitual=Test Ritual
|
||||
ritual.BloodMagic.waterRitual=Ritual of the Full Spring
|
||||
ritual.BloodMagic.lavaRitual=Serenade of the Nether
|
||||
ritual.BloodMagic.greenGrove=Ritual of the Green Grove
|
||||
ritual.BloodMagic.greenGroveRitual=Ritual of the Green Grove
|
||||
ritual.BloodMagic.jumpRitual=Ritual of the High Jump
|
||||
ritual.BloodMagic.wellOfSufferingRitual=Well of Suffering
|
||||
|
||||
# Chat
|
||||
chat.BloodMagic.altarMaker.setTier=Set Tier to: %d
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"parent":"bloodmagic:item/ItemModelBase",
|
||||
"textures": {
|
||||
"layer0":"bloodmagic:items/RitualDiviner"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"parent":"bloodmagic:item/ItemModelBase",
|
||||
"textures": {
|
||||
"layer0":"bloodmagic:items/RitualDiviner"
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in a new issue