Fancy fancy new wings.

This commit is contained in:
Lizbeth Rika committed 2014-08-29 03:02:56 +01:00
1 parent 6a1ea1421e
commit 475197c2f5
11 files changed
+170 -83

No files matched your search

@@ -1,74 +0,0 @@
/**
* 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();
}
}
}
@@ -0,0 +1,137 @@
/**
* 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 net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
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 org.lwjgl.opengl.GL11;
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
import baubles.common.container.InventoryBaubles;
import baubles.common.lib.PlayerHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public final class TiaraWingRenderHandler {
@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) {
int meta = inv.getStackInSlot(0).getItemDamage();
if(meta > 0 && meta <= ItemFlightTiara.wingIcons.length) {
IIcon icon = ItemFlightTiara.wingIcons[meta - 1];
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 ry = 0F;
float h = 0.2F;
float i = 0.15F;
float s = 1F;
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
switch(meta) {
case 1 : { // Jibril
h = 0.4F;
break;
}
case 2 : { // Sephiroth
s = 1.3F;
break;
}
case 3 : { // Cirno
h = -0.1F;
rz = 0F;
rx = 0F;
i = 0.3F;
break;
}
case 4 : { // Fire
int light = 15728880;
int lightmapX = light % 65536;
int lightmapY = light / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
break;
}
case 5 : { // Kuroyukihime
h = 0.8F;
rz = 180F;
ry = -rx;
rx = 0F;
s = 2F;
break;
}
case 6 : { // Random Devil
rz = 150F;
break;
}
case 7 : { // Lyfa
h = -0.1F;
rz = 0F;
ry = -rx;
rx = 0F;
GL11.glColor4f(1F, 1F, 1F, 0.5F + (float) Math.cos((double) event.entityPlayer.ticksExisted * 0.3F) * 0.2F);
break;
}
}
float f = icon.getMinU();
float f1 = icon.getMaxU();
float f2 = icon.getMinV();
float f3 = icon.getMaxV();
float sr = 1F / s;
if(event.entityPlayer.isSneaking())
GL11.glRotatef(28.64789F, 1.0F, 0.0F, 0.0F);
GL11.glTranslatef(0F, h, i);
GL11.glRotatef(rz, 0F, 0F, 1F);
GL11.glRotatef(rx, 1F, 0F, 0F);
GL11.glRotatef(ry, 0F, 1F, 0F);
GL11.glScalef(s, s, s);
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 32F);
GL11.glScalef(sr, sr, sr);
GL11.glRotatef(-ry, 0F, 1F, 0F);
GL11.glRotatef(-rx, 1F, 0F, 0F);
GL11.glRotatef(-rz, 0F, 0F, 1F);
if(meta != 2) { // Sephiroth
GL11.glScalef(-1F, 1F, 1F);
GL11.glRotatef(rz, 0F, 0F, 1F);
GL11.glRotatef(rx, 1F, 0F, 0F);
GL11.glRotatef(ry, 0F, 1F, 0F);
GL11.glScalef(s, s, s);
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 32F);
GL11.glScalef(sr, sr, sr);
GL11.glRotatef(-ry, 1F, 0F, 0F);
GL11.glRotatef(-rx, 1F, 0F, 0F);
GL11.glRotatef(-rz, 0F, 0F, 1F);
}
GL11.glColor3f(1F, 1F, 1F);
GL11.glPopMatrix();
}
}
}
}
@@ -28,7 +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.TiaraWingRenderHandler;
import vazkii.botania.client.core.handler.LightningHandler;
import vazkii.botania.client.core.handler.TooltipHandler;
import vazkii.botania.client.core.helper.ShaderHelper;
@@ -104,7 +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());
MinecraftForge.EVENT_BUS.register(new TiaraWingRenderHandler());
if(ConfigHandler.versionCheckEnabled)
new VersionChecker().init();
@@ -15,9 +15,12 @@ import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import vazkii.botania.api.mana.IManaUsingItem;
@@ -38,15 +41,14 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
public static List<String> playersWithFlight = new ArrayList();
private static final int COST = 50;
@SideOnly(Side.CLIENT)
public static IIcon iconWings;
@SideOnly(Side.CLIENT)
public static IIcon iconDemonWings;
public static IIcon[] wingIcons;
private static final int WING_TYPES = 7;
public ItemFlightTiara() {
super(LibItemNames.FLIGHT_TIARA);
MinecraftForge.EVENT_BUS.register(this);
FMLCommonHandler.instance().bus().register(this);
setHasSubtypes(true);
}
@Override
@@ -58,8 +60,20 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister) {
itemIcon = IconHelper.forItem(par1IconRegister, this, 0);
iconWings = IconHelper.forItem(par1IconRegister, this, 1);
iconDemonWings = IconHelper.forItem(par1IconRegister, this, 2);
wingIcons = new IIcon[WING_TYPES];
for(int i = 0; i < WING_TYPES; i++)
wingIcons[i] = IconHelper.forItem(par1IconRegister, this, i + 1);
}
@Override
public void getSubItems(Item item, CreativeTabs tab, List list) {
for(int i = 0; i < WING_TYPES + 1; i++)
list.add(new ItemStack(item, 1, i));
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("botania.wings" + par1ItemStack.getItemDamage()));
}
@SubscribeEvent
+10
View File
@@ -76,6 +76,16 @@ botania.rank3=&aA
botania.rank4=&dS
botania.rank5=&6SS
# WINGS
botania.wings0=No Wings
botania.wings1=Wings: Flügel
botania.wings2=Wings: One-Winged Angel
botania.wings3=Wings: Ice Fairy
botania.wings4=Wings: Firelord
botania.wings5=Wings: Black Snow Princess
botania.wings6=Wings: Lord of the Pit
botania.wings7=Wings: Sylph
# ROMAN NUMERALS
botania.roman1=I
botania.roman2=II
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B