diff --git a/MODSRC/vazkii/botania/client/core/handler/JibrilRenderHandler.java b/MODSRC/vazkii/botania/client/core/handler/JibrilRenderHandler.java new file mode 100644 index 000000000..73f36eedb --- /dev/null +++ b/MODSRC/vazkii/botania/client/core/handler/JibrilRenderHandler.java @@ -0,0 +1,74 @@ +/** + * 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 27, 2014, 8:55:00 PM (GMT)] + */ +package vazkii.botania.client.core.handler; + +import org.lwjgl.opengl.GL11; + +import baubles.common.container.InventoryBaubles; +import baubles.common.lib.PlayerHandler; +import vazkii.botania.common.block.BlockModFlower; +import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.ItemRenderer; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.util.IIcon; +import net.minecraftforge.client.event.RenderPlayerEvent; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; + +public final class JibrilRenderHandler { + + @SubscribeEvent + public void onPlayerRender(RenderPlayerEvent.Specials.Post event) { + InventoryBaubles inv = PlayerHandler.getPlayerBaubles(event.entityPlayer); + if(inv.getStackInSlot(0) != null && inv.getStackInSlot(0).getItem() instanceof ItemFlightTiara) { + GL11.glPushMatrix(); + IIcon icon = event.entityPlayer.worldObj.provider.isHellWorld ? ItemFlightTiara.iconDemonWings : ItemFlightTiara.iconWings; + Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); + + boolean flying = event.entityPlayer.capabilities.isFlying; + + float rz = 120F; + float rx = 20F + (float) ((Math.sin((double) event.entityPlayer.ticksExisted * (flying ? 0.4F : 0.2F)) + 0.5F) * (flying ? 30F : 5F)); + float d = 0F; + float h = 0.4F; + float i = 0.15F; + + float f = icon.getMinU(); + float f1 = icon.getMaxU(); + float f2 = icon.getMinV(); + float f3 = icon.getMaxV(); + + if(event.entityPlayer.isSneaking()) + GL11.glRotatef(28.64789F, 1.0F, 0.0F, 0.0F); + + GL11.glTranslatef(-d, h, i); + GL11.glRotatef(rz, 0F, 0F, 1F); + GL11.glRotatef(rx, 1F, 0F, 0F); + ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 32F); + GL11.glRotatef(-rx, 1F, 0F, 0F); + GL11.glRotatef(-rz, 0F, 0F, 1F); + + GL11.glScalef(-1F, 1F, 1F); + GL11.glRotatef(rz, 0F, 0F, 1F); + GL11.glRotatef(rx, 1F, 0F, 0F); + ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 32F); + GL11.glRotatef(-rx, 1F, 0F, 0F); + GL11.glRotatef(-rz, 0F, 0F, 1F); + GL11.glTranslatef(d, 0F, 0F); + + + GL11.glColor3f(1F, 1F, 1F); + GL11.glPopMatrix(); + } + } +} diff --git a/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java b/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java index 3533b6067..f03327915 100644 --- a/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java +++ b/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java @@ -28,6 +28,7 @@ import vazkii.botania.client.core.handler.BotaniaPlayerController; import vazkii.botania.client.core.handler.BoundTileRenderer; import vazkii.botania.client.core.handler.ClientTickHandler; import vazkii.botania.client.core.handler.HUDHandler; +import vazkii.botania.client.core.handler.JibrilRenderHandler; import vazkii.botania.client.core.handler.LightningHandler; import vazkii.botania.client.core.handler.TooltipHandler; import vazkii.botania.client.core.helper.ShaderHelper; @@ -103,6 +104,7 @@ public class ClientProxy extends CommonProxy { if(ConfigHandler.boundBlockWireframe) MinecraftForge.EVENT_BUS.register(new BoundTileRenderer()); MinecraftForge.EVENT_BUS.register(new TooltipHandler()); + MinecraftForge.EVENT_BUS.register(new JibrilRenderHandler()); if(ConfigHandler.versionCheckEnabled) new VersionChecker().init(); diff --git a/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java b/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java index f8dd5582b..fec70f516 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java +++ b/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java @@ -14,12 +14,15 @@ package vazkii.botania.common.item.equipment.bauble; import java.util.ArrayList; import java.util.List; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import vazkii.botania.api.mana.IManaUsingItem; import vazkii.botania.api.mana.ManaItemHandler; +import vazkii.botania.client.core.helper.IconHelper; import vazkii.botania.common.Botania; import vazkii.botania.common.lib.LibItemNames; import baubles.api.BaubleType; @@ -32,6 +35,9 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem { public static List playersWithFlight = new ArrayList(); private static final int COST = 50; + + public static IIcon iconWings; + public static IIcon iconDemonWings; public ItemFlightTiara() { super(LibItemNames.FLIGHT_TIARA); @@ -44,6 +50,13 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem { return BaubleType.AMULET; } + @Override + public void registerIcons(IIconRegister par1IconRegister) { + itemIcon = IconHelper.forItem(par1IconRegister, this, 0); + iconWings = IconHelper.forItem(par1IconRegister, this, 1); + iconDemonWings = IconHelper.forItem(par1IconRegister, this, 2); + } + @SubscribeEvent public void updatePlayerFlyStatus(LivingUpdateEvent event) { if(event.entityLiving instanceof EntityPlayer) { diff --git a/resources/assets/botania/textures/items/flightTiara.png b/resources/assets/botania/textures/items/flightTiara0.png similarity index 100% rename from resources/assets/botania/textures/items/flightTiara.png rename to resources/assets/botania/textures/items/flightTiara0.png diff --git a/resources/assets/botania/textures/items/flightTiara1.png b/resources/assets/botania/textures/items/flightTiara1.png new file mode 100644 index 000000000..d38b0ba7d Binary files /dev/null and b/resources/assets/botania/textures/items/flightTiara1.png differ diff --git a/resources/assets/botania/textures/items/flightTiara2.png b/resources/assets/botania/textures/items/flightTiara2.png new file mode 100644 index 000000000..d66e4e9d7 Binary files /dev/null and b/resources/assets/botania/textures/items/flightTiara2.png differ