mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-22 13:09:42 +00:00
Wings!
This commit is contained in:
1 parent
98e9e5e83c
commit
59727964ed
6 files changed
+89
No files matched your search
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* 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 @ [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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
@@ -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<String> 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) {
|
||||
|
||||
File renamed without changes.
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
Reference in new issue
Block a user