From b1def3eeae8b09622509898f2326e10e48e2d011 Mon Sep 17 00:00:00 2001 From: Lizbeth Rika Date: Wed, 6 Aug 2014 22:20:09 +0100 Subject: [PATCH] Added the Vitreous Pickaxe. --- .../client/core/proxy/ClientProxy.java | 2 + .../client/render/item/RenderGlassPick.java | 85 ++++++++++++++++++ .../common/core/BotaniaCreativeTab.java | 1 + .../vazkii/botania/common/item/ModItems.java | 5 +- .../item/equipment/tool/ItemGlassPick.java | 43 +++++++++ .../tool/manasteel/ItemManasteelPick.java | 8 +- .../botania/common/lib/LibItemNames.java | 1 + resources/assets/botania/lang/en_US.lang | 1 + .../botania/textures/items/glassPick.png | Bin 0 -> 3227 bytes 9 files changed, 143 insertions(+), 3 deletions(-) create mode 100644 MODSRC/vazkii/botania/client/render/item/RenderGlassPick.java create mode 100644 MODSRC/vazkii/botania/common/item/equipment/tool/ItemGlassPick.java create mode 100644 resources/assets/botania/textures/items/glassPick.png diff --git a/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java b/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java index 0da5dcbb5..2eda00ef7 100644 --- a/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java +++ b/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java @@ -47,6 +47,7 @@ import vazkii.botania.client.render.block.RenderSpreader; import vazkii.botania.client.render.block.RenderTinyPotato; import vazkii.botania.client.render.entity.RenderDoppleganger; import vazkii.botania.client.render.entity.RenderPixie; +import vazkii.botania.client.render.item.RenderGlassPick; import vazkii.botania.client.render.item.RenderLens; import vazkii.botania.client.render.item.RenderLexicon; import vazkii.botania.client.render.tile.RenderTileAlfPortal; @@ -129,6 +130,7 @@ public class ClientProxy extends CommonProxy { MinecraftForgeClient.registerItemRenderer(ModItems.lens, new RenderLens()); if(ConfigHandler.lexicon3dModel) MinecraftForgeClient.registerItemRenderer(ModItems.lexicon, new RenderLexicon()); + MinecraftForgeClient.registerItemRenderer(ModItems.glassPick, new RenderGlassPick()); ClientRegistry.bindTileEntitySpecialRenderer(TileAltar.class, new RenderTileAltar()); ClientRegistry.bindTileEntitySpecialRenderer(TileSpreader.class, new RenderTileSpreader()); diff --git a/MODSRC/vazkii/botania/client/render/item/RenderGlassPick.java b/MODSRC/vazkii/botania/client/render/item/RenderGlassPick.java new file mode 100644 index 000000000..c2b826ea1 --- /dev/null +++ b/MODSRC/vazkii/botania/client/render/item/RenderGlassPick.java @@ -0,0 +1,85 @@ +/** + * This class was created by . 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 @ [Aug 6, 2014, 10:04:57 PM (GMT)] + */ +package vazkii.botania.client.render.item; + +import java.awt.Color; + +import net.minecraft.client.renderer.ItemRenderer; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraftforge.client.IItemRenderer; + +import org.lwjgl.opengl.GL11; + +import vazkii.botania.api.mana.ILens; +import vazkii.botania.common.item.ItemLens; + +public class RenderGlassPick implements IItemRenderer { + + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return type != ItemRenderType.INVENTORY; + } + + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return helper == ItemRendererHelper.ENTITY_ROTATION || helper == ItemRendererHelper.ENTITY_BOBBING; + } + + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + switch(type) { + case ENTITY : { + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, 0F, 0F); + if(item.isOnItemFrame()) + GL11.glTranslatef(0F, -0.3F, 0.01F); + render(item); + GL11.glPopMatrix(); + break; + } + case EQUIPPED : { + render(item); + break; + } + case EQUIPPED_FIRST_PERSON : { + render(item); + break; + } + default : break; + } + } + + public static void render(ItemStack item) { + int dmg = item.getItemDamage(); + IIcon icon = item.getItem().getIconFromDamageForRenderPass(dmg, 0); + float f = icon.getMinU(); + float f1 = icon.getMaxU(); + float f2 = icon.getMinV(); + float f3 = icon.getMaxV(); + float scale = 1F / 16F; + + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(1F, 1F, 1F, 1F); + ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), scale); + + GL11.glDisable(GL11.GL_BLEND); + GL11.glPopMatrix(); + + GL11.glColor4f(1F, 1F, 1F, 1F); + } + + +} diff --git a/MODSRC/vazkii/botania/common/core/BotaniaCreativeTab.java b/MODSRC/vazkii/botania/common/core/BotaniaCreativeTab.java index 827c96274..0f095457e 100644 --- a/MODSRC/vazkii/botania/common/core/BotaniaCreativeTab.java +++ b/MODSRC/vazkii/botania/common/core/BotaniaCreativeTab.java @@ -162,6 +162,7 @@ public final class BotaniaCreativeTab extends CreativeTabs { addBlock(ModBlocks.elfQuartzSlab); addBlock(ModBlocks.elfQuartzStairs); + addItem(ModItems.glassPick); addItem(ModItems.manasteelPick); addItem(ModItems.manasteelShovel); addItem(ModItems.manasteelAxe); diff --git a/MODSRC/vazkii/botania/common/item/ModItems.java b/MODSRC/vazkii/botania/common/item/ModItems.java index 2c6ceb787..f83abadba 100644 --- a/MODSRC/vazkii/botania/common/item/ModItems.java +++ b/MODSRC/vazkii/botania/common/item/ModItems.java @@ -50,6 +50,7 @@ import vazkii.botania.common.item.equipment.bauble.ItemTinyPlanet; import vazkii.botania.common.item.equipment.bauble.ItemTravelBelt; import vazkii.botania.common.item.equipment.bauble.ItemWaterRing; import vazkii.botania.common.item.equipment.tool.ItemEnderDagger; +import vazkii.botania.common.item.equipment.tool.ItemGlassPick; import vazkii.botania.common.item.equipment.tool.ItemTerraPick; import vazkii.botania.common.item.equipment.tool.ItemTerraSword; import vazkii.botania.common.item.equipment.tool.elementium.ItemElementiumAxe; @@ -147,6 +148,7 @@ public final class ModItems { public static Item itemFinder; public static Item superLavaPendant; public static Item enderHand; + public static Item glassPick; public static void init() { lexicon = new ItemLexicon(); @@ -230,7 +232,8 @@ public final class ModItems { itemFinder = new ItemItemFinder(); superLavaPendant = new ItemSuperLavaPendant(); enderHand = new ItemEnderHand(); - + glassPick = new ItemGlassPick(); + OreDictionary.registerOre(LibOreDict.LEXICON, lexicon); for(int i = 0; i < 16; i++) { OreDictionary.registerOre(LibOreDict.PETAL[i], new ItemStack(petal, 1, i)); diff --git a/MODSRC/vazkii/botania/common/item/equipment/tool/ItemGlassPick.java b/MODSRC/vazkii/botania/common/item/equipment/tool/ItemGlassPick.java new file mode 100644 index 000000000..4bd60cc81 --- /dev/null +++ b/MODSRC/vazkii/botania/common/item/equipment/tool/ItemGlassPick.java @@ -0,0 +1,43 @@ +/** + * This class was created by . 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 @ [Aug 6, 2014, 9:55:23 PM (GMT)] + */ +package vazkii.botania.common.item.equipment.tool; + +import net.minecraft.block.material.Material; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.EnumHelper; +import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent; +import vazkii.botania.common.item.equipment.tool.manasteel.ItemManasteelPick; +import vazkii.botania.common.lib.LibItemNames; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; + +public class ItemGlassPick extends ItemManasteelPick { + + private static final int MANA_PER_DAMAGE = 160; + private static final ToolMaterial MATERIAL = EnumHelper.addToolMaterial("MANASTEEL_GLASS", 0, 125, 4.8F, 1F, 10); + + public ItemGlassPick() { + super(MATERIAL, LibItemNames.GLASS_PICK); + MinecraftForge.EVENT_BUS.register(this); + } + + @SubscribeEvent + public void onBlockDrops(HarvestDropsEvent event) { + if(event.harvester.getCurrentEquippedItem() != null && event.harvester.getCurrentEquippedItem().getItem() == this && event.block.getMaterial() == Material.glass && event.block.canSilkHarvest(event.world, event.harvester, event.x, event.y, event.z, event.blockMetadata)) + event.drops.add(new ItemStack(event.block, 1, event.blockMetadata)); + } + + public int getManaPerDmg() { + return MANA_PER_DAMAGE; + } + +} diff --git a/MODSRC/vazkii/botania/common/item/equipment/tool/manasteel/ItemManasteelPick.java b/MODSRC/vazkii/botania/common/item/equipment/tool/manasteel/ItemManasteelPick.java index 2feb0e8a4..b8b8d6f51 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/tool/manasteel/ItemManasteelPick.java +++ b/MODSRC/vazkii/botania/common/item/equipment/tool/manasteel/ItemManasteelPick.java @@ -63,17 +63,21 @@ public class ItemManasteelPick extends ItemPickaxe implements IManaUsingItem { @Override public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { - ToolCommons.damageItem(par1ItemStack, 1, par3EntityLivingBase, MANA_PER_DAMAGE); + ToolCommons.damageItem(par1ItemStack, 1, par3EntityLivingBase, getManaPerDmg()); return true; } @Override public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase entity) { if(block.getBlockHardness(world, x, y, z) != 0F) - ToolCommons.damageItem(stack, 1, entity, MANA_PER_DAMAGE); + ToolCommons.damageItem(stack, 1, entity, getManaPerDmg()); return true; } + + public int getManaPerDmg() { + return MANA_PER_DAMAGE; + } @Override public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) { diff --git a/MODSRC/vazkii/botania/common/lib/LibItemNames.java b/MODSRC/vazkii/botania/common/lib/LibItemNames.java index e68de2cfb..a2cca92da 100644 --- a/MODSRC/vazkii/botania/common/lib/LibItemNames.java +++ b/MODSRC/vazkii/botania/common/lib/LibItemNames.java @@ -94,6 +94,7 @@ public final class LibItemNames { public static final String ITEM_FINDER = "itemFinder"; public static final String SUPER_LAVA_PENDANT = "superLavaPendant"; public static final String ENDER_HAND = "enderHand"; + public static final String GLASS_PICK = "glassPick"; public static final String[] LENS_NAMES = new String[] { "lensNormal", diff --git a/resources/assets/botania/lang/en_US.lang b/resources/assets/botania/lang/en_US.lang index f96a0c0b3..333f0fcfb 100644 --- a/resources/assets/botania/lang/en_US.lang +++ b/resources/assets/botania/lang/en_US.lang @@ -683,6 +683,7 @@ item.botania:elementiumHelmReveal.name=Elementium Helmet of Revealing item.botania:itemFinder.name=The Spectator item.botania:superLavaPendant.name=Crimson Pendant item.botania:enderHand.name=Hand of Ender +item.botania:glassPick.name=Vitreous Pickaxe # GUI TEXT botania.gui.lexicon.header=Lexica Botania, %s Edition Table of Contents diff --git a/resources/assets/botania/textures/items/glassPick.png b/resources/assets/botania/textures/items/glassPick.png new file mode 100644 index 0000000000000000000000000000000000000000..b425b03d2dcea37ec4e995d553a553bc8a401bcf GIT binary patch literal 3227 zcmV;M3}o|(P)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l zn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