Added a slingshot + recipe/docs.

This commit is contained in:
Vasco Lavos committed 2014-06-27 01:25:29 +01:00
1 parent 1428b41078
commit f26040006a
9 files changed
+128 -7

No files matched your search

@@ -13,6 +13,7 @@ package vazkii.botania.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockVine;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
@@ -20,11 +21,14 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.item.block.ItemBlockMod;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import cpw.mods.fml.common.registry.GameRegistry;
public class BlockSolidVines extends BlockVine {
public class BlockSolidVines extends BlockVine implements ILexiconable {
public BlockSolidVines() {
setBlockName(LibBlockNames.SOLID_VINE);
@@ -55,4 +59,9 @@ public class BlockSolidVines extends BlockVine {
return new ItemStack(Blocks.vine);
}
@Override
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
return LexiconData.vineBall;
}
}
@@ -70,6 +70,7 @@ public final class BotaniaCreativeTab extends CreativeTabs {
addItem(ModItems.rainbowRod);
addItem(ModItems.tornadoRod);
addItem(ModItems.fireRod);
addItem(ModItems.slingshot);
addItem(ModItems.vineBall);
addBlock(ModBlocks.forestDrum);
addBlock(ModBlocks.forestEye);
@@ -150,6 +150,8 @@ public final class ModCrafingRecipes {
public static List<IRecipe> recipesDreamwoodSpreader;
public static IRecipe recipeTornadoRod;
public static IRecipe recipeFireRod;
public static IRecipe recipeVineBall;
public static IRecipe recipeSlingshot;
public static void init() {
// Lexicon Recipe
@@ -879,12 +881,25 @@ public final class ModCrafingRecipes {
// Rod of the Hells Recipe
addOreDictRecipe(new ItemStack(ModItems.fireRod),
" R", " T ", "R ",
" F", " T ", "R ",
'F', new ItemStack(Items.blaze_powder),
'T', LibOreDict.LIVINGWOOD_TWIG,
'R', LibOreDict.RUNE[1]);
recipeFireRod = BotaniaAPI.getLatestAddedRecipe();
// Vine Ball Recipe
addOreDictRecipe(new ItemStack(ModItems.vineBall),
"VVV", "VVV", "VVV",
'V', new ItemStack(Blocks.vine));
recipeVineBall = BotaniaAPI.getLatestAddedRecipe();
// Livingwood Slingshot Recipe
addOreDictRecipe(new ItemStack(ModItems.slingshot),
" TA", " TT", "T ",
'T', LibOreDict.LIVINGWOOD_TWIG,
'A', LibOreDict.RUNE[3]);
recipeSlingshot = BotaniaAPI.getLatestAddedRecipe();
// Mana and Terrasteel Block Recipes
addOreDictRecipe(new ItemStack(ModBlocks.storage, 1, 0),
"III", "III", "III",
@@ -21,15 +21,16 @@ import vazkii.botania.common.block.ModBlocks;
public class EntityVineBall extends EntityThrowable {
boolean gravity = true;
public EntityVineBall(World par1World) {
super(par1World);
dataWatcher.addObject(30, 0F);
dataWatcher.setObjectWatched(30);
}
public EntityVineBall(EntityPlayer player, boolean gravity) {
super(player.worldObj, player);
this.gravity = gravity;
dataWatcher.addObject(30, gravity ? 0.03F : 0F);
dataWatcher.setObjectWatched(30);
}
@Override
@@ -62,7 +63,7 @@ public class EntityVineBall extends EntityThrowable {
@Override
protected float getGravityVelocity() {
return gravity ? super.getGravityVelocity() : 0F;
return dataWatcher.getWatchableObjectFloat(30);
}
}
@@ -0,0 +1,82 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Jun 27, 2014, 12:38:58 AM (GMT)]
*/
package vazkii.botania.common.item;
import vazkii.botania.common.entity.EntityVineBall;
import vazkii.botania.common.lib.LibItemNames;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.init.Items;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
import net.minecraftforge.event.entity.player.ArrowNockEvent;
public class ItemSlingshot extends ItemMod {
public ItemSlingshot() {
setMaxStackSize(1);
setUnlocalizedName(LibItemNames.SLINGSHOT);
}
@Override
public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4) {
int j = getMaxItemUseDuration(par1ItemStack) - par4;
if(par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(ModItems.vineBall)) {
float f = (float)j / 20.0F;
f = (f * f + f * 2.0F) / 3.0F;
if(f < 1F)
return;
if(!par3EntityPlayer.capabilities.isCreativeMode)
par3EntityPlayer.inventory.consumeInventoryItem(ModItems.vineBall);
if(!par2World.isRemote) {
EntityVineBall ball = new EntityVineBall(par3EntityPlayer, false);
ball.motionX *= 1.6;
ball.motionY *= 1.6;
ball.motionZ *= 1.6;
par2World.spawnEntityInWorld(ball);
}
}
}
@Override
public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
return par1ItemStack;
}
@Override
public int getMaxItemUseDuration(ItemStack par1ItemStack) {
return 72000;
}
@Override
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
return EnumAction.bow;
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if(par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(ModItems.vineBall))
par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
return par1ItemStack;
}
}
@@ -201,7 +201,8 @@ public final class ModItems {
tornadoRod = new ItemTornadoRod();
fireRod = new ItemFireRod();
vineBall = new ItemVineBall();
slingshot = new ItemSlingshot();
OreDictionary.registerOre(LibOreDict.LEXICON, lexicon);
for(int i = 0; i < 16; i++) {
OreDictionary.registerOre(LibOreDict.PETAL[i], new ItemStack(petal, 1, i));
@@ -128,6 +128,7 @@ public final class LexiconData {
public static LexiconEntry rainbowRod;
public static LexiconEntry tornadoRod;
public static LexiconEntry fireRod;
public static LexiconEntry vineBall;
public static LexiconEntry baublesIntro;
public static LexiconEntry tinyPlanet;
@@ -428,6 +429,9 @@ public final class LexiconData {
fireRod = new BLexiconEntry(LibLexicon.TOOL_FIRE_ROD, categoryTools);
fireRod.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeFireRod));
vineBall = new BLexiconEntry(LibLexicon.TOOL_VINE_BALL, categoryTools);
vineBall.setLexiconPages(new PageText("0"), new PageText("1"), new PageCraftingRecipe("2", ModCrafingRecipes.recipeVineBall), new PageCraftingRecipe("3", ModCrafingRecipes.recipeSlingshot));
// BAUBLES ENTRIES
baublesIntro = new BLexiconEntry(LibLexicon.BAUBLE_INTRO, categoryBaubles);
baublesIntro.setPriority().setLexiconPages(new PageText("0"), new PageImage("1", LibResources.ENTRY_BAUBLES), new PageText("2"));
@@ -106,6 +106,7 @@ public final class LibLexicon {
public static final String TOOL_RAINBOW_ROD = "rainbowRod";
public static final String TOOL_TORNADO_ROD = "tornadoRod";
public static final String TOOL_FIRE_ROD = "fireRod";
public static final String TOOL_VINE_BALL = "vineBall";
public static final String BAUBLE_INTRO = "bIntro";
public static final String BAUBLE_TINY_PLANET = "tinyPlanet";
+7
View File
@@ -1078,6 +1078,13 @@ botania.entry.fireRod=Rod of the Hells
botania.page.fireRod0=The &1Rod of the Hells&0 contains the essence of a burning flame, using it on the ground will create a circle of fire that burns anything inside it, for a decent cost of &4Mana&0.<br>The ring has a decent radius, and takes a small amount of time to fully propagate, it's to note that after that time it burns anything living in it, the caster included.
botania.page.fireRod1=Megu Megu Fire Endless Night
# -- VINE BALLS
botania.entry.vineBall=Vine Balls
botania.page.vineBall0=&1Ladders&0 can't stand up on their own, they require something on their back, whereas &1Vines&0 don't. Normally, though, &1Vines&0 aren't strong enough for someone to climb them when they're freestanding.<br>By combining a few &1Vines&0, it's possible to create a ball that can be thrown, to create a climbable ladder of strong &1Vines&0 where it hits.
botania.page.vineBall1=It's also possible, by combining some materials such as &1Livingwood&0 and &1String&0 to create a slingshot that lets these &1Vine Balls&0 be shot while completely ignoring the force of gravity.
botania.page.vineBall2=This would be in Vineacraft...
botania.page.vineBall3=...if that actually existed.
# - BAUBLES
# -- AN INTRODUCTION TO BAUBLES
botania.entry.bIntro=An Introduction to Baubles