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 000000000..b425b03d2 Binary files /dev/null and b/resources/assets/botania/textures/items/glassPick.png differ