mirror of
https://github.com/GTNewHorizons/Avaritia.git
synced 2026-11-21 04:32:29 +00:00
Fabulous Infinitato
This commit is contained in:
1 parent
1b41b2d13d
commit
3716a65f8d
7 files changed
+101
-1
No files matched your search
@@ -0,0 +1,44 @@
|
||||
package fox.spiteful.avaritia.compat.botania;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemInfinitatoCostume extends Item {
|
||||
|
||||
private static final String[] types = new String[]{"armstrong", "moon", "egbert"};
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon[] icons;
|
||||
|
||||
public ItemInfinitatoCostume(){
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister ir) {
|
||||
icons = new IIcon[types.length];
|
||||
|
||||
for (int x = 0; x < types.length; x++) {
|
||||
icons[x] = ir.registerIcon("avaritia:" + "costume_" + types[x]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int dam) {
|
||||
return this.icons[dam % icons.length];
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package fox.spiteful.avaritia.compat.botania;
|
||||
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
@@ -108,6 +111,34 @@ public class RenderTileInfinitato extends TileEntitySpecialRenderer {
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
model.render();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
String name = potato.name.toLowerCase();
|
||||
mc.renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
||||
float scale = 1F / 4F;
|
||||
GL11.glTranslatef(0F, 1F, 0F);
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
if(name.equals("armstrong")) {
|
||||
GL11.glScalef(1.75F, 1.75F, 1.25F);
|
||||
GL11.glRotatef(180F, 0F, 0F, 1F);
|
||||
GL11.glTranslatef(-0.5F, -0.55F, -0.8F);
|
||||
renderIcon(Tsundere.costumes.getIconFromDamage(0));
|
||||
}
|
||||
else if(name.startsWith("moo") && name.endsWith("oon")) {
|
||||
GL11.glScalef(1.75F, 1.75F, 1.25F);
|
||||
GL11.glRotatef(180F, 0F, 0F, 1F);
|
||||
GL11.glTranslatef(-0.5F, -0.6F, -0.8F);
|
||||
renderIcon(Tsundere.costumes.getIconFromDamage(1));
|
||||
}
|
||||
else if(name.equals("egbert")) {
|
||||
GL11.glScalef(1.25F, 1.25F, 1.25F);
|
||||
GL11.glRotatef(180F, 0F, 0F, 1F);
|
||||
GL11.glTranslatef(-0.5F, -1.4F, -0.8F);
|
||||
renderIcon(Tsundere.costumes.getIconFromDamage(2));
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
GL11.glRotatef(-rotZ, 0F, 0F, 1F);
|
||||
GL11.glRotatef(-rotY, 0F, 1F, 0F);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
@@ -116,7 +147,7 @@ public class RenderTileInfinitato extends TileEntitySpecialRenderer {
|
||||
MovingObjectPosition pos = mc.objectMouseOver;
|
||||
if(!potato.name.isEmpty() && pos != null && pos.blockX == potato.xCoord && pos.blockY == potato.yCoord && pos.blockZ == potato.zCoord) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0F, -0.6F, 0F);
|
||||
GL11.glTranslatef(0F, -0.4F, 0F);
|
||||
GL11.glRotatef(-RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F);
|
||||
float f = 1.6F;
|
||||
@@ -148,4 +179,12 @@ public class RenderTileInfinitato extends TileEntitySpecialRenderer {
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void renderIcon(IIcon icon) {
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package fox.spiteful.avaritia.compat.botania;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import fox.spiteful.avaritia.blocks.LudicrousBlocks;
|
||||
import fox.spiteful.avaritia.compat.Compat;
|
||||
import fox.spiteful.avaritia.compat.nei.NotEnough;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeCraftingManager;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeShapedRecipe;
|
||||
import fox.spiteful.avaritia.crafting.Grinder;
|
||||
@@ -12,10 +13,13 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
public class Tsundere {
|
||||
|
||||
public static Item costumes;
|
||||
|
||||
public static void baka() throws Compat.ItemNotFoundException {
|
||||
Item resource = Compat.getItem("Botania", "manaResource");
|
||||
Block storage = Compat.getBlock("Botania", "storage");
|
||||
@@ -53,6 +57,14 @@ public class Tsundere {
|
||||
|
||||
LudicrousBlocks.infinitato = GameRegistry.registerBlock(new BlockInfinitato(), "infinitato");
|
||||
GameRegistry.registerTileEntity(TileInfinitato.class, "Avaritia_Infinitato");
|
||||
costumes = new ItemInfinitatoCostume();
|
||||
GameRegistry.registerItem(costumes, "costumes");
|
||||
if(Compat.nei){
|
||||
try{
|
||||
NotEnough.hide(new ItemStack(costumes, 1, OreDictionary.WILDCARD_VALUE));
|
||||
}
|
||||
catch(Throwable e){}
|
||||
}
|
||||
|
||||
Block potato = Compat.getBlock("Botania", "tinyPotato");
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package fox.spiteful.avaritia.compat.nei;
|
||||
|
||||
import codechicken.nei.api.API;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class NotEnough {
|
||||
|
||||
@@ -15,4 +16,8 @@ public class NotEnough {
|
||||
API.registerUsageHandler(shapeless);
|
||||
API.registerUsageHandler(compress);
|
||||
}
|
||||
|
||||
public static void hide(ItemStack stack){
|
||||
API.hideItem(stack);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user